1 | (function(global, factory) {
|
2 | typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue")) : typeof define === "function" && define.amd ? define(["exports", "vue"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.vant = {}, global.Vue));
|
3 | })(this, function(exports2, vue) {
|
4 | "use strict";
|
5 | function noop() {
|
6 | }
|
7 | const extend = Object.assign;
|
8 | const inBrowser$1 = typeof window !== "undefined";
|
9 | const isObject$1 = (val) => val !== null && typeof val === "object";
|
10 | const isDef = (val) => val !== void 0 && val !== null;
|
11 | const isFunction = (val) => typeof val === "function";
|
12 | const isPromise = (val) => isObject$1(val) && isFunction(val.then) && isFunction(val.catch);
|
13 | const isDate = (val) => Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
|
14 | function isMobile(value) {
|
15 | value = value.replace(/[^-|\d]/g, "");
|
16 | return /^((\+86)|(86))?(1)\d{10}$/.test(value) || /^0[0-9-]{10,13}$/.test(value);
|
17 | }
|
18 | const isNumeric = (val) => typeof val === "number" || /^\d+(\.\d+)?$/.test(val);
|
19 | const isIOS$1 = () => inBrowser$1 ? /ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase()) : false;
|
20 | function get(object, path) {
|
21 | const keys = path.split(".");
|
22 | let result = object;
|
23 | keys.forEach((key) => {
|
24 | var _a;
|
25 | result = isObject$1(result) ? (_a = result[key]) != null ? _a : "" : "";
|
26 | });
|
27 | return result;
|
28 | }
|
29 | function pick(obj, keys, ignoreUndefined) {
|
30 | return keys.reduce(
|
31 | (ret, key) => {
|
32 | if (!ignoreUndefined || obj[key] !== void 0) {
|
33 | ret[key] = obj[key];
|
34 | }
|
35 | return ret;
|
36 | },
|
37 | {}
|
38 | );
|
39 | }
|
40 | const isSameValue = (newValue, oldValue) => JSON.stringify(newValue) === JSON.stringify(oldValue);
|
41 | const toArray = (item) => Array.isArray(item) ? item : [item];
|
42 | const unknownProp = null;
|
43 | const numericProp = [Number, String];
|
44 | const truthProp = {
|
45 | type: Boolean,
|
46 | default: true
|
47 | };
|
48 | const makeRequiredProp = (type) => ({
|
49 | type,
|
50 | required: true
|
51 | });
|
52 | const makeArrayProp = () => ({
|
53 | type: Array,
|
54 | default: () => []
|
55 | });
|
56 | const makeNumberProp = (defaultVal) => ({
|
57 | type: Number,
|
58 | default: defaultVal
|
59 | });
|
60 | const makeNumericProp = (defaultVal) => ({
|
61 | type: numericProp,
|
62 | default: defaultVal
|
63 | });
|
64 | const makeStringProp = (defaultVal) => ({
|
65 | type: String,
|
66 | default: defaultVal
|
67 | });
|
68 | var inBrowser = typeof window !== "undefined";
|
69 | function raf(fn) {
|
70 | return inBrowser ? requestAnimationFrame(fn) : -1;
|
71 | }
|
72 | function cancelRaf(id) {
|
73 | if (inBrowser) {
|
74 | cancelAnimationFrame(id);
|
75 | }
|
76 | }
|
77 | function doubleRaf(fn) {
|
78 | raf(() => raf(fn));
|
79 | }
|
80 | var isWindow = (val) => val === window;
|
81 | var makeDOMRect = (width2, height2) => ({
|
82 | top: 0,
|
83 | left: 0,
|
84 | right: width2,
|
85 | bottom: height2,
|
86 | width: width2,
|
87 | height: height2
|
88 | });
|
89 | var useRect = (elementOrRef) => {
|
90 | const element = vue.unref(elementOrRef);
|
91 | if (isWindow(element)) {
|
92 | const width2 = element.innerWidth;
|
93 | const height2 = element.innerHeight;
|
94 | return makeDOMRect(width2, height2);
|
95 | }
|
96 | if (element == null ? void 0 : element.getBoundingClientRect) {
|
97 | return element.getBoundingClientRect();
|
98 | }
|
99 | return makeDOMRect(0, 0);
|
100 | };
|
101 | function useToggle(defaultValue = false) {
|
102 | const state = vue.ref(defaultValue);
|
103 | const toggle = (value = !state.value) => {
|
104 | state.value = value;
|
105 | };
|
106 | return [state, toggle];
|
107 | }
|
108 | function useParent(key) {
|
109 | const parent = vue.inject(key, null);
|
110 | if (parent) {
|
111 | const instance2 = vue.getCurrentInstance();
|
112 | const { link, unlink, internalChildren } = parent;
|
113 | link(instance2);
|
114 | vue.onUnmounted(() => unlink(instance2));
|
115 | const index = vue.computed(() => internalChildren.indexOf(instance2));
|
116 | return {
|
117 | parent,
|
118 | index
|
119 | };
|
120 | }
|
121 | return {
|
122 | parent: null,
|
123 | index: vue.ref(-1)
|
124 | };
|
125 | }
|
126 | function flattenVNodes(children) {
|
127 | const result = [];
|
128 | const traverse = (children2) => {
|
129 | if (Array.isArray(children2)) {
|
130 | children2.forEach((child) => {
|
131 | var _a;
|
132 | if (vue.isVNode(child)) {
|
133 | result.push(child);
|
134 | if ((_a = child.component) == null ? void 0 : _a.subTree) {
|
135 | result.push(child.component.subTree);
|
136 | traverse(child.component.subTree.children);
|
137 | }
|
138 | if (child.children) {
|
139 | traverse(child.children);
|
140 | }
|
141 | }
|
142 | });
|
143 | }
|
144 | };
|
145 | traverse(children);
|
146 | return result;
|
147 | }
|
148 | var findVNodeIndex = (vnodes, vnode) => {
|
149 | const index = vnodes.indexOf(vnode);
|
150 | if (index === -1) {
|
151 | return vnodes.findIndex(
|
152 | (item) => vnode.key !== void 0 && vnode.key !== null && item.type === vnode.type && item.key === vnode.key
|
153 | );
|
154 | }
|
155 | return index;
|
156 | };
|
157 | function sortChildren(parent, publicChildren, internalChildren) {
|
158 | const vnodes = flattenVNodes(parent.subTree.children);
|
159 | internalChildren.sort(
|
160 | (a, b) => findVNodeIndex(vnodes, a.vnode) - findVNodeIndex(vnodes, b.vnode)
|
161 | );
|
162 | const orderedPublicChildren = internalChildren.map((item) => item.proxy);
|
163 | publicChildren.sort((a, b) => {
|
164 | const indexA = orderedPublicChildren.indexOf(a);
|
165 | const indexB = orderedPublicChildren.indexOf(b);
|
166 | return indexA - indexB;
|
167 | });
|
168 | }
|
169 | function useChildren(key) {
|
170 | const publicChildren = vue.reactive([]);
|
171 | const internalChildren = vue.reactive([]);
|
172 | const parent = vue.getCurrentInstance();
|
173 | const linkChildren = (value) => {
|
174 | const link = (child) => {
|
175 | if (child.proxy) {
|
176 | internalChildren.push(child);
|
177 | publicChildren.push(child.proxy);
|
178 | sortChildren(parent, publicChildren, internalChildren);
|
179 | }
|
180 | };
|
181 | const unlink = (child) => {
|
182 | const index = internalChildren.indexOf(child);
|
183 | publicChildren.splice(index, 1);
|
184 | internalChildren.splice(index, 1);
|
185 | };
|
186 | vue.provide(
|
187 | key,
|
188 | Object.assign(
|
189 | {
|
190 | link,
|
191 | unlink,
|
192 | children: publicChildren,
|
193 | internalChildren
|
194 | },
|
195 | value
|
196 | )
|
197 | );
|
198 | };
|
199 | return {
|
200 | children: publicChildren,
|
201 | linkChildren
|
202 | };
|
203 | }
|
204 | var SECOND = 1e3;
|
205 | var MINUTE = 60 * SECOND;
|
206 | var HOUR = 60 * MINUTE;
|
207 | var DAY = 24 * HOUR;
|
208 | function parseTime(time) {
|
209 | const days = Math.floor(time / DAY);
|
210 | const hours = Math.floor(time % DAY / HOUR);
|
211 | const minutes = Math.floor(time % HOUR / MINUTE);
|
212 | const seconds = Math.floor(time % MINUTE / SECOND);
|
213 | const milliseconds = Math.floor(time % SECOND);
|
214 | return {
|
215 | total: time,
|
216 | days,
|
217 | hours,
|
218 | minutes,
|
219 | seconds,
|
220 | milliseconds
|
221 | };
|
222 | }
|
223 | function isSameSecond(time1, time2) {
|
224 | return Math.floor(time1 / 1e3) === Math.floor(time2 / 1e3);
|
225 | }
|
226 | function useCountDown(options) {
|
227 | let rafId;
|
228 | let endTime;
|
229 | let counting;
|
230 | let deactivated;
|
231 | const remain = vue.ref(options.time);
|
232 | const current2 = vue.computed(() => parseTime(remain.value));
|
233 | const pause = () => {
|
234 | counting = false;
|
235 | cancelRaf(rafId);
|
236 | };
|
237 | const getCurrentRemain = () => Math.max(endTime - Date.now(), 0);
|
238 | const setRemain = (value) => {
|
239 | var _a, _b;
|
240 | remain.value = value;
|
241 | (_a = options.onChange) == null ? void 0 : _a.call(options, current2.value);
|
242 | if (value === 0) {
|
243 | pause();
|
244 | (_b = options.onFinish) == null ? void 0 : _b.call(options);
|
245 | }
|
246 | };
|
247 | const microTick = () => {
|
248 | rafId = raf(() => {
|
249 | if (counting) {
|
250 | setRemain(getCurrentRemain());
|
251 | if (remain.value > 0) {
|
252 | microTick();
|
253 | }
|
254 | }
|
255 | });
|
256 | };
|
257 | const macroTick = () => {
|
258 | rafId = raf(() => {
|
259 | if (counting) {
|
260 | const remainRemain = getCurrentRemain();
|
261 | if (!isSameSecond(remainRemain, remain.value) || remainRemain === 0) {
|
262 | setRemain(remainRemain);
|
263 | }
|
264 | if (remain.value > 0) {
|
265 | macroTick();
|
266 | }
|
267 | }
|
268 | });
|
269 | };
|
270 | const tick = () => {
|
271 | if (!inBrowser) {
|
272 | return;
|
273 | }
|
274 | if (options.millisecond) {
|
275 | microTick();
|
276 | } else {
|
277 | macroTick();
|
278 | }
|
279 | };
|
280 | const start2 = () => {
|
281 | if (!counting) {
|
282 | endTime = Date.now() + remain.value;
|
283 | counting = true;
|
284 | tick();
|
285 | }
|
286 | };
|
287 | const reset = (totalTime = options.time) => {
|
288 | pause();
|
289 | remain.value = totalTime;
|
290 | };
|
291 | vue.onBeforeUnmount(pause);
|
292 | vue.onActivated(() => {
|
293 | if (deactivated) {
|
294 | counting = true;
|
295 | deactivated = false;
|
296 | tick();
|
297 | }
|
298 | });
|
299 | vue.onDeactivated(() => {
|
300 | if (counting) {
|
301 | pause();
|
302 | deactivated = true;
|
303 | }
|
304 | });
|
305 | return {
|
306 | start: start2,
|
307 | pause,
|
308 | reset,
|
309 | current: current2
|
310 | };
|
311 | }
|
312 | function onMountedOrActivated(hook) {
|
313 | let mounted;
|
314 | vue.onMounted(() => {
|
315 | hook();
|
316 | vue.nextTick(() => {
|
317 | mounted = true;
|
318 | });
|
319 | });
|
320 | vue.onActivated(() => {
|
321 | if (mounted) {
|
322 | hook();
|
323 | }
|
324 | });
|
325 | }
|
326 | function useEventListener(type, listener, options = {}) {
|
327 | if (!inBrowser) {
|
328 | return;
|
329 | }
|
330 | const { target = window, passive: passive2 = false, capture = false } = options;
|
331 | let cleaned = false;
|
332 | let attached;
|
333 | const add = (target2) => {
|
334 | if (cleaned) {
|
335 | return;
|
336 | }
|
337 | const element = vue.unref(target2);
|
338 | if (element && !attached) {
|
339 | element.addEventListener(type, listener, {
|
340 | capture,
|
341 | passive: passive2
|
342 | });
|
343 | attached = true;
|
344 | }
|
345 | };
|
346 | const remove2 = (target2) => {
|
347 | if (cleaned) {
|
348 | return;
|
349 | }
|
350 | const element = vue.unref(target2);
|
351 | if (element && attached) {
|
352 | element.removeEventListener(type, listener, capture);
|
353 | attached = false;
|
354 | }
|
355 | };
|
356 | vue.onUnmounted(() => remove2(target));
|
357 | vue.onDeactivated(() => remove2(target));
|
358 | onMountedOrActivated(() => add(target));
|
359 | let stopWatch;
|
360 | if (vue.isRef(target)) {
|
361 | stopWatch = vue.watch(target, (val, oldVal) => {
|
362 | remove2(oldVal);
|
363 | add(val);
|
364 | });
|
365 | }
|
366 | return () => {
|
367 | stopWatch == null ? void 0 : stopWatch();
|
368 | remove2(target);
|
369 | cleaned = true;
|
370 | };
|
371 | }
|
372 | function useClickAway(target, listener, options = {}) {
|
373 | if (!inBrowser) {
|
374 | return;
|
375 | }
|
376 | const { eventName = "click" } = options;
|
377 | const onClick = (event) => {
|
378 | const targets = Array.isArray(target) ? target : [target];
|
379 | const isClickAway = targets.every((item) => {
|
380 | const element = vue.unref(item);
|
381 | return element && !element.contains(event.target);
|
382 | });
|
383 | if (isClickAway) {
|
384 | listener(event);
|
385 | }
|
386 | };
|
387 | useEventListener(eventName, onClick, { target: document });
|
388 | }
|
389 | var width;
|
390 | var height;
|
391 | function useWindowSize() {
|
392 | if (!width) {
|
393 | width = vue.ref(0);
|
394 | height = vue.ref(0);
|
395 | if (inBrowser) {
|
396 | const update = () => {
|
397 | width.value = window.innerWidth;
|
398 | height.value = window.innerHeight;
|
399 | };
|
400 | update();
|
401 | window.addEventListener("resize", update, { passive: true });
|
402 | window.addEventListener("orientationchange", update, { passive: true });
|
403 | }
|
404 | }
|
405 | return { width, height };
|
406 | }
|
407 | var overflowScrollReg = /scroll|auto|overlay/i;
|
408 | var defaultRoot = inBrowser ? window : void 0;
|
409 | function isElement$1(node) {
|
410 | const ELEMENT_NODE_TYPE = 1;
|
411 | return node.tagName !== "HTML" && node.tagName !== "BODY" && node.nodeType === ELEMENT_NODE_TYPE;
|
412 | }
|
413 | function getScrollParent$1(el, root = defaultRoot) {
|
414 | let node = el;
|
415 | while (node && node !== root && isElement$1(node)) {
|
416 | const { overflowY } = window.getComputedStyle(node);
|
417 | if (overflowScrollReg.test(overflowY)) {
|
418 | return node;
|
419 | }
|
420 | node = node.parentNode;
|
421 | }
|
422 | return root;
|
423 | }
|
424 | function useScrollParent(el, root = defaultRoot) {
|
425 | const scrollParent = vue.ref();
|
426 | vue.onMounted(() => {
|
427 | if (el.value) {
|
428 | scrollParent.value = getScrollParent$1(el.value, root);
|
429 | }
|
430 | });
|
431 | return scrollParent;
|
432 | }
|
433 | var visibility;
|
434 | function usePageVisibility() {
|
435 | if (!visibility) {
|
436 | visibility = vue.ref("visible");
|
437 | if (inBrowser) {
|
438 | const update = () => {
|
439 | visibility.value = document.hidden ? "hidden" : "visible";
|
440 | };
|
441 | update();
|
442 | window.addEventListener("visibilitychange", update);
|
443 | }
|
444 | }
|
445 | return visibility;
|
446 | }
|
447 | var CUSTOM_FIELD_INJECTION_KEY = Symbol("van-field");
|
448 | function useCustomFieldValue(customValue) {
|
449 | const field = vue.inject(CUSTOM_FIELD_INJECTION_KEY, null);
|
450 | if (field && !field.customValue.value) {
|
451 | field.customValue.value = customValue;
|
452 | vue.watch(customValue, () => {
|
453 | field.resetValidation();
|
454 | field.validateWithTrigger("onChange");
|
455 | });
|
456 | }
|
457 | }
|
458 | function getScrollTop(el) {
|
459 | const top2 = "scrollTop" in el ? el.scrollTop : el.pageYOffset;
|
460 | return Math.max(top2, 0);
|
461 | }
|
462 | function setScrollTop(el, value) {
|
463 | if ("scrollTop" in el) {
|
464 | el.scrollTop = value;
|
465 | } else {
|
466 | el.scrollTo(el.scrollX, value);
|
467 | }
|
468 | }
|
469 | function getRootScrollTop() {
|
470 | return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
|
471 | }
|
472 | function setRootScrollTop(value) {
|
473 | setScrollTop(window, value);
|
474 | setScrollTop(document.body, value);
|
475 | }
|
476 | function getElementTop(el, scroller) {
|
477 | if (el === window) {
|
478 | return 0;
|
479 | }
|
480 | const scrollTop = scroller ? getScrollTop(scroller) : getRootScrollTop();
|
481 | return useRect(el).top + scrollTop;
|
482 | }
|
483 | const isIOS = isIOS$1();
|
484 | function resetScroll() {
|
485 | if (isIOS) {
|
486 | setRootScrollTop(getRootScrollTop());
|
487 | }
|
488 | }
|
489 | const stopPropagation = (event) => event.stopPropagation();
|
490 | function preventDefault(event, isStopPropagation) {
|
491 | if (typeof event.cancelable !== "boolean" || event.cancelable) {
|
492 | event.preventDefault();
|
493 | }
|
494 | if (isStopPropagation) {
|
495 | stopPropagation(event);
|
496 | }
|
497 | }
|
498 | function isHidden(elementRef) {
|
499 | const el = vue.unref(elementRef);
|
500 | if (!el) {
|
501 | return false;
|
502 | }
|
503 | const style = window.getComputedStyle(el);
|
504 | const hidden = style.display === "none";
|
505 | const parentHidden = el.offsetParent === null && style.position !== "fixed";
|
506 | return hidden || parentHidden;
|
507 | }
|
508 | const { width: windowWidth, height: windowHeight } = useWindowSize();
|
509 | function isContainingBlock(el) {
|
510 | const css = window.getComputedStyle(el);
|
511 | return css.transform !== "none" || css.perspective !== "none" || ["transform", "perspective", "filter"].some(
|
512 | (value) => (css.willChange || "").includes(value)
|
513 | );
|
514 | }
|
515 | function getContainingBlock$1(el) {
|
516 | let node = el.parentElement;
|
517 | while (node) {
|
518 | if (node && node.tagName !== "HTML" && node.tagName !== "BODY" && isContainingBlock(node)) {
|
519 | return node;
|
520 | }
|
521 | node = node.parentElement;
|
522 | }
|
523 | return null;
|
524 | }
|
525 | function addUnit(value) {
|
526 | if (isDef(value)) {
|
527 | return isNumeric(value) ? `${value}px` : String(value);
|
528 | }
|
529 | return void 0;
|
530 | }
|
531 | function getSizeStyle(originSize) {
|
532 | if (isDef(originSize)) {
|
533 | if (Array.isArray(originSize)) {
|
534 | return {
|
535 | width: addUnit(originSize[0]),
|
536 | height: addUnit(originSize[1])
|
537 | };
|
538 | }
|
539 | const size = addUnit(originSize);
|
540 | return {
|
541 | width: size,
|
542 | height: size
|
543 | };
|
544 | }
|
545 | }
|
546 | function getZIndexStyle(zIndex) {
|
547 | const style = {};
|
548 | if (zIndex !== void 0) {
|
549 | style.zIndex = +zIndex;
|
550 | }
|
551 | return style;
|
552 | }
|
553 | let rootFontSize;
|
554 | function getRootFontSize() {
|
555 | if (!rootFontSize) {
|
556 | const doc = document.documentElement;
|
557 | const fontSize = doc.style.fontSize || window.getComputedStyle(doc).fontSize;
|
558 | rootFontSize = parseFloat(fontSize);
|
559 | }
|
560 | return rootFontSize;
|
561 | }
|
562 | function convertRem(value) {
|
563 | value = value.replace(/rem/g, "");
|
564 | return +value * getRootFontSize();
|
565 | }
|
566 | function convertVw(value) {
|
567 | value = value.replace(/vw/g, "");
|
568 | return +value * windowWidth.value / 100;
|
569 | }
|
570 | function convertVh(value) {
|
571 | value = value.replace(/vh/g, "");
|
572 | return +value * windowHeight.value / 100;
|
573 | }
|
574 | function unitToPx(value) {
|
575 | if (typeof value === "number") {
|
576 | return value;
|
577 | }
|
578 | if (inBrowser$1) {
|
579 | if (value.includes("rem")) {
|
580 | return convertRem(value);
|
581 | }
|
582 | if (value.includes("vw")) {
|
583 | return convertVw(value);
|
584 | }
|
585 | if (value.includes("vh")) {
|
586 | return convertVh(value);
|
587 | }
|
588 | }
|
589 | return parseFloat(value);
|
590 | }
|
591 | const camelizeRE = /-(\w)/g;
|
592 | const camelize = (str) => str.replace(camelizeRE, (_, c) => c.toUpperCase());
|
593 | const kebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase().replace(/^-/, "");
|
594 | function padZero(num, targetLength = 2) {
|
595 | let str = num + "";
|
596 | while (str.length < targetLength) {
|
597 | str = "0" + str;
|
598 | }
|
599 | return str;
|
600 | }
|
601 | const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
|
602 | function trimExtraChar(value, char, regExp) {
|
603 | const index = value.indexOf(char);
|
604 | if (index === -1) {
|
605 | return value;
|
606 | }
|
607 | if (char === "-" && index !== 0) {
|
608 | return value.slice(0, index);
|
609 | }
|
610 | return value.slice(0, index + 1) + value.slice(index).replace(regExp, "");
|
611 | }
|
612 | function formatNumber(value, allowDot = true, allowMinus = true) {
|
613 | if (allowDot) {
|
614 | value = trimExtraChar(value, ".", /\./g);
|
615 | } else {
|
616 | value = value.split(".")[0];
|
617 | }
|
618 | if (allowMinus) {
|
619 | value = trimExtraChar(value, "-", /-/g);
|
620 | } else {
|
621 | value = value.replace(/-/, "");
|
622 | }
|
623 | const regExp = allowDot ? /[^-0-9.]/g : /[^-0-9]/g;
|
624 | return value.replace(regExp, "");
|
625 | }
|
626 | function addNumber(num1, num2) {
|
627 | const cardinal = 10 ** 10;
|
628 | return Math.round((num1 + num2) * cardinal) / cardinal;
|
629 | }
|
630 | const { hasOwnProperty } = Object.prototype;
|
631 | function assignKey(to, from, key) {
|
632 | const val = from[key];
|
633 | if (!isDef(val)) {
|
634 | return;
|
635 | }
|
636 | if (!hasOwnProperty.call(to, key) || !isObject$1(val)) {
|
637 | to[key] = val;
|
638 | } else {
|
639 | to[key] = deepAssign(Object(to[key]), val);
|
640 | }
|
641 | }
|
642 | function deepAssign(to, from) {
|
643 | Object.keys(from).forEach((key) => {
|
644 | assignKey(to, from, key);
|
645 | });
|
646 | return to;
|
647 | }
|
648 | var stdin_default$1W = {
|
649 | name: "姓名",
|
650 | tel: "电话",
|
651 | save: "保存",
|
652 | clear: "清空",
|
653 | cancel: "取消",
|
654 | confirm: "确认",
|
655 | delete: "删除",
|
656 | loading: "加载中...",
|
657 | noCoupon: "暂无优惠券",
|
658 | nameEmpty: "请填写姓名",
|
659 | addContact: "添加联系人",
|
660 | telInvalid: "请填写正确的电话",
|
661 | vanCalendar: {
|
662 | end: "结束",
|
663 | start: "开始",
|
664 | title: "日期选择",
|
665 | weekdays: ["日", "一", "二", "三", "四", "五", "六"],
|
666 | monthTitle: (year, month) => `${year}年${month}月`,
|
667 | rangePrompt: (maxRange) => `最多选择 ${maxRange} 天`
|
668 | },
|
669 | vanCascader: {
|
670 | select: "请选择"
|
671 | },
|
672 | vanPagination: {
|
673 | prev: "上一页",
|
674 | next: "下一页"
|
675 | },
|
676 | vanPullRefresh: {
|
677 | pulling: "下拉即可刷新...",
|
678 | loosing: "释放即可刷新..."
|
679 | },
|
680 | vanSubmitBar: {
|
681 | label: "合计:"
|
682 | },
|
683 | vanCoupon: {
|
684 | unlimited: "无门槛",
|
685 | discount: (discount) => `${discount}折`,
|
686 | condition: (condition) => `满${condition}元可用`
|
687 | },
|
688 | vanCouponCell: {
|
689 | title: "优惠券",
|
690 | count: (count) => `${count}张可用`
|
691 | },
|
692 | vanCouponList: {
|
693 | exchange: "兑换",
|
694 | close: "不使用",
|
695 | enable: "可用",
|
696 | disabled: "不可用",
|
697 | placeholder: "输入优惠码"
|
698 | },
|
699 | vanAddressEdit: {
|
700 | area: "地区",
|
701 | areaEmpty: "请选择地区",
|
702 | addressEmpty: "请填写详细地址",
|
703 | addressDetail: "详细地址",
|
704 | defaultAddress: "设为默认收货地址"
|
705 | },
|
706 | vanAddressList: {
|
707 | add: "新增地址"
|
708 | }
|
709 | };
|
710 | const lang = vue.ref("zh-CN");
|
711 | const messages = vue.reactive({
|
712 | "zh-CN": stdin_default$1W
|
713 | });
|
714 | const Locale = {
|
715 | messages() {
|
716 | return messages[lang.value];
|
717 | },
|
718 | use(newLang, newMessages) {
|
719 | lang.value = newLang;
|
720 | this.add({ [newLang]: newMessages });
|
721 | },
|
722 | add(newMessages = {}) {
|
723 | deepAssign(messages, newMessages);
|
724 | }
|
725 | };
|
726 | const useCurrentLang = () => lang;
|
727 | var stdin_default$1V = Locale;
|
728 | function createTranslate(name2) {
|
729 | const prefix = camelize(name2) + ".";
|
730 | return (path, ...args) => {
|
731 | const messages2 = stdin_default$1V.messages();
|
732 | const message = get(messages2, prefix + path) || get(messages2, path);
|
733 | return isFunction(message) ? message(...args) : message;
|
734 | };
|
735 | }
|
736 | function genBem(name2, mods) {
|
737 | if (!mods) {
|
738 | return "";
|
739 | }
|
740 | if (typeof mods === "string") {
|
741 | return ` ${name2}--${mods}`;
|
742 | }
|
743 | if (Array.isArray(mods)) {
|
744 | return mods.reduce(
|
745 | (ret, item) => ret + genBem(name2, item),
|
746 | ""
|
747 | );
|
748 | }
|
749 | return Object.keys(mods).reduce(
|
750 | (ret, key) => ret + (mods[key] ? genBem(name2, key) : ""),
|
751 | ""
|
752 | );
|
753 | }
|
754 | function createBEM(name2) {
|
755 | return (el, mods) => {
|
756 | if (el && typeof el !== "string") {
|
757 | mods = el;
|
758 | el = "";
|
759 | }
|
760 | el = el ? `${name2}__${el}` : name2;
|
761 | return `${el}${genBem(el, mods)}`;
|
762 | };
|
763 | }
|
764 | function createNamespace(name2) {
|
765 | const prefixedName = `van-${name2}`;
|
766 | return [
|
767 | prefixedName,
|
768 | createBEM(prefixedName),
|
769 | createTranslate(prefixedName)
|
770 | ];
|
771 | }
|
772 | const BORDER = "van-hairline";
|
773 | const BORDER_TOP = `${BORDER}--top`;
|
774 | const BORDER_LEFT = `${BORDER}--left`;
|
775 | const BORDER_RIGHT = `${BORDER}--right`;
|
776 | const BORDER_BOTTOM = `${BORDER}--bottom`;
|
777 | const BORDER_SURROUND = `${BORDER}--surround`;
|
778 | const BORDER_TOP_BOTTOM = `${BORDER}--top-bottom`;
|
779 | const BORDER_UNSET_TOP_BOTTOM = `${BORDER}-unset--top-bottom`;
|
780 | const HAPTICS_FEEDBACK = "van-haptics-feedback";
|
781 | const FORM_KEY = Symbol("van-form");
|
782 | const LONG_PRESS_START_TIME = 500;
|
783 | const TAP_OFFSET = 5;
|
784 | function callInterceptor(interceptor, {
|
785 | args = [],
|
786 | done,
|
787 | canceled,
|
788 | error
|
789 | }) {
|
790 | if (interceptor) {
|
791 | const returnVal = interceptor.apply(null, args);
|
792 | if (isPromise(returnVal)) {
|
793 | returnVal.then((value) => {
|
794 | if (value) {
|
795 | done();
|
796 | } else if (canceled) {
|
797 | canceled();
|
798 | }
|
799 | }).catch(error || noop);
|
800 | } else if (returnVal) {
|
801 | done();
|
802 | } else if (canceled) {
|
803 | canceled();
|
804 | }
|
805 | } else {
|
806 | done();
|
807 | }
|
808 | }
|
809 | function withInstall(options) {
|
810 | options.install = (app) => {
|
811 | const { name: name2 } = options;
|
812 | if (name2) {
|
813 | app.component(name2, options);
|
814 | app.component(camelize(`-${name2}`), options);
|
815 | }
|
816 | };
|
817 | return options;
|
818 | }
|
819 | function closest(arr, target) {
|
820 | return arr.reduce(
|
821 | (pre, cur) => Math.abs(pre - target) < Math.abs(cur - target) ? pre : cur
|
822 | );
|
823 | }
|
824 | const POPUP_TOGGLE_KEY = Symbol();
|
825 | function onPopupReopen(callback) {
|
826 | const popupToggleStatus = vue.inject(POPUP_TOGGLE_KEY, null);
|
827 | if (popupToggleStatus) {
|
828 | vue.watch(popupToggleStatus, (show) => {
|
829 | if (show) {
|
830 | callback();
|
831 | }
|
832 | });
|
833 | }
|
834 | }
|
835 | const useHeight = (element, withSafeArea) => {
|
836 | const height2 = vue.ref();
|
837 | const setHeight = () => {
|
838 | height2.value = useRect(element).height;
|
839 | };
|
840 | vue.onMounted(() => {
|
841 | vue.nextTick(setHeight);
|
842 | if (withSafeArea) {
|
843 | for (let i = 1; i <= 3; i++) {
|
844 | setTimeout(setHeight, 100 * i);
|
845 | }
|
846 | }
|
847 | });
|
848 | onPopupReopen(() => vue.nextTick(setHeight));
|
849 | vue.watch([windowWidth, windowHeight], setHeight);
|
850 | return height2;
|
851 | };
|
852 | function usePlaceholder(contentRef, bem2) {
|
853 | const height2 = useHeight(contentRef, true);
|
854 | return (renderContent) => vue.createVNode("div", {
|
855 | "class": bem2("placeholder"),
|
856 | "style": {
|
857 | height: height2.value ? `${height2.value}px` : void 0
|
858 | }
|
859 | }, [renderContent()]);
|
860 | }
|
861 | const [name$1K, bem$1F] = createNamespace("action-bar");
|
862 | const ACTION_BAR_KEY = Symbol(name$1K);
|
863 | const actionBarProps = {
|
864 | placeholder: Boolean,
|
865 | safeAreaInsetBottom: truthProp
|
866 | };
|
867 | var stdin_default$1U = vue.defineComponent({
|
868 | name: name$1K,
|
869 | props: actionBarProps,
|
870 | setup(props2, {
|
871 | slots
|
872 | }) {
|
873 | const root = vue.ref();
|
874 | const renderPlaceholder = usePlaceholder(root, bem$1F);
|
875 | const {
|
876 | linkChildren
|
877 | } = useChildren(ACTION_BAR_KEY);
|
878 | linkChildren();
|
879 | const renderActionBar = () => {
|
880 | var _a;
|
881 | return vue.createVNode("div", {
|
882 | "ref": root,
|
883 | "class": [bem$1F(), {
|
884 | "van-safe-area-bottom": props2.safeAreaInsetBottom
|
885 | }]
|
886 | }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
887 | };
|
888 | return () => {
|
889 | if (props2.placeholder) {
|
890 | return renderPlaceholder(renderActionBar);
|
891 | }
|
892 | return renderActionBar();
|
893 | };
|
894 | }
|
895 | });
|
896 | const ActionBar = withInstall(stdin_default$1U);
|
897 | function useExpose(apis) {
|
898 | const instance2 = vue.getCurrentInstance();
|
899 | if (instance2) {
|
900 | extend(instance2.proxy, apis);
|
901 | }
|
902 | }
|
903 | const routeProps = {
|
904 | to: [String, Object],
|
905 | url: String,
|
906 | replace: Boolean
|
907 | };
|
908 | function route({
|
909 | to,
|
910 | url,
|
911 | replace,
|
912 | $router: router
|
913 | }) {
|
914 | if (to && router) {
|
915 | router[replace ? "replace" : "push"](to);
|
916 | } else if (url) {
|
917 | replace ? location.replace(url) : location.href = url;
|
918 | }
|
919 | }
|
920 | function useRoute() {
|
921 | const vm = vue.getCurrentInstance().proxy;
|
922 | return () => route(vm);
|
923 | }
|
924 | const [name$1J, bem$1E] = createNamespace("badge");
|
925 | const badgeProps = {
|
926 | dot: Boolean,
|
927 | max: numericProp,
|
928 | tag: makeStringProp("div"),
|
929 | color: String,
|
930 | offset: Array,
|
931 | content: numericProp,
|
932 | showZero: truthProp,
|
933 | position: makeStringProp("top-right")
|
934 | };
|
935 | var stdin_default$1T = vue.defineComponent({
|
936 | name: name$1J,
|
937 | props: badgeProps,
|
938 | setup(props2, {
|
939 | slots
|
940 | }) {
|
941 | const hasContent = () => {
|
942 | if (slots.content) {
|
943 | return true;
|
944 | }
|
945 | const {
|
946 | content,
|
947 | showZero
|
948 | } = props2;
|
949 | return isDef(content) && content !== "" && (showZero || content !== 0 && content !== "0");
|
950 | };
|
951 | const renderContent = () => {
|
952 | const {
|
953 | dot,
|
954 | max,
|
955 | content
|
956 | } = props2;
|
957 | if (!dot && hasContent()) {
|
958 | if (slots.content) {
|
959 | return slots.content();
|
960 | }
|
961 | if (isDef(max) && isNumeric(content) && +content > +max) {
|
962 | return `${max}+`;
|
963 | }
|
964 | return content;
|
965 | }
|
966 | };
|
967 | const getOffsetWithMinusString = (val) => val.startsWith("-") ? val.replace("-", "") : `-${val}`;
|
968 | const style = vue.computed(() => {
|
969 | const style2 = {
|
970 | background: props2.color
|
971 | };
|
972 | if (props2.offset) {
|
973 | const [x, y] = props2.offset;
|
974 | const {
|
975 | position
|
976 | } = props2;
|
977 | const [offsetY, offsetX] = position.split("-");
|
978 | if (slots.default) {
|
979 | if (typeof y === "number") {
|
980 | style2[offsetY] = addUnit(offsetY === "top" ? y : -y);
|
981 | } else {
|
982 | style2[offsetY] = offsetY === "top" ? addUnit(y) : getOffsetWithMinusString(y);
|
983 | }
|
984 | if (typeof x === "number") {
|
985 | style2[offsetX] = addUnit(offsetX === "left" ? x : -x);
|
986 | } else {
|
987 | style2[offsetX] = offsetX === "left" ? addUnit(x) : getOffsetWithMinusString(x);
|
988 | }
|
989 | } else {
|
990 | style2.marginTop = addUnit(y);
|
991 | style2.marginLeft = addUnit(x);
|
992 | }
|
993 | }
|
994 | return style2;
|
995 | });
|
996 | const renderBadge = () => {
|
997 | if (hasContent() || props2.dot) {
|
998 | return vue.createVNode("div", {
|
999 | "class": bem$1E([props2.position, {
|
1000 | dot: props2.dot,
|
1001 | fixed: !!slots.default
|
1002 | }]),
|
1003 | "style": style.value
|
1004 | }, [renderContent()]);
|
1005 | }
|
1006 | };
|
1007 | return () => {
|
1008 | if (slots.default) {
|
1009 | const {
|
1010 | tag
|
1011 | } = props2;
|
1012 | return vue.createVNode(tag, {
|
1013 | "class": bem$1E("wrapper")
|
1014 | }, {
|
1015 | default: () => [slots.default(), renderBadge()]
|
1016 | });
|
1017 | }
|
1018 | return renderBadge();
|
1019 | };
|
1020 | }
|
1021 | });
|
1022 | const Badge = withInstall(stdin_default$1T);
|
1023 | let globalZIndex = 2e3;
|
1024 | const useGlobalZIndex = () => ++globalZIndex;
|
1025 | const setGlobalZIndex = (val) => {
|
1026 | globalZIndex = val;
|
1027 | };
|
1028 | const [name$1I, bem$1D] = createNamespace("config-provider");
|
1029 | const CONFIG_PROVIDER_KEY = Symbol(name$1I);
|
1030 | const configProviderProps = {
|
1031 | tag: makeStringProp("div"),
|
1032 | theme: makeStringProp("light"),
|
1033 | zIndex: Number,
|
1034 | themeVars: Object,
|
1035 | themeVarsDark: Object,
|
1036 | themeVarsLight: Object,
|
1037 | themeVarsScope: makeStringProp("local"),
|
1038 | iconPrefix: String
|
1039 | };
|
1040 | function insertDash(str) {
|
1041 | return str.replace(/([a-zA-Z])(\d)/g, "$1-$2");
|
1042 | }
|
1043 | function mapThemeVarsToCSSVars(themeVars) {
|
1044 | const cssVars = {};
|
1045 | Object.keys(themeVars).forEach((key) => {
|
1046 | const formattedKey = insertDash(kebabCase(key));
|
1047 | cssVars[`--van-${formattedKey}`] = themeVars[key];
|
1048 | });
|
1049 | return cssVars;
|
1050 | }
|
1051 | function syncThemeVarsOnRoot(newStyle = {}, oldStyle = {}) {
|
1052 | Object.keys(newStyle).forEach((key) => {
|
1053 | if (newStyle[key] !== oldStyle[key]) {
|
1054 | document.documentElement.style.setProperty(key, newStyle[key]);
|
1055 | }
|
1056 | });
|
1057 | Object.keys(oldStyle).forEach((key) => {
|
1058 | if (!newStyle[key]) {
|
1059 | document.documentElement.style.removeProperty(key);
|
1060 | }
|
1061 | });
|
1062 | }
|
1063 | var stdin_default$1S = vue.defineComponent({
|
1064 | name: name$1I,
|
1065 | props: configProviderProps,
|
1066 | setup(props2, {
|
1067 | slots
|
1068 | }) {
|
1069 | const style = vue.computed(() => mapThemeVarsToCSSVars(extend({}, props2.themeVars, props2.theme === "dark" ? props2.themeVarsDark : props2.themeVarsLight)));
|
1070 | if (inBrowser$1) {
|
1071 | const addTheme = () => {
|
1072 | document.documentElement.classList.add(`van-theme-${props2.theme}`);
|
1073 | };
|
1074 | const removeTheme = (theme = props2.theme) => {
|
1075 | document.documentElement.classList.remove(`van-theme-${theme}`);
|
1076 | };
|
1077 | vue.watch(() => props2.theme, (newVal, oldVal) => {
|
1078 | if (oldVal) {
|
1079 | removeTheme(oldVal);
|
1080 | }
|
1081 | addTheme();
|
1082 | }, {
|
1083 | immediate: true
|
1084 | });
|
1085 | vue.onActivated(addTheme);
|
1086 | vue.onDeactivated(removeTheme);
|
1087 | vue.onBeforeUnmount(removeTheme);
|
1088 | vue.watch(style, (newStyle, oldStyle) => {
|
1089 | if (props2.themeVarsScope === "global") {
|
1090 | syncThemeVarsOnRoot(newStyle, oldStyle);
|
1091 | }
|
1092 | });
|
1093 | vue.watch(() => props2.themeVarsScope, (newScope, oldScope) => {
|
1094 | if (oldScope === "global") {
|
1095 | syncThemeVarsOnRoot({}, style.value);
|
1096 | }
|
1097 | if (newScope === "global") {
|
1098 | syncThemeVarsOnRoot(style.value, {});
|
1099 | }
|
1100 | });
|
1101 | if (props2.themeVarsScope === "global") {
|
1102 | syncThemeVarsOnRoot(style.value, {});
|
1103 | }
|
1104 | }
|
1105 | vue.provide(CONFIG_PROVIDER_KEY, props2);
|
1106 | vue.watchEffect(() => {
|
1107 | if (props2.zIndex !== void 0) {
|
1108 | setGlobalZIndex(props2.zIndex);
|
1109 | }
|
1110 | });
|
1111 | return () => vue.createVNode(props2.tag, {
|
1112 | "class": bem$1D(),
|
1113 | "style": props2.themeVarsScope === "local" ? style.value : void 0
|
1114 | }, {
|
1115 | default: () => {
|
1116 | var _a;
|
1117 | return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
|
1118 | }
|
1119 | });
|
1120 | }
|
1121 | });
|
1122 | const [name$1H, bem$1C] = createNamespace("icon");
|
1123 | const isImage$1 = (name2) => name2 == null ? void 0 : name2.includes("/");
|
1124 | const iconProps = {
|
1125 | dot: Boolean,
|
1126 | tag: makeStringProp("i"),
|
1127 | name: String,
|
1128 | size: numericProp,
|
1129 | badge: numericProp,
|
1130 | color: String,
|
1131 | badgeProps: Object,
|
1132 | classPrefix: String
|
1133 | };
|
1134 | var stdin_default$1R = vue.defineComponent({
|
1135 | name: name$1H,
|
1136 | props: iconProps,
|
1137 | setup(props2, {
|
1138 | slots
|
1139 | }) {
|
1140 | const config = vue.inject(CONFIG_PROVIDER_KEY, null);
|
1141 | const classPrefix = vue.computed(() => props2.classPrefix || (config == null ? void 0 : config.iconPrefix) || bem$1C());
|
1142 | return () => {
|
1143 | const {
|
1144 | tag,
|
1145 | dot,
|
1146 | name: name2,
|
1147 | size,
|
1148 | badge,
|
1149 | color
|
1150 | } = props2;
|
1151 | const isImageIcon = isImage$1(name2);
|
1152 | return vue.createVNode(Badge, vue.mergeProps({
|
1153 | "dot": dot,
|
1154 | "tag": tag,
|
1155 | "class": [classPrefix.value, isImageIcon ? "" : `${classPrefix.value}-${name2}`],
|
1156 | "style": {
|
1157 | color,
|
1158 | fontSize: addUnit(size)
|
1159 | },
|
1160 | "content": badge
|
1161 | }, props2.badgeProps), {
|
1162 | default: () => {
|
1163 | var _a;
|
1164 | return [(_a = slots.default) == null ? void 0 : _a.call(slots), isImageIcon && vue.createVNode("img", {
|
1165 | "class": bem$1C("image"),
|
1166 | "src": name2
|
1167 | }, null)];
|
1168 | }
|
1169 | });
|
1170 | };
|
1171 | }
|
1172 | });
|
1173 | const Icon = withInstall(stdin_default$1R);
|
1174 | var stdin_default$1Q = Icon;
|
1175 | const [name$1G, bem$1B] = createNamespace("loading");
|
1176 | const SpinIcon = Array(12).fill(null).map((_, index) => vue.createVNode("i", {
|
1177 | "class": bem$1B("line", String(index + 1))
|
1178 | }, null));
|
1179 | const CircularIcon = vue.createVNode("svg", {
|
1180 | "class": bem$1B("circular"),
|
1181 | "viewBox": "25 25 50 50"
|
1182 | }, [vue.createVNode("circle", {
|
1183 | "cx": "50",
|
1184 | "cy": "50",
|
1185 | "r": "20",
|
1186 | "fill": "none"
|
1187 | }, null)]);
|
1188 | const loadingProps = {
|
1189 | size: numericProp,
|
1190 | type: makeStringProp("circular"),
|
1191 | color: String,
|
1192 | vertical: Boolean,
|
1193 | textSize: numericProp,
|
1194 | textColor: String
|
1195 | };
|
1196 | var stdin_default$1P = vue.defineComponent({
|
1197 | name: name$1G,
|
1198 | props: loadingProps,
|
1199 | setup(props2, {
|
1200 | slots
|
1201 | }) {
|
1202 | const spinnerStyle = vue.computed(() => extend({
|
1203 | color: props2.color
|
1204 | }, getSizeStyle(props2.size)));
|
1205 | const renderIcon = () => {
|
1206 | const DefaultIcon = props2.type === "spinner" ? SpinIcon : CircularIcon;
|
1207 | return vue.createVNode("span", {
|
1208 | "class": bem$1B("spinner", props2.type),
|
1209 | "style": spinnerStyle.value
|
1210 | }, [slots.icon ? slots.icon() : DefaultIcon]);
|
1211 | };
|
1212 | const renderText = () => {
|
1213 | var _a;
|
1214 | if (slots.default) {
|
1215 | return vue.createVNode("span", {
|
1216 | "class": bem$1B("text"),
|
1217 | "style": {
|
1218 | fontSize: addUnit(props2.textSize),
|
1219 | color: (_a = props2.textColor) != null ? _a : props2.color
|
1220 | }
|
1221 | }, [slots.default()]);
|
1222 | }
|
1223 | };
|
1224 | return () => {
|
1225 | const {
|
1226 | type,
|
1227 | vertical
|
1228 | } = props2;
|
1229 | return vue.createVNode("div", {
|
1230 | "class": bem$1B([type, {
|
1231 | vertical
|
1232 | }]),
|
1233 | "aria-live": "polite",
|
1234 | "aria-busy": true
|
1235 | }, [renderIcon(), renderText()]);
|
1236 | };
|
1237 | }
|
1238 | });
|
1239 | const Loading = withInstall(stdin_default$1P);
|
1240 | const [name$1F, bem$1A] = createNamespace("button");
|
1241 | const buttonProps = extend({}, routeProps, {
|
1242 | tag: makeStringProp("button"),
|
1243 | text: String,
|
1244 | icon: String,
|
1245 | type: makeStringProp("default"),
|
1246 | size: makeStringProp("normal"),
|
1247 | color: String,
|
1248 | block: Boolean,
|
1249 | plain: Boolean,
|
1250 | round: Boolean,
|
1251 | square: Boolean,
|
1252 | loading: Boolean,
|
1253 | hairline: Boolean,
|
1254 | disabled: Boolean,
|
1255 | iconPrefix: String,
|
1256 | nativeType: makeStringProp("button"),
|
1257 | loadingSize: numericProp,
|
1258 | loadingText: String,
|
1259 | loadingType: String,
|
1260 | iconPosition: makeStringProp("left")
|
1261 | });
|
1262 | var stdin_default$1O = vue.defineComponent({
|
1263 | name: name$1F,
|
1264 | props: buttonProps,
|
1265 | emits: ["click"],
|
1266 | setup(props2, {
|
1267 | emit,
|
1268 | slots
|
1269 | }) {
|
1270 | const route2 = useRoute();
|
1271 | const renderLoadingIcon = () => {
|
1272 | if (slots.loading) {
|
1273 | return slots.loading();
|
1274 | }
|
1275 | return vue.createVNode(Loading, {
|
1276 | "size": props2.loadingSize,
|
1277 | "type": props2.loadingType,
|
1278 | "class": bem$1A("loading")
|
1279 | }, null);
|
1280 | };
|
1281 | const renderIcon = () => {
|
1282 | if (props2.loading) {
|
1283 | return renderLoadingIcon();
|
1284 | }
|
1285 | if (slots.icon) {
|
1286 | return vue.createVNode("div", {
|
1287 | "class": bem$1A("icon")
|
1288 | }, [slots.icon()]);
|
1289 | }
|
1290 | if (props2.icon) {
|
1291 | return vue.createVNode(Icon, {
|
1292 | "name": props2.icon,
|
1293 | "class": bem$1A("icon"),
|
1294 | "classPrefix": props2.iconPrefix
|
1295 | }, null);
|
1296 | }
|
1297 | };
|
1298 | const renderText = () => {
|
1299 | let text;
|
1300 | if (props2.loading) {
|
1301 | text = props2.loadingText;
|
1302 | } else {
|
1303 | text = slots.default ? slots.default() : props2.text;
|
1304 | }
|
1305 | if (text) {
|
1306 | return vue.createVNode("span", {
|
1307 | "class": bem$1A("text")
|
1308 | }, [text]);
|
1309 | }
|
1310 | };
|
1311 | const getStyle = () => {
|
1312 | const {
|
1313 | color,
|
1314 | plain
|
1315 | } = props2;
|
1316 | if (color) {
|
1317 | const style = {
|
1318 | color: plain ? color : "white"
|
1319 | };
|
1320 | if (!plain) {
|
1321 | style.background = color;
|
1322 | }
|
1323 | if (color.includes("gradient")) {
|
1324 | style.border = 0;
|
1325 | } else {
|
1326 | style.borderColor = color;
|
1327 | }
|
1328 | return style;
|
1329 | }
|
1330 | };
|
1331 | const onClick = (event) => {
|
1332 | if (props2.loading) {
|
1333 | preventDefault(event);
|
1334 | } else if (!props2.disabled) {
|
1335 | emit("click", event);
|
1336 | route2();
|
1337 | }
|
1338 | };
|
1339 | return () => {
|
1340 | const {
|
1341 | tag,
|
1342 | type,
|
1343 | size,
|
1344 | block,
|
1345 | round: round2,
|
1346 | plain,
|
1347 | square,
|
1348 | loading,
|
1349 | disabled,
|
1350 | hairline,
|
1351 | nativeType,
|
1352 | iconPosition
|
1353 | } = props2;
|
1354 | const classes = [bem$1A([type, size, {
|
1355 | plain,
|
1356 | block,
|
1357 | round: round2,
|
1358 | square,
|
1359 | loading,
|
1360 | disabled,
|
1361 | hairline
|
1362 | }]), {
|
1363 | [BORDER_SURROUND]: hairline
|
1364 | }];
|
1365 | return vue.createVNode(tag, {
|
1366 | "type": nativeType,
|
1367 | "class": classes,
|
1368 | "style": getStyle(),
|
1369 | "disabled": disabled,
|
1370 | "onClick": onClick
|
1371 | }, {
|
1372 | default: () => [vue.createVNode("div", {
|
1373 | "class": bem$1A("content")
|
1374 | }, [iconPosition === "left" && renderIcon(), renderText(), iconPosition === "right" && renderIcon()])]
|
1375 | });
|
1376 | };
|
1377 | }
|
1378 | });
|
1379 | const Button = withInstall(stdin_default$1O);
|
1380 | const [name$1E, bem$1z] = createNamespace("action-bar-button");
|
1381 | const actionBarButtonProps = extend({}, routeProps, {
|
1382 | type: String,
|
1383 | text: String,
|
1384 | icon: String,
|
1385 | color: String,
|
1386 | loading: Boolean,
|
1387 | disabled: Boolean
|
1388 | });
|
1389 | var stdin_default$1N = vue.defineComponent({
|
1390 | name: name$1E,
|
1391 | props: actionBarButtonProps,
|
1392 | setup(props2, {
|
1393 | slots
|
1394 | }) {
|
1395 | const route2 = useRoute();
|
1396 | const {
|
1397 | parent,
|
1398 | index
|
1399 | } = useParent(ACTION_BAR_KEY);
|
1400 | const isFirst = vue.computed(() => {
|
1401 | if (parent) {
|
1402 | const prev = parent.children[index.value - 1];
|
1403 | return !(prev && "isButton" in prev);
|
1404 | }
|
1405 | });
|
1406 | const isLast = vue.computed(() => {
|
1407 | if (parent) {
|
1408 | const next = parent.children[index.value + 1];
|
1409 | return !(next && "isButton" in next);
|
1410 | }
|
1411 | });
|
1412 | useExpose({
|
1413 | isButton: true
|
1414 | });
|
1415 | return () => {
|
1416 | const {
|
1417 | type,
|
1418 | icon,
|
1419 | text,
|
1420 | color,
|
1421 | loading,
|
1422 | disabled
|
1423 | } = props2;
|
1424 | return vue.createVNode(Button, {
|
1425 | "class": bem$1z([type, {
|
1426 | last: isLast.value,
|
1427 | first: isFirst.value
|
1428 | }]),
|
1429 | "size": "large",
|
1430 | "type": type,
|
1431 | "icon": icon,
|
1432 | "color": color,
|
1433 | "loading": loading,
|
1434 | "disabled": disabled,
|
1435 | "onClick": route2
|
1436 | }, {
|
1437 | default: () => [slots.default ? slots.default() : text]
|
1438 | });
|
1439 | };
|
1440 | }
|
1441 | });
|
1442 | const ActionBarButton = withInstall(stdin_default$1N);
|
1443 | const [name$1D, bem$1y] = createNamespace("action-bar-icon");
|
1444 | const actionBarIconProps = extend({}, routeProps, {
|
1445 | dot: Boolean,
|
1446 | text: String,
|
1447 | icon: String,
|
1448 | color: String,
|
1449 | badge: numericProp,
|
1450 | iconClass: unknownProp,
|
1451 | badgeProps: Object,
|
1452 | iconPrefix: String
|
1453 | });
|
1454 | var stdin_default$1M = vue.defineComponent({
|
1455 | name: name$1D,
|
1456 | props: actionBarIconProps,
|
1457 | setup(props2, {
|
1458 | slots
|
1459 | }) {
|
1460 | const route2 = useRoute();
|
1461 | useParent(ACTION_BAR_KEY);
|
1462 | const renderIcon = () => {
|
1463 | const {
|
1464 | dot,
|
1465 | badge,
|
1466 | icon,
|
1467 | color,
|
1468 | iconClass,
|
1469 | badgeProps: badgeProps2,
|
1470 | iconPrefix
|
1471 | } = props2;
|
1472 | if (slots.icon) {
|
1473 | return vue.createVNode(Badge, vue.mergeProps({
|
1474 | "dot": dot,
|
1475 | "class": bem$1y("icon"),
|
1476 | "content": badge
|
1477 | }, badgeProps2), {
|
1478 | default: slots.icon
|
1479 | });
|
1480 | }
|
1481 | return vue.createVNode(Icon, {
|
1482 | "tag": "div",
|
1483 | "dot": dot,
|
1484 | "name": icon,
|
1485 | "badge": badge,
|
1486 | "color": color,
|
1487 | "class": [bem$1y("icon"), iconClass],
|
1488 | "badgeProps": badgeProps2,
|
1489 | "classPrefix": iconPrefix
|
1490 | }, null);
|
1491 | };
|
1492 | return () => vue.createVNode("div", {
|
1493 | "role": "button",
|
1494 | "class": bem$1y(),
|
1495 | "tabindex": 0,
|
1496 | "onClick": route2
|
1497 | }, [renderIcon(), slots.default ? slots.default() : props2.text]);
|
1498 | }
|
1499 | });
|
1500 | const ActionBarIcon = withInstall(stdin_default$1M);
|
1501 | const popupSharedProps = {
|
1502 |
|
1503 | show: Boolean,
|
1504 |
|
1505 | zIndex: numericProp,
|
1506 |
|
1507 | overlay: truthProp,
|
1508 |
|
1509 | duration: numericProp,
|
1510 |
|
1511 | teleport: [String, Object],
|
1512 |
|
1513 | lockScroll: truthProp,
|
1514 |
|
1515 | lazyRender: truthProp,
|
1516 |
|
1517 | beforeClose: Function,
|
1518 |
|
1519 | overlayStyle: Object,
|
1520 |
|
1521 | overlayClass: unknownProp,
|
1522 |
|
1523 | transitionAppear: Boolean,
|
1524 |
|
1525 | closeOnClickOverlay: truthProp
|
1526 | };
|
1527 | const popupSharedPropKeys = Object.keys(
|
1528 | popupSharedProps
|
1529 | );
|
1530 | function getDirection(x, y) {
|
1531 | if (x > y) {
|
1532 | return "horizontal";
|
1533 | }
|
1534 | if (y > x) {
|
1535 | return "vertical";
|
1536 | }
|
1537 | return "";
|
1538 | }
|
1539 | function useTouch() {
|
1540 | const startX = vue.ref(0);
|
1541 | const startY = vue.ref(0);
|
1542 | const deltaX = vue.ref(0);
|
1543 | const deltaY = vue.ref(0);
|
1544 | const offsetX = vue.ref(0);
|
1545 | const offsetY = vue.ref(0);
|
1546 | const direction = vue.ref("");
|
1547 | const isTap = vue.ref(true);
|
1548 | const isVertical = () => direction.value === "vertical";
|
1549 | const isHorizontal = () => direction.value === "horizontal";
|
1550 | const reset = () => {
|
1551 | deltaX.value = 0;
|
1552 | deltaY.value = 0;
|
1553 | offsetX.value = 0;
|
1554 | offsetY.value = 0;
|
1555 | direction.value = "";
|
1556 | isTap.value = true;
|
1557 | };
|
1558 | const start2 = (event) => {
|
1559 | reset();
|
1560 | startX.value = event.touches[0].clientX;
|
1561 | startY.value = event.touches[0].clientY;
|
1562 | };
|
1563 | const move = (event) => {
|
1564 | const touch = event.touches[0];
|
1565 | deltaX.value = (touch.clientX < 0 ? 0 : touch.clientX) - startX.value;
|
1566 | deltaY.value = touch.clientY - startY.value;
|
1567 | offsetX.value = Math.abs(deltaX.value);
|
1568 | offsetY.value = Math.abs(deltaY.value);
|
1569 | const LOCK_DIRECTION_DISTANCE = 10;
|
1570 | if (!direction.value || offsetX.value < LOCK_DIRECTION_DISTANCE && offsetY.value < LOCK_DIRECTION_DISTANCE) {
|
1571 | direction.value = getDirection(offsetX.value, offsetY.value);
|
1572 | }
|
1573 | if (isTap.value && (offsetX.value > TAP_OFFSET || offsetY.value > TAP_OFFSET)) {
|
1574 | isTap.value = false;
|
1575 | }
|
1576 | };
|
1577 | return {
|
1578 | move,
|
1579 | start: start2,
|
1580 | reset,
|
1581 | startX,
|
1582 | startY,
|
1583 | deltaX,
|
1584 | deltaY,
|
1585 | offsetX,
|
1586 | offsetY,
|
1587 | direction,
|
1588 | isVertical,
|
1589 | isHorizontal,
|
1590 | isTap
|
1591 | };
|
1592 | }
|
1593 | let totalLockCount = 0;
|
1594 | const BODY_LOCK_CLASS = "van-overflow-hidden";
|
1595 | function useLockScroll(rootRef, shouldLock) {
|
1596 | const touch = useTouch();
|
1597 | const DIRECTION_UP = "01";
|
1598 | const DIRECTION_DOWN = "10";
|
1599 | const onTouchMove = (event) => {
|
1600 | touch.move(event);
|
1601 | const direction = touch.deltaY.value > 0 ? DIRECTION_DOWN : DIRECTION_UP;
|
1602 | const el = getScrollParent$1(
|
1603 | event.target,
|
1604 | rootRef.value
|
1605 | );
|
1606 | const { scrollHeight, offsetHeight, scrollTop } = el;
|
1607 | let status = "11";
|
1608 | if (scrollTop === 0) {
|
1609 | status = offsetHeight >= scrollHeight ? "00" : "01";
|
1610 | } else if (scrollTop + offsetHeight >= scrollHeight) {
|
1611 | status = "10";
|
1612 | }
|
1613 | if (status !== "11" && touch.isVertical() && !(parseInt(status, 2) & parseInt(direction, 2))) {
|
1614 | preventDefault(event, true);
|
1615 | }
|
1616 | };
|
1617 | const lock = () => {
|
1618 | document.addEventListener("touchstart", touch.start);
|
1619 | document.addEventListener("touchmove", onTouchMove, { passive: false });
|
1620 | if (!totalLockCount) {
|
1621 | document.body.classList.add(BODY_LOCK_CLASS);
|
1622 | }
|
1623 | totalLockCount++;
|
1624 | };
|
1625 | const unlock = () => {
|
1626 | if (totalLockCount) {
|
1627 | document.removeEventListener("touchstart", touch.start);
|
1628 | document.removeEventListener("touchmove", onTouchMove);
|
1629 | totalLockCount--;
|
1630 | if (!totalLockCount) {
|
1631 | document.body.classList.remove(BODY_LOCK_CLASS);
|
1632 | }
|
1633 | }
|
1634 | };
|
1635 | const init = () => shouldLock() && lock();
|
1636 | const destroy = () => shouldLock() && unlock();
|
1637 | onMountedOrActivated(init);
|
1638 | vue.onDeactivated(destroy);
|
1639 | vue.onBeforeUnmount(destroy);
|
1640 | vue.watch(shouldLock, (value) => {
|
1641 | value ? lock() : unlock();
|
1642 | });
|
1643 | }
|
1644 | function useLazyRender(show) {
|
1645 | const inited = vue.ref(false);
|
1646 | vue.watch(
|
1647 | show,
|
1648 | (value) => {
|
1649 | if (value) {
|
1650 | inited.value = value;
|
1651 | }
|
1652 | },
|
1653 | { immediate: true }
|
1654 | );
|
1655 | return (render) => () => inited.value ? render() : null;
|
1656 | }
|
1657 | const useScopeId = () => {
|
1658 | var _a;
|
1659 | const { scopeId } = ((_a = vue.getCurrentInstance()) == null ? void 0 : _a.vnode) || {};
|
1660 | return scopeId ? { [scopeId]: "" } : null;
|
1661 | };
|
1662 | const [name$1C, bem$1x] = createNamespace("overlay");
|
1663 | const overlayProps = {
|
1664 | show: Boolean,
|
1665 | zIndex: numericProp,
|
1666 | duration: numericProp,
|
1667 | className: unknownProp,
|
1668 | lockScroll: truthProp,
|
1669 | lazyRender: truthProp,
|
1670 | customStyle: Object
|
1671 | };
|
1672 | var stdin_default$1L = vue.defineComponent({
|
1673 | name: name$1C,
|
1674 | props: overlayProps,
|
1675 | setup(props2, {
|
1676 | slots
|
1677 | }) {
|
1678 | const root = vue.ref();
|
1679 | const lazyRender = useLazyRender(() => props2.show || !props2.lazyRender);
|
1680 | const onTouchMove = (event) => {
|
1681 | if (props2.lockScroll) {
|
1682 | preventDefault(event, true);
|
1683 | }
|
1684 | };
|
1685 | const renderOverlay = lazyRender(() => {
|
1686 | var _a;
|
1687 | const style = extend(getZIndexStyle(props2.zIndex), props2.customStyle);
|
1688 | if (isDef(props2.duration)) {
|
1689 | style.animationDuration = `${props2.duration}s`;
|
1690 | }
|
1691 | return vue.withDirectives(vue.createVNode("div", {
|
1692 | "ref": root,
|
1693 | "style": style,
|
1694 | "class": [bem$1x(), props2.className]
|
1695 | }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), [[vue.vShow, props2.show]]);
|
1696 | });
|
1697 | useEventListener("touchmove", onTouchMove, {
|
1698 | target: root
|
1699 | });
|
1700 | return () => vue.createVNode(vue.Transition, {
|
1701 | "name": "van-fade",
|
1702 | "appear": true
|
1703 | }, {
|
1704 | default: renderOverlay
|
1705 | });
|
1706 | }
|
1707 | });
|
1708 | const Overlay = withInstall(stdin_default$1L);
|
1709 | const popupProps$2 = extend({}, popupSharedProps, {
|
1710 | round: Boolean,
|
1711 | position: makeStringProp("center"),
|
1712 | closeIcon: makeStringProp("cross"),
|
1713 | closeable: Boolean,
|
1714 | transition: String,
|
1715 | iconPrefix: String,
|
1716 | closeOnPopstate: Boolean,
|
1717 | closeIconPosition: makeStringProp("top-right"),
|
1718 | safeAreaInsetTop: Boolean,
|
1719 | safeAreaInsetBottom: Boolean
|
1720 | });
|
1721 | const [name$1B, bem$1w] = createNamespace("popup");
|
1722 | var stdin_default$1K = vue.defineComponent({
|
1723 | name: name$1B,
|
1724 | inheritAttrs: false,
|
1725 | props: popupProps$2,
|
1726 | emits: ["open", "close", "opened", "closed", "keydown", "update:show", "clickOverlay", "clickCloseIcon"],
|
1727 | setup(props2, {
|
1728 | emit,
|
1729 | attrs,
|
1730 | slots
|
1731 | }) {
|
1732 | let opened;
|
1733 | let shouldReopen;
|
1734 | const zIndex = vue.ref();
|
1735 | const popupRef = vue.ref();
|
1736 | const lazyRender = useLazyRender(() => props2.show || !props2.lazyRender);
|
1737 | const style = vue.computed(() => {
|
1738 | const style2 = {
|
1739 | zIndex: zIndex.value
|
1740 | };
|
1741 | if (isDef(props2.duration)) {
|
1742 | const key = props2.position === "center" ? "animationDuration" : "transitionDuration";
|
1743 | style2[key] = `${props2.duration}s`;
|
1744 | }
|
1745 | return style2;
|
1746 | });
|
1747 | const open = () => {
|
1748 | if (!opened) {
|
1749 | opened = true;
|
1750 | zIndex.value = props2.zIndex !== void 0 ? +props2.zIndex : useGlobalZIndex();
|
1751 | emit("open");
|
1752 | }
|
1753 | };
|
1754 | const close = () => {
|
1755 | if (opened) {
|
1756 | callInterceptor(props2.beforeClose, {
|
1757 | done() {
|
1758 | opened = false;
|
1759 | emit("close");
|
1760 | emit("update:show", false);
|
1761 | }
|
1762 | });
|
1763 | }
|
1764 | };
|
1765 | const onClickOverlay = (event) => {
|
1766 | emit("clickOverlay", event);
|
1767 | if (props2.closeOnClickOverlay) {
|
1768 | close();
|
1769 | }
|
1770 | };
|
1771 | const renderOverlay = () => {
|
1772 | if (props2.overlay) {
|
1773 | return vue.createVNode(Overlay, vue.mergeProps({
|
1774 | "show": props2.show,
|
1775 | "class": props2.overlayClass,
|
1776 | "zIndex": zIndex.value,
|
1777 | "duration": props2.duration,
|
1778 | "customStyle": props2.overlayStyle,
|
1779 | "role": props2.closeOnClickOverlay ? "button" : void 0,
|
1780 | "tabindex": props2.closeOnClickOverlay ? 0 : void 0
|
1781 | }, useScopeId(), {
|
1782 | "onClick": onClickOverlay
|
1783 | }), {
|
1784 | default: slots["overlay-content"]
|
1785 | });
|
1786 | }
|
1787 | };
|
1788 | const onClickCloseIcon = (event) => {
|
1789 | emit("clickCloseIcon", event);
|
1790 | close();
|
1791 | };
|
1792 | const renderCloseIcon = () => {
|
1793 | if (props2.closeable) {
|
1794 | return vue.createVNode(Icon, {
|
1795 | "role": "button",
|
1796 | "tabindex": 0,
|
1797 | "name": props2.closeIcon,
|
1798 | "class": [bem$1w("close-icon", props2.closeIconPosition), HAPTICS_FEEDBACK],
|
1799 | "classPrefix": props2.iconPrefix,
|
1800 | "onClick": onClickCloseIcon
|
1801 | }, null);
|
1802 | }
|
1803 | };
|
1804 | let timer2;
|
1805 | const onOpened = () => {
|
1806 | if (timer2)
|
1807 | clearTimeout(timer2);
|
1808 | timer2 = setTimeout(() => {
|
1809 | emit("opened");
|
1810 | });
|
1811 | };
|
1812 | const onClosed = () => emit("closed");
|
1813 | const onKeydown = (event) => emit("keydown", event);
|
1814 | const renderPopup = lazyRender(() => {
|
1815 | var _a;
|
1816 | const {
|
1817 | round: round2,
|
1818 | position,
|
1819 | safeAreaInsetTop,
|
1820 | safeAreaInsetBottom
|
1821 | } = props2;
|
1822 | return vue.withDirectives(vue.createVNode("div", vue.mergeProps({
|
1823 | "ref": popupRef,
|
1824 | "style": style.value,
|
1825 | "role": "dialog",
|
1826 | "tabindex": 0,
|
1827 | "class": [bem$1w({
|
1828 | round: round2,
|
1829 | [position]: position
|
1830 | }), {
|
1831 | "van-safe-area-top": safeAreaInsetTop,
|
1832 | "van-safe-area-bottom": safeAreaInsetBottom
|
1833 | }],
|
1834 | "onKeydown": onKeydown
|
1835 | }, attrs, useScopeId()), [(_a = slots.default) == null ? void 0 : _a.call(slots), renderCloseIcon()]), [[vue.vShow, props2.show]]);
|
1836 | });
|
1837 | const renderTransition = () => {
|
1838 | const {
|
1839 | position,
|
1840 | transition,
|
1841 | transitionAppear
|
1842 | } = props2;
|
1843 | const name2 = position === "center" ? "van-fade" : `van-popup-slide-${position}`;
|
1844 | return vue.createVNode(vue.Transition, {
|
1845 | "name": transition || name2,
|
1846 | "appear": transitionAppear,
|
1847 | "onAfterEnter": onOpened,
|
1848 | "onAfterLeave": onClosed
|
1849 | }, {
|
1850 | default: renderPopup
|
1851 | });
|
1852 | };
|
1853 | vue.watch(() => props2.show, (show) => {
|
1854 | if (show && !opened) {
|
1855 | open();
|
1856 | if (attrs.tabindex === 0) {
|
1857 | vue.nextTick(() => {
|
1858 | var _a;
|
1859 | (_a = popupRef.value) == null ? void 0 : _a.focus();
|
1860 | });
|
1861 | }
|
1862 | }
|
1863 | if (!show && opened) {
|
1864 | opened = false;
|
1865 | emit("close");
|
1866 | }
|
1867 | });
|
1868 | useExpose({
|
1869 | popupRef
|
1870 | });
|
1871 | useLockScroll(popupRef, () => props2.show && props2.lockScroll);
|
1872 | useEventListener("popstate", () => {
|
1873 | if (props2.closeOnPopstate) {
|
1874 | close();
|
1875 | shouldReopen = false;
|
1876 | }
|
1877 | });
|
1878 | vue.onMounted(() => {
|
1879 | if (props2.show) {
|
1880 | open();
|
1881 | }
|
1882 | });
|
1883 | vue.onActivated(() => {
|
1884 | if (shouldReopen) {
|
1885 | emit("update:show", true);
|
1886 | shouldReopen = false;
|
1887 | }
|
1888 | });
|
1889 | vue.onDeactivated(() => {
|
1890 | if (props2.show && props2.teleport) {
|
1891 | close();
|
1892 | shouldReopen = true;
|
1893 | }
|
1894 | });
|
1895 | vue.provide(POPUP_TOGGLE_KEY, () => props2.show);
|
1896 | return () => {
|
1897 | if (props2.teleport) {
|
1898 | return vue.createVNode(vue.Teleport, {
|
1899 | "to": props2.teleport
|
1900 | }, {
|
1901 | default: () => [renderOverlay(), renderTransition()]
|
1902 | });
|
1903 | }
|
1904 | return vue.createVNode(vue.Fragment, null, [renderOverlay(), renderTransition()]);
|
1905 | };
|
1906 | }
|
1907 | });
|
1908 | const Popup = withInstall(stdin_default$1K);
|
1909 | const [name$1A, bem$1v] = createNamespace("action-sheet");
|
1910 | const actionSheetProps = extend({}, popupSharedProps, {
|
1911 | title: String,
|
1912 | round: truthProp,
|
1913 | actions: makeArrayProp(),
|
1914 | closeIcon: makeStringProp("cross"),
|
1915 | closeable: truthProp,
|
1916 | cancelText: String,
|
1917 | description: String,
|
1918 | closeOnPopstate: truthProp,
|
1919 | closeOnClickAction: Boolean,
|
1920 | safeAreaInsetBottom: truthProp
|
1921 | });
|
1922 | const popupInheritKeys$2 = [...popupSharedPropKeys, "round", "closeOnPopstate", "safeAreaInsetBottom"];
|
1923 | var stdin_default$1J = vue.defineComponent({
|
1924 | name: name$1A,
|
1925 | props: actionSheetProps,
|
1926 | emits: ["select", "cancel", "update:show"],
|
1927 | setup(props2, {
|
1928 | slots,
|
1929 | emit
|
1930 | }) {
|
1931 | const updateShow = (show) => emit("update:show", show);
|
1932 | const onCancel = () => {
|
1933 | updateShow(false);
|
1934 | emit("cancel");
|
1935 | };
|
1936 | const renderHeader = () => {
|
1937 | if (props2.title) {
|
1938 | return vue.createVNode("div", {
|
1939 | "class": bem$1v("header")
|
1940 | }, [props2.title, props2.closeable && vue.createVNode(Icon, {
|
1941 | "name": props2.closeIcon,
|
1942 | "class": [bem$1v("close"), HAPTICS_FEEDBACK],
|
1943 | "onClick": onCancel
|
1944 | }, null)]);
|
1945 | }
|
1946 | };
|
1947 | const renderCancel = () => {
|
1948 | if (slots.cancel || props2.cancelText) {
|
1949 | return [vue.createVNode("div", {
|
1950 | "class": bem$1v("gap")
|
1951 | }, null), vue.createVNode("button", {
|
1952 | "type": "button",
|
1953 | "class": bem$1v("cancel"),
|
1954 | "onClick": onCancel
|
1955 | }, [slots.cancel ? slots.cancel() : props2.cancelText])];
|
1956 | }
|
1957 | };
|
1958 | const renderIcon = (action) => {
|
1959 | if (action.icon) {
|
1960 | return vue.createVNode(Icon, {
|
1961 | "class": bem$1v("item-icon"),
|
1962 | "name": action.icon
|
1963 | }, null);
|
1964 | }
|
1965 | };
|
1966 | const renderActionContent = (action, index) => {
|
1967 | if (action.loading) {
|
1968 | return vue.createVNode(Loading, {
|
1969 | "class": bem$1v("loading-icon")
|
1970 | }, null);
|
1971 | }
|
1972 | if (slots.action) {
|
1973 | return slots.action({
|
1974 | action,
|
1975 | index
|
1976 | });
|
1977 | }
|
1978 | return [vue.createVNode("span", {
|
1979 | "class": bem$1v("name")
|
1980 | }, [action.name]), action.subname && vue.createVNode("div", {
|
1981 | "class": bem$1v("subname")
|
1982 | }, [action.subname])];
|
1983 | };
|
1984 | const renderAction = (action, index) => {
|
1985 | const {
|
1986 | color,
|
1987 | loading,
|
1988 | callback,
|
1989 | disabled,
|
1990 | className
|
1991 | } = action;
|
1992 | const onClick = () => {
|
1993 | if (disabled || loading) {
|
1994 | return;
|
1995 | }
|
1996 | if (callback) {
|
1997 | callback(action);
|
1998 | }
|
1999 | if (props2.closeOnClickAction) {
|
2000 | updateShow(false);
|
2001 | }
|
2002 | vue.nextTick(() => emit("select", action, index));
|
2003 | };
|
2004 | return vue.createVNode("button", {
|
2005 | "type": "button",
|
2006 | "style": {
|
2007 | color
|
2008 | },
|
2009 | "class": [bem$1v("item", {
|
2010 | loading,
|
2011 | disabled
|
2012 | }), className],
|
2013 | "onClick": onClick
|
2014 | }, [renderIcon(action), renderActionContent(action, index)]);
|
2015 | };
|
2016 | const renderDescription = () => {
|
2017 | if (props2.description || slots.description) {
|
2018 | const content = slots.description ? slots.description() : props2.description;
|
2019 | return vue.createVNode("div", {
|
2020 | "class": bem$1v("description")
|
2021 | }, [content]);
|
2022 | }
|
2023 | };
|
2024 | return () => vue.createVNode(Popup, vue.mergeProps({
|
2025 | "class": bem$1v(),
|
2026 | "position": "bottom",
|
2027 | "onUpdate:show": updateShow
|
2028 | }, pick(props2, popupInheritKeys$2)), {
|
2029 | default: () => {
|
2030 | var _a;
|
2031 | return [renderHeader(), renderDescription(), vue.createVNode("div", {
|
2032 | "class": bem$1v("content")
|
2033 | }, [props2.actions.map(renderAction), (_a = slots.default) == null ? void 0 : _a.call(slots)]), renderCancel()];
|
2034 | }
|
2035 | });
|
2036 | }
|
2037 | });
|
2038 | const ActionSheet = withInstall(stdin_default$1J);
|
2039 | const [name$1z, bem$1u, t$k] = createNamespace("picker");
|
2040 | const getFirstEnabledOption = (options) => options.find((option) => !option.disabled) || options[0];
|
2041 | function getColumnsType(columns, fields) {
|
2042 | const firstColumn = columns[0];
|
2043 | if (firstColumn) {
|
2044 | if (Array.isArray(firstColumn)) {
|
2045 | return "multiple";
|
2046 | }
|
2047 | if (fields.children in firstColumn) {
|
2048 | return "cascade";
|
2049 | }
|
2050 | }
|
2051 | return "default";
|
2052 | }
|
2053 | function findIndexOfEnabledOption(options, index) {
|
2054 | index = clamp(index, 0, options.length);
|
2055 | for (let i = index; i < options.length; i++) {
|
2056 | if (!options[i].disabled)
|
2057 | return i;
|
2058 | }
|
2059 | for (let i = index - 1; i >= 0; i--) {
|
2060 | if (!options[i].disabled)
|
2061 | return i;
|
2062 | }
|
2063 | return 0;
|
2064 | }
|
2065 | const isOptionExist = (options, value, fields) => value !== void 0 && !!options.find((option) => option[fields.value] === value);
|
2066 | function findOptionByValue(options, value, fields) {
|
2067 | const index = options.findIndex((option) => option[fields.value] === value);
|
2068 | const enabledIndex = findIndexOfEnabledOption(options, index);
|
2069 | return options[enabledIndex];
|
2070 | }
|
2071 | function formatCascadeColumns(columns, fields, selectedValues) {
|
2072 | const formatted = [];
|
2073 | let cursor = {
|
2074 | [fields.children]: columns
|
2075 | };
|
2076 | let columnIndex = 0;
|
2077 | while (cursor && cursor[fields.children]) {
|
2078 | const options = cursor[fields.children];
|
2079 | const value = selectedValues.value[columnIndex];
|
2080 | cursor = isDef(value) ? findOptionByValue(options, value, fields) : void 0;
|
2081 | if (!cursor && options.length) {
|
2082 | const firstValue = getFirstEnabledOption(options)[fields.value];
|
2083 | cursor = findOptionByValue(options, firstValue, fields);
|
2084 | }
|
2085 | columnIndex++;
|
2086 | formatted.push(options);
|
2087 | }
|
2088 | return formatted;
|
2089 | }
|
2090 | function getElementTranslateY(element) {
|
2091 | const { transform } = window.getComputedStyle(element);
|
2092 | const translateY = transform.slice(7, transform.length - 1).split(", ")[5];
|
2093 | return Number(translateY);
|
2094 | }
|
2095 | function assignDefaultFields(fields) {
|
2096 | return extend(
|
2097 | {
|
2098 | text: "text",
|
2099 | value: "value",
|
2100 | children: "children"
|
2101 | },
|
2102 | fields
|
2103 | );
|
2104 | }
|
2105 | const DEFAULT_DURATION = 200;
|
2106 | const MOMENTUM_TIME = 300;
|
2107 | const MOMENTUM_DISTANCE = 15;
|
2108 | const [name$1y, bem$1t] = createNamespace("picker-column");
|
2109 | const PICKER_KEY = Symbol(name$1y);
|
2110 | var stdin_default$1I = vue.defineComponent({
|
2111 | name: name$1y,
|
2112 | props: {
|
2113 | value: numericProp,
|
2114 | fields: makeRequiredProp(Object),
|
2115 | options: makeArrayProp(),
|
2116 | readonly: Boolean,
|
2117 | allowHtml: Boolean,
|
2118 | optionHeight: makeRequiredProp(Number),
|
2119 | swipeDuration: makeRequiredProp(numericProp),
|
2120 | visibleOptionNum: makeRequiredProp(numericProp)
|
2121 | },
|
2122 | emits: ["change", "clickOption", "scrollInto"],
|
2123 | setup(props2, {
|
2124 | emit,
|
2125 | slots
|
2126 | }) {
|
2127 | let moving;
|
2128 | let startOffset;
|
2129 | let touchStartTime;
|
2130 | let momentumOffset;
|
2131 | let transitionEndTrigger;
|
2132 | const root = vue.ref();
|
2133 | const wrapper = vue.ref();
|
2134 | const currentOffset = vue.ref(0);
|
2135 | const currentDuration = vue.ref(0);
|
2136 | const touch = useTouch();
|
2137 | const count = () => props2.options.length;
|
2138 | const baseOffset = () => props2.optionHeight * (+props2.visibleOptionNum - 1) / 2;
|
2139 | const updateValueByIndex = (index) => {
|
2140 | let enabledIndex = findIndexOfEnabledOption(props2.options, index);
|
2141 | const offset2 = -enabledIndex * props2.optionHeight;
|
2142 | const trigger = () => {
|
2143 | if (enabledIndex > count() - 1) {
|
2144 | enabledIndex = findIndexOfEnabledOption(props2.options, index);
|
2145 | }
|
2146 | const value = props2.options[enabledIndex][props2.fields.value];
|
2147 | if (value !== props2.value) {
|
2148 | emit("change", value);
|
2149 | }
|
2150 | };
|
2151 | if (moving && offset2 !== currentOffset.value) {
|
2152 | transitionEndTrigger = trigger;
|
2153 | } else {
|
2154 | trigger();
|
2155 | }
|
2156 | currentOffset.value = offset2;
|
2157 | };
|
2158 | const isReadonly = () => props2.readonly || !props2.options.length;
|
2159 | const onClickOption = (index) => {
|
2160 | if (moving || isReadonly()) {
|
2161 | return;
|
2162 | }
|
2163 | transitionEndTrigger = null;
|
2164 | currentDuration.value = DEFAULT_DURATION;
|
2165 | updateValueByIndex(index);
|
2166 | emit("clickOption", props2.options[index]);
|
2167 | };
|
2168 | const getIndexByOffset = (offset2) => clamp(Math.round(-offset2 / props2.optionHeight), 0, count() - 1);
|
2169 | const currentIndex = vue.computed(() => getIndexByOffset(currentOffset.value));
|
2170 | const momentum = (distance, duration) => {
|
2171 | const speed = Math.abs(distance / duration);
|
2172 | distance = currentOffset.value + speed / 3e-3 * (distance < 0 ? -1 : 1);
|
2173 | const index = getIndexByOffset(distance);
|
2174 | currentDuration.value = +props2.swipeDuration;
|
2175 | updateValueByIndex(index);
|
2176 | };
|
2177 | const stopMomentum = () => {
|
2178 | moving = false;
|
2179 | currentDuration.value = 0;
|
2180 | if (transitionEndTrigger) {
|
2181 | transitionEndTrigger();
|
2182 | transitionEndTrigger = null;
|
2183 | }
|
2184 | };
|
2185 | const onTouchStart = (event) => {
|
2186 | if (isReadonly()) {
|
2187 | return;
|
2188 | }
|
2189 | touch.start(event);
|
2190 | if (moving) {
|
2191 | const translateY = getElementTranslateY(wrapper.value);
|
2192 | currentOffset.value = Math.min(0, translateY - baseOffset());
|
2193 | }
|
2194 | currentDuration.value = 0;
|
2195 | startOffset = currentOffset.value;
|
2196 | touchStartTime = Date.now();
|
2197 | momentumOffset = startOffset;
|
2198 | transitionEndTrigger = null;
|
2199 | };
|
2200 | const onTouchMove = (event) => {
|
2201 | if (isReadonly()) {
|
2202 | return;
|
2203 | }
|
2204 | touch.move(event);
|
2205 | if (touch.isVertical()) {
|
2206 | moving = true;
|
2207 | preventDefault(event, true);
|
2208 | }
|
2209 | const newOffset = clamp(startOffset + touch.deltaY.value, -(count() * props2.optionHeight), props2.optionHeight);
|
2210 | const newIndex = getIndexByOffset(newOffset);
|
2211 | if (newIndex !== currentIndex.value) {
|
2212 | emit("scrollInto", props2.options[newIndex]);
|
2213 | }
|
2214 | currentOffset.value = newOffset;
|
2215 | const now = Date.now();
|
2216 | if (now - touchStartTime > MOMENTUM_TIME) {
|
2217 | touchStartTime = now;
|
2218 | momentumOffset = newOffset;
|
2219 | }
|
2220 | };
|
2221 | const onTouchEnd = () => {
|
2222 | if (isReadonly()) {
|
2223 | return;
|
2224 | }
|
2225 | const distance = currentOffset.value - momentumOffset;
|
2226 | const duration = Date.now() - touchStartTime;
|
2227 | const startMomentum = duration < MOMENTUM_TIME && Math.abs(distance) > MOMENTUM_DISTANCE;
|
2228 | if (startMomentum) {
|
2229 | momentum(distance, duration);
|
2230 | return;
|
2231 | }
|
2232 | const index = getIndexByOffset(currentOffset.value);
|
2233 | currentDuration.value = DEFAULT_DURATION;
|
2234 | updateValueByIndex(index);
|
2235 | setTimeout(() => {
|
2236 | moving = false;
|
2237 | }, 0);
|
2238 | };
|
2239 | const renderOptions = () => {
|
2240 | const optionStyle = {
|
2241 | height: `${props2.optionHeight}px`
|
2242 | };
|
2243 | return props2.options.map((option, index) => {
|
2244 | const text = option[props2.fields.text];
|
2245 | const {
|
2246 | disabled
|
2247 | } = option;
|
2248 | const value = option[props2.fields.value];
|
2249 | const data = {
|
2250 | role: "button",
|
2251 | style: optionStyle,
|
2252 | tabindex: disabled ? -1 : 0,
|
2253 | class: [bem$1t("item", {
|
2254 | disabled,
|
2255 | selected: value === props2.value
|
2256 | }), option.className],
|
2257 | onClick: () => onClickOption(index)
|
2258 | };
|
2259 | const childData = {
|
2260 | class: "van-ellipsis",
|
2261 | [props2.allowHtml ? "innerHTML" : "textContent"]: text
|
2262 | };
|
2263 | return vue.createVNode("li", data, [slots.option ? slots.option(option, index) : vue.createVNode("div", childData, null)]);
|
2264 | });
|
2265 | };
|
2266 | useParent(PICKER_KEY);
|
2267 | useExpose({
|
2268 | stopMomentum
|
2269 | });
|
2270 | vue.watchEffect(() => {
|
2271 | const index = moving ? Math.floor(-currentOffset.value / props2.optionHeight) : props2.options.findIndex((option) => option[props2.fields.value] === props2.value);
|
2272 | const enabledIndex = findIndexOfEnabledOption(props2.options, index);
|
2273 | const offset2 = -enabledIndex * props2.optionHeight;
|
2274 | if (moving && enabledIndex < index)
|
2275 | stopMomentum();
|
2276 | currentOffset.value = offset2;
|
2277 | });
|
2278 | useEventListener("touchmove", onTouchMove, {
|
2279 | target: root
|
2280 | });
|
2281 | return () => vue.createVNode("div", {
|
2282 | "ref": root,
|
2283 | "class": bem$1t(),
|
2284 | "onTouchstartPassive": onTouchStart,
|
2285 | "onTouchend": onTouchEnd,
|
2286 | "onTouchcancel": onTouchEnd
|
2287 | }, [vue.createVNode("ul", {
|
2288 | "ref": wrapper,
|
2289 | "style": {
|
2290 | transform: `translate3d(0, ${currentOffset.value + baseOffset()}px, 0)`,
|
2291 | transitionDuration: `${currentDuration.value}ms`,
|
2292 | transitionProperty: currentDuration.value ? "all" : "none"
|
2293 | },
|
2294 | "class": bem$1t("wrapper"),
|
2295 | "onTransitionend": stopMomentum
|
2296 | }, [renderOptions()])]);
|
2297 | }
|
2298 | });
|
2299 | const [name$1x] = createNamespace("picker-toolbar");
|
2300 | const pickerToolbarProps = {
|
2301 | title: String,
|
2302 | cancelButtonText: String,
|
2303 | confirmButtonText: String
|
2304 | };
|
2305 | const pickerToolbarSlots = ["cancel", "confirm", "title", "toolbar"];
|
2306 | const pickerToolbarPropKeys = Object.keys(pickerToolbarProps);
|
2307 | var stdin_default$1H = vue.defineComponent({
|
2308 | name: name$1x,
|
2309 | props: pickerToolbarProps,
|
2310 | emits: ["confirm", "cancel"],
|
2311 | setup(props2, {
|
2312 | emit,
|
2313 | slots
|
2314 | }) {
|
2315 | const renderTitle = () => {
|
2316 | if (slots.title) {
|
2317 | return slots.title();
|
2318 | }
|
2319 | if (props2.title) {
|
2320 | return vue.createVNode("div", {
|
2321 | "class": [bem$1u("title"), "van-ellipsis"]
|
2322 | }, [props2.title]);
|
2323 | }
|
2324 | };
|
2325 | const onCancel = () => emit("cancel");
|
2326 | const onConfirm = () => emit("confirm");
|
2327 | const renderCancel = () => {
|
2328 | var _a;
|
2329 | const text = (_a = props2.cancelButtonText) != null ? _a : t$k("cancel");
|
2330 | if (!slots.cancel && !text) {
|
2331 | return;
|
2332 | }
|
2333 | return vue.createVNode("button", {
|
2334 | "type": "button",
|
2335 | "class": [bem$1u("cancel"), HAPTICS_FEEDBACK],
|
2336 | "onClick": onCancel
|
2337 | }, [slots.cancel ? slots.cancel() : text]);
|
2338 | };
|
2339 | const renderConfirm = () => {
|
2340 | var _a;
|
2341 | const text = (_a = props2.confirmButtonText) != null ? _a : t$k("confirm");
|
2342 | if (!slots.confirm && !text) {
|
2343 | return;
|
2344 | }
|
2345 | return vue.createVNode("button", {
|
2346 | "type": "button",
|
2347 | "class": [bem$1u("confirm"), HAPTICS_FEEDBACK],
|
2348 | "onClick": onConfirm
|
2349 | }, [slots.confirm ? slots.confirm() : text]);
|
2350 | };
|
2351 | return () => vue.createVNode("div", {
|
2352 | "class": bem$1u("toolbar")
|
2353 | }, [slots.toolbar ? slots.toolbar() : [renderCancel(), renderTitle(), renderConfirm()]]);
|
2354 | }
|
2355 | });
|
2356 | const useSyncPropRef = (getProp, setProp) => {
|
2357 | const propRef = vue.ref(getProp());
|
2358 | vue.watch(getProp, (value) => {
|
2359 | if (value !== propRef.value) {
|
2360 | propRef.value = value;
|
2361 | }
|
2362 | });
|
2363 | vue.watch(propRef, (value) => {
|
2364 | if (value !== getProp()) {
|
2365 | setProp(value);
|
2366 | }
|
2367 | });
|
2368 | return propRef;
|
2369 | };
|
2370 | |
2371 |
|
2372 |
|
2373 |
|
2374 |
|
2375 | const isArray = Array.isArray;
|
2376 | const isString = (val) => typeof val === "string";
|
2377 | const isObject = (val) => val !== null && typeof val === "object";
|
2378 | const cacheStringFunction = (fn) => {
|
2379 | const cache = Object.create(null);
|
2380 | return (str) => {
|
2381 | const hit = cache[str];
|
2382 | return hit || (cache[str] = fn(str));
|
2383 | };
|
2384 | };
|
2385 | const hyphenateRE = /\B([A-Z])/g;
|
2386 | const hyphenate = cacheStringFunction(
|
2387 | (str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
2388 | );
|
2389 | function normalizeStyle(value) {
|
2390 | if (isArray(value)) {
|
2391 | const res = {};
|
2392 | for (let i = 0; i < value.length; i++) {
|
2393 | const item = value[i];
|
2394 | const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
|
2395 | if (normalized) {
|
2396 | for (const key in normalized) {
|
2397 | res[key] = normalized[key];
|
2398 | }
|
2399 | }
|
2400 | }
|
2401 | return res;
|
2402 | } else if (isString(value) || isObject(value)) {
|
2403 | return value;
|
2404 | }
|
2405 | }
|
2406 | const listDelimiterRE = /;(?![^(]*\))/g;
|
2407 | const propertyDelimiterRE = /:([^]+)/;
|
2408 | const styleCommentRE = /\/\*[^]*?\*\//g;
|
2409 | function parseStringStyle(cssText) {
|
2410 | const ret = {};
|
2411 | cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
|
2412 | if (item) {
|
2413 | const tmp = item.split(propertyDelimiterRE);
|
2414 | tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
2415 | }
|
2416 | });
|
2417 | return ret;
|
2418 | }
|
2419 | function stringifyStyle(styles) {
|
2420 | let ret = "";
|
2421 | if (!styles || isString(styles)) {
|
2422 | return ret;
|
2423 | }
|
2424 | for (const key in styles) {
|
2425 | const value = styles[key];
|
2426 | const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
2427 | if (isString(value) || typeof value === "number") {
|
2428 | ret += `${normalizedKey}:${value};`;
|
2429 | }
|
2430 | }
|
2431 | return ret;
|
2432 | }
|
2433 | function normalizeClass(value) {
|
2434 | let res = "";
|
2435 | if (isString(value)) {
|
2436 | res = value;
|
2437 | } else if (isArray(value)) {
|
2438 | for (let i = 0; i < value.length; i++) {
|
2439 | const normalized = normalizeClass(value[i]);
|
2440 | if (normalized) {
|
2441 | res += normalized + " ";
|
2442 | }
|
2443 | }
|
2444 | } else if (isObject(value)) {
|
2445 | for (const name2 in value) {
|
2446 | if (value[name2]) {
|
2447 | res += name2 + " ";
|
2448 | }
|
2449 | }
|
2450 | }
|
2451 | return res.trim();
|
2452 | }
|
2453 | function scrollLeftTo(scroller, to, duration) {
|
2454 | let rafId;
|
2455 | let count = 0;
|
2456 | const from = scroller.scrollLeft;
|
2457 | const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
|
2458 | function cancel() {
|
2459 | cancelRaf(rafId);
|
2460 | }
|
2461 | function animate() {
|
2462 | scroller.scrollLeft += (to - from) / frames;
|
2463 | if (++count < frames) {
|
2464 | rafId = raf(animate);
|
2465 | }
|
2466 | }
|
2467 | animate();
|
2468 | return cancel;
|
2469 | }
|
2470 | function scrollTopTo(scroller, to, duration, callback) {
|
2471 | let rafId;
|
2472 | let current2 = getScrollTop(scroller);
|
2473 | const isDown = current2 < to;
|
2474 | const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
|
2475 | const step = (to - current2) / frames;
|
2476 | function cancel() {
|
2477 | cancelRaf(rafId);
|
2478 | }
|
2479 | function animate() {
|
2480 | current2 += step;
|
2481 | if (isDown && current2 > to || !isDown && current2 < to) {
|
2482 | current2 = to;
|
2483 | }
|
2484 | setScrollTop(scroller, current2);
|
2485 | if (isDown && current2 < to || !isDown && current2 > to) {
|
2486 | rafId = raf(animate);
|
2487 | } else if (callback) {
|
2488 | rafId = raf(callback);
|
2489 | }
|
2490 | }
|
2491 | animate();
|
2492 | return cancel;
|
2493 | }
|
2494 | let current = 0;
|
2495 | function useId() {
|
2496 | const vm = vue.getCurrentInstance();
|
2497 | const { name: name2 = "unknown" } = (vm == null ? void 0 : vm.type) || {};
|
2498 | return `${name2}-${++current}`;
|
2499 | }
|
2500 | function useRefs() {
|
2501 | const refs = vue.ref([]);
|
2502 | const cache = [];
|
2503 | vue.onBeforeUpdate(() => {
|
2504 | refs.value = [];
|
2505 | });
|
2506 | const setRefs = (index) => {
|
2507 | if (!cache[index]) {
|
2508 | cache[index] = (el) => {
|
2509 | refs.value[index] = el;
|
2510 | };
|
2511 | }
|
2512 | return cache[index];
|
2513 | };
|
2514 | return [refs, setRefs];
|
2515 | }
|
2516 | function useVisibilityChange(target, onChange) {
|
2517 | if (!inBrowser$1 || !window.IntersectionObserver) {
|
2518 | return;
|
2519 | }
|
2520 | const observer = new IntersectionObserver(
|
2521 | (entries) => {
|
2522 | onChange(entries[0].intersectionRatio > 0);
|
2523 | },
|
2524 | { root: document.body }
|
2525 | );
|
2526 | const observe = () => {
|
2527 | if (target.value) {
|
2528 | observer.observe(target.value);
|
2529 | }
|
2530 | };
|
2531 | const unobserve = () => {
|
2532 | if (target.value) {
|
2533 | observer.unobserve(target.value);
|
2534 | }
|
2535 | };
|
2536 | vue.onDeactivated(unobserve);
|
2537 | vue.onBeforeUnmount(unobserve);
|
2538 | onMountedOrActivated(observe);
|
2539 | }
|
2540 | const [name$1w, bem$1s] = createNamespace("sticky");
|
2541 | const stickyProps = {
|
2542 | zIndex: numericProp,
|
2543 | position: makeStringProp("top"),
|
2544 | container: Object,
|
2545 | offsetTop: makeNumericProp(0),
|
2546 | offsetBottom: makeNumericProp(0)
|
2547 | };
|
2548 | var stdin_default$1G = vue.defineComponent({
|
2549 | name: name$1w,
|
2550 | props: stickyProps,
|
2551 | emits: ["scroll", "change"],
|
2552 | setup(props2, {
|
2553 | emit,
|
2554 | slots
|
2555 | }) {
|
2556 | const root = vue.ref();
|
2557 | const scrollParent = useScrollParent(root);
|
2558 | const state = vue.reactive({
|
2559 | fixed: false,
|
2560 | width: 0,
|
2561 |
|
2562 | height: 0,
|
2563 |
|
2564 | transform: 0
|
2565 | });
|
2566 | const isReset = vue.ref(false);
|
2567 | const offset2 = vue.computed(() => unitToPx(props2.position === "top" ? props2.offsetTop : props2.offsetBottom));
|
2568 | const rootStyle = vue.computed(() => {
|
2569 | if (isReset.value) {
|
2570 | return;
|
2571 | }
|
2572 | const {
|
2573 | fixed,
|
2574 | height: height2,
|
2575 | width: width2
|
2576 | } = state;
|
2577 | if (fixed) {
|
2578 | return {
|
2579 | width: `${width2}px`,
|
2580 | height: `${height2}px`
|
2581 | };
|
2582 | }
|
2583 | });
|
2584 | const stickyStyle = vue.computed(() => {
|
2585 | if (!state.fixed || isReset.value) {
|
2586 | return;
|
2587 | }
|
2588 | const style = extend(getZIndexStyle(props2.zIndex), {
|
2589 | width: `${state.width}px`,
|
2590 | height: `${state.height}px`,
|
2591 | [props2.position]: `${offset2.value}px`
|
2592 | });
|
2593 | if (state.transform) {
|
2594 | style.transform = `translate3d(0, ${state.transform}px, 0)`;
|
2595 | }
|
2596 | return style;
|
2597 | });
|
2598 | const emitScroll = (scrollTop) => emit("scroll", {
|
2599 | scrollTop,
|
2600 | isFixed: state.fixed
|
2601 | });
|
2602 | const onScroll = () => {
|
2603 | if (!root.value || isHidden(root)) {
|
2604 | return;
|
2605 | }
|
2606 | const {
|
2607 | container,
|
2608 | position
|
2609 | } = props2;
|
2610 | const rootRect = useRect(root);
|
2611 | const scrollTop = getScrollTop(window);
|
2612 | state.width = rootRect.width;
|
2613 | state.height = rootRect.height;
|
2614 | if (position === "top") {
|
2615 | if (container) {
|
2616 | const containerRect = useRect(container);
|
2617 | const difference = containerRect.bottom - offset2.value - state.height;
|
2618 | state.fixed = offset2.value > rootRect.top && containerRect.bottom > 0;
|
2619 | state.transform = difference < 0 ? difference : 0;
|
2620 | } else {
|
2621 | state.fixed = offset2.value > rootRect.top;
|
2622 | }
|
2623 | } else {
|
2624 | const {
|
2625 | clientHeight
|
2626 | } = document.documentElement;
|
2627 | if (container) {
|
2628 | const containerRect = useRect(container);
|
2629 | const difference = clientHeight - containerRect.top - offset2.value - state.height;
|
2630 | state.fixed = clientHeight - offset2.value < rootRect.bottom && clientHeight > containerRect.top;
|
2631 | state.transform = difference < 0 ? -difference : 0;
|
2632 | } else {
|
2633 | state.fixed = clientHeight - offset2.value < rootRect.bottom;
|
2634 | }
|
2635 | }
|
2636 | emitScroll(scrollTop);
|
2637 | };
|
2638 | vue.watch(() => state.fixed, (value) => emit("change", value));
|
2639 | useEventListener("scroll", onScroll, {
|
2640 | target: scrollParent,
|
2641 | passive: true
|
2642 | });
|
2643 | useVisibilityChange(root, onScroll);
|
2644 | vue.watch([windowWidth, windowHeight], () => {
|
2645 | if (!root.value || isHidden(root) || !state.fixed) {
|
2646 | return;
|
2647 | }
|
2648 | isReset.value = true;
|
2649 | vue.nextTick(() => {
|
2650 | const rootRect = useRect(root);
|
2651 | state.width = rootRect.width;
|
2652 | state.height = rootRect.height;
|
2653 | isReset.value = false;
|
2654 | });
|
2655 | });
|
2656 | return () => {
|
2657 | var _a;
|
2658 | return vue.createVNode("div", {
|
2659 | "ref": root,
|
2660 | "style": rootStyle.value
|
2661 | }, [vue.createVNode("div", {
|
2662 | "class": bem$1s({
|
2663 | fixed: state.fixed && !isReset.value
|
2664 | }),
|
2665 | "style": stickyStyle.value
|
2666 | }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
|
2667 | };
|
2668 | }
|
2669 | });
|
2670 | const Sticky = withInstall(stdin_default$1G);
|
2671 | const [name$1v, bem$1r] = createNamespace("swipe");
|
2672 | const swipeProps = {
|
2673 | loop: truthProp,
|
2674 | width: numericProp,
|
2675 | height: numericProp,
|
2676 | vertical: Boolean,
|
2677 | autoplay: makeNumericProp(0),
|
2678 | duration: makeNumericProp(500),
|
2679 | touchable: truthProp,
|
2680 | lazyRender: Boolean,
|
2681 | initialSwipe: makeNumericProp(0),
|
2682 | indicatorColor: String,
|
2683 | showIndicators: truthProp,
|
2684 | stopPropagation: truthProp
|
2685 | };
|
2686 | const SWIPE_KEY = Symbol(name$1v);
|
2687 | var stdin_default$1F = vue.defineComponent({
|
2688 | name: name$1v,
|
2689 | props: swipeProps,
|
2690 | emits: ["change", "dragStart", "dragEnd"],
|
2691 | setup(props2, {
|
2692 | emit,
|
2693 | slots
|
2694 | }) {
|
2695 | const root = vue.ref();
|
2696 | const track = vue.ref();
|
2697 | const state = vue.reactive({
|
2698 | rect: null,
|
2699 | width: 0,
|
2700 | height: 0,
|
2701 | offset: 0,
|
2702 | active: 0,
|
2703 | swiping: false
|
2704 | });
|
2705 | let dragging = false;
|
2706 | const touch = useTouch();
|
2707 | const {
|
2708 | children,
|
2709 | linkChildren
|
2710 | } = useChildren(SWIPE_KEY);
|
2711 | const count = vue.computed(() => children.length);
|
2712 | const size = vue.computed(() => state[props2.vertical ? "height" : "width"]);
|
2713 | const delta = vue.computed(() => props2.vertical ? touch.deltaY.value : touch.deltaX.value);
|
2714 | const minOffset = vue.computed(() => {
|
2715 | if (state.rect) {
|
2716 | const base = props2.vertical ? state.rect.height : state.rect.width;
|
2717 | return base - size.value * count.value;
|
2718 | }
|
2719 | return 0;
|
2720 | });
|
2721 | const maxCount = vue.computed(() => size.value ? Math.ceil(Math.abs(minOffset.value) / size.value) : count.value);
|
2722 | const trackSize = vue.computed(() => count.value * size.value);
|
2723 | const activeIndicator = vue.computed(() => (state.active + count.value) % count.value);
|
2724 | const isCorrectDirection = vue.computed(() => {
|
2725 | const expect = props2.vertical ? "vertical" : "horizontal";
|
2726 | return touch.direction.value === expect;
|
2727 | });
|
2728 | const trackStyle = vue.computed(() => {
|
2729 | const style = {
|
2730 | transitionDuration: `${state.swiping ? 0 : props2.duration}ms`,
|
2731 | transform: `translate${props2.vertical ? "Y" : "X"}(${+state.offset.toFixed(2)}px)`
|
2732 | };
|
2733 | if (size.value) {
|
2734 | const mainAxis = props2.vertical ? "height" : "width";
|
2735 | const crossAxis = props2.vertical ? "width" : "height";
|
2736 | style[mainAxis] = `${trackSize.value}px`;
|
2737 | style[crossAxis] = props2[crossAxis] ? `${props2[crossAxis]}px` : "";
|
2738 | }
|
2739 | return style;
|
2740 | });
|
2741 | const getTargetActive = (pace) => {
|
2742 | const {
|
2743 | active
|
2744 | } = state;
|
2745 | if (pace) {
|
2746 | if (props2.loop) {
|
2747 | return clamp(active + pace, -1, count.value);
|
2748 | }
|
2749 | return clamp(active + pace, 0, maxCount.value);
|
2750 | }
|
2751 | return active;
|
2752 | };
|
2753 | const getTargetOffset = (targetActive, offset2 = 0) => {
|
2754 | let currentPosition = targetActive * size.value;
|
2755 | if (!props2.loop) {
|
2756 | currentPosition = Math.min(currentPosition, -minOffset.value);
|
2757 | }
|
2758 | let targetOffset = offset2 - currentPosition;
|
2759 | if (!props2.loop) {
|
2760 | targetOffset = clamp(targetOffset, minOffset.value, 0);
|
2761 | }
|
2762 | return targetOffset;
|
2763 | };
|
2764 | const move = ({
|
2765 | pace = 0,
|
2766 | offset: offset2 = 0,
|
2767 | emitChange
|
2768 | }) => {
|
2769 | if (count.value <= 1) {
|
2770 | return;
|
2771 | }
|
2772 | const {
|
2773 | active
|
2774 | } = state;
|
2775 | const targetActive = getTargetActive(pace);
|
2776 | const targetOffset = getTargetOffset(targetActive, offset2);
|
2777 | if (props2.loop) {
|
2778 | if (children[0] && targetOffset !== minOffset.value) {
|
2779 | const outRightBound = targetOffset < minOffset.value;
|
2780 | children[0].setOffset(outRightBound ? trackSize.value : 0);
|
2781 | }
|
2782 | if (children[count.value - 1] && targetOffset !== 0) {
|
2783 | const outLeftBound = targetOffset > 0;
|
2784 | children[count.value - 1].setOffset(outLeftBound ? -trackSize.value : 0);
|
2785 | }
|
2786 | }
|
2787 | state.active = targetActive;
|
2788 | state.offset = targetOffset;
|
2789 | if (emitChange && targetActive !== active) {
|
2790 | emit("change", activeIndicator.value);
|
2791 | }
|
2792 | };
|
2793 | const correctPosition = () => {
|
2794 | state.swiping = true;
|
2795 | if (state.active <= -1) {
|
2796 | move({
|
2797 | pace: count.value
|
2798 | });
|
2799 | } else if (state.active >= count.value) {
|
2800 | move({
|
2801 | pace: -count.value
|
2802 | });
|
2803 | }
|
2804 | };
|
2805 | const prev = () => {
|
2806 | correctPosition();
|
2807 | touch.reset();
|
2808 | doubleRaf(() => {
|
2809 | state.swiping = false;
|
2810 | move({
|
2811 | pace: -1,
|
2812 | emitChange: true
|
2813 | });
|
2814 | });
|
2815 | };
|
2816 | const next = () => {
|
2817 | correctPosition();
|
2818 | touch.reset();
|
2819 | doubleRaf(() => {
|
2820 | state.swiping = false;
|
2821 | move({
|
2822 | pace: 1,
|
2823 | emitChange: true
|
2824 | });
|
2825 | });
|
2826 | };
|
2827 | let autoplayTimer;
|
2828 | const stopAutoplay = () => clearTimeout(autoplayTimer);
|
2829 | const autoplay = () => {
|
2830 | stopAutoplay();
|
2831 | if (+props2.autoplay > 0 && count.value > 1) {
|
2832 | autoplayTimer = setTimeout(() => {
|
2833 | next();
|
2834 | autoplay();
|
2835 | }, +props2.autoplay);
|
2836 | }
|
2837 | };
|
2838 | const initialize = (active = +props2.initialSwipe) => {
|
2839 | if (!root.value) {
|
2840 | return;
|
2841 | }
|
2842 | const cb = () => {
|
2843 | var _a, _b;
|
2844 | if (!isHidden(root)) {
|
2845 | const rect = {
|
2846 | width: root.value.offsetWidth,
|
2847 | height: root.value.offsetHeight
|
2848 | };
|
2849 | state.rect = rect;
|
2850 | state.width = +((_a = props2.width) != null ? _a : rect.width);
|
2851 | state.height = +((_b = props2.height) != null ? _b : rect.height);
|
2852 | }
|
2853 | if (count.value) {
|
2854 | active = Math.min(count.value - 1, active);
|
2855 | if (active === -1) {
|
2856 | active = count.value - 1;
|
2857 | }
|
2858 | }
|
2859 | state.active = active;
|
2860 | state.swiping = true;
|
2861 | state.offset = getTargetOffset(active);
|
2862 | children.forEach((swipe) => {
|
2863 | swipe.setOffset(0);
|
2864 | });
|
2865 | autoplay();
|
2866 | };
|
2867 | if (isHidden(root)) {
|
2868 | vue.nextTick().then(cb);
|
2869 | } else {
|
2870 | cb();
|
2871 | }
|
2872 | };
|
2873 | const resize = () => initialize(state.active);
|
2874 | let touchStartTime;
|
2875 | const onTouchStart = (event) => {
|
2876 | if (!props2.touchable ||
|
2877 | event.touches.length > 1)
|
2878 | return;
|
2879 | touch.start(event);
|
2880 | dragging = false;
|
2881 | touchStartTime = Date.now();
|
2882 | stopAutoplay();
|
2883 | correctPosition();
|
2884 | };
|
2885 | const onTouchMove = (event) => {
|
2886 | if (props2.touchable && state.swiping) {
|
2887 | touch.move(event);
|
2888 | if (isCorrectDirection.value) {
|
2889 | const isEdgeTouch = !props2.loop && (state.active === 0 && delta.value > 0 || state.active === count.value - 1 && delta.value < 0);
|
2890 | if (!isEdgeTouch) {
|
2891 | preventDefault(event, props2.stopPropagation);
|
2892 | move({
|
2893 | offset: delta.value
|
2894 | });
|
2895 | if (!dragging) {
|
2896 | emit("dragStart", {
|
2897 | index: activeIndicator.value
|
2898 | });
|
2899 | dragging = true;
|
2900 | }
|
2901 | }
|
2902 | }
|
2903 | }
|
2904 | };
|
2905 | const onTouchEnd = () => {
|
2906 | if (!props2.touchable || !state.swiping) {
|
2907 | return;
|
2908 | }
|
2909 | const duration = Date.now() - touchStartTime;
|
2910 | const speed = delta.value / duration;
|
2911 | const shouldSwipe = Math.abs(speed) > 0.25 || Math.abs(delta.value) > size.value / 2;
|
2912 | if (shouldSwipe && isCorrectDirection.value) {
|
2913 | const offset2 = props2.vertical ? touch.offsetY.value : touch.offsetX.value;
|
2914 | let pace = 0;
|
2915 | if (props2.loop) {
|
2916 | pace = offset2 > 0 ? delta.value > 0 ? -1 : 1 : 0;
|
2917 | } else {
|
2918 | pace = -Math[delta.value > 0 ? "ceil" : "floor"](delta.value / size.value);
|
2919 | }
|
2920 | move({
|
2921 | pace,
|
2922 | emitChange: true
|
2923 | });
|
2924 | } else if (delta.value) {
|
2925 | move({
|
2926 | pace: 0
|
2927 | });
|
2928 | }
|
2929 | dragging = false;
|
2930 | state.swiping = false;
|
2931 | emit("dragEnd", {
|
2932 | index: activeIndicator.value
|
2933 | });
|
2934 | autoplay();
|
2935 | };
|
2936 | const swipeTo = (index, options = {}) => {
|
2937 | correctPosition();
|
2938 | touch.reset();
|
2939 | doubleRaf(() => {
|
2940 | let targetIndex;
|
2941 | if (props2.loop && index === count.value) {
|
2942 | targetIndex = state.active === 0 ? 0 : index;
|
2943 | } else {
|
2944 | targetIndex = index % count.value;
|
2945 | }
|
2946 | if (options.immediate) {
|
2947 | doubleRaf(() => {
|
2948 | state.swiping = false;
|
2949 | });
|
2950 | } else {
|
2951 | state.swiping = false;
|
2952 | }
|
2953 | move({
|
2954 | pace: targetIndex - state.active,
|
2955 | emitChange: true
|
2956 | });
|
2957 | });
|
2958 | };
|
2959 | const renderDot = (_, index) => {
|
2960 | const active = index === activeIndicator.value;
|
2961 | const style = active ? {
|
2962 | backgroundColor: props2.indicatorColor
|
2963 | } : void 0;
|
2964 | return vue.createVNode("i", {
|
2965 | "style": style,
|
2966 | "class": bem$1r("indicator", {
|
2967 | active
|
2968 | })
|
2969 | }, null);
|
2970 | };
|
2971 | const renderIndicator = () => {
|
2972 | if (slots.indicator) {
|
2973 | return slots.indicator({
|
2974 | active: activeIndicator.value,
|
2975 | total: count.value
|
2976 | });
|
2977 | }
|
2978 | if (props2.showIndicators && count.value > 1) {
|
2979 | return vue.createVNode("div", {
|
2980 | "class": bem$1r("indicators", {
|
2981 | vertical: props2.vertical
|
2982 | })
|
2983 | }, [Array(count.value).fill("").map(renderDot)]);
|
2984 | }
|
2985 | };
|
2986 | useExpose({
|
2987 | prev,
|
2988 | next,
|
2989 | state,
|
2990 | resize,
|
2991 | swipeTo
|
2992 | });
|
2993 | linkChildren({
|
2994 | size,
|
2995 | props: props2,
|
2996 | count,
|
2997 | activeIndicator
|
2998 | });
|
2999 | vue.watch(() => props2.initialSwipe, (value) => initialize(+value));
|
3000 | vue.watch(count, () => initialize(state.active));
|
3001 | vue.watch(() => props2.autoplay, autoplay);
|
3002 | vue.watch([windowWidth, windowHeight, () => props2.width, () => props2.height], resize);
|
3003 | vue.watch(usePageVisibility(), (visible) => {
|
3004 | if (visible === "visible") {
|
3005 | autoplay();
|
3006 | } else {
|
3007 | stopAutoplay();
|
3008 | }
|
3009 | });
|
3010 | vue.onMounted(initialize);
|
3011 | vue.onActivated(() => initialize(state.active));
|
3012 | onPopupReopen(() => initialize(state.active));
|
3013 | vue.onDeactivated(stopAutoplay);
|
3014 | vue.onBeforeUnmount(stopAutoplay);
|
3015 | useEventListener("touchmove", onTouchMove, {
|
3016 | target: track
|
3017 | });
|
3018 | return () => {
|
3019 | var _a;
|
3020 | return vue.createVNode("div", {
|
3021 | "ref": root,
|
3022 | "class": bem$1r()
|
3023 | }, [vue.createVNode("div", {
|
3024 | "ref": track,
|
3025 | "style": trackStyle.value,
|
3026 | "class": bem$1r("track", {
|
3027 | vertical: props2.vertical
|
3028 | }),
|
3029 | "onTouchstartPassive": onTouchStart,
|
3030 | "onTouchend": onTouchEnd,
|
3031 | "onTouchcancel": onTouchEnd
|
3032 | }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), renderIndicator()]);
|
3033 | };
|
3034 | }
|
3035 | });
|
3036 | const Swipe = withInstall(stdin_default$1F);
|
3037 | const [name$1u, bem$1q] = createNamespace("tabs");
|
3038 | var stdin_default$1E = vue.defineComponent({
|
3039 | name: name$1u,
|
3040 | props: {
|
3041 | count: makeRequiredProp(Number),
|
3042 | inited: Boolean,
|
3043 | animated: Boolean,
|
3044 | duration: makeRequiredProp(numericProp),
|
3045 | swipeable: Boolean,
|
3046 | lazyRender: Boolean,
|
3047 | currentIndex: makeRequiredProp(Number)
|
3048 | },
|
3049 | emits: ["change"],
|
3050 | setup(props2, {
|
3051 | emit,
|
3052 | slots
|
3053 | }) {
|
3054 | const swipeRef = vue.ref();
|
3055 | const onChange = (index) => emit("change", index);
|
3056 | const renderChildren = () => {
|
3057 | var _a;
|
3058 | const Content = (_a = slots.default) == null ? void 0 : _a.call(slots);
|
3059 | if (props2.animated || props2.swipeable) {
|
3060 | return vue.createVNode(Swipe, {
|
3061 | "ref": swipeRef,
|
3062 | "loop": false,
|
3063 | "class": bem$1q("track"),
|
3064 | "duration": +props2.duration * 1e3,
|
3065 | "touchable": props2.swipeable,
|
3066 | "lazyRender": props2.lazyRender,
|
3067 | "showIndicators": false,
|
3068 | "onChange": onChange
|
3069 | }, {
|
3070 | default: () => [Content]
|
3071 | });
|
3072 | }
|
3073 | return Content;
|
3074 | };
|
3075 | const swipeToCurrentTab = (index) => {
|
3076 | const swipe = swipeRef.value;
|
3077 | if (swipe && swipe.state.active !== index) {
|
3078 | swipe.swipeTo(index, {
|
3079 | immediate: !props2.inited
|
3080 | });
|
3081 | }
|
3082 | };
|
3083 | vue.watch(() => props2.currentIndex, swipeToCurrentTab);
|
3084 | vue.onMounted(() => {
|
3085 | swipeToCurrentTab(props2.currentIndex);
|
3086 | });
|
3087 | useExpose({
|
3088 | swipeRef
|
3089 | });
|
3090 | return () => vue.createVNode("div", {
|
3091 | "class": bem$1q("content", {
|
3092 | animated: props2.animated || props2.swipeable
|
3093 | })
|
3094 | }, [renderChildren()]);
|
3095 | }
|
3096 | });
|
3097 | const [name$1t, bem$1p] = createNamespace("tabs");
|
3098 | const tabsProps = {
|
3099 | type: makeStringProp("line"),
|
3100 | color: String,
|
3101 | border: Boolean,
|
3102 | sticky: Boolean,
|
3103 | shrink: Boolean,
|
3104 | active: makeNumericProp(0),
|
3105 | duration: makeNumericProp(0.3),
|
3106 | animated: Boolean,
|
3107 | ellipsis: truthProp,
|
3108 | swipeable: Boolean,
|
3109 | scrollspy: Boolean,
|
3110 | offsetTop: makeNumericProp(0),
|
3111 | background: String,
|
3112 | lazyRender: truthProp,
|
3113 | showHeader: truthProp,
|
3114 | lineWidth: numericProp,
|
3115 | lineHeight: numericProp,
|
3116 | beforeChange: Function,
|
3117 | swipeThreshold: makeNumericProp(5),
|
3118 | titleActiveColor: String,
|
3119 | titleInactiveColor: String
|
3120 | };
|
3121 | const TABS_KEY = Symbol(name$1t);
|
3122 | var stdin_default$1D = vue.defineComponent({
|
3123 | name: name$1t,
|
3124 | props: tabsProps,
|
3125 | emits: ["change", "scroll", "rendered", "clickTab", "update:active"],
|
3126 | setup(props2, {
|
3127 | emit,
|
3128 | slots
|
3129 | }) {
|
3130 | let tabHeight;
|
3131 | let lockScroll;
|
3132 | let stickyFixed;
|
3133 | let cancelScrollLeftToRaf;
|
3134 | let cancelScrollTopToRaf;
|
3135 | const root = vue.ref();
|
3136 | const navRef = vue.ref();
|
3137 | const wrapRef = vue.ref();
|
3138 | const contentRef = vue.ref();
|
3139 | const id = useId();
|
3140 | const scroller = useScrollParent(root);
|
3141 | const [titleRefs, setTitleRefs] = useRefs();
|
3142 | const {
|
3143 | children,
|
3144 | linkChildren
|
3145 | } = useChildren(TABS_KEY);
|
3146 | const state = vue.reactive({
|
3147 | inited: false,
|
3148 | position: "",
|
3149 | lineStyle: {},
|
3150 | currentIndex: -1
|
3151 | });
|
3152 | const scrollable = vue.computed(() => children.length > +props2.swipeThreshold || !props2.ellipsis || props2.shrink);
|
3153 | const navStyle = vue.computed(() => ({
|
3154 | borderColor: props2.color,
|
3155 | background: props2.background
|
3156 | }));
|
3157 | const getTabName = (tab, index) => {
|
3158 | var _a;
|
3159 | return (_a = tab.name) != null ? _a : index;
|
3160 | };
|
3161 | const currentName = vue.computed(() => {
|
3162 | const activeTab = children[state.currentIndex];
|
3163 | if (activeTab) {
|
3164 | return getTabName(activeTab, state.currentIndex);
|
3165 | }
|
3166 | });
|
3167 | const offsetTopPx = vue.computed(() => unitToPx(props2.offsetTop));
|
3168 | const scrollOffset = vue.computed(() => {
|
3169 | if (props2.sticky) {
|
3170 | return offsetTopPx.value + tabHeight;
|
3171 | }
|
3172 | return 0;
|
3173 | });
|
3174 | const scrollIntoView = (immediate) => {
|
3175 | const nav = navRef.value;
|
3176 | const titles = titleRefs.value;
|
3177 | if (!scrollable.value || !nav || !titles || !titles[state.currentIndex]) {
|
3178 | return;
|
3179 | }
|
3180 | const title = titles[state.currentIndex].$el;
|
3181 | const to = title.offsetLeft - (nav.offsetWidth - title.offsetWidth) / 2;
|
3182 | if (cancelScrollLeftToRaf)
|
3183 | cancelScrollLeftToRaf();
|
3184 | cancelScrollLeftToRaf = scrollLeftTo(nav, to, immediate ? 0 : +props2.duration);
|
3185 | };
|
3186 | const setLine = () => {
|
3187 | const shouldAnimate = state.inited;
|
3188 | vue.nextTick(() => {
|
3189 | const titles = titleRefs.value;
|
3190 | if (!titles || !titles[state.currentIndex] || props2.type !== "line" || isHidden(root.value)) {
|
3191 | return;
|
3192 | }
|
3193 | const title = titles[state.currentIndex].$el;
|
3194 | const {
|
3195 | lineWidth,
|
3196 | lineHeight
|
3197 | } = props2;
|
3198 | const left2 = title.offsetLeft + title.offsetWidth / 2;
|
3199 | const lineStyle = {
|
3200 | width: addUnit(lineWidth),
|
3201 | backgroundColor: props2.color,
|
3202 | transform: `translateX(${left2}px) translateX(-50%)`
|
3203 | };
|
3204 | if (shouldAnimate) {
|
3205 | lineStyle.transitionDuration = `${props2.duration}s`;
|
3206 | }
|
3207 | if (isDef(lineHeight)) {
|
3208 | const height2 = addUnit(lineHeight);
|
3209 | lineStyle.height = height2;
|
3210 | lineStyle.borderRadius = height2;
|
3211 | }
|
3212 | state.lineStyle = lineStyle;
|
3213 | });
|
3214 | };
|
3215 | const findAvailableTab = (index) => {
|
3216 | const diff = index < state.currentIndex ? -1 : 1;
|
3217 | while (index >= 0 && index < children.length) {
|
3218 | if (!children[index].disabled) {
|
3219 | return index;
|
3220 | }
|
3221 | index += diff;
|
3222 | }
|
3223 | };
|
3224 | const setCurrentIndex = (currentIndex, skipScrollIntoView) => {
|
3225 | const newIndex = findAvailableTab(currentIndex);
|
3226 | if (!isDef(newIndex)) {
|
3227 | return;
|
3228 | }
|
3229 | const newTab = children[newIndex];
|
3230 | const newName = getTabName(newTab, newIndex);
|
3231 | const shouldEmitChange = state.currentIndex !== null;
|
3232 | if (state.currentIndex !== newIndex) {
|
3233 | state.currentIndex = newIndex;
|
3234 | if (!skipScrollIntoView) {
|
3235 | scrollIntoView();
|
3236 | }
|
3237 | setLine();
|
3238 | }
|
3239 | if (newName !== props2.active) {
|
3240 | emit("update:active", newName);
|
3241 | if (shouldEmitChange) {
|
3242 | emit("change", newName, newTab.title);
|
3243 | }
|
3244 | }
|
3245 | if (stickyFixed && !props2.scrollspy) {
|
3246 | setRootScrollTop(Math.ceil(getElementTop(root.value) - offsetTopPx.value));
|
3247 | }
|
3248 | };
|
3249 | const setCurrentIndexByName = (name2, skipScrollIntoView) => {
|
3250 | const matched = children.find((tab, index2) => getTabName(tab, index2) === name2);
|
3251 | const index = matched ? children.indexOf(matched) : 0;
|
3252 | setCurrentIndex(index, skipScrollIntoView);
|
3253 | };
|
3254 | const scrollToCurrentContent = (immediate = false) => {
|
3255 | if (props2.scrollspy) {
|
3256 | const target = children[state.currentIndex].$el;
|
3257 | if (target && scroller.value) {
|
3258 | const to = getElementTop(target, scroller.value) - scrollOffset.value;
|
3259 | lockScroll = true;
|
3260 | if (cancelScrollTopToRaf)
|
3261 | cancelScrollTopToRaf();
|
3262 | cancelScrollTopToRaf = scrollTopTo(scroller.value, to, immediate ? 0 : +props2.duration, () => {
|
3263 | lockScroll = false;
|
3264 | });
|
3265 | }
|
3266 | }
|
3267 | };
|
3268 | const onClickTab = (item, index, event) => {
|
3269 | const {
|
3270 | title,
|
3271 | disabled
|
3272 | } = children[index];
|
3273 | const name2 = getTabName(children[index], index);
|
3274 | if (!disabled) {
|
3275 | callInterceptor(props2.beforeChange, {
|
3276 | args: [name2],
|
3277 | done: () => {
|
3278 | setCurrentIndex(index);
|
3279 | scrollToCurrentContent();
|
3280 | }
|
3281 | });
|
3282 | route(item);
|
3283 | }
|
3284 | emit("clickTab", {
|
3285 | name: name2,
|
3286 | title,
|
3287 | event,
|
3288 | disabled
|
3289 | });
|
3290 | };
|
3291 | const onStickyScroll = (params) => {
|
3292 | stickyFixed = params.isFixed;
|
3293 | emit("scroll", params);
|
3294 | };
|
3295 | const scrollTo = (name2) => {
|
3296 | vue.nextTick(() => {
|
3297 | setCurrentIndexByName(name2);
|
3298 | scrollToCurrentContent(true);
|
3299 | });
|
3300 | };
|
3301 | const getCurrentIndexOnScroll = () => {
|
3302 | for (let index = 0; index < children.length; index++) {
|
3303 | const {
|
3304 | top: top2
|
3305 | } = useRect(children[index].$el);
|
3306 | if (top2 > scrollOffset.value) {
|
3307 | return index === 0 ? 0 : index - 1;
|
3308 | }
|
3309 | }
|
3310 | return children.length - 1;
|
3311 | };
|
3312 | const onScroll = () => {
|
3313 | if (props2.scrollspy && !lockScroll) {
|
3314 | const index = getCurrentIndexOnScroll();
|
3315 | setCurrentIndex(index);
|
3316 | }
|
3317 | };
|
3318 | const renderLine = () => {
|
3319 | if (props2.type === "line" && children.length) {
|
3320 | return vue.createVNode("div", {
|
3321 | "class": bem$1p("line"),
|
3322 | "style": state.lineStyle
|
3323 | }, null);
|
3324 | }
|
3325 | };
|
3326 | const renderHeader = () => {
|
3327 | var _a, _b, _c;
|
3328 | const {
|
3329 | type,
|
3330 | border,
|
3331 | sticky
|
3332 | } = props2;
|
3333 | const Header = [vue.createVNode("div", {
|
3334 | "ref": sticky ? void 0 : wrapRef,
|
3335 | "class": [bem$1p("wrap"), {
|
3336 | [BORDER_TOP_BOTTOM]: type === "line" && border
|
3337 | }]
|
3338 | }, [vue.createVNode("div", {
|
3339 | "ref": navRef,
|
3340 | "role": "tablist",
|
3341 | "class": bem$1p("nav", [type, {
|
3342 | shrink: props2.shrink,
|
3343 | complete: scrollable.value
|
3344 | }]),
|
3345 | "style": navStyle.value,
|
3346 | "aria-orientation": "horizontal"
|
3347 | }, [(_a = slots["nav-left"]) == null ? void 0 : _a.call(slots), children.map((item) => item.renderTitle(onClickTab)), renderLine(), (_b = slots["nav-right"]) == null ? void 0 : _b.call(slots)])]), (_c = slots["nav-bottom"]) == null ? void 0 : _c.call(slots)];
|
3348 | if (sticky) {
|
3349 | return vue.createVNode("div", {
|
3350 | "ref": wrapRef
|
3351 | }, [Header]);
|
3352 | }
|
3353 | return Header;
|
3354 | };
|
3355 | const resize = () => {
|
3356 | setLine();
|
3357 | vue.nextTick(() => {
|
3358 | var _a, _b;
|
3359 | scrollIntoView(true);
|
3360 | (_b = (_a = contentRef.value) == null ? void 0 : _a.swipeRef.value) == null ? void 0 : _b.resize();
|
3361 | });
|
3362 | };
|
3363 | vue.watch(() => [props2.color, props2.duration, props2.lineWidth, props2.lineHeight], setLine);
|
3364 | vue.watch(windowWidth, resize);
|
3365 | vue.watch(() => props2.active, (value) => {
|
3366 | if (value !== currentName.value) {
|
3367 | setCurrentIndexByName(value);
|
3368 | }
|
3369 | });
|
3370 | vue.watch(() => children.length, () => {
|
3371 | if (state.inited) {
|
3372 | setCurrentIndexByName(props2.active);
|
3373 | setLine();
|
3374 | vue.nextTick(() => {
|
3375 | scrollIntoView(true);
|
3376 | });
|
3377 | }
|
3378 | });
|
3379 | const init = () => {
|
3380 | setCurrentIndexByName(props2.active, true);
|
3381 | vue.nextTick(() => {
|
3382 | state.inited = true;
|
3383 | if (wrapRef.value) {
|
3384 | tabHeight = useRect(wrapRef.value).height;
|
3385 | }
|
3386 | scrollIntoView(true);
|
3387 | });
|
3388 | };
|
3389 | const onRendered = (name2, title) => emit("rendered", name2, title);
|
3390 | useExpose({
|
3391 | resize,
|
3392 | scrollTo
|
3393 | });
|
3394 | vue.onActivated(setLine);
|
3395 | onPopupReopen(setLine);
|
3396 | onMountedOrActivated(init);
|
3397 | useVisibilityChange(root, setLine);
|
3398 | useEventListener("scroll", onScroll, {
|
3399 | target: scroller,
|
3400 | passive: true
|
3401 | });
|
3402 | linkChildren({
|
3403 | id,
|
3404 | props: props2,
|
3405 | setLine,
|
3406 | scrollable,
|
3407 | onRendered,
|
3408 | currentName,
|
3409 | setTitleRefs,
|
3410 | scrollIntoView
|
3411 | });
|
3412 | return () => vue.createVNode("div", {
|
3413 | "ref": root,
|
3414 | "class": bem$1p([props2.type])
|
3415 | }, [props2.showHeader ? props2.sticky ? vue.createVNode(Sticky, {
|
3416 | "container": root.value,
|
3417 | "offsetTop": offsetTopPx.value,
|
3418 | "onScroll": onStickyScroll
|
3419 | }, {
|
3420 | default: () => [renderHeader()]
|
3421 | }) : renderHeader() : null, vue.createVNode(stdin_default$1E, {
|
3422 | "ref": contentRef,
|
3423 | "count": children.length,
|
3424 | "inited": state.inited,
|
3425 | "animated": props2.animated,
|
3426 | "duration": props2.duration,
|
3427 | "swipeable": props2.swipeable,
|
3428 | "lazyRender": props2.lazyRender,
|
3429 | "currentIndex": state.currentIndex,
|
3430 | "onChange": setCurrentIndex
|
3431 | }, {
|
3432 | default: () => {
|
3433 | var _a;
|
3434 | return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
|
3435 | }
|
3436 | })]);
|
3437 | }
|
3438 | });
|
3439 | const TAB_STATUS_KEY = Symbol();
|
3440 | const useTabStatus = () => vue.inject(TAB_STATUS_KEY, null);
|
3441 | const [name$1s, bem$1o] = createNamespace("tab");
|
3442 | const TabTitle = vue.defineComponent({
|
3443 | name: name$1s,
|
3444 | props: {
|
3445 | id: String,
|
3446 | dot: Boolean,
|
3447 | type: String,
|
3448 | color: String,
|
3449 | title: String,
|
3450 | badge: numericProp,
|
3451 | shrink: Boolean,
|
3452 | isActive: Boolean,
|
3453 | disabled: Boolean,
|
3454 | controls: String,
|
3455 | scrollable: Boolean,
|
3456 | activeColor: String,
|
3457 | inactiveColor: String,
|
3458 | showZeroBadge: truthProp
|
3459 | },
|
3460 | setup(props2, {
|
3461 | slots
|
3462 | }) {
|
3463 | const style = vue.computed(() => {
|
3464 | const style2 = {};
|
3465 | const {
|
3466 | type,
|
3467 | color,
|
3468 | disabled,
|
3469 | isActive,
|
3470 | activeColor,
|
3471 | inactiveColor
|
3472 | } = props2;
|
3473 | const isCard = type === "card";
|
3474 | if (color && isCard) {
|
3475 | style2.borderColor = color;
|
3476 | if (!disabled) {
|
3477 | if (isActive) {
|
3478 | style2.backgroundColor = color;
|
3479 | } else {
|
3480 | style2.color = color;
|
3481 | }
|
3482 | }
|
3483 | }
|
3484 | const titleColor = isActive ? activeColor : inactiveColor;
|
3485 | if (titleColor) {
|
3486 | style2.color = titleColor;
|
3487 | }
|
3488 | return style2;
|
3489 | });
|
3490 | const renderText = () => {
|
3491 | const Text = vue.createVNode("span", {
|
3492 | "class": bem$1o("text", {
|
3493 | ellipsis: !props2.scrollable
|
3494 | })
|
3495 | }, [slots.title ? slots.title() : props2.title]);
|
3496 | if (props2.dot || isDef(props2.badge) && props2.badge !== "") {
|
3497 | return vue.createVNode(Badge, {
|
3498 | "dot": props2.dot,
|
3499 | "content": props2.badge,
|
3500 | "showZero": props2.showZeroBadge
|
3501 | }, {
|
3502 | default: () => [Text]
|
3503 | });
|
3504 | }
|
3505 | return Text;
|
3506 | };
|
3507 | return () => vue.createVNode("div", {
|
3508 | "id": props2.id,
|
3509 | "role": "tab",
|
3510 | "class": [bem$1o([props2.type, {
|
3511 | grow: props2.scrollable && !props2.shrink,
|
3512 | shrink: props2.shrink,
|
3513 | active: props2.isActive,
|
3514 | disabled: props2.disabled
|
3515 | }])],
|
3516 | "style": style.value,
|
3517 | "tabindex": props2.disabled ? void 0 : props2.isActive ? 0 : -1,
|
3518 | "aria-selected": props2.isActive,
|
3519 | "aria-disabled": props2.disabled || void 0,
|
3520 | "aria-controls": props2.controls
|
3521 | }, [renderText()]);
|
3522 | }
|
3523 | });
|
3524 | const [name$1r, bem$1n] = createNamespace("swipe-item");
|
3525 | var stdin_default$1C = vue.defineComponent({
|
3526 | name: name$1r,
|
3527 | setup(props2, {
|
3528 | slots
|
3529 | }) {
|
3530 | let rendered;
|
3531 | const state = vue.reactive({
|
3532 | offset: 0,
|
3533 | inited: false,
|
3534 | mounted: false
|
3535 | });
|
3536 | const {
|
3537 | parent,
|
3538 | index
|
3539 | } = useParent(SWIPE_KEY);
|
3540 | if (!parent) {
|
3541 | return;
|
3542 | }
|
3543 | const style = vue.computed(() => {
|
3544 | const style2 = {};
|
3545 | const {
|
3546 | vertical
|
3547 | } = parent.props;
|
3548 | if (parent.size.value) {
|
3549 | style2[vertical ? "height" : "width"] = `${parent.size.value}px`;
|
3550 | }
|
3551 | if (state.offset) {
|
3552 | style2.transform = `translate${vertical ? "Y" : "X"}(${state.offset}px)`;
|
3553 | }
|
3554 | return style2;
|
3555 | });
|
3556 | const shouldRender = vue.computed(() => {
|
3557 | const {
|
3558 | loop,
|
3559 | lazyRender
|
3560 | } = parent.props;
|
3561 | if (!lazyRender || rendered) {
|
3562 | return true;
|
3563 | }
|
3564 | if (!state.mounted) {
|
3565 | return false;
|
3566 | }
|
3567 | const active = parent.activeIndicator.value;
|
3568 | const maxActive = parent.count.value - 1;
|
3569 | const prevActive = active === 0 && loop ? maxActive : active - 1;
|
3570 | const nextActive = active === maxActive && loop ? 0 : active + 1;
|
3571 | rendered = index.value === active || index.value === prevActive || index.value === nextActive;
|
3572 | return rendered;
|
3573 | });
|
3574 | const setOffset = (offset2) => {
|
3575 | state.offset = offset2;
|
3576 | };
|
3577 | vue.onMounted(() => {
|
3578 | vue.nextTick(() => {
|
3579 | state.mounted = true;
|
3580 | });
|
3581 | });
|
3582 | useExpose({
|
3583 | setOffset
|
3584 | });
|
3585 | return () => {
|
3586 | var _a;
|
3587 | return vue.createVNode("div", {
|
3588 | "class": bem$1n(),
|
3589 | "style": style.value
|
3590 | }, [shouldRender.value ? (_a = slots.default) == null ? void 0 : _a.call(slots) : null]);
|
3591 | };
|
3592 | }
|
3593 | });
|
3594 | const SwipeItem = withInstall(stdin_default$1C);
|
3595 | const [name$1q, bem$1m] = createNamespace("tab");
|
3596 | const tabProps = extend({}, routeProps, {
|
3597 | dot: Boolean,
|
3598 | name: numericProp,
|
3599 | badge: numericProp,
|
3600 | title: String,
|
3601 | disabled: Boolean,
|
3602 | titleClass: unknownProp,
|
3603 | titleStyle: [String, Object],
|
3604 | showZeroBadge: truthProp
|
3605 | });
|
3606 | var stdin_default$1B = vue.defineComponent({
|
3607 | name: name$1q,
|
3608 | props: tabProps,
|
3609 | setup(props2, {
|
3610 | slots
|
3611 | }) {
|
3612 | const id = useId();
|
3613 | const inited = vue.ref(false);
|
3614 | const instance2 = vue.getCurrentInstance();
|
3615 | const {
|
3616 | parent,
|
3617 | index
|
3618 | } = useParent(TABS_KEY);
|
3619 | if (!parent) {
|
3620 | return;
|
3621 | }
|
3622 | const getName = () => {
|
3623 | var _a;
|
3624 | return (_a = props2.name) != null ? _a : index.value;
|
3625 | };
|
3626 | const init = () => {
|
3627 | inited.value = true;
|
3628 | if (parent.props.lazyRender) {
|
3629 | vue.nextTick(() => {
|
3630 | parent.onRendered(getName(), props2.title);
|
3631 | });
|
3632 | }
|
3633 | };
|
3634 | const active = vue.computed(() => {
|
3635 | const isActive = getName() === parent.currentName.value;
|
3636 | if (isActive && !inited.value) {
|
3637 | init();
|
3638 | }
|
3639 | return isActive;
|
3640 | });
|
3641 | const parsedClass = vue.ref("");
|
3642 | const parsedStyle = vue.ref("");
|
3643 | vue.watchEffect(() => {
|
3644 | const {
|
3645 | titleClass,
|
3646 | titleStyle
|
3647 | } = props2;
|
3648 | parsedClass.value = titleClass ? normalizeClass(titleClass) : "";
|
3649 | parsedStyle.value = titleStyle && typeof titleStyle !== "string" ? stringifyStyle(normalizeStyle(titleStyle)) : titleStyle;
|
3650 | });
|
3651 | const renderTitle = (onClickTab) => vue.createVNode(TabTitle, vue.mergeProps({
|
3652 | "key": id,
|
3653 | "id": `${parent.id}-${index.value}`,
|
3654 | "ref": parent.setTitleRefs(index.value),
|
3655 | "style": parsedStyle.value,
|
3656 | "class": parsedClass.value,
|
3657 | "isActive": active.value,
|
3658 | "controls": id,
|
3659 | "scrollable": parent.scrollable.value,
|
3660 | "activeColor": parent.props.titleActiveColor,
|
3661 | "inactiveColor": parent.props.titleInactiveColor,
|
3662 | "onClick": (event) => onClickTab(instance2.proxy, index.value, event)
|
3663 | }, pick(parent.props, ["type", "color", "shrink"]), pick(props2, ["dot", "badge", "title", "disabled", "showZeroBadge"])), {
|
3664 | title: slots.title
|
3665 | });
|
3666 | const hasInactiveClass = vue.ref(!active.value);
|
3667 | vue.watch(active, (val) => {
|
3668 | if (val) {
|
3669 | hasInactiveClass.value = false;
|
3670 | } else {
|
3671 | doubleRaf(() => {
|
3672 | hasInactiveClass.value = true;
|
3673 | });
|
3674 | }
|
3675 | });
|
3676 | vue.watch(() => props2.title, () => {
|
3677 | parent.setLine();
|
3678 | parent.scrollIntoView();
|
3679 | });
|
3680 | vue.provide(TAB_STATUS_KEY, active);
|
3681 | useExpose({
|
3682 | id,
|
3683 | renderTitle
|
3684 | });
|
3685 | return () => {
|
3686 | var _a;
|
3687 | const label = `${parent.id}-${index.value}`;
|
3688 | const {
|
3689 | animated,
|
3690 | swipeable,
|
3691 | scrollspy,
|
3692 | lazyRender
|
3693 | } = parent.props;
|
3694 | if (!slots.default && !animated) {
|
3695 | return;
|
3696 | }
|
3697 | const show = scrollspy || active.value;
|
3698 | if (animated || swipeable) {
|
3699 | return vue.createVNode(SwipeItem, {
|
3700 | "id": id,
|
3701 | "role": "tabpanel",
|
3702 | "class": bem$1m("panel-wrapper", {
|
3703 | inactive: hasInactiveClass.value
|
3704 | }),
|
3705 | "tabindex": active.value ? 0 : -1,
|
3706 | "aria-hidden": !active.value,
|
3707 | "aria-labelledby": label
|
3708 | }, {
|
3709 | default: () => {
|
3710 | var _a2;
|
3711 | return [vue.createVNode("div", {
|
3712 | "class": bem$1m("panel")
|
3713 | }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)])];
|
3714 | }
|
3715 | });
|
3716 | }
|
3717 | const shouldRender = inited.value || scrollspy || !lazyRender;
|
3718 | const Content = shouldRender ? (_a = slots.default) == null ? void 0 : _a.call(slots) : null;
|
3719 | return vue.withDirectives(vue.createVNode("div", {
|
3720 | "id": id,
|
3721 | "role": "tabpanel",
|
3722 | "class": bem$1m("panel"),
|
3723 | "tabindex": show ? 0 : -1,
|
3724 | "aria-labelledby": label
|
3725 | }, [Content]), [[vue.vShow, show]]);
|
3726 | };
|
3727 | }
|
3728 | });
|
3729 | const Tab = withInstall(stdin_default$1B);
|
3730 | const Tabs = withInstall(stdin_default$1D);
|
3731 | const [name$1p, bem$1l] = createNamespace("picker-group");
|
3732 | const PICKER_GROUP_KEY = Symbol(name$1p);
|
3733 | const pickerGroupProps = extend({
|
3734 | tabs: makeArrayProp(),
|
3735 | activeTab: makeNumericProp(0),
|
3736 | nextStepText: String
|
3737 | }, pickerToolbarProps);
|
3738 | var stdin_default$1A = vue.defineComponent({
|
3739 | name: name$1p,
|
3740 | props: pickerGroupProps,
|
3741 | emits: ["confirm", "cancel", "update:activeTab"],
|
3742 | setup(props2, {
|
3743 | emit,
|
3744 | slots
|
3745 | }) {
|
3746 | const activeTab = useSyncPropRef(() => props2.activeTab, (value) => emit("update:activeTab", value));
|
3747 | const {
|
3748 | children,
|
3749 | linkChildren
|
3750 | } = useChildren(PICKER_GROUP_KEY);
|
3751 | linkChildren();
|
3752 | const showNextButton = () => +activeTab.value < props2.tabs.length - 1 && props2.nextStepText;
|
3753 | const onConfirm = () => {
|
3754 | if (showNextButton()) {
|
3755 | activeTab.value = +activeTab.value + 1;
|
3756 | } else {
|
3757 | emit("confirm", children.map((item) => item.confirm()));
|
3758 | }
|
3759 | };
|
3760 | const onCancel = () => emit("cancel");
|
3761 | return () => {
|
3762 | var _a, _b;
|
3763 | const childNodes = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) == null ? void 0 : _b.filter((node) => node.type !== vue.Comment);
|
3764 | const confirmButtonText = showNextButton() ? props2.nextStepText : props2.confirmButtonText;
|
3765 | return vue.createVNode("div", {
|
3766 | "class": bem$1l()
|
3767 | }, [vue.createVNode(stdin_default$1H, {
|
3768 | "title": props2.title,
|
3769 | "cancelButtonText": props2.cancelButtonText,
|
3770 | "confirmButtonText": confirmButtonText,
|
3771 | "onConfirm": onConfirm,
|
3772 | "onCancel": onCancel
|
3773 | }, pick(slots, pickerToolbarSlots)), vue.createVNode(Tabs, {
|
3774 | "active": activeTab.value,
|
3775 | "onUpdate:active": ($event) => activeTab.value = $event,
|
3776 | "class": bem$1l("tabs"),
|
3777 | "shrink": true,
|
3778 | "animated": true,
|
3779 | "lazyRender": false
|
3780 | }, {
|
3781 | default: () => [props2.tabs.map((title, index) => vue.createVNode(Tab, {
|
3782 | "title": title,
|
3783 | "titleClass": bem$1l("tab-title")
|
3784 | }, {
|
3785 | default: () => [childNodes == null ? void 0 : childNodes[index]]
|
3786 | }))]
|
3787 | })]);
|
3788 | };
|
3789 | }
|
3790 | });
|
3791 | const pickerSharedProps = extend({
|
3792 | loading: Boolean,
|
3793 | readonly: Boolean,
|
3794 | allowHtml: Boolean,
|
3795 | optionHeight: makeNumericProp(44),
|
3796 | showToolbar: truthProp,
|
3797 | swipeDuration: makeNumericProp(1e3),
|
3798 | visibleOptionNum: makeNumericProp(6)
|
3799 | }, pickerToolbarProps);
|
3800 | const pickerProps = extend({}, pickerSharedProps, {
|
3801 | columns: makeArrayProp(),
|
3802 | modelValue: makeArrayProp(),
|
3803 | toolbarPosition: makeStringProp("top"),
|
3804 | columnsFieldNames: Object
|
3805 | });
|
3806 | var stdin_default$1z = vue.defineComponent({
|
3807 | name: name$1z,
|
3808 | props: pickerProps,
|
3809 | emits: ["confirm", "cancel", "change", "scrollInto", "clickOption", "update:modelValue"],
|
3810 | setup(props2, {
|
3811 | emit,
|
3812 | slots
|
3813 | }) {
|
3814 | const columnsRef = vue.ref();
|
3815 | const selectedValues = vue.ref(props2.modelValue.slice(0));
|
3816 | const {
|
3817 | parent
|
3818 | } = useParent(PICKER_GROUP_KEY);
|
3819 | const {
|
3820 | children,
|
3821 | linkChildren
|
3822 | } = useChildren(PICKER_KEY);
|
3823 | linkChildren();
|
3824 | const fields = vue.computed(() => assignDefaultFields(props2.columnsFieldNames));
|
3825 | const optionHeight = vue.computed(() => unitToPx(props2.optionHeight));
|
3826 | const columnsType = vue.computed(() => getColumnsType(props2.columns, fields.value));
|
3827 | const currentColumns = vue.computed(() => {
|
3828 | const {
|
3829 | columns
|
3830 | } = props2;
|
3831 | switch (columnsType.value) {
|
3832 | case "multiple":
|
3833 | return columns;
|
3834 | case "cascade":
|
3835 | return formatCascadeColumns(columns, fields.value, selectedValues);
|
3836 | default:
|
3837 | return [columns];
|
3838 | }
|
3839 | });
|
3840 | const hasOptions = vue.computed(() => currentColumns.value.some((options) => options.length));
|
3841 | const selectedOptions = vue.computed(() => currentColumns.value.map((options, index) => findOptionByValue(options, selectedValues.value[index], fields.value)));
|
3842 | const selectedIndexes = vue.computed(() => currentColumns.value.map((options, index) => options.findIndex((option) => option[fields.value.value] === selectedValues.value[index])));
|
3843 | const setValue = (index, value) => {
|
3844 | if (selectedValues.value[index] !== value) {
|
3845 | const newValues = selectedValues.value.slice(0);
|
3846 | newValues[index] = value;
|
3847 | selectedValues.value = newValues;
|
3848 | }
|
3849 | };
|
3850 | const getEventParams = () => ({
|
3851 | selectedValues: selectedValues.value.slice(0),
|
3852 | selectedOptions: selectedOptions.value,
|
3853 | selectedIndexes: selectedIndexes.value
|
3854 | });
|
3855 | const onChange = (value, columnIndex) => {
|
3856 | setValue(columnIndex, value);
|
3857 | if (columnsType.value === "cascade") {
|
3858 | selectedValues.value.forEach((value2, index) => {
|
3859 | const options = currentColumns.value[index];
|
3860 | if (!isOptionExist(options, value2, fields.value)) {
|
3861 | setValue(index, options.length ? options[0][fields.value.value] : void 0);
|
3862 | }
|
3863 | });
|
3864 | }
|
3865 | vue.nextTick(() => {
|
3866 | emit("change", extend({
|
3867 | columnIndex
|
3868 | }, getEventParams()));
|
3869 | });
|
3870 | };
|
3871 | const onClickOption = (currentOption, columnIndex) => {
|
3872 | const params = {
|
3873 | columnIndex,
|
3874 | currentOption
|
3875 | };
|
3876 | emit("clickOption", extend(getEventParams(), params));
|
3877 | emit("scrollInto", params);
|
3878 | };
|
3879 | const confirm = () => {
|
3880 | children.forEach((child) => child.stopMomentum());
|
3881 | const params = getEventParams();
|
3882 | vue.nextTick(() => {
|
3883 | emit("confirm", params);
|
3884 | });
|
3885 | return params;
|
3886 | };
|
3887 | const cancel = () => emit("cancel", getEventParams());
|
3888 | const renderColumnItems = () => currentColumns.value.map((options, columnIndex) => vue.createVNode(stdin_default$1I, {
|
3889 | "value": selectedValues.value[columnIndex],
|
3890 | "fields": fields.value,
|
3891 | "options": options,
|
3892 | "readonly": props2.readonly,
|
3893 | "allowHtml": props2.allowHtml,
|
3894 | "optionHeight": optionHeight.value,
|
3895 | "swipeDuration": props2.swipeDuration,
|
3896 | "visibleOptionNum": props2.visibleOptionNum,
|
3897 | "onChange": (value) => onChange(value, columnIndex),
|
3898 | "onClickOption": (option) => onClickOption(option, columnIndex),
|
3899 | "onScrollInto": (option) => {
|
3900 | emit("scrollInto", {
|
3901 | currentOption: option,
|
3902 | columnIndex
|
3903 | });
|
3904 | }
|
3905 | }, {
|
3906 | option: slots.option
|
3907 | }));
|
3908 | const renderMask = (wrapHeight) => {
|
3909 | if (hasOptions.value) {
|
3910 | const frameStyle = {
|
3911 | height: `${optionHeight.value}px`
|
3912 | };
|
3913 | const maskStyle = {
|
3914 | backgroundSize: `100% ${(wrapHeight - optionHeight.value) / 2}px`
|
3915 | };
|
3916 | return [vue.createVNode("div", {
|
3917 | "class": bem$1u("mask"),
|
3918 | "style": maskStyle
|
3919 | }, null), vue.createVNode("div", {
|
3920 | "class": [BORDER_UNSET_TOP_BOTTOM, bem$1u("frame")],
|
3921 | "style": frameStyle
|
3922 | }, null)];
|
3923 | }
|
3924 | };
|
3925 | const renderColumns = () => {
|
3926 | const wrapHeight = optionHeight.value * +props2.visibleOptionNum;
|
3927 | const columnsStyle = {
|
3928 | height: `${wrapHeight}px`
|
3929 | };
|
3930 | return vue.createVNode("div", {
|
3931 | "ref": columnsRef,
|
3932 | "class": bem$1u("columns"),
|
3933 | "style": columnsStyle
|
3934 | }, [renderColumnItems(), renderMask(wrapHeight)]);
|
3935 | };
|
3936 | const renderToolbar = () => {
|
3937 | if (props2.showToolbar && !parent) {
|
3938 | return vue.createVNode(stdin_default$1H, vue.mergeProps(pick(props2, pickerToolbarPropKeys), {
|
3939 | "onConfirm": confirm,
|
3940 | "onCancel": cancel
|
3941 | }), pick(slots, pickerToolbarSlots));
|
3942 | }
|
3943 | };
|
3944 | vue.watch(currentColumns, (columns) => {
|
3945 | columns.forEach((options, index) => {
|
3946 | if (options.length && !isOptionExist(options, selectedValues.value[index], fields.value)) {
|
3947 | setValue(index, getFirstEnabledOption(options)[fields.value.value]);
|
3948 | }
|
3949 | });
|
3950 | }, {
|
3951 | immediate: true
|
3952 | });
|
3953 | let lastEmittedModelValue;
|
3954 | vue.watch(() => props2.modelValue, (newValues) => {
|
3955 | if (!isSameValue(newValues, selectedValues.value) && !isSameValue(newValues, lastEmittedModelValue)) {
|
3956 | selectedValues.value = newValues.slice(0);
|
3957 | lastEmittedModelValue = newValues.slice(0);
|
3958 | }
|
3959 | }, {
|
3960 | deep: true
|
3961 | });
|
3962 | vue.watch(selectedValues, (newValues) => {
|
3963 | if (!isSameValue(newValues, props2.modelValue)) {
|
3964 | lastEmittedModelValue = newValues.slice(0);
|
3965 | emit("update:modelValue", lastEmittedModelValue);
|
3966 | }
|
3967 | }, {
|
3968 | immediate: true
|
3969 | });
|
3970 | useEventListener("touchmove", preventDefault, {
|
3971 | target: columnsRef
|
3972 | });
|
3973 | const getSelectedOptions = () => selectedOptions.value;
|
3974 | useExpose({
|
3975 | confirm,
|
3976 | getSelectedOptions
|
3977 | });
|
3978 | return () => {
|
3979 | var _a, _b;
|
3980 | return vue.createVNode("div", {
|
3981 | "class": bem$1u()
|
3982 | }, [props2.toolbarPosition === "top" ? renderToolbar() : null, props2.loading ? vue.createVNode(Loading, {
|
3983 | "class": bem$1u("loading")
|
3984 | }, null) : null, (_a = slots["columns-top"]) == null ? void 0 : _a.call(slots), renderColumns(), (_b = slots["columns-bottom"]) == null ? void 0 : _b.call(slots), props2.toolbarPosition === "bottom" ? renderToolbar() : null]);
|
3985 | };
|
3986 | }
|
3987 | });
|
3988 | const AREA_EMPTY_CODE = "000000";
|
3989 | const INHERIT_SLOTS = [
|
3990 | "title",
|
3991 | "cancel",
|
3992 | "confirm",
|
3993 | "toolbar",
|
3994 | "columns-top",
|
3995 | "columns-bottom"
|
3996 | ];
|
3997 | const INHERIT_PROPS = [
|
3998 | "title",
|
3999 | "loading",
|
4000 | "readonly",
|
4001 | "optionHeight",
|
4002 | "swipeDuration",
|
4003 | "visibleOptionNum",
|
4004 | "cancelButtonText",
|
4005 | "confirmButtonText"
|
4006 | ];
|
4007 | const makeOption = (text = "", value = AREA_EMPTY_CODE, children = void 0) => ({
|
4008 | text,
|
4009 | value,
|
4010 | children
|
4011 | });
|
4012 | function formatDataForCascade({
|
4013 | areaList,
|
4014 | columnsNum,
|
4015 | columnsPlaceholder: placeholder
|
4016 | }) {
|
4017 | const {
|
4018 | city_list: city = {},
|
4019 | county_list: county = {},
|
4020 | province_list: province = {}
|
4021 | } = areaList;
|
4022 | const showCity = +columnsNum > 1;
|
4023 | const showCounty = +columnsNum > 2;
|
4024 | const getProvinceChildren = () => {
|
4025 | if (showCity) {
|
4026 | return placeholder.length ? [
|
4027 | makeOption(
|
4028 | placeholder[0],
|
4029 | AREA_EMPTY_CODE,
|
4030 | showCounty ? [] : void 0
|
4031 | )
|
4032 | ] : [];
|
4033 | }
|
4034 | };
|
4035 | const provinceMap = new Map();
|
4036 | Object.keys(province).forEach((code) => {
|
4037 | provinceMap.set(
|
4038 | code.slice(0, 2),
|
4039 | makeOption(province[code], code, getProvinceChildren())
|
4040 | );
|
4041 | });
|
4042 | const cityMap = new Map();
|
4043 | if (showCity) {
|
4044 | const getCityChildren = () => {
|
4045 | if (showCounty) {
|
4046 | return placeholder.length ? [makeOption(placeholder[1])] : [];
|
4047 | }
|
4048 | };
|
4049 | Object.keys(city).forEach((code) => {
|
4050 | const option = makeOption(city[code], code, getCityChildren());
|
4051 | cityMap.set(code.slice(0, 4), option);
|
4052 | const province2 = provinceMap.get(code.slice(0, 2));
|
4053 | if (province2) {
|
4054 | province2.children.push(option);
|
4055 | }
|
4056 | });
|
4057 | }
|
4058 | if (showCounty) {
|
4059 | Object.keys(county).forEach((code) => {
|
4060 | const city2 = cityMap.get(code.slice(0, 4));
|
4061 | if (city2) {
|
4062 | city2.children.push(makeOption(county[code], code));
|
4063 | }
|
4064 | });
|
4065 | }
|
4066 | const options = Array.from(provinceMap.values());
|
4067 | if (placeholder.length) {
|
4068 | const county2 = showCounty ? [makeOption(placeholder[2])] : void 0;
|
4069 | const city2 = showCity ? [makeOption(placeholder[1], AREA_EMPTY_CODE, county2)] : void 0;
|
4070 | options.unshift(makeOption(placeholder[0], AREA_EMPTY_CODE, city2));
|
4071 | }
|
4072 | return options;
|
4073 | }
|
4074 | const Picker = withInstall(stdin_default$1z);
|
4075 | const [name$1o, bem$1k] = createNamespace("area");
|
4076 | const areaProps = extend({}, pick(pickerSharedProps, INHERIT_PROPS), {
|
4077 | modelValue: String,
|
4078 | columnsNum: makeNumericProp(3),
|
4079 | columnsPlaceholder: makeArrayProp(),
|
4080 | areaList: {
|
4081 | type: Object,
|
4082 | default: () => ({})
|
4083 | }
|
4084 | });
|
4085 | var stdin_default$1y = vue.defineComponent({
|
4086 | name: name$1o,
|
4087 | props: areaProps,
|
4088 | emits: ["change", "confirm", "cancel", "update:modelValue"],
|
4089 | setup(props2, {
|
4090 | emit,
|
4091 | slots
|
4092 | }) {
|
4093 | const codes = vue.ref([]);
|
4094 | const picker = vue.ref();
|
4095 | const columns = vue.computed(() => formatDataForCascade(props2));
|
4096 | const onChange = (...args) => emit("change", ...args);
|
4097 | const onCancel = (...args) => emit("cancel", ...args);
|
4098 | const onConfirm = (...args) => emit("confirm", ...args);
|
4099 | vue.watch(codes, (newCodes) => {
|
4100 | const lastCode = newCodes.length ? newCodes[newCodes.length - 1] : "";
|
4101 | if (lastCode && lastCode !== props2.modelValue) {
|
4102 | emit("update:modelValue", lastCode);
|
4103 | }
|
4104 | }, {
|
4105 | deep: true
|
4106 | });
|
4107 | vue.watch(() => props2.modelValue, (newCode) => {
|
4108 | if (newCode) {
|
4109 | const lastCode = codes.value.length ? codes.value[codes.value.length - 1] : "";
|
4110 | if (newCode !== lastCode) {
|
4111 | codes.value = [`${newCode.slice(0, 2)}0000`, `${newCode.slice(0, 4)}00`, newCode].slice(0, +props2.columnsNum);
|
4112 | }
|
4113 | } else {
|
4114 | codes.value = [];
|
4115 | }
|
4116 | }, {
|
4117 | immediate: true
|
4118 | });
|
4119 | useExpose({
|
4120 | confirm: () => {
|
4121 | var _a;
|
4122 | return (_a = picker.value) == null ? void 0 : _a.confirm();
|
4123 | },
|
4124 | getSelectedOptions: () => {
|
4125 | var _a;
|
4126 | return ((_a = picker.value) == null ? void 0 : _a.getSelectedOptions()) || [];
|
4127 | }
|
4128 | });
|
4129 | return () => vue.createVNode(Picker, vue.mergeProps({
|
4130 | "ref": picker,
|
4131 | "modelValue": codes.value,
|
4132 | "onUpdate:modelValue": ($event) => codes.value = $event,
|
4133 | "class": bem$1k(),
|
4134 | "columns": columns.value,
|
4135 | "onChange": onChange,
|
4136 | "onCancel": onCancel,
|
4137 | "onConfirm": onConfirm
|
4138 | }, pick(props2, INHERIT_PROPS)), pick(slots, INHERIT_SLOTS));
|
4139 | }
|
4140 | });
|
4141 | const Area = withInstall(stdin_default$1y);
|
4142 | const [name$1n, bem$1j] = createNamespace("cell");
|
4143 | const cellSharedProps = {
|
4144 | tag: makeStringProp("div"),
|
4145 | icon: String,
|
4146 | size: String,
|
4147 | title: numericProp,
|
4148 | value: numericProp,
|
4149 | label: numericProp,
|
4150 | center: Boolean,
|
4151 | isLink: Boolean,
|
4152 | border: truthProp,
|
4153 | iconPrefix: String,
|
4154 | valueClass: unknownProp,
|
4155 | labelClass: unknownProp,
|
4156 | titleClass: unknownProp,
|
4157 | titleStyle: null,
|
4158 | arrowDirection: String,
|
4159 | required: {
|
4160 | type: [Boolean, String],
|
4161 | default: null
|
4162 | },
|
4163 | clickable: {
|
4164 | type: Boolean,
|
4165 | default: null
|
4166 | }
|
4167 | };
|
4168 | const cellProps = extend({}, cellSharedProps, routeProps);
|
4169 | var stdin_default$1x = vue.defineComponent({
|
4170 | name: name$1n,
|
4171 | props: cellProps,
|
4172 | setup(props2, {
|
4173 | slots
|
4174 | }) {
|
4175 | const route2 = useRoute();
|
4176 | const renderLabel = () => {
|
4177 | const showLabel = slots.label || isDef(props2.label);
|
4178 | if (showLabel) {
|
4179 | return vue.createVNode("div", {
|
4180 | "class": [bem$1j("label"), props2.labelClass]
|
4181 | }, [slots.label ? slots.label() : props2.label]);
|
4182 | }
|
4183 | };
|
4184 | const renderTitle = () => {
|
4185 | var _a;
|
4186 | if (slots.title || isDef(props2.title)) {
|
4187 | const titleSlot = (_a = slots.title) == null ? void 0 : _a.call(slots);
|
4188 | if (Array.isArray(titleSlot) && titleSlot.length === 0) {
|
4189 | return;
|
4190 | }
|
4191 | return vue.createVNode("div", {
|
4192 | "class": [bem$1j("title"), props2.titleClass],
|
4193 | "style": props2.titleStyle
|
4194 | }, [titleSlot || vue.createVNode("span", null, [props2.title]), renderLabel()]);
|
4195 | }
|
4196 | };
|
4197 | const renderValue = () => {
|
4198 | const slot = slots.value || slots.default;
|
4199 | const hasValue = slot || isDef(props2.value);
|
4200 | if (hasValue) {
|
4201 | return vue.createVNode("div", {
|
4202 | "class": [bem$1j("value"), props2.valueClass]
|
4203 | }, [slot ? slot() : vue.createVNode("span", null, [props2.value])]);
|
4204 | }
|
4205 | };
|
4206 | const renderLeftIcon = () => {
|
4207 | if (slots.icon) {
|
4208 | return slots.icon();
|
4209 | }
|
4210 | if (props2.icon) {
|
4211 | return vue.createVNode(Icon, {
|
4212 | "name": props2.icon,
|
4213 | "class": bem$1j("left-icon"),
|
4214 | "classPrefix": props2.iconPrefix
|
4215 | }, null);
|
4216 | }
|
4217 | };
|
4218 | const renderRightIcon = () => {
|
4219 | if (slots["right-icon"]) {
|
4220 | return slots["right-icon"]();
|
4221 | }
|
4222 | if (props2.isLink) {
|
4223 | const name2 = props2.arrowDirection && props2.arrowDirection !== "right" ? `arrow-${props2.arrowDirection}` : "arrow";
|
4224 | return vue.createVNode(Icon, {
|
4225 | "name": name2,
|
4226 | "class": bem$1j("right-icon")
|
4227 | }, null);
|
4228 | }
|
4229 | };
|
4230 | return () => {
|
4231 | var _a;
|
4232 | const {
|
4233 | tag,
|
4234 | size,
|
4235 | center,
|
4236 | border,
|
4237 | isLink,
|
4238 | required
|
4239 | } = props2;
|
4240 | const clickable = (_a = props2.clickable) != null ? _a : isLink;
|
4241 | const classes = {
|
4242 | center,
|
4243 | required: !!required,
|
4244 | clickable,
|
4245 | borderless: !border
|
4246 | };
|
4247 | if (size) {
|
4248 | classes[size] = !!size;
|
4249 | }
|
4250 | return vue.createVNode(tag, {
|
4251 | "class": bem$1j(classes),
|
4252 | "role": clickable ? "button" : void 0,
|
4253 | "tabindex": clickable ? 0 : void 0,
|
4254 | "onClick": route2
|
4255 | }, {
|
4256 | default: () => {
|
4257 | var _a2;
|
4258 | return [renderLeftIcon(), renderTitle(), renderValue(), renderRightIcon(), (_a2 = slots.extra) == null ? void 0 : _a2.call(slots)];
|
4259 | }
|
4260 | });
|
4261 | };
|
4262 | }
|
4263 | });
|
4264 | const Cell = withInstall(stdin_default$1x);
|
4265 | const [name$1m, bem$1i] = createNamespace("form");
|
4266 | const formProps = {
|
4267 | colon: Boolean,
|
4268 | disabled: Boolean,
|
4269 | readonly: Boolean,
|
4270 | required: [Boolean, String],
|
4271 | showError: Boolean,
|
4272 | labelWidth: numericProp,
|
4273 | labelAlign: String,
|
4274 | inputAlign: String,
|
4275 | scrollToError: Boolean,
|
4276 | validateFirst: Boolean,
|
4277 | submitOnEnter: truthProp,
|
4278 | showErrorMessage: truthProp,
|
4279 | errorMessageAlign: String,
|
4280 | validateTrigger: {
|
4281 | type: [String, Array],
|
4282 | default: "onBlur"
|
4283 | }
|
4284 | };
|
4285 | var stdin_default$1w = vue.defineComponent({
|
4286 | name: name$1m,
|
4287 | props: formProps,
|
4288 | emits: ["submit", "failed"],
|
4289 | setup(props2, {
|
4290 | emit,
|
4291 | slots
|
4292 | }) {
|
4293 | const {
|
4294 | children,
|
4295 | linkChildren
|
4296 | } = useChildren(FORM_KEY);
|
4297 | const getFieldsByNames = (names) => {
|
4298 | if (names) {
|
4299 | return children.filter((field) => names.includes(field.name));
|
4300 | }
|
4301 | return children;
|
4302 | };
|
4303 | const validateSeq = (names) => new Promise((resolve, reject) => {
|
4304 | const errors = [];
|
4305 | const fields = getFieldsByNames(names);
|
4306 | fields.reduce((promise, field) => promise.then(() => {
|
4307 | if (!errors.length) {
|
4308 | return field.validate().then((error) => {
|
4309 | if (error) {
|
4310 | errors.push(error);
|
4311 | }
|
4312 | });
|
4313 | }
|
4314 | }), Promise.resolve()).then(() => {
|
4315 | if (errors.length) {
|
4316 | reject(errors);
|
4317 | } else {
|
4318 | resolve();
|
4319 | }
|
4320 | });
|
4321 | });
|
4322 | const validateAll = (names) => new Promise((resolve, reject) => {
|
4323 | const fields = getFieldsByNames(names);
|
4324 | Promise.all(fields.map((item) => item.validate())).then((errors) => {
|
4325 | errors = errors.filter(Boolean);
|
4326 | if (errors.length) {
|
4327 | reject(errors);
|
4328 | } else {
|
4329 | resolve();
|
4330 | }
|
4331 | });
|
4332 | });
|
4333 | const validateField = (name2) => {
|
4334 | const matched = children.find((item) => item.name === name2);
|
4335 | if (matched) {
|
4336 | return new Promise((resolve, reject) => {
|
4337 | matched.validate().then((error) => {
|
4338 | if (error) {
|
4339 | reject(error);
|
4340 | } else {
|
4341 | resolve();
|
4342 | }
|
4343 | });
|
4344 | });
|
4345 | }
|
4346 | return Promise.reject();
|
4347 | };
|
4348 | const validate = (name2) => {
|
4349 | if (typeof name2 === "string") {
|
4350 | return validateField(name2);
|
4351 | }
|
4352 | return props2.validateFirst ? validateSeq(name2) : validateAll(name2);
|
4353 | };
|
4354 | const resetValidation = (name2) => {
|
4355 | if (typeof name2 === "string") {
|
4356 | name2 = [name2];
|
4357 | }
|
4358 | const fields = getFieldsByNames(name2);
|
4359 | fields.forEach((item) => {
|
4360 | item.resetValidation();
|
4361 | });
|
4362 | };
|
4363 | const getValidationStatus = () => children.reduce((form, field) => {
|
4364 | form[field.name] = field.getValidationStatus();
|
4365 | return form;
|
4366 | }, {});
|
4367 | const scrollToField = (name2, options) => {
|
4368 | children.some((item) => {
|
4369 | if (item.name === name2) {
|
4370 | item.$el.scrollIntoView(options);
|
4371 | return true;
|
4372 | }
|
4373 | return false;
|
4374 | });
|
4375 | };
|
4376 | const getValues = () => children.reduce((form, field) => {
|
4377 | if (field.name !== void 0) {
|
4378 | form[field.name] = field.formValue.value;
|
4379 | }
|
4380 | return form;
|
4381 | }, {});
|
4382 | const submit = () => {
|
4383 | const values = getValues();
|
4384 | validate().then(() => emit("submit", values)).catch((errors) => {
|
4385 | emit("failed", {
|
4386 | values,
|
4387 | errors
|
4388 | });
|
4389 | if (props2.scrollToError && errors[0].name) {
|
4390 | scrollToField(errors[0].name);
|
4391 | }
|
4392 | });
|
4393 | };
|
4394 | const onSubmit = (event) => {
|
4395 | preventDefault(event);
|
4396 | submit();
|
4397 | };
|
4398 | linkChildren({
|
4399 | props: props2
|
4400 | });
|
4401 | useExpose({
|
4402 | submit,
|
4403 | validate,
|
4404 | getValues,
|
4405 | scrollToField,
|
4406 | resetValidation,
|
4407 | getValidationStatus
|
4408 | });
|
4409 | return () => {
|
4410 | var _a;
|
4411 | return vue.createVNode("form", {
|
4412 | "class": bem$1i(),
|
4413 | "onSubmit": onSubmit
|
4414 | }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
4415 | };
|
4416 | }
|
4417 | });
|
4418 | const Form = withInstall(stdin_default$1w);
|
4419 | function isEmptyValue(value) {
|
4420 | if (Array.isArray(value)) {
|
4421 | return !value.length;
|
4422 | }
|
4423 | if (value === 0) {
|
4424 | return false;
|
4425 | }
|
4426 | return !value;
|
4427 | }
|
4428 | function runSyncRule(value, rule) {
|
4429 | if (isEmptyValue(value)) {
|
4430 | if (rule.required) {
|
4431 | return false;
|
4432 | }
|
4433 | if (rule.validateEmpty === false) {
|
4434 | return true;
|
4435 | }
|
4436 | }
|
4437 | if (rule.pattern && !rule.pattern.test(String(value))) {
|
4438 | return false;
|
4439 | }
|
4440 | return true;
|
4441 | }
|
4442 | function runRuleValidator(value, rule) {
|
4443 | return new Promise((resolve) => {
|
4444 | const returnVal = rule.validator(value, rule);
|
4445 | if (isPromise(returnVal)) {
|
4446 | returnVal.then(resolve);
|
4447 | return;
|
4448 | }
|
4449 | resolve(returnVal);
|
4450 | });
|
4451 | }
|
4452 | function getRuleMessage(value, rule) {
|
4453 | const { message } = rule;
|
4454 | if (isFunction(message)) {
|
4455 | return message(value, rule);
|
4456 | }
|
4457 | return message || "";
|
4458 | }
|
4459 | function startComposing({ target }) {
|
4460 | target.composing = true;
|
4461 | }
|
4462 | function endComposing({ target }) {
|
4463 | if (target.composing) {
|
4464 | target.composing = false;
|
4465 | target.dispatchEvent(new Event("input"));
|
4466 | }
|
4467 | }
|
4468 | function resizeTextarea(input, autosize) {
|
4469 | const scrollTop = getRootScrollTop();
|
4470 | input.style.height = "auto";
|
4471 | let height2 = input.scrollHeight;
|
4472 | if (isObject$1(autosize)) {
|
4473 | const { maxHeight, minHeight } = autosize;
|
4474 | if (maxHeight !== void 0) {
|
4475 | height2 = Math.min(height2, maxHeight);
|
4476 | }
|
4477 | if (minHeight !== void 0) {
|
4478 | height2 = Math.max(height2, minHeight);
|
4479 | }
|
4480 | }
|
4481 | if (height2) {
|
4482 | input.style.height = `${height2}px`;
|
4483 | setRootScrollTop(scrollTop);
|
4484 | }
|
4485 | }
|
4486 | function mapInputType(type) {
|
4487 | if (type === "number") {
|
4488 | return {
|
4489 | type: "text",
|
4490 | inputmode: "decimal"
|
4491 | };
|
4492 | }
|
4493 | if (type === "digit") {
|
4494 | return {
|
4495 | type: "tel",
|
4496 | inputmode: "numeric"
|
4497 | };
|
4498 | }
|
4499 | return { type };
|
4500 | }
|
4501 | function getStringLength(str) {
|
4502 | return [...str].length;
|
4503 | }
|
4504 | function cutString(str, maxlength) {
|
4505 | return [...str].slice(0, maxlength).join("");
|
4506 | }
|
4507 | const [name$1l, bem$1h] = createNamespace("field");
|
4508 | const fieldSharedProps = {
|
4509 | id: String,
|
4510 | name: String,
|
4511 | leftIcon: String,
|
4512 | rightIcon: String,
|
4513 | autofocus: Boolean,
|
4514 | clearable: Boolean,
|
4515 | maxlength: numericProp,
|
4516 | formatter: Function,
|
4517 | clearIcon: makeStringProp("clear"),
|
4518 | modelValue: makeNumericProp(""),
|
4519 | inputAlign: String,
|
4520 | placeholder: String,
|
4521 | autocomplete: String,
|
4522 | autocapitalize: String,
|
4523 | autocorrect: String,
|
4524 | errorMessage: String,
|
4525 | enterkeyhint: String,
|
4526 | clearTrigger: makeStringProp("focus"),
|
4527 | formatTrigger: makeStringProp("onChange"),
|
4528 | spellcheck: {
|
4529 | type: Boolean,
|
4530 | default: null
|
4531 | },
|
4532 | error: {
|
4533 | type: Boolean,
|
4534 | default: null
|
4535 | },
|
4536 | disabled: {
|
4537 | type: Boolean,
|
4538 | default: null
|
4539 | },
|
4540 | readonly: {
|
4541 | type: Boolean,
|
4542 | default: null
|
4543 | }
|
4544 | };
|
4545 | const fieldProps = extend({}, cellSharedProps, fieldSharedProps, {
|
4546 | rows: numericProp,
|
4547 | type: makeStringProp("text"),
|
4548 | rules: Array,
|
4549 | autosize: [Boolean, Object],
|
4550 | labelWidth: numericProp,
|
4551 | labelClass: unknownProp,
|
4552 | labelAlign: String,
|
4553 | showWordLimit: Boolean,
|
4554 | errorMessageAlign: String,
|
4555 | colon: {
|
4556 | type: Boolean,
|
4557 | default: null
|
4558 | }
|
4559 | });
|
4560 | var stdin_default$1v = vue.defineComponent({
|
4561 | name: name$1l,
|
4562 | props: fieldProps,
|
4563 | emits: ["blur", "focus", "clear", "keypress", "clickInput", "endValidate", "startValidate", "clickLeftIcon", "clickRightIcon", "update:modelValue"],
|
4564 | setup(props2, {
|
4565 | emit,
|
4566 | slots
|
4567 | }) {
|
4568 | const id = useId();
|
4569 | const state = vue.reactive({
|
4570 | status: "unvalidated",
|
4571 | focused: false,
|
4572 | validateMessage: ""
|
4573 | });
|
4574 | const inputRef = vue.ref();
|
4575 | const clearIconRef = vue.ref();
|
4576 | const customValue = vue.ref();
|
4577 | const {
|
4578 | parent: form
|
4579 | } = useParent(FORM_KEY);
|
4580 | const getModelValue = () => {
|
4581 | var _a;
|
4582 | return String((_a = props2.modelValue) != null ? _a : "");
|
4583 | };
|
4584 | const getProp = (key) => {
|
4585 | if (isDef(props2[key])) {
|
4586 | return props2[key];
|
4587 | }
|
4588 | if (form && isDef(form.props[key])) {
|
4589 | return form.props[key];
|
4590 | }
|
4591 | };
|
4592 | const showClear = vue.computed(() => {
|
4593 | const readonly = getProp("readonly");
|
4594 | if (props2.clearable && !readonly) {
|
4595 | const hasValue = getModelValue() !== "";
|
4596 | const trigger = props2.clearTrigger === "always" || props2.clearTrigger === "focus" && state.focused;
|
4597 | return hasValue && trigger;
|
4598 | }
|
4599 | return false;
|
4600 | });
|
4601 | const formValue = vue.computed(() => {
|
4602 | if (customValue.value && slots.input) {
|
4603 | return customValue.value();
|
4604 | }
|
4605 | return props2.modelValue;
|
4606 | });
|
4607 | const showRequiredMark = vue.computed(() => {
|
4608 | var _a;
|
4609 | const required = getProp("required");
|
4610 | if (required === "auto") {
|
4611 | return (_a = props2.rules) == null ? void 0 : _a.some((rule) => rule.required);
|
4612 | }
|
4613 | return required;
|
4614 | });
|
4615 | const runRules = (rules) => rules.reduce((promise, rule) => promise.then(() => {
|
4616 | if (state.status === "failed") {
|
4617 | return;
|
4618 | }
|
4619 | let {
|
4620 | value
|
4621 | } = formValue;
|
4622 | if (rule.formatter) {
|
4623 | value = rule.formatter(value, rule);
|
4624 | }
|
4625 | if (!runSyncRule(value, rule)) {
|
4626 | state.status = "failed";
|
4627 | state.validateMessage = getRuleMessage(value, rule);
|
4628 | return;
|
4629 | }
|
4630 | if (rule.validator) {
|
4631 | if (isEmptyValue(value) && rule.validateEmpty === false) {
|
4632 | return;
|
4633 | }
|
4634 | return runRuleValidator(value, rule).then((result) => {
|
4635 | if (result && typeof result === "string") {
|
4636 | state.status = "failed";
|
4637 | state.validateMessage = result;
|
4638 | } else if (result === false) {
|
4639 | state.status = "failed";
|
4640 | state.validateMessage = getRuleMessage(value, rule);
|
4641 | }
|
4642 | });
|
4643 | }
|
4644 | }), Promise.resolve());
|
4645 | const resetValidation = () => {
|
4646 | state.status = "unvalidated";
|
4647 | state.validateMessage = "";
|
4648 | };
|
4649 | const endValidate = () => emit("endValidate", {
|
4650 | status: state.status,
|
4651 | message: state.validateMessage
|
4652 | });
|
4653 | const validate = (rules = props2.rules) => new Promise((resolve) => {
|
4654 | resetValidation();
|
4655 | if (rules) {
|
4656 | emit("startValidate");
|
4657 | runRules(rules).then(() => {
|
4658 | if (state.status === "failed") {
|
4659 | resolve({
|
4660 | name: props2.name,
|
4661 | message: state.validateMessage
|
4662 | });
|
4663 | endValidate();
|
4664 | } else {
|
4665 | state.status = "passed";
|
4666 | resolve();
|
4667 | endValidate();
|
4668 | }
|
4669 | });
|
4670 | } else {
|
4671 | resolve();
|
4672 | }
|
4673 | });
|
4674 | const validateWithTrigger = (trigger) => {
|
4675 | if (form && props2.rules) {
|
4676 | const {
|
4677 | validateTrigger
|
4678 | } = form.props;
|
4679 | const defaultTrigger = toArray(validateTrigger).includes(trigger);
|
4680 | const rules = props2.rules.filter((rule) => {
|
4681 | if (rule.trigger) {
|
4682 | return toArray(rule.trigger).includes(trigger);
|
4683 | }
|
4684 | return defaultTrigger;
|
4685 | });
|
4686 | if (rules.length) {
|
4687 | validate(rules);
|
4688 | }
|
4689 | }
|
4690 | };
|
4691 | const limitValueLength = (value) => {
|
4692 | var _a;
|
4693 | const {
|
4694 | maxlength
|
4695 | } = props2;
|
4696 | if (isDef(maxlength) && getStringLength(value) > +maxlength) {
|
4697 | const modelValue = getModelValue();
|
4698 | if (modelValue && getStringLength(modelValue) === +maxlength) {
|
4699 | return modelValue;
|
4700 | }
|
4701 | const selectionEnd = (_a = inputRef.value) == null ? void 0 : _a.selectionEnd;
|
4702 | if (state.focused && selectionEnd) {
|
4703 | const valueArr = [...value];
|
4704 | const exceededLength = valueArr.length - +maxlength;
|
4705 | valueArr.splice(selectionEnd - exceededLength, exceededLength);
|
4706 | return valueArr.join("");
|
4707 | }
|
4708 | return cutString(value, +maxlength);
|
4709 | }
|
4710 | return value;
|
4711 | };
|
4712 | const updateValue = (value, trigger = "onChange") => {
|
4713 | const originalValue = value;
|
4714 | value = limitValueLength(value);
|
4715 | const limitDiffLen = getStringLength(originalValue) - getStringLength(value);
|
4716 | if (props2.type === "number" || props2.type === "digit") {
|
4717 | const isNumber = props2.type === "number";
|
4718 | value = formatNumber(value, isNumber, isNumber);
|
4719 | }
|
4720 | let formatterDiffLen = 0;
|
4721 | if (props2.formatter && trigger === props2.formatTrigger) {
|
4722 | const {
|
4723 | formatter,
|
4724 | maxlength
|
4725 | } = props2;
|
4726 | value = formatter(value);
|
4727 | if (isDef(maxlength) && getStringLength(value) > +maxlength) {
|
4728 | value = cutString(value, +maxlength);
|
4729 | }
|
4730 | if (inputRef.value && state.focused) {
|
4731 | const {
|
4732 | selectionEnd
|
4733 | } = inputRef.value;
|
4734 | const bcoVal = cutString(originalValue, selectionEnd);
|
4735 | formatterDiffLen = getStringLength(formatter(bcoVal)) - getStringLength(bcoVal);
|
4736 | }
|
4737 | }
|
4738 | if (inputRef.value && inputRef.value.value !== value) {
|
4739 | if (state.focused) {
|
4740 | let {
|
4741 | selectionStart,
|
4742 | selectionEnd
|
4743 | } = inputRef.value;
|
4744 | inputRef.value.value = value;
|
4745 | if (isDef(selectionStart) && isDef(selectionEnd)) {
|
4746 | const valueLen = getStringLength(value);
|
4747 | if (limitDiffLen) {
|
4748 | selectionStart -= limitDiffLen;
|
4749 | selectionEnd -= limitDiffLen;
|
4750 | } else if (formatterDiffLen) {
|
4751 | selectionStart += formatterDiffLen;
|
4752 | selectionEnd += formatterDiffLen;
|
4753 | }
|
4754 | inputRef.value.setSelectionRange(Math.min(selectionStart, valueLen), Math.min(selectionEnd, valueLen));
|
4755 | }
|
4756 | } else {
|
4757 | inputRef.value.value = value;
|
4758 | }
|
4759 | }
|
4760 | if (value !== props2.modelValue) {
|
4761 | emit("update:modelValue", value);
|
4762 | }
|
4763 | };
|
4764 | const onInput = (event) => {
|
4765 | if (!event.target.composing) {
|
4766 | updateValue(event.target.value);
|
4767 | }
|
4768 | };
|
4769 | const blur = () => {
|
4770 | var _a;
|
4771 | return (_a = inputRef.value) == null ? void 0 : _a.blur();
|
4772 | };
|
4773 | const focus = () => {
|
4774 | var _a;
|
4775 | return (_a = inputRef.value) == null ? void 0 : _a.focus();
|
4776 | };
|
4777 | const adjustTextareaSize = () => {
|
4778 | const input = inputRef.value;
|
4779 | if (props2.type === "textarea" && props2.autosize && input) {
|
4780 | resizeTextarea(input, props2.autosize);
|
4781 | }
|
4782 | };
|
4783 | const onFocus = (event) => {
|
4784 | state.focused = true;
|
4785 | emit("focus", event);
|
4786 | vue.nextTick(adjustTextareaSize);
|
4787 | if (getProp("readonly")) {
|
4788 | blur();
|
4789 | }
|
4790 | };
|
4791 | const onBlur = (event) => {
|
4792 | state.focused = false;
|
4793 | updateValue(getModelValue(), "onBlur");
|
4794 | emit("blur", event);
|
4795 | if (getProp("readonly")) {
|
4796 | return;
|
4797 | }
|
4798 | validateWithTrigger("onBlur");
|
4799 | vue.nextTick(adjustTextareaSize);
|
4800 | resetScroll();
|
4801 | };
|
4802 | const onClickInput = (event) => emit("clickInput", event);
|
4803 | const onClickLeftIcon = (event) => emit("clickLeftIcon", event);
|
4804 | const onClickRightIcon = (event) => emit("clickRightIcon", event);
|
4805 | const onClear = (event) => {
|
4806 | preventDefault(event);
|
4807 | emit("update:modelValue", "");
|
4808 | emit("clear", event);
|
4809 | };
|
4810 | const showError = vue.computed(() => {
|
4811 | if (typeof props2.error === "boolean") {
|
4812 | return props2.error;
|
4813 | }
|
4814 | if (form && form.props.showError && state.status === "failed") {
|
4815 | return true;
|
4816 | }
|
4817 | });
|
4818 | const labelStyle = vue.computed(() => {
|
4819 | const labelWidth = getProp("labelWidth");
|
4820 | const labelAlign = getProp("labelAlign");
|
4821 | if (labelWidth && labelAlign !== "top") {
|
4822 | return {
|
4823 | width: addUnit(labelWidth)
|
4824 | };
|
4825 | }
|
4826 | });
|
4827 | const onKeypress = (event) => {
|
4828 | const ENTER_CODE = 13;
|
4829 | if (event.keyCode === ENTER_CODE) {
|
4830 | const submitOnEnter = form && form.props.submitOnEnter;
|
4831 | if (!submitOnEnter && props2.type !== "textarea") {
|
4832 | preventDefault(event);
|
4833 | }
|
4834 | if (props2.type === "search") {
|
4835 | blur();
|
4836 | }
|
4837 | }
|
4838 | emit("keypress", event);
|
4839 | };
|
4840 | const getInputId = () => props2.id || `${id}-input`;
|
4841 | const getValidationStatus = () => state.status;
|
4842 | const renderInput = () => {
|
4843 | const controlClass = bem$1h("control", [getProp("inputAlign"), {
|
4844 | error: showError.value,
|
4845 | custom: !!slots.input,
|
4846 | "min-height": props2.type === "textarea" && !props2.autosize
|
4847 | }]);
|
4848 | if (slots.input) {
|
4849 | return vue.createVNode("div", {
|
4850 | "class": controlClass,
|
4851 | "onClick": onClickInput
|
4852 | }, [slots.input()]);
|
4853 | }
|
4854 | const inputAttrs = {
|
4855 | id: getInputId(),
|
4856 | ref: inputRef,
|
4857 | name: props2.name,
|
4858 | rows: props2.rows !== void 0 ? +props2.rows : void 0,
|
4859 | class: controlClass,
|
4860 | disabled: getProp("disabled"),
|
4861 | readonly: getProp("readonly"),
|
4862 | autofocus: props2.autofocus,
|
4863 | placeholder: props2.placeholder,
|
4864 | autocomplete: props2.autocomplete,
|
4865 | autocapitalize: props2.autocapitalize,
|
4866 | autocorrect: props2.autocorrect,
|
4867 | enterkeyhint: props2.enterkeyhint,
|
4868 | spellcheck: props2.spellcheck,
|
4869 | "aria-labelledby": props2.label ? `${id}-label` : void 0,
|
4870 | onBlur,
|
4871 | onFocus,
|
4872 | onInput,
|
4873 | onClick: onClickInput,
|
4874 | onChange: endComposing,
|
4875 | onKeypress,
|
4876 | onCompositionend: endComposing,
|
4877 | onCompositionstart: startComposing
|
4878 | };
|
4879 | if (props2.type === "textarea") {
|
4880 | return vue.createVNode("textarea", inputAttrs, null);
|
4881 | }
|
4882 | return vue.createVNode("input", vue.mergeProps(mapInputType(props2.type), inputAttrs), null);
|
4883 | };
|
4884 | const renderLeftIcon = () => {
|
4885 | const leftIconSlot = slots["left-icon"];
|
4886 | if (props2.leftIcon || leftIconSlot) {
|
4887 | return vue.createVNode("div", {
|
4888 | "class": bem$1h("left-icon"),
|
4889 | "onClick": onClickLeftIcon
|
4890 | }, [leftIconSlot ? leftIconSlot() : vue.createVNode(Icon, {
|
4891 | "name": props2.leftIcon,
|
4892 | "classPrefix": props2.iconPrefix
|
4893 | }, null)]);
|
4894 | }
|
4895 | };
|
4896 | const renderRightIcon = () => {
|
4897 | const rightIconSlot = slots["right-icon"];
|
4898 | if (props2.rightIcon || rightIconSlot) {
|
4899 | return vue.createVNode("div", {
|
4900 | "class": bem$1h("right-icon"),
|
4901 | "onClick": onClickRightIcon
|
4902 | }, [rightIconSlot ? rightIconSlot() : vue.createVNode(Icon, {
|
4903 | "name": props2.rightIcon,
|
4904 | "classPrefix": props2.iconPrefix
|
4905 | }, null)]);
|
4906 | }
|
4907 | };
|
4908 | const renderWordLimit = () => {
|
4909 | if (props2.showWordLimit && props2.maxlength) {
|
4910 | const count = getStringLength(getModelValue());
|
4911 | return vue.createVNode("div", {
|
4912 | "class": bem$1h("word-limit")
|
4913 | }, [vue.createVNode("span", {
|
4914 | "class": bem$1h("word-num")
|
4915 | }, [count]), vue.createTextVNode("/"), props2.maxlength]);
|
4916 | }
|
4917 | };
|
4918 | const renderMessage = () => {
|
4919 | if (form && form.props.showErrorMessage === false) {
|
4920 | return;
|
4921 | }
|
4922 | const message = props2.errorMessage || state.validateMessage;
|
4923 | if (message) {
|
4924 | const slot = slots["error-message"];
|
4925 | const errorMessageAlign = getProp("errorMessageAlign");
|
4926 | return vue.createVNode("div", {
|
4927 | "class": bem$1h("error-message", errorMessageAlign)
|
4928 | }, [slot ? slot({
|
4929 | message
|
4930 | }) : message]);
|
4931 | }
|
4932 | };
|
4933 | const renderLabel = () => {
|
4934 | const labelWidth = getProp("labelWidth");
|
4935 | const labelAlign = getProp("labelAlign");
|
4936 | const colon = getProp("colon") ? ":" : "";
|
4937 | if (slots.label) {
|
4938 | return [slots.label(), colon];
|
4939 | }
|
4940 | if (props2.label) {
|
4941 | return vue.createVNode("label", {
|
4942 | "id": `${id}-label`,
|
4943 | "for": slots.input ? void 0 : getInputId(),
|
4944 | "onClick": (event) => {
|
4945 | preventDefault(event);
|
4946 | focus();
|
4947 | },
|
4948 | "style": labelAlign === "top" && labelWidth ? {
|
4949 | width: addUnit(labelWidth)
|
4950 | } : void 0
|
4951 | }, [props2.label + colon]);
|
4952 | }
|
4953 | };
|
4954 | const renderFieldBody = () => [vue.createVNode("div", {
|
4955 | "class": bem$1h("body")
|
4956 | }, [renderInput(), showClear.value && vue.createVNode(Icon, {
|
4957 | "ref": clearIconRef,
|
4958 | "name": props2.clearIcon,
|
4959 | "class": bem$1h("clear")
|
4960 | }, null), renderRightIcon(), slots.button && vue.createVNode("div", {
|
4961 | "class": bem$1h("button")
|
4962 | }, [slots.button()])]), renderWordLimit(), renderMessage()];
|
4963 | useExpose({
|
4964 | blur,
|
4965 | focus,
|
4966 | validate,
|
4967 | formValue,
|
4968 | resetValidation,
|
4969 | getValidationStatus
|
4970 | });
|
4971 | vue.provide(CUSTOM_FIELD_INJECTION_KEY, {
|
4972 | customValue,
|
4973 | resetValidation,
|
4974 | validateWithTrigger
|
4975 | });
|
4976 | vue.watch(() => props2.modelValue, () => {
|
4977 | updateValue(getModelValue());
|
4978 | resetValidation();
|
4979 | validateWithTrigger("onChange");
|
4980 | vue.nextTick(adjustTextareaSize);
|
4981 | });
|
4982 | vue.onMounted(() => {
|
4983 | updateValue(getModelValue(), props2.formatTrigger);
|
4984 | vue.nextTick(adjustTextareaSize);
|
4985 | });
|
4986 | useEventListener("touchstart", onClear, {
|
4987 | target: vue.computed(() => {
|
4988 | var _a;
|
4989 | return (_a = clearIconRef.value) == null ? void 0 : _a.$el;
|
4990 | })
|
4991 | });
|
4992 | return () => {
|
4993 | const disabled = getProp("disabled");
|
4994 | const labelAlign = getProp("labelAlign");
|
4995 | const LeftIcon = renderLeftIcon();
|
4996 | const renderTitle = () => {
|
4997 | const Label = renderLabel();
|
4998 | if (labelAlign === "top") {
|
4999 | return [LeftIcon, Label].filter(Boolean);
|
5000 | }
|
5001 | return Label || [];
|
5002 | };
|
5003 | return vue.createVNode(Cell, {
|
5004 | "size": props2.size,
|
5005 | "class": bem$1h({
|
5006 | error: showError.value,
|
5007 | disabled,
|
5008 | [`label-${labelAlign}`]: labelAlign
|
5009 | }),
|
5010 | "center": props2.center,
|
5011 | "border": props2.border,
|
5012 | "isLink": props2.isLink,
|
5013 | "clickable": props2.clickable,
|
5014 | "titleStyle": labelStyle.value,
|
5015 | "valueClass": bem$1h("value"),
|
5016 | "titleClass": [bem$1h("label", [labelAlign, {
|
5017 | required: showRequiredMark.value
|
5018 | }]), props2.labelClass],
|
5019 | "arrowDirection": props2.arrowDirection
|
5020 | }, {
|
5021 | icon: LeftIcon && labelAlign !== "top" ? () => LeftIcon : null,
|
5022 | title: renderTitle,
|
5023 | value: renderFieldBody,
|
5024 | extra: slots.extra
|
5025 | });
|
5026 | };
|
5027 | }
|
5028 | });
|
5029 | const Field = withInstall(stdin_default$1v);
|
5030 | let lockCount = 0;
|
5031 | function lockClick(lock) {
|
5032 | if (lock) {
|
5033 | if (!lockCount) {
|
5034 | document.body.classList.add("van-toast--unclickable");
|
5035 | }
|
5036 | lockCount++;
|
5037 | } else if (lockCount) {
|
5038 | lockCount--;
|
5039 | if (!lockCount) {
|
5040 | document.body.classList.remove("van-toast--unclickable");
|
5041 | }
|
5042 | }
|
5043 | }
|
5044 | const [name$1k, bem$1g] = createNamespace("toast");
|
5045 | const popupInheritProps$1 = ["show", "overlay", "teleport", "transition", "overlayClass", "overlayStyle", "closeOnClickOverlay", "zIndex"];
|
5046 | const toastProps = {
|
5047 | icon: String,
|
5048 | show: Boolean,
|
5049 | type: makeStringProp("text"),
|
5050 | overlay: Boolean,
|
5051 | message: numericProp,
|
5052 | iconSize: numericProp,
|
5053 | duration: makeNumberProp(2e3),
|
5054 | position: makeStringProp("middle"),
|
5055 | teleport: [String, Object],
|
5056 | wordBreak: String,
|
5057 | className: unknownProp,
|
5058 | iconPrefix: String,
|
5059 | transition: makeStringProp("van-fade"),
|
5060 | loadingType: String,
|
5061 | forbidClick: Boolean,
|
5062 | overlayClass: unknownProp,
|
5063 | overlayStyle: Object,
|
5064 | closeOnClick: Boolean,
|
5065 | closeOnClickOverlay: Boolean,
|
5066 | zIndex: numericProp
|
5067 | };
|
5068 | var stdin_default$1u = vue.defineComponent({
|
5069 | name: name$1k,
|
5070 | props: toastProps,
|
5071 | emits: ["update:show"],
|
5072 | setup(props2, {
|
5073 | emit,
|
5074 | slots
|
5075 | }) {
|
5076 | let timer2;
|
5077 | let clickable = false;
|
5078 | const toggleClickable = () => {
|
5079 | const newValue = props2.show && props2.forbidClick;
|
5080 | if (clickable !== newValue) {
|
5081 | clickable = newValue;
|
5082 | lockClick(clickable);
|
5083 | }
|
5084 | };
|
5085 | const updateShow = (show) => emit("update:show", show);
|
5086 | const onClick = () => {
|
5087 | if (props2.closeOnClick) {
|
5088 | updateShow(false);
|
5089 | }
|
5090 | };
|
5091 | const clearTimer = () => clearTimeout(timer2);
|
5092 | const renderIcon = () => {
|
5093 | const {
|
5094 | icon,
|
5095 | type,
|
5096 | iconSize,
|
5097 | iconPrefix,
|
5098 | loadingType
|
5099 | } = props2;
|
5100 | const hasIcon = icon || type === "success" || type === "fail";
|
5101 | if (hasIcon) {
|
5102 | return vue.createVNode(Icon, {
|
5103 | "name": icon || type,
|
5104 | "size": iconSize,
|
5105 | "class": bem$1g("icon"),
|
5106 | "classPrefix": iconPrefix
|
5107 | }, null);
|
5108 | }
|
5109 | if (type === "loading") {
|
5110 | return vue.createVNode(Loading, {
|
5111 | "class": bem$1g("loading"),
|
5112 | "size": iconSize,
|
5113 | "type": loadingType
|
5114 | }, null);
|
5115 | }
|
5116 | };
|
5117 | const renderMessage = () => {
|
5118 | const {
|
5119 | type,
|
5120 | message
|
5121 | } = props2;
|
5122 | if (slots.message) {
|
5123 | return vue.createVNode("div", {
|
5124 | "class": bem$1g("text")
|
5125 | }, [slots.message()]);
|
5126 | }
|
5127 | if (isDef(message) && message !== "") {
|
5128 | return type === "html" ? vue.createVNode("div", {
|
5129 | "key": 0,
|
5130 | "class": bem$1g("text"),
|
5131 | "innerHTML": String(message)
|
5132 | }, null) : vue.createVNode("div", {
|
5133 | "class": bem$1g("text")
|
5134 | }, [message]);
|
5135 | }
|
5136 | };
|
5137 | vue.watch(() => [props2.show, props2.forbidClick], toggleClickable);
|
5138 | vue.watch(() => [props2.show, props2.type, props2.message, props2.duration], () => {
|
5139 | clearTimer();
|
5140 | if (props2.show && props2.duration > 0) {
|
5141 | timer2 = setTimeout(() => {
|
5142 | updateShow(false);
|
5143 | }, props2.duration);
|
5144 | }
|
5145 | });
|
5146 | vue.onMounted(toggleClickable);
|
5147 | vue.onUnmounted(toggleClickable);
|
5148 | return () => vue.createVNode(Popup, vue.mergeProps({
|
5149 | "class": [bem$1g([props2.position, props2.wordBreak === "normal" ? "break-normal" : props2.wordBreak, {
|
5150 | [props2.type]: !props2.icon
|
5151 | }]), props2.className],
|
5152 | "lockScroll": false,
|
5153 | "onClick": onClick,
|
5154 | "onClosed": clearTimer,
|
5155 | "onUpdate:show": updateShow
|
5156 | }, pick(props2, popupInheritProps$1)), {
|
5157 | default: () => [renderIcon(), renderMessage()]
|
5158 | });
|
5159 | }
|
5160 | });
|
5161 | function usePopupState() {
|
5162 | const state = vue.reactive({
|
5163 | show: false
|
5164 | });
|
5165 | const toggle = (show) => {
|
5166 | state.show = show;
|
5167 | };
|
5168 | const open = (props2) => {
|
5169 | extend(state, props2, { transitionAppear: true });
|
5170 | toggle(true);
|
5171 | };
|
5172 | const close = () => toggle(false);
|
5173 | useExpose({ open, close, toggle });
|
5174 | return {
|
5175 | open,
|
5176 | close,
|
5177 | state,
|
5178 | toggle
|
5179 | };
|
5180 | }
|
5181 | function mountComponent(RootComponent) {
|
5182 | const app = vue.createApp(RootComponent);
|
5183 | const root = document.createElement("div");
|
5184 | document.body.appendChild(root);
|
5185 | return {
|
5186 | instance: app.mount(root),
|
5187 | unmount() {
|
5188 | app.unmount();
|
5189 | document.body.removeChild(root);
|
5190 | }
|
5191 | };
|
5192 | }
|
5193 | const defaultOptions$1 = {
|
5194 | icon: "",
|
5195 | type: "text",
|
5196 | message: "",
|
5197 | className: "",
|
5198 | overlay: false,
|
5199 | onClose: void 0,
|
5200 | onOpened: void 0,
|
5201 | duration: 2e3,
|
5202 | teleport: "body",
|
5203 | iconSize: void 0,
|
5204 | iconPrefix: void 0,
|
5205 | position: "middle",
|
5206 | transition: "van-fade",
|
5207 | forbidClick: false,
|
5208 | loadingType: void 0,
|
5209 | overlayClass: "",
|
5210 | overlayStyle: void 0,
|
5211 | closeOnClick: false,
|
5212 | closeOnClickOverlay: false
|
5213 | };
|
5214 | let queue = [];
|
5215 | let allowMultiple = false;
|
5216 | let currentOptions$2 = extend({}, defaultOptions$1);
|
5217 | const defaultOptionsMap = new Map();
|
5218 | function parseOptions$1(message) {
|
5219 | if (isObject$1(message)) {
|
5220 | return message;
|
5221 | }
|
5222 | return {
|
5223 | message
|
5224 | };
|
5225 | }
|
5226 | function createInstance() {
|
5227 | const {
|
5228 | instance: instance2,
|
5229 | unmount
|
5230 | } = mountComponent({
|
5231 | setup() {
|
5232 | const message = vue.ref("");
|
5233 | const {
|
5234 | open,
|
5235 | state,
|
5236 | close,
|
5237 | toggle
|
5238 | } = usePopupState();
|
5239 | const onClosed = () => {
|
5240 | if (allowMultiple) {
|
5241 | queue = queue.filter((item) => item !== instance2);
|
5242 | unmount();
|
5243 | }
|
5244 | };
|
5245 | const render = () => {
|
5246 | const attrs = {
|
5247 | onClosed,
|
5248 | "onUpdate:show": toggle
|
5249 | };
|
5250 | return vue.createVNode(stdin_default$1u, vue.mergeProps(state, attrs), null);
|
5251 | };
|
5252 | vue.watch(message, (val) => {
|
5253 | state.message = val;
|
5254 | });
|
5255 | vue.getCurrentInstance().render = render;
|
5256 | return {
|
5257 | open,
|
5258 | close,
|
5259 | message
|
5260 | };
|
5261 | }
|
5262 | });
|
5263 | return instance2;
|
5264 | }
|
5265 | function getInstance() {
|
5266 | if (!queue.length || allowMultiple) {
|
5267 | const instance2 = createInstance();
|
5268 | queue.push(instance2);
|
5269 | }
|
5270 | return queue[queue.length - 1];
|
5271 | }
|
5272 | function showToast(options = {}) {
|
5273 | if (!inBrowser$1) {
|
5274 | return {};
|
5275 | }
|
5276 | const toast = getInstance();
|
5277 | const parsedOptions = parseOptions$1(options);
|
5278 | toast.open(extend({}, currentOptions$2, defaultOptionsMap.get(parsedOptions.type || currentOptions$2.type), parsedOptions));
|
5279 | return toast;
|
5280 | }
|
5281 | const createMethod = (type) => (options) => showToast(extend({
|
5282 | type
|
5283 | }, parseOptions$1(options)));
|
5284 | const showLoadingToast = createMethod("loading");
|
5285 | const showSuccessToast = createMethod("success");
|
5286 | const showFailToast = createMethod("fail");
|
5287 | const closeToast = (all) => {
|
5288 | var _a;
|
5289 | if (queue.length) {
|
5290 | if (all) {
|
5291 | queue.forEach((toast) => {
|
5292 | toast.close();
|
5293 | });
|
5294 | queue = [];
|
5295 | } else if (!allowMultiple) {
|
5296 | queue[0].close();
|
5297 | } else {
|
5298 | (_a = queue.shift()) == null ? void 0 : _a.close();
|
5299 | }
|
5300 | }
|
5301 | };
|
5302 | function setToastDefaultOptions(type, options) {
|
5303 | if (typeof type === "string") {
|
5304 | defaultOptionsMap.set(type, options);
|
5305 | } else {
|
5306 | extend(currentOptions$2, type);
|
5307 | }
|
5308 | }
|
5309 | const resetToastDefaultOptions = (type) => {
|
5310 | if (typeof type === "string") {
|
5311 | defaultOptionsMap.delete(type);
|
5312 | } else {
|
5313 | currentOptions$2 = extend({}, defaultOptions$1);
|
5314 | defaultOptionsMap.clear();
|
5315 | }
|
5316 | };
|
5317 | const allowMultipleToast = (value = true) => {
|
5318 | allowMultiple = value;
|
5319 | };
|
5320 | const Toast = withInstall(stdin_default$1u);
|
5321 | const [name$1j, bem$1f] = createNamespace("switch");
|
5322 | const switchProps = {
|
5323 | size: numericProp,
|
5324 | loading: Boolean,
|
5325 | disabled: Boolean,
|
5326 | modelValue: unknownProp,
|
5327 | activeColor: String,
|
5328 | inactiveColor: String,
|
5329 | activeValue: {
|
5330 | type: unknownProp,
|
5331 | default: true
|
5332 | },
|
5333 | inactiveValue: {
|
5334 | type: unknownProp,
|
5335 | default: false
|
5336 | }
|
5337 | };
|
5338 | var stdin_default$1t = vue.defineComponent({
|
5339 | name: name$1j,
|
5340 | props: switchProps,
|
5341 | emits: ["change", "update:modelValue"],
|
5342 | setup(props2, {
|
5343 | emit,
|
5344 | slots
|
5345 | }) {
|
5346 | const isChecked = () => props2.modelValue === props2.activeValue;
|
5347 | const onClick = () => {
|
5348 | if (!props2.disabled && !props2.loading) {
|
5349 | const newValue = isChecked() ? props2.inactiveValue : props2.activeValue;
|
5350 | emit("update:modelValue", newValue);
|
5351 | emit("change", newValue);
|
5352 | }
|
5353 | };
|
5354 | const renderLoading = () => {
|
5355 | if (props2.loading) {
|
5356 | const color = isChecked() ? props2.activeColor : props2.inactiveColor;
|
5357 | return vue.createVNode(Loading, {
|
5358 | "class": bem$1f("loading"),
|
5359 | "color": color
|
5360 | }, null);
|
5361 | }
|
5362 | if (slots.node) {
|
5363 | return slots.node();
|
5364 | }
|
5365 | };
|
5366 | useCustomFieldValue(() => props2.modelValue);
|
5367 | return () => {
|
5368 | var _a;
|
5369 | const {
|
5370 | size,
|
5371 | loading,
|
5372 | disabled,
|
5373 | activeColor,
|
5374 | inactiveColor
|
5375 | } = props2;
|
5376 | const checked = isChecked();
|
5377 | const style = {
|
5378 | fontSize: addUnit(size),
|
5379 | backgroundColor: checked ? activeColor : inactiveColor
|
5380 | };
|
5381 | return vue.createVNode("div", {
|
5382 | "role": "switch",
|
5383 | "class": bem$1f({
|
5384 | on: checked,
|
5385 | loading,
|
5386 | disabled
|
5387 | }),
|
5388 | "style": style,
|
5389 | "tabindex": disabled ? void 0 : 0,
|
5390 | "aria-checked": checked,
|
5391 | "onClick": onClick
|
5392 | }, [vue.createVNode("div", {
|
5393 | "class": bem$1f("node")
|
5394 | }, [renderLoading()]), (_a = slots.background) == null ? void 0 : _a.call(slots)]);
|
5395 | };
|
5396 | }
|
5397 | });
|
5398 | const Switch = withInstall(stdin_default$1t);
|
5399 | const [name$1i, bem$1e] = createNamespace("address-edit-detail");
|
5400 | const t$j = createNamespace("address-edit")[2];
|
5401 | var stdin_default$1s = vue.defineComponent({
|
5402 | name: name$1i,
|
5403 | props: {
|
5404 | show: Boolean,
|
5405 | rows: numericProp,
|
5406 | value: String,
|
5407 | rules: Array,
|
5408 | focused: Boolean,
|
5409 | maxlength: numericProp,
|
5410 | searchResult: Array,
|
5411 | showSearchResult: Boolean
|
5412 | },
|
5413 | emits: ["blur", "focus", "input", "selectSearch"],
|
5414 | setup(props2, {
|
5415 | emit
|
5416 | }) {
|
5417 | const field = vue.ref();
|
5418 | const showSearchResult = () => props2.focused && props2.searchResult && props2.showSearchResult;
|
5419 | const onSelect = (express) => {
|
5420 | emit("selectSearch", express);
|
5421 | emit("input", `${express.address || ""} ${express.name || ""}`.trim());
|
5422 | };
|
5423 | const renderSearchResult = () => {
|
5424 | if (!showSearchResult()) {
|
5425 | return;
|
5426 | }
|
5427 | const {
|
5428 | searchResult
|
5429 | } = props2;
|
5430 | return searchResult.map((express) => vue.createVNode(Cell, {
|
5431 | "clickable": true,
|
5432 | "key": (express.name || "") + (express.address || ""),
|
5433 | "icon": "location-o",
|
5434 | "title": express.name,
|
5435 | "label": express.address,
|
5436 | "class": bem$1e("search-item"),
|
5437 | "border": false,
|
5438 | "onClick": () => onSelect(express)
|
5439 | }, null));
|
5440 | };
|
5441 | const onBlur = (event) => emit("blur", event);
|
5442 | const onFocus = (event) => emit("focus", event);
|
5443 | const onInput = (value) => emit("input", value);
|
5444 | return () => {
|
5445 | if (props2.show) {
|
5446 | return vue.createVNode(vue.Fragment, null, [vue.createVNode(Field, {
|
5447 | "autosize": true,
|
5448 | "clearable": true,
|
5449 | "ref": field,
|
5450 | "class": bem$1e(),
|
5451 | "rows": props2.rows,
|
5452 | "type": "textarea",
|
5453 | "rules": props2.rules,
|
5454 | "label": t$j("addressDetail"),
|
5455 | "border": !showSearchResult(),
|
5456 | "maxlength": props2.maxlength,
|
5457 | "modelValue": props2.value,
|
5458 | "placeholder": t$j("addressDetail"),
|
5459 | "onBlur": onBlur,
|
5460 | "onFocus": onFocus,
|
5461 | "onUpdate:modelValue": onInput
|
5462 | }, null), renderSearchResult()]);
|
5463 | }
|
5464 | };
|
5465 | }
|
5466 | });
|
5467 | const [name$1h, bem$1d, t$i] = createNamespace("address-edit");
|
5468 | const DEFAULT_DATA = {
|
5469 | name: "",
|
5470 | tel: "",
|
5471 | city: "",
|
5472 | county: "",
|
5473 | country: "",
|
5474 | province: "",
|
5475 | areaCode: "",
|
5476 | isDefault: false,
|
5477 | addressDetail: ""
|
5478 | };
|
5479 | const addressEditProps = {
|
5480 | areaList: Object,
|
5481 | isSaving: Boolean,
|
5482 | isDeleting: Boolean,
|
5483 | validator: Function,
|
5484 | showArea: truthProp,
|
5485 | showDetail: truthProp,
|
5486 | showDelete: Boolean,
|
5487 | disableArea: Boolean,
|
5488 | searchResult: Array,
|
5489 | telMaxlength: numericProp,
|
5490 | showSetDefault: Boolean,
|
5491 | saveButtonText: String,
|
5492 | areaPlaceholder: String,
|
5493 | deleteButtonText: String,
|
5494 | showSearchResult: Boolean,
|
5495 | detailRows: makeNumericProp(1),
|
5496 | detailMaxlength: makeNumericProp(200),
|
5497 | areaColumnsPlaceholder: makeArrayProp(),
|
5498 | addressInfo: {
|
5499 | type: Object,
|
5500 | default: () => extend({}, DEFAULT_DATA)
|
5501 | },
|
5502 | telValidator: {
|
5503 | type: Function,
|
5504 | default: isMobile
|
5505 | }
|
5506 | };
|
5507 | var stdin_default$1r = vue.defineComponent({
|
5508 | name: name$1h,
|
5509 | props: addressEditProps,
|
5510 | emits: ["save", "focus", "change", "delete", "clickArea", "changeArea", "changeDetail", "selectSearch", "changeDefault"],
|
5511 | setup(props2, {
|
5512 | emit,
|
5513 | slots
|
5514 | }) {
|
5515 | const areaRef = vue.ref();
|
5516 | const data = vue.reactive({});
|
5517 | const showAreaPopup = vue.ref(false);
|
5518 | const detailFocused = vue.ref(false);
|
5519 | const areaListLoaded = vue.computed(() => isObject$1(props2.areaList) && Object.keys(props2.areaList).length);
|
5520 | const areaText = vue.computed(() => {
|
5521 | const {
|
5522 | province,
|
5523 | city,
|
5524 | county,
|
5525 | areaCode
|
5526 | } = data;
|
5527 | if (areaCode) {
|
5528 | const arr = [province, city, county];
|
5529 | if (province && province === city) {
|
5530 | arr.splice(1, 1);
|
5531 | }
|
5532 | return arr.filter(Boolean).join("/");
|
5533 | }
|
5534 | return "";
|
5535 | });
|
5536 | const hideBottomFields = vue.computed(() => {
|
5537 | var _a;
|
5538 | return ((_a = props2.searchResult) == null ? void 0 : _a.length) && detailFocused.value;
|
5539 | });
|
5540 | const onFocus = (key) => {
|
5541 | detailFocused.value = key === "addressDetail";
|
5542 | emit("focus", key);
|
5543 | };
|
5544 | const onChange = (key, value) => {
|
5545 | emit("change", {
|
5546 | key,
|
5547 | value
|
5548 | });
|
5549 | };
|
5550 | const rules = vue.computed(() => {
|
5551 | const {
|
5552 | validator,
|
5553 | telValidator
|
5554 | } = props2;
|
5555 | const makeRule = (name2, emptyMessage) => ({
|
5556 | validator: (value) => {
|
5557 | if (validator) {
|
5558 | const message = validator(name2, value);
|
5559 | if (message) {
|
5560 | return message;
|
5561 | }
|
5562 | }
|
5563 | if (!value) {
|
5564 | return emptyMessage;
|
5565 | }
|
5566 | return true;
|
5567 | }
|
5568 | });
|
5569 | return {
|
5570 | name: [makeRule("name", t$i("nameEmpty"))],
|
5571 | tel: [makeRule("tel", t$i("telInvalid")), {
|
5572 | validator: telValidator,
|
5573 | message: t$i("telInvalid")
|
5574 | }],
|
5575 | areaCode: [makeRule("areaCode", t$i("areaEmpty"))],
|
5576 | addressDetail: [makeRule("addressDetail", t$i("addressEmpty"))]
|
5577 | };
|
5578 | });
|
5579 | const onSave = () => emit("save", data);
|
5580 | const onChangeDetail = (val) => {
|
5581 | data.addressDetail = val;
|
5582 | emit("changeDetail", val);
|
5583 | };
|
5584 | const assignAreaText = (options) => {
|
5585 | data.province = options[0].text;
|
5586 | data.city = options[1].text;
|
5587 | data.county = options[2].text;
|
5588 | };
|
5589 | const onAreaConfirm = ({
|
5590 | selectedValues,
|
5591 | selectedOptions
|
5592 | }) => {
|
5593 | if (selectedValues.some((value) => value === AREA_EMPTY_CODE)) {
|
5594 | showToast(t$i("areaEmpty"));
|
5595 | } else {
|
5596 | showAreaPopup.value = false;
|
5597 | assignAreaText(selectedOptions);
|
5598 | emit("changeArea", selectedOptions);
|
5599 | }
|
5600 | };
|
5601 | const onDelete = () => emit("delete", data);
|
5602 | const setAreaCode = (code) => {
|
5603 | data.areaCode = code || "";
|
5604 | };
|
5605 | const onDetailBlur = () => {
|
5606 | setTimeout(() => {
|
5607 | detailFocused.value = false;
|
5608 | });
|
5609 | };
|
5610 | const setAddressDetail = (value) => {
|
5611 | data.addressDetail = value;
|
5612 | };
|
5613 | const renderSetDefaultCell = () => {
|
5614 | if (props2.showSetDefault) {
|
5615 | const slots2 = {
|
5616 | "right-icon": () => vue.createVNode(Switch, {
|
5617 | "modelValue": data.isDefault,
|
5618 | "onUpdate:modelValue": ($event) => data.isDefault = $event,
|
5619 | "onChange": (event) => emit("changeDefault", event)
|
5620 | }, null)
|
5621 | };
|
5622 | return vue.withDirectives(vue.createVNode(Cell, {
|
5623 | "center": true,
|
5624 | "border": false,
|
5625 | "title": t$i("defaultAddress"),
|
5626 | "class": bem$1d("default")
|
5627 | }, slots2), [[vue.vShow, !hideBottomFields.value]]);
|
5628 | }
|
5629 | };
|
5630 | useExpose({
|
5631 | setAreaCode,
|
5632 | setAddressDetail
|
5633 | });
|
5634 | vue.watch(() => props2.addressInfo, (value) => {
|
5635 | extend(data, DEFAULT_DATA, value);
|
5636 | vue.nextTick(() => {
|
5637 | var _a;
|
5638 | const options = (_a = areaRef.value) == null ? void 0 : _a.getSelectedOptions();
|
5639 | if (options && options.every((option) => option && option.value !== AREA_EMPTY_CODE)) {
|
5640 | assignAreaText(options);
|
5641 | }
|
5642 | });
|
5643 | }, {
|
5644 | deep: true,
|
5645 | immediate: true
|
5646 | });
|
5647 | return () => {
|
5648 | const {
|
5649 | disableArea
|
5650 | } = props2;
|
5651 | return vue.createVNode(Form, {
|
5652 | "class": bem$1d(),
|
5653 | "onSubmit": onSave
|
5654 | }, {
|
5655 | default: () => {
|
5656 | var _a;
|
5657 | return [vue.createVNode("div", {
|
5658 | "class": bem$1d("fields")
|
5659 | }, [vue.createVNode(Field, {
|
5660 | "modelValue": data.name,
|
5661 | "onUpdate:modelValue": [($event) => data.name = $event, (val) => onChange("name", val)],
|
5662 | "clearable": true,
|
5663 | "label": t$i("name"),
|
5664 | "rules": rules.value.name,
|
5665 | "placeholder": t$i("name"),
|
5666 | "onFocus": () => onFocus("name")
|
5667 | }, null), vue.createVNode(Field, {
|
5668 | "modelValue": data.tel,
|
5669 | "onUpdate:modelValue": [($event) => data.tel = $event, (val) => onChange("tel", val)],
|
5670 | "clearable": true,
|
5671 | "type": "tel",
|
5672 | "label": t$i("tel"),
|
5673 | "rules": rules.value.tel,
|
5674 | "maxlength": props2.telMaxlength,
|
5675 | "placeholder": t$i("tel"),
|
5676 | "onFocus": () => onFocus("tel")
|
5677 | }, null), vue.withDirectives(vue.createVNode(Field, {
|
5678 | "readonly": true,
|
5679 | "label": t$i("area"),
|
5680 | "is-link": !disableArea,
|
5681 | "modelValue": areaText.value,
|
5682 | "rules": props2.showArea ? rules.value.areaCode : void 0,
|
5683 | "placeholder": props2.areaPlaceholder || t$i("area"),
|
5684 | "onFocus": () => onFocus("areaCode"),
|
5685 | "onClick": () => {
|
5686 | emit("clickArea");
|
5687 | showAreaPopup.value = !disableArea;
|
5688 | }
|
5689 | }, null), [[vue.vShow, props2.showArea]]), vue.createVNode(stdin_default$1s, {
|
5690 | "show": props2.showDetail,
|
5691 | "rows": props2.detailRows,
|
5692 | "rules": rules.value.addressDetail,
|
5693 | "value": data.addressDetail,
|
5694 | "focused": detailFocused.value,
|
5695 | "maxlength": props2.detailMaxlength,
|
5696 | "searchResult": props2.searchResult,
|
5697 | "showSearchResult": props2.showSearchResult,
|
5698 | "onBlur": onDetailBlur,
|
5699 | "onFocus": () => onFocus("addressDetail"),
|
5700 | "onInput": onChangeDetail,
|
5701 | "onSelectSearch": (event) => emit("selectSearch", event)
|
5702 | }, null), (_a = slots.default) == null ? void 0 : _a.call(slots)]), renderSetDefaultCell(), vue.withDirectives(vue.createVNode("div", {
|
5703 | "class": bem$1d("buttons")
|
5704 | }, [vue.createVNode(Button, {
|
5705 | "block": true,
|
5706 | "round": true,
|
5707 | "type": "primary",
|
5708 | "text": props2.saveButtonText || t$i("save"),
|
5709 | "class": bem$1d("button"),
|
5710 | "loading": props2.isSaving,
|
5711 | "nativeType": "submit"
|
5712 | }, null), props2.showDelete && vue.createVNode(Button, {
|
5713 | "block": true,
|
5714 | "round": true,
|
5715 | "class": bem$1d("button"),
|
5716 | "loading": props2.isDeleting,
|
5717 | "text": props2.deleteButtonText || t$i("delete"),
|
5718 | "onClick": onDelete
|
5719 | }, null)]), [[vue.vShow, !hideBottomFields.value]]), vue.createVNode(Popup, {
|
5720 | "show": showAreaPopup.value,
|
5721 | "onUpdate:show": ($event) => showAreaPopup.value = $event,
|
5722 | "round": true,
|
5723 | "teleport": "body",
|
5724 | "position": "bottom",
|
5725 | "lazyRender": false
|
5726 | }, {
|
5727 | default: () => [vue.createVNode(Area, {
|
5728 | "modelValue": data.areaCode,
|
5729 | "onUpdate:modelValue": ($event) => data.areaCode = $event,
|
5730 | "ref": areaRef,
|
5731 | "loading": !areaListLoaded.value,
|
5732 | "areaList": props2.areaList,
|
5733 | "columnsPlaceholder": props2.areaColumnsPlaceholder,
|
5734 | "onConfirm": onAreaConfirm,
|
5735 | "onCancel": () => {
|
5736 | showAreaPopup.value = false;
|
5737 | }
|
5738 | }, null)]
|
5739 | })];
|
5740 | }
|
5741 | });
|
5742 | };
|
5743 | }
|
5744 | });
|
5745 | const AddressEdit = withInstall(stdin_default$1r);
|
5746 | const [name$1g, bem$1c] = createNamespace("radio-group");
|
5747 | const radioGroupProps = {
|
5748 | shape: String,
|
5749 | disabled: Boolean,
|
5750 | iconSize: numericProp,
|
5751 | direction: String,
|
5752 | modelValue: unknownProp,
|
5753 | checkedColor: String
|
5754 | };
|
5755 | const RADIO_KEY = Symbol(name$1g);
|
5756 | var stdin_default$1q = vue.defineComponent({
|
5757 | name: name$1g,
|
5758 | props: radioGroupProps,
|
5759 | emits: ["change", "update:modelValue"],
|
5760 | setup(props2, {
|
5761 | emit,
|
5762 | slots
|
5763 | }) {
|
5764 | const {
|
5765 | linkChildren
|
5766 | } = useChildren(RADIO_KEY);
|
5767 | const updateValue = (value) => emit("update:modelValue", value);
|
5768 | vue.watch(() => props2.modelValue, (value) => emit("change", value));
|
5769 | linkChildren({
|
5770 | props: props2,
|
5771 | updateValue
|
5772 | });
|
5773 | useCustomFieldValue(() => props2.modelValue);
|
5774 | return () => {
|
5775 | var _a;
|
5776 | return vue.createVNode("div", {
|
5777 | "class": bem$1c([props2.direction]),
|
5778 | "role": "radiogroup"
|
5779 | }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
5780 | };
|
5781 | }
|
5782 | });
|
5783 | const RadioGroup = withInstall(stdin_default$1q);
|
5784 | const [name$1f, bem$1b] = createNamespace("tag");
|
5785 | const tagProps = {
|
5786 | size: String,
|
5787 | mark: Boolean,
|
5788 | show: truthProp,
|
5789 | type: makeStringProp("default"),
|
5790 | color: String,
|
5791 | plain: Boolean,
|
5792 | round: Boolean,
|
5793 | textColor: String,
|
5794 | closeable: Boolean
|
5795 | };
|
5796 | var stdin_default$1p = vue.defineComponent({
|
5797 | name: name$1f,
|
5798 | props: tagProps,
|
5799 | emits: ["close"],
|
5800 | setup(props2, {
|
5801 | slots,
|
5802 | emit
|
5803 | }) {
|
5804 | const onClose = (event) => {
|
5805 | event.stopPropagation();
|
5806 | emit("close", event);
|
5807 | };
|
5808 | const getStyle = () => {
|
5809 | if (props2.plain) {
|
5810 | return {
|
5811 | color: props2.textColor || props2.color,
|
5812 | borderColor: props2.color
|
5813 | };
|
5814 | }
|
5815 | return {
|
5816 | color: props2.textColor,
|
5817 | background: props2.color
|
5818 | };
|
5819 | };
|
5820 | const renderTag = () => {
|
5821 | var _a;
|
5822 | const {
|
5823 | type,
|
5824 | mark,
|
5825 | plain,
|
5826 | round: round2,
|
5827 | size,
|
5828 | closeable
|
5829 | } = props2;
|
5830 | const classes = {
|
5831 | mark,
|
5832 | plain,
|
5833 | round: round2
|
5834 | };
|
5835 | if (size) {
|
5836 | classes[size] = size;
|
5837 | }
|
5838 | const CloseIcon = closeable && vue.createVNode(Icon, {
|
5839 | "name": "cross",
|
5840 | "class": [bem$1b("close"), HAPTICS_FEEDBACK],
|
5841 | "onClick": onClose
|
5842 | }, null);
|
5843 | return vue.createVNode("span", {
|
5844 | "style": getStyle(),
|
5845 | "class": bem$1b([classes, type])
|
5846 | }, [(_a = slots.default) == null ? void 0 : _a.call(slots), CloseIcon]);
|
5847 | };
|
5848 | return () => vue.createVNode(vue.Transition, {
|
5849 | "name": props2.closeable ? "van-fade" : void 0
|
5850 | }, {
|
5851 | default: () => [props2.show ? renderTag() : null]
|
5852 | });
|
5853 | }
|
5854 | });
|
5855 | const Tag = withInstall(stdin_default$1p);
|
5856 | const checkerProps = {
|
5857 | name: unknownProp,
|
5858 | disabled: Boolean,
|
5859 | iconSize: numericProp,
|
5860 | modelValue: unknownProp,
|
5861 | checkedColor: String,
|
5862 | labelPosition: String,
|
5863 | labelDisabled: Boolean
|
5864 | };
|
5865 | var stdin_default$1o = vue.defineComponent({
|
5866 | props: extend({}, checkerProps, {
|
5867 | bem: makeRequiredProp(Function),
|
5868 | role: String,
|
5869 | shape: String,
|
5870 | parent: Object,
|
5871 | checked: Boolean,
|
5872 | bindGroup: truthProp,
|
5873 | indeterminate: {
|
5874 | type: Boolean,
|
5875 | default: null
|
5876 | }
|
5877 | }),
|
5878 | emits: ["click", "toggle"],
|
5879 | setup(props2, {
|
5880 | emit,
|
5881 | slots
|
5882 | }) {
|
5883 | const iconRef = vue.ref();
|
5884 | const getParentProp = (name2) => {
|
5885 | if (props2.parent && props2.bindGroup) {
|
5886 | return props2.parent.props[name2];
|
5887 | }
|
5888 | };
|
5889 | const disabled = vue.computed(() => {
|
5890 | if (props2.parent && props2.bindGroup) {
|
5891 | const disabled2 = getParentProp("disabled") || props2.disabled;
|
5892 | if (props2.role === "checkbox") {
|
5893 | const checkedCount = getParentProp("modelValue").length;
|
5894 | const max = getParentProp("max");
|
5895 | const overlimit = max && checkedCount >= +max;
|
5896 | return disabled2 || overlimit && !props2.checked;
|
5897 | }
|
5898 | return disabled2;
|
5899 | }
|
5900 | return props2.disabled;
|
5901 | });
|
5902 | const direction = vue.computed(() => getParentProp("direction"));
|
5903 | const iconStyle = vue.computed(() => {
|
5904 | const checkedColor = props2.checkedColor || getParentProp("checkedColor");
|
5905 | if (checkedColor && props2.checked && !disabled.value) {
|
5906 | return {
|
5907 | borderColor: checkedColor,
|
5908 | backgroundColor: checkedColor
|
5909 | };
|
5910 | }
|
5911 | });
|
5912 | const shape = vue.computed(() => {
|
5913 | return props2.shape || getParentProp("shape") || "round";
|
5914 | });
|
5915 | const onClick = (event) => {
|
5916 | const {
|
5917 | target
|
5918 | } = event;
|
5919 | const icon = iconRef.value;
|
5920 | const iconClicked = icon === target || (icon == null ? void 0 : icon.contains(target));
|
5921 | if (!disabled.value && (iconClicked || !props2.labelDisabled)) {
|
5922 | emit("toggle");
|
5923 | }
|
5924 | emit("click", event);
|
5925 | };
|
5926 | const renderIcon = () => {
|
5927 | var _a, _b;
|
5928 | const {
|
5929 | bem: bem2,
|
5930 | checked,
|
5931 | indeterminate
|
5932 | } = props2;
|
5933 | const iconSize = props2.iconSize || getParentProp("iconSize");
|
5934 | return vue.createVNode("div", {
|
5935 | "ref": iconRef,
|
5936 | "class": bem2("icon", [shape.value, {
|
5937 | disabled: disabled.value,
|
5938 | checked,
|
5939 | indeterminate
|
5940 | }]),
|
5941 | "style": shape.value !== "dot" ? {
|
5942 | fontSize: addUnit(iconSize)
|
5943 | } : {
|
5944 | width: addUnit(iconSize),
|
5945 | height: addUnit(iconSize),
|
5946 | borderColor: (_a = iconStyle.value) == null ? void 0 : _a.borderColor
|
5947 | }
|
5948 | }, [slots.icon ? slots.icon({
|
5949 | checked,
|
5950 | disabled: disabled.value
|
5951 | }) : shape.value !== "dot" ? vue.createVNode(Icon, {
|
5952 | "name": indeterminate ? "minus" : "success",
|
5953 | "style": iconStyle.value
|
5954 | }, null) : vue.createVNode("div", {
|
5955 | "class": bem2("icon--dot__icon"),
|
5956 | "style": {
|
5957 | backgroundColor: (_b = iconStyle.value) == null ? void 0 : _b.backgroundColor
|
5958 | }
|
5959 | }, null)]);
|
5960 | };
|
5961 | const renderLabel = () => {
|
5962 | const {
|
5963 | checked
|
5964 | } = props2;
|
5965 | if (slots.default) {
|
5966 | return vue.createVNode("span", {
|
5967 | "class": props2.bem("label", [props2.labelPosition, {
|
5968 | disabled: disabled.value
|
5969 | }])
|
5970 | }, [slots.default({
|
5971 | checked,
|
5972 | disabled: disabled.value
|
5973 | })]);
|
5974 | }
|
5975 | };
|
5976 | return () => {
|
5977 | const nodes = props2.labelPosition === "left" ? [renderLabel(), renderIcon()] : [renderIcon(), renderLabel()];
|
5978 | return vue.createVNode("div", {
|
5979 | "role": props2.role,
|
5980 | "class": props2.bem([{
|
5981 | disabled: disabled.value,
|
5982 | "label-disabled": props2.labelDisabled
|
5983 | }, direction.value]),
|
5984 | "tabindex": disabled.value ? void 0 : 0,
|
5985 | "aria-checked": props2.checked,
|
5986 | "onClick": onClick
|
5987 | }, [nodes]);
|
5988 | };
|
5989 | }
|
5990 | });
|
5991 | const radioProps = extend({}, checkerProps, {
|
5992 | shape: String
|
5993 | });
|
5994 | const [name$1e, bem$1a] = createNamespace("radio");
|
5995 | var stdin_default$1n = vue.defineComponent({
|
5996 | name: name$1e,
|
5997 | props: radioProps,
|
5998 | emits: ["update:modelValue"],
|
5999 | setup(props2, {
|
6000 | emit,
|
6001 | slots
|
6002 | }) {
|
6003 | const {
|
6004 | parent
|
6005 | } = useParent(RADIO_KEY);
|
6006 | const checked = () => {
|
6007 | const value = parent ? parent.props.modelValue : props2.modelValue;
|
6008 | return value === props2.name;
|
6009 | };
|
6010 | const toggle = () => {
|
6011 | if (parent) {
|
6012 | parent.updateValue(props2.name);
|
6013 | } else {
|
6014 | emit("update:modelValue", props2.name);
|
6015 | }
|
6016 | };
|
6017 | return () => vue.createVNode(stdin_default$1o, vue.mergeProps({
|
6018 | "bem": bem$1a,
|
6019 | "role": "radio",
|
6020 | "parent": parent,
|
6021 | "checked": checked(),
|
6022 | "onToggle": toggle
|
6023 | }, props2), pick(slots, ["default", "icon"]));
|
6024 | }
|
6025 | });
|
6026 | const Radio = withInstall(stdin_default$1n);
|
6027 | const [name$1d, bem$19] = createNamespace("address-item");
|
6028 | var stdin_default$1m = vue.defineComponent({
|
6029 | name: name$1d,
|
6030 | props: {
|
6031 | address: makeRequiredProp(Object),
|
6032 | disabled: Boolean,
|
6033 | switchable: Boolean,
|
6034 | defaultTagText: String,
|
6035 | rightIcon: makeStringProp("edit")
|
6036 | },
|
6037 | emits: ["edit", "click", "select"],
|
6038 | setup(props2, {
|
6039 | slots,
|
6040 | emit
|
6041 | }) {
|
6042 | const onClick = () => {
|
6043 | if (props2.switchable) {
|
6044 | emit("select");
|
6045 | }
|
6046 | emit("click");
|
6047 | };
|
6048 | const renderRightIcon = () => vue.createVNode(Icon, {
|
6049 | "name": props2.rightIcon,
|
6050 | "class": bem$19("edit"),
|
6051 | "onClick": (event) => {
|
6052 | event.stopPropagation();
|
6053 | emit("edit");
|
6054 | emit("click");
|
6055 | }
|
6056 | }, null);
|
6057 | const renderTag = () => {
|
6058 | if (slots.tag) {
|
6059 | return slots.tag(props2.address);
|
6060 | }
|
6061 | if (props2.address.isDefault && props2.defaultTagText) {
|
6062 | return vue.createVNode(Tag, {
|
6063 | "type": "primary",
|
6064 | "round": true,
|
6065 | "class": bem$19("tag")
|
6066 | }, {
|
6067 | default: () => [props2.defaultTagText]
|
6068 | });
|
6069 | }
|
6070 | };
|
6071 | const renderContent = () => {
|
6072 | const {
|
6073 | address,
|
6074 | disabled,
|
6075 | switchable
|
6076 | } = props2;
|
6077 | const Info = [vue.createVNode("div", {
|
6078 | "class": bem$19("name")
|
6079 | }, [`${address.name} ${address.tel}`, renderTag()]), vue.createVNode("div", {
|
6080 | "class": bem$19("address")
|
6081 | }, [address.address])];
|
6082 | if (switchable && !disabled) {
|
6083 | return vue.createVNode(Radio, {
|
6084 | "name": address.id,
|
6085 | "iconSize": 18
|
6086 | }, {
|
6087 | default: () => [Info]
|
6088 | });
|
6089 | }
|
6090 | return Info;
|
6091 | };
|
6092 | return () => {
|
6093 | var _a;
|
6094 | const {
|
6095 | disabled
|
6096 | } = props2;
|
6097 | return vue.createVNode("div", {
|
6098 | "class": bem$19({
|
6099 | disabled
|
6100 | }),
|
6101 | "onClick": onClick
|
6102 | }, [vue.createVNode(Cell, {
|
6103 | "border": false,
|
6104 | "titleClass": bem$19("title")
|
6105 | }, {
|
6106 | title: renderContent,
|
6107 | "right-icon": renderRightIcon
|
6108 | }), (_a = slots.bottom) == null ? void 0 : _a.call(slots, extend({}, props2.address, {
|
6109 | disabled
|
6110 | }))]);
|
6111 | };
|
6112 | }
|
6113 | });
|
6114 | const [name$1c, bem$18, t$h] = createNamespace("address-list");
|
6115 | const addressListProps = {
|
6116 | list: makeArrayProp(),
|
6117 | modelValue: numericProp,
|
6118 | switchable: truthProp,
|
6119 | disabledText: String,
|
6120 | disabledList: makeArrayProp(),
|
6121 | showAddButton: truthProp,
|
6122 | addButtonText: String,
|
6123 | defaultTagText: String,
|
6124 | rightIcon: makeStringProp("edit")
|
6125 | };
|
6126 | var stdin_default$1l = vue.defineComponent({
|
6127 | name: name$1c,
|
6128 | props: addressListProps,
|
6129 | emits: ["add", "edit", "select", "clickItem", "editDisabled", "selectDisabled", "update:modelValue"],
|
6130 | setup(props2, {
|
6131 | slots,
|
6132 | emit
|
6133 | }) {
|
6134 | const renderItem = (item, index, disabled) => {
|
6135 | const onEdit = () => emit(disabled ? "editDisabled" : "edit", item, index);
|
6136 | const onClick = () => emit("clickItem", item, index);
|
6137 | const onSelect = () => {
|
6138 | emit(disabled ? "selectDisabled" : "select", item, index);
|
6139 | if (!disabled) {
|
6140 | emit("update:modelValue", item.id);
|
6141 | }
|
6142 | };
|
6143 | return vue.createVNode(stdin_default$1m, {
|
6144 | "key": item.id,
|
6145 | "address": item,
|
6146 | "disabled": disabled,
|
6147 | "switchable": props2.switchable,
|
6148 | "defaultTagText": props2.defaultTagText,
|
6149 | "rightIcon": props2.rightIcon,
|
6150 | "onEdit": onEdit,
|
6151 | "onClick": onClick,
|
6152 | "onSelect": onSelect
|
6153 | }, {
|
6154 | bottom: slots["item-bottom"],
|
6155 | tag: slots.tag
|
6156 | });
|
6157 | };
|
6158 | const renderList = (list, disabled) => {
|
6159 | if (list) {
|
6160 | return list.map((item, index) => renderItem(item, index, disabled));
|
6161 | }
|
6162 | };
|
6163 | const renderBottom = () => props2.showAddButton ? vue.createVNode("div", {
|
6164 | "class": [bem$18("bottom"), "van-safe-area-bottom"]
|
6165 | }, [vue.createVNode(Button, {
|
6166 | "round": true,
|
6167 | "block": true,
|
6168 | "type": "primary",
|
6169 | "text": props2.addButtonText || t$h("add"),
|
6170 | "class": bem$18("add"),
|
6171 | "onClick": () => emit("add")
|
6172 | }, null)]) : void 0;
|
6173 | return () => {
|
6174 | var _a, _b;
|
6175 | const List2 = renderList(props2.list);
|
6176 | const DisabledList = renderList(props2.disabledList, true);
|
6177 | const DisabledText = props2.disabledText && vue.createVNode("div", {
|
6178 | "class": bem$18("disabled-text")
|
6179 | }, [props2.disabledText]);
|
6180 | return vue.createVNode("div", {
|
6181 | "class": bem$18()
|
6182 | }, [(_a = slots.top) == null ? void 0 : _a.call(slots), vue.createVNode(RadioGroup, {
|
6183 | "modelValue": props2.modelValue
|
6184 | }, {
|
6185 | default: () => [List2]
|
6186 | }), DisabledText, DisabledList, (_b = slots.default) == null ? void 0 : _b.call(slots), renderBottom()]);
|
6187 | };
|
6188 | }
|
6189 | });
|
6190 | const AddressList = withInstall(stdin_default$1l);
|
6191 | const hasIntersectionObserver = inBrowser && "IntersectionObserver" in window && "IntersectionObserverEntry" in window && "intersectionRatio" in window.IntersectionObserverEntry.prototype;
|
6192 | const modeType = {
|
6193 | event: "event",
|
6194 | observer: "observer"
|
6195 | };
|
6196 | function remove(arr, item) {
|
6197 | if (!arr.length)
|
6198 | return;
|
6199 | const index = arr.indexOf(item);
|
6200 | if (index > -1)
|
6201 | return arr.splice(index, 1);
|
6202 | }
|
6203 | function getBestSelectionFromSrcset(el, scale) {
|
6204 | if (el.tagName !== "IMG" || !el.getAttribute("data-srcset"))
|
6205 | return;
|
6206 | let options = el.getAttribute("data-srcset");
|
6207 | const container = el.parentNode;
|
6208 | const containerWidth = container.offsetWidth * scale;
|
6209 | let spaceIndex;
|
6210 | let tmpSrc;
|
6211 | let tmpWidth;
|
6212 | options = options.trim().split(",");
|
6213 | const result = options.map((item) => {
|
6214 | item = item.trim();
|
6215 | spaceIndex = item.lastIndexOf(" ");
|
6216 | if (spaceIndex === -1) {
|
6217 | tmpSrc = item;
|
6218 | tmpWidth = 999998;
|
6219 | } else {
|
6220 | tmpSrc = item.substr(0, spaceIndex);
|
6221 | tmpWidth = parseInt(
|
6222 | item.substr(spaceIndex + 1, item.length - spaceIndex - 2),
|
6223 | 10
|
6224 | );
|
6225 | }
|
6226 | return [tmpWidth, tmpSrc];
|
6227 | });
|
6228 | result.sort((a, b) => {
|
6229 | if (a[0] < b[0]) {
|
6230 | return 1;
|
6231 | }
|
6232 | if (a[0] > b[0]) {
|
6233 | return -1;
|
6234 | }
|
6235 | if (a[0] === b[0]) {
|
6236 | if (b[1].indexOf(".webp", b[1].length - 5) !== -1) {
|
6237 | return 1;
|
6238 | }
|
6239 | if (a[1].indexOf(".webp", a[1].length - 5) !== -1) {
|
6240 | return -1;
|
6241 | }
|
6242 | }
|
6243 | return 0;
|
6244 | });
|
6245 | let bestSelectedSrc = "";
|
6246 | let tmpOption;
|
6247 | for (let i = 0; i < result.length; i++) {
|
6248 | tmpOption = result[i];
|
6249 | bestSelectedSrc = tmpOption[1];
|
6250 | const next = result[i + 1];
|
6251 | if (next && next[0] < containerWidth) {
|
6252 | bestSelectedSrc = tmpOption[1];
|
6253 | break;
|
6254 | } else if (!next) {
|
6255 | bestSelectedSrc = tmpOption[1];
|
6256 | break;
|
6257 | }
|
6258 | }
|
6259 | return bestSelectedSrc;
|
6260 | }
|
6261 | const getDPR = (scale = 1) => inBrowser ? window.devicePixelRatio || scale : scale;
|
6262 | function supportWebp() {
|
6263 | if (!inBrowser)
|
6264 | return false;
|
6265 | let support = true;
|
6266 | try {
|
6267 | const elem = document.createElement("canvas");
|
6268 | if (elem.getContext && elem.getContext("2d")) {
|
6269 | support = elem.toDataURL("image/webp").indexOf("data:image/webp") === 0;
|
6270 | }
|
6271 | } catch (err) {
|
6272 | support = false;
|
6273 | }
|
6274 | return support;
|
6275 | }
|
6276 | function throttle(action, delay) {
|
6277 | let timeout = null;
|
6278 | let lastRun = 0;
|
6279 | return function(...args) {
|
6280 | if (timeout) {
|
6281 | return;
|
6282 | }
|
6283 | const elapsed = Date.now() - lastRun;
|
6284 | const runCallback = () => {
|
6285 | lastRun = Date.now();
|
6286 | timeout = false;
|
6287 | action.apply(this, args);
|
6288 | };
|
6289 | if (elapsed >= delay) {
|
6290 | runCallback();
|
6291 | } else {
|
6292 | timeout = setTimeout(runCallback, delay);
|
6293 | }
|
6294 | };
|
6295 | }
|
6296 | function on(el, type, func) {
|
6297 | el.addEventListener(type, func, {
|
6298 | capture: false,
|
6299 | passive: true
|
6300 | });
|
6301 | }
|
6302 | function off(el, type, func) {
|
6303 | el.removeEventListener(type, func, false);
|
6304 | }
|
6305 | const loadImageAsync = (item, resolve, reject) => {
|
6306 | const image = new Image();
|
6307 | if (!item || !item.src) {
|
6308 | return reject(new Error("image src is required"));
|
6309 | }
|
6310 | image.src = item.src;
|
6311 | if (item.cors) {
|
6312 | image.crossOrigin = item.cors;
|
6313 | }
|
6314 | image.onload = () => resolve({
|
6315 | naturalHeight: image.naturalHeight,
|
6316 | naturalWidth: image.naturalWidth,
|
6317 | src: image.src
|
6318 | });
|
6319 | image.onerror = (e) => reject(e);
|
6320 | };
|
6321 | class ImageCache {
|
6322 | constructor({ max }) {
|
6323 | this.options = {
|
6324 | max: max || 100
|
6325 | };
|
6326 | this.caches = [];
|
6327 | }
|
6328 | has(key) {
|
6329 | return this.caches.indexOf(key) > -1;
|
6330 | }
|
6331 | add(key) {
|
6332 | if (this.has(key))
|
6333 | return;
|
6334 | this.caches.push(key);
|
6335 | if (this.caches.length > this.options.max) {
|
6336 | this.free();
|
6337 | }
|
6338 | }
|
6339 | free() {
|
6340 | this.caches.shift();
|
6341 | }
|
6342 | }
|
6343 | const [name$1b, bem$17] = createNamespace("back-top");
|
6344 | const backTopProps = {
|
6345 | right: numericProp,
|
6346 | bottom: numericProp,
|
6347 | zIndex: numericProp,
|
6348 | target: [String, Object],
|
6349 | offset: makeNumericProp(200),
|
6350 | immediate: Boolean,
|
6351 | teleport: {
|
6352 | type: [String, Object],
|
6353 | default: "body"
|
6354 | }
|
6355 | };
|
6356 | var stdin_default$1k = vue.defineComponent({
|
6357 | name: name$1b,
|
6358 | inheritAttrs: false,
|
6359 | props: backTopProps,
|
6360 | emits: ["click"],
|
6361 | setup(props2, {
|
6362 | emit,
|
6363 | slots,
|
6364 | attrs
|
6365 | }) {
|
6366 | let shouldReshow = false;
|
6367 | const show = vue.ref(false);
|
6368 | const root = vue.ref();
|
6369 | const scrollParent = vue.ref();
|
6370 | const style = vue.computed(() => extend(getZIndexStyle(props2.zIndex), {
|
6371 | right: addUnit(props2.right),
|
6372 | bottom: addUnit(props2.bottom)
|
6373 | }));
|
6374 | const onClick = (event) => {
|
6375 | var _a;
|
6376 | emit("click", event);
|
6377 | (_a = scrollParent.value) == null ? void 0 : _a.scrollTo({
|
6378 | top: 0,
|
6379 | behavior: props2.immediate ? "auto" : "smooth"
|
6380 | });
|
6381 | };
|
6382 | const scroll = () => {
|
6383 | show.value = scrollParent.value ? getScrollTop(scrollParent.value) >= +props2.offset : false;
|
6384 | };
|
6385 | const getTarget = () => {
|
6386 | const {
|
6387 | target
|
6388 | } = props2;
|
6389 | if (typeof target === "string") {
|
6390 | const el = document.querySelector(target);
|
6391 | if (el) {
|
6392 | return el;
|
6393 | }
|
6394 | } else {
|
6395 | return target;
|
6396 | }
|
6397 | };
|
6398 | const updateTarget = () => {
|
6399 | if (inBrowser$1) {
|
6400 | vue.nextTick(() => {
|
6401 | scrollParent.value = props2.target ? getTarget() : getScrollParent$1(root.value);
|
6402 | scroll();
|
6403 | });
|
6404 | }
|
6405 | };
|
6406 | useEventListener("scroll", throttle(scroll, 100), {
|
6407 | target: scrollParent
|
6408 | });
|
6409 | vue.onMounted(updateTarget);
|
6410 | vue.onActivated(() => {
|
6411 | if (shouldReshow) {
|
6412 | show.value = true;
|
6413 | shouldReshow = false;
|
6414 | }
|
6415 | });
|
6416 | vue.onDeactivated(() => {
|
6417 | if (show.value && props2.teleport) {
|
6418 | show.value = false;
|
6419 | shouldReshow = true;
|
6420 | }
|
6421 | });
|
6422 | vue.watch(() => props2.target, updateTarget);
|
6423 | return () => {
|
6424 | const Content = vue.createVNode("div", vue.mergeProps({
|
6425 | "ref": !props2.teleport ? root : void 0,
|
6426 | "class": bem$17({
|
6427 | active: show.value
|
6428 | }),
|
6429 | "style": style.value,
|
6430 | "onClick": onClick
|
6431 | }, attrs), [slots.default ? slots.default() : vue.createVNode(Icon, {
|
6432 | "name": "back-top",
|
6433 | "class": bem$17("icon")
|
6434 | }, null)]);
|
6435 | if (props2.teleport) {
|
6436 | return [vue.createVNode("div", {
|
6437 | "ref": root,
|
6438 | "class": bem$17("placeholder")
|
6439 | }, null), vue.createVNode(vue.Teleport, {
|
6440 | "to": props2.teleport
|
6441 | }, {
|
6442 | default: () => [Content]
|
6443 | })];
|
6444 | }
|
6445 | return Content;
|
6446 | };
|
6447 | }
|
6448 | });
|
6449 | const BackTop = withInstall(stdin_default$1k);
|
6450 | var __async = (__this, __arguments, generator) => {
|
6451 | return new Promise((resolve, reject) => {
|
6452 | var fulfilled = (value) => {
|
6453 | try {
|
6454 | step(generator.next(value));
|
6455 | } catch (e) {
|
6456 | reject(e);
|
6457 | }
|
6458 | };
|
6459 | var rejected = (value) => {
|
6460 | try {
|
6461 | step(generator.throw(value));
|
6462 | } catch (e) {
|
6463 | reject(e);
|
6464 | }
|
6465 | };
|
6466 | var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
6467 | step((generator = generator.apply(__this, __arguments)).next());
|
6468 | });
|
6469 | };
|
6470 | const barrageProps = {
|
6471 | top: makeNumericProp(10),
|
6472 | rows: makeNumericProp(4),
|
6473 | duration: makeNumericProp(4e3),
|
6474 | autoPlay: truthProp,
|
6475 | delay: makeNumberProp(300),
|
6476 | modelValue: makeArrayProp()
|
6477 | };
|
6478 | const [name$1a, bem$16] = createNamespace("barrage");
|
6479 | var stdin_default$1j = vue.defineComponent({
|
6480 | name: name$1a,
|
6481 | props: barrageProps,
|
6482 | emits: ["update:modelValue"],
|
6483 | setup(props2, {
|
6484 | emit,
|
6485 | slots
|
6486 | }) {
|
6487 | const barrageWrapper = vue.ref();
|
6488 | const className = bem$16("item");
|
6489 | const total = vue.ref(0);
|
6490 | const barrageItems = [];
|
6491 | const createBarrageItem = (text, delay = props2.delay) => {
|
6492 | const item = document.createElement("span");
|
6493 | item.className = className;
|
6494 | item.innerText = String(text);
|
6495 | item.style.animationDuration = `${props2.duration}ms`;
|
6496 | item.style.animationDelay = `${delay}ms`;
|
6497 | item.style.animationName = "van-barrage";
|
6498 | item.style.animationTimingFunction = "linear";
|
6499 | return item;
|
6500 | };
|
6501 | const isInitBarrage = vue.ref(true);
|
6502 | const isPlay = vue.ref(props2.autoPlay);
|
6503 | const appendBarrageItem = ({
|
6504 | id,
|
6505 | text
|
6506 | }, i) => {
|
6507 | var _a;
|
6508 | const item = createBarrageItem(text, isInitBarrage.value ? i * props2.delay : void 0);
|
6509 | if (!props2.autoPlay && isPlay.value === false) {
|
6510 | item.style.animationPlayState = "paused";
|
6511 | }
|
6512 | (_a = barrageWrapper.value) == null ? void 0 : _a.append(item);
|
6513 | total.value++;
|
6514 | const top2 = (total.value - 1) % +props2.rows * item.offsetHeight + +props2.top;
|
6515 | item.style.top = `${top2}px`;
|
6516 | item.dataset.id = String(id);
|
6517 | barrageItems.push(item);
|
6518 | item.addEventListener("animationend", () => {
|
6519 | emit("update:modelValue", [...props2.modelValue].filter((v) => String(v.id) !== item.dataset.id));
|
6520 | });
|
6521 | };
|
6522 | const updateBarrages = (newValue, oldValue) => {
|
6523 | const map = new Map(oldValue.map((item) => [item.id, item]));
|
6524 | newValue.forEach((item, i) => {
|
6525 | if (map.has(item.id)) {
|
6526 | map.delete(item.id);
|
6527 | } else {
|
6528 | appendBarrageItem(item, i);
|
6529 | }
|
6530 | });
|
6531 | map.forEach((item) => {
|
6532 | const index = barrageItems.findIndex((span) => span.dataset.id === String(item.id));
|
6533 | if (index > -1) {
|
6534 | barrageItems[index].remove();
|
6535 | barrageItems.splice(index, 1);
|
6536 | }
|
6537 | });
|
6538 | isInitBarrage.value = false;
|
6539 | };
|
6540 | vue.watch(() => props2.modelValue.slice(), (newValue, oldValue) => updateBarrages(newValue != null ? newValue : [], oldValue != null ? oldValue : []), {
|
6541 | deep: true
|
6542 | });
|
6543 | const rootStyle = vue.ref({});
|
6544 | vue.onMounted(() => __async(this, null, function* () {
|
6545 | var _a;
|
6546 | rootStyle.value["--move-distance"] = `-${(_a = barrageWrapper.value) == null ? void 0 : _a.offsetWidth}px`;
|
6547 | yield vue.nextTick();
|
6548 | updateBarrages(props2.modelValue, []);
|
6549 | }));
|
6550 | const play = () => {
|
6551 | isPlay.value = true;
|
6552 | barrageItems.forEach((item) => {
|
6553 | item.style.animationPlayState = "running";
|
6554 | });
|
6555 | };
|
6556 | const pause = () => {
|
6557 | isPlay.value = false;
|
6558 | barrageItems.forEach((item) => {
|
6559 | item.style.animationPlayState = "paused";
|
6560 | });
|
6561 | };
|
6562 | useExpose({
|
6563 | play,
|
6564 | pause
|
6565 | });
|
6566 | return () => {
|
6567 | var _a;
|
6568 | return vue.createVNode("div", {
|
6569 | "class": bem$16(),
|
6570 | "ref": barrageWrapper,
|
6571 | "style": rootStyle.value
|
6572 | }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
6573 | };
|
6574 | }
|
6575 | });
|
6576 | const Barrage = withInstall(stdin_default$1j);
|
6577 | const [name$19, bem$15, t$g] = createNamespace("calendar");
|
6578 | const formatMonthTitle = (date) => t$g("monthTitle", date.getFullYear(), date.getMonth() + 1);
|
6579 | function compareMonth(date1, date2) {
|
6580 | const year1 = date1.getFullYear();
|
6581 | const year2 = date2.getFullYear();
|
6582 | if (year1 === year2) {
|
6583 | const month1 = date1.getMonth();
|
6584 | const month2 = date2.getMonth();
|
6585 | return month1 === month2 ? 0 : month1 > month2 ? 1 : -1;
|
6586 | }
|
6587 | return year1 > year2 ? 1 : -1;
|
6588 | }
|
6589 | function compareDay(day1, day2) {
|
6590 | const compareMonthResult = compareMonth(day1, day2);
|
6591 | if (compareMonthResult === 0) {
|
6592 | const date1 = day1.getDate();
|
6593 | const date2 = day2.getDate();
|
6594 | return date1 === date2 ? 0 : date1 > date2 ? 1 : -1;
|
6595 | }
|
6596 | return compareMonthResult;
|
6597 | }
|
6598 | const cloneDate = (date) => new Date(date);
|
6599 | const cloneDates = (dates) => Array.isArray(dates) ? dates.map(cloneDate) : cloneDate(dates);
|
6600 | function getDayByOffset(date, offset2) {
|
6601 | const cloned = cloneDate(date);
|
6602 | cloned.setDate(cloned.getDate() + offset2);
|
6603 | return cloned;
|
6604 | }
|
6605 | const getPrevDay = (date) => getDayByOffset(date, -1);
|
6606 | const getNextDay = (date) => getDayByOffset(date, 1);
|
6607 | const getToday = () => {
|
6608 | const today = new Date();
|
6609 | today.setHours(0, 0, 0, 0);
|
6610 | return today;
|
6611 | };
|
6612 | function calcDateNum(date) {
|
6613 | const day1 = date[0].getTime();
|
6614 | const day2 = date[1].getTime();
|
6615 | return (day2 - day1) / (1e3 * 60 * 60 * 24) + 1;
|
6616 | }
|
6617 | const sharedProps = extend({}, pickerSharedProps, {
|
6618 | modelValue: makeArrayProp(),
|
6619 | filter: Function,
|
6620 | formatter: {
|
6621 | type: Function,
|
6622 | default: (type, option) => option
|
6623 | }
|
6624 | });
|
6625 | const pickerInheritKeys = Object.keys(pickerSharedProps);
|
6626 | function times(n, iteratee) {
|
6627 | if (n < 0) {
|
6628 | return [];
|
6629 | }
|
6630 | const result = Array(n);
|
6631 | let index = -1;
|
6632 | while (++index < n) {
|
6633 | result[index] = iteratee(index);
|
6634 | }
|
6635 | return result;
|
6636 | }
|
6637 | const getMonthEndDay = (year, month) => 32 - new Date(year, month - 1, 32).getDate();
|
6638 | const genOptions = (min, max, type, formatter, filter, values) => {
|
6639 | const options = times(max - min + 1, (index) => {
|
6640 | const value = padZero(min + index);
|
6641 | return formatter(type, {
|
6642 | text: value,
|
6643 | value
|
6644 | });
|
6645 | });
|
6646 | return filter ? filter(type, options, values) : options;
|
6647 | };
|
6648 | const formatValueRange = (values, columns) => values.map((value, index) => {
|
6649 | const column = columns[index];
|
6650 | if (column.length) {
|
6651 | const minValue = +column[0].value;
|
6652 | const maxValue = +column[column.length - 1].value;
|
6653 | return padZero(clamp(+value, minValue, maxValue));
|
6654 | }
|
6655 | return value;
|
6656 | });
|
6657 | const [name$18] = createNamespace("calendar-day");
|
6658 | var stdin_default$1i = vue.defineComponent({
|
6659 | name: name$18,
|
6660 | props: {
|
6661 | item: makeRequiredProp(Object),
|
6662 | color: String,
|
6663 | index: Number,
|
6664 | offset: makeNumberProp(0),
|
6665 | rowHeight: String
|
6666 | },
|
6667 | emits: ["click", "clickDisabledDate"],
|
6668 | setup(props2, {
|
6669 | emit,
|
6670 | slots
|
6671 | }) {
|
6672 | const style = vue.computed(() => {
|
6673 | var _a;
|
6674 | const {
|
6675 | item,
|
6676 | index,
|
6677 | color,
|
6678 | offset: offset2,
|
6679 | rowHeight
|
6680 | } = props2;
|
6681 | const style2 = {
|
6682 | height: rowHeight
|
6683 | };
|
6684 | if (item.type === "placeholder") {
|
6685 | style2.width = "100%";
|
6686 | return style2;
|
6687 | }
|
6688 | if (index === 0) {
|
6689 | style2.marginLeft = `${100 * offset2 / 7}%`;
|
6690 | }
|
6691 | if (color) {
|
6692 | switch (item.type) {
|
6693 | case "end":
|
6694 | case "start":
|
6695 | case "start-end":
|
6696 | case "multiple-middle":
|
6697 | case "multiple-selected":
|
6698 | style2.background = color;
|
6699 | break;
|
6700 | case "middle":
|
6701 | style2.color = color;
|
6702 | break;
|
6703 | }
|
6704 | }
|
6705 | if (offset2 + (((_a = item.date) == null ? void 0 : _a.getDate()) || 1) > 28) {
|
6706 | style2.marginBottom = 0;
|
6707 | }
|
6708 | return style2;
|
6709 | });
|
6710 | const onClick = () => {
|
6711 | if (props2.item.type !== "disabled") {
|
6712 | emit("click", props2.item);
|
6713 | } else {
|
6714 | emit("clickDisabledDate", props2.item);
|
6715 | }
|
6716 | };
|
6717 | const renderTopInfo = () => {
|
6718 | const {
|
6719 | topInfo
|
6720 | } = props2.item;
|
6721 | if (topInfo || slots["top-info"]) {
|
6722 | return vue.createVNode("div", {
|
6723 | "class": bem$15("top-info")
|
6724 | }, [slots["top-info"] ? slots["top-info"](props2.item) : topInfo]);
|
6725 | }
|
6726 | };
|
6727 | const renderBottomInfo = () => {
|
6728 | const {
|
6729 | bottomInfo
|
6730 | } = props2.item;
|
6731 | if (bottomInfo || slots["bottom-info"]) {
|
6732 | return vue.createVNode("div", {
|
6733 | "class": bem$15("bottom-info")
|
6734 | }, [slots["bottom-info"] ? slots["bottom-info"](props2.item) : bottomInfo]);
|
6735 | }
|
6736 | };
|
6737 | const renderContent = () => {
|
6738 | const {
|
6739 | item,
|
6740 | color,
|
6741 | rowHeight
|
6742 | } = props2;
|
6743 | const {
|
6744 | type,
|
6745 | text
|
6746 | } = item;
|
6747 | const Nodes = [renderTopInfo(), text, renderBottomInfo()];
|
6748 | if (type === "selected") {
|
6749 | return vue.createVNode("div", {
|
6750 | "class": bem$15("selected-day"),
|
6751 | "style": {
|
6752 | width: rowHeight,
|
6753 | height: rowHeight,
|
6754 | background: color
|
6755 | }
|
6756 | }, [Nodes]);
|
6757 | }
|
6758 | return Nodes;
|
6759 | };
|
6760 | return () => {
|
6761 | const {
|
6762 | type,
|
6763 | className
|
6764 | } = props2.item;
|
6765 | if (type === "placeholder") {
|
6766 | return vue.createVNode("div", {
|
6767 | "class": bem$15("day"),
|
6768 | "style": style.value
|
6769 | }, null);
|
6770 | }
|
6771 | return vue.createVNode("div", {
|
6772 | "role": "gridcell",
|
6773 | "style": style.value,
|
6774 | "class": [bem$15("day", type), className],
|
6775 | "tabindex": type === "disabled" ? void 0 : -1,
|
6776 | "onClick": onClick
|
6777 | }, [renderContent()]);
|
6778 | };
|
6779 | }
|
6780 | });
|
6781 | const [name$17] = createNamespace("calendar-month");
|
6782 | const calendarMonthProps = {
|
6783 | date: makeRequiredProp(Date),
|
6784 | type: String,
|
6785 | color: String,
|
6786 | minDate: makeRequiredProp(Date),
|
6787 | maxDate: makeRequiredProp(Date),
|
6788 | showMark: Boolean,
|
6789 | rowHeight: numericProp,
|
6790 | formatter: Function,
|
6791 | lazyRender: Boolean,
|
6792 | currentDate: [Date, Array],
|
6793 | allowSameDay: Boolean,
|
6794 | showSubtitle: Boolean,
|
6795 | showMonthTitle: Boolean,
|
6796 | firstDayOfWeek: Number
|
6797 | };
|
6798 | var stdin_default$1h = vue.defineComponent({
|
6799 | name: name$17,
|
6800 | props: calendarMonthProps,
|
6801 | emits: ["click", "clickDisabledDate"],
|
6802 | setup(props2, {
|
6803 | emit,
|
6804 | slots
|
6805 | }) {
|
6806 | const [visible, setVisible] = useToggle();
|
6807 | const daysRef = vue.ref();
|
6808 | const monthRef = vue.ref();
|
6809 | const height2 = useHeight(monthRef);
|
6810 | const title = vue.computed(() => formatMonthTitle(props2.date));
|
6811 | const rowHeight = vue.computed(() => addUnit(props2.rowHeight));
|
6812 | const offset2 = vue.computed(() => {
|
6813 | const realDay = props2.date.getDay();
|
6814 | if (props2.firstDayOfWeek) {
|
6815 | return (realDay + 7 - props2.firstDayOfWeek) % 7;
|
6816 | }
|
6817 | return realDay;
|
6818 | });
|
6819 | const totalDay = vue.computed(() => getMonthEndDay(props2.date.getFullYear(), props2.date.getMonth() + 1));
|
6820 | const shouldRender = vue.computed(() => visible.value || !props2.lazyRender);
|
6821 | const getTitle = () => title.value;
|
6822 | const getMultipleDayType = (day) => {
|
6823 | const isSelected = (date) => props2.currentDate.some((item) => compareDay(item, date) === 0);
|
6824 | if (isSelected(day)) {
|
6825 | const prevDay = getPrevDay(day);
|
6826 | const nextDay = getNextDay(day);
|
6827 | const prevSelected = isSelected(prevDay);
|
6828 | const nextSelected = isSelected(nextDay);
|
6829 | if (prevSelected && nextSelected) {
|
6830 | return "multiple-middle";
|
6831 | }
|
6832 | if (prevSelected) {
|
6833 | return "end";
|
6834 | }
|
6835 | if (nextSelected) {
|
6836 | return "start";
|
6837 | }
|
6838 | return "multiple-selected";
|
6839 | }
|
6840 | return "";
|
6841 | };
|
6842 | const getRangeDayType = (day) => {
|
6843 | const [startDay, endDay] = props2.currentDate;
|
6844 | if (!startDay) {
|
6845 | return "";
|
6846 | }
|
6847 | const compareToStart = compareDay(day, startDay);
|
6848 | if (!endDay) {
|
6849 | return compareToStart === 0 ? "start" : "";
|
6850 | }
|
6851 | const compareToEnd = compareDay(day, endDay);
|
6852 | if (props2.allowSameDay && compareToStart === 0 && compareToEnd === 0) {
|
6853 | return "start-end";
|
6854 | }
|
6855 | if (compareToStart === 0) {
|
6856 | return "start";
|
6857 | }
|
6858 | if (compareToEnd === 0) {
|
6859 | return "end";
|
6860 | }
|
6861 | if (compareToStart > 0 && compareToEnd < 0) {
|
6862 | return "middle";
|
6863 | }
|
6864 | return "";
|
6865 | };
|
6866 | const getDayType = (day) => {
|
6867 | const {
|
6868 | type,
|
6869 | minDate,
|
6870 | maxDate,
|
6871 | currentDate
|
6872 | } = props2;
|
6873 | if (compareDay(day, minDate) < 0 || compareDay(day, maxDate) > 0) {
|
6874 | return "disabled";
|
6875 | }
|
6876 | if (currentDate === null) {
|
6877 | return "";
|
6878 | }
|
6879 | if (Array.isArray(currentDate)) {
|
6880 | if (type === "multiple") {
|
6881 | return getMultipleDayType(day);
|
6882 | }
|
6883 | if (type === "range") {
|
6884 | return getRangeDayType(day);
|
6885 | }
|
6886 | } else if (type === "single") {
|
6887 | return compareDay(day, currentDate) === 0 ? "selected" : "";
|
6888 | }
|
6889 | return "";
|
6890 | };
|
6891 | const getBottomInfo = (dayType) => {
|
6892 | if (props2.type === "range") {
|
6893 | if (dayType === "start" || dayType === "end") {
|
6894 | return t$g(dayType);
|
6895 | }
|
6896 | if (dayType === "start-end") {
|
6897 | return `${t$g("start")}/${t$g("end")}`;
|
6898 | }
|
6899 | }
|
6900 | };
|
6901 | const renderTitle = () => {
|
6902 | if (props2.showMonthTitle) {
|
6903 | return vue.createVNode("div", {
|
6904 | "class": bem$15("month-title")
|
6905 | }, [slots["month-title"] ? slots["month-title"]({
|
6906 | date: props2.date,
|
6907 | text: title.value
|
6908 | }) : title.value]);
|
6909 | }
|
6910 | };
|
6911 | const renderMark = () => {
|
6912 | if (props2.showMark && shouldRender.value) {
|
6913 | return vue.createVNode("div", {
|
6914 | "class": bem$15("month-mark")
|
6915 | }, [props2.date.getMonth() + 1]);
|
6916 | }
|
6917 | };
|
6918 | const placeholders = vue.computed(() => {
|
6919 | const count = Math.ceil((totalDay.value + offset2.value) / 7);
|
6920 | return Array(count).fill({
|
6921 | type: "placeholder"
|
6922 | });
|
6923 | });
|
6924 | const days = vue.computed(() => {
|
6925 | const days2 = [];
|
6926 | const year = props2.date.getFullYear();
|
6927 | const month = props2.date.getMonth();
|
6928 | for (let day = 1; day <= totalDay.value; day++) {
|
6929 | const date = new Date(year, month, day);
|
6930 | const type = getDayType(date);
|
6931 | let config = {
|
6932 | date,
|
6933 | type,
|
6934 | text: day,
|
6935 | bottomInfo: getBottomInfo(type)
|
6936 | };
|
6937 | if (props2.formatter) {
|
6938 | config = props2.formatter(config);
|
6939 | }
|
6940 | days2.push(config);
|
6941 | }
|
6942 | return days2;
|
6943 | });
|
6944 | const disabledDays = vue.computed(() => days.value.filter((day) => day.type === "disabled"));
|
6945 | const scrollToDate = (body, targetDate) => {
|
6946 | if (daysRef.value) {
|
6947 | const daysRect = useRect(daysRef.value);
|
6948 | const totalRows = placeholders.value.length;
|
6949 | const currentRow = Math.ceil((targetDate.getDate() + offset2.value) / 7);
|
6950 | const rowOffset = (currentRow - 1) * daysRect.height / totalRows;
|
6951 | setScrollTop(body, daysRect.top + rowOffset + body.scrollTop - useRect(body).top);
|
6952 | }
|
6953 | };
|
6954 | const renderDay = (item, index) => vue.createVNode(stdin_default$1i, {
|
6955 | "item": item,
|
6956 | "index": index,
|
6957 | "color": props2.color,
|
6958 | "offset": offset2.value,
|
6959 | "rowHeight": rowHeight.value,
|
6960 | "onClick": (item2) => emit("click", item2),
|
6961 | "onClickDisabledDate": (item2) => emit("clickDisabledDate", item2)
|
6962 | }, pick(slots, ["top-info", "bottom-info"]));
|
6963 | const renderDays = () => vue.createVNode("div", {
|
6964 | "ref": daysRef,
|
6965 | "role": "grid",
|
6966 | "class": bem$15("days")
|
6967 | }, [renderMark(), (shouldRender.value ? days : placeholders).value.map(renderDay)]);
|
6968 | useExpose({
|
6969 | getTitle,
|
6970 | getHeight: () => height2.value,
|
6971 | setVisible,
|
6972 | scrollToDate,
|
6973 | disabledDays
|
6974 | });
|
6975 | return () => vue.createVNode("div", {
|
6976 | "class": bem$15("month"),
|
6977 | "ref": monthRef
|
6978 | }, [renderTitle(), renderDays()]);
|
6979 | }
|
6980 | });
|
6981 | const [name$16] = createNamespace("calendar-header");
|
6982 | var stdin_default$1g = vue.defineComponent({
|
6983 | name: name$16,
|
6984 | props: {
|
6985 | date: Date,
|
6986 | title: String,
|
6987 | subtitle: String,
|
6988 | showTitle: Boolean,
|
6989 | showSubtitle: Boolean,
|
6990 | firstDayOfWeek: Number
|
6991 | },
|
6992 | emits: ["clickSubtitle"],
|
6993 | setup(props2, {
|
6994 | slots,
|
6995 | emit
|
6996 | }) {
|
6997 | const renderTitle = () => {
|
6998 | if (props2.showTitle) {
|
6999 | const text = props2.title || t$g("title");
|
7000 | const title = slots.title ? slots.title() : text;
|
7001 | return vue.createVNode("div", {
|
7002 | "class": bem$15("header-title")
|
7003 | }, [title]);
|
7004 | }
|
7005 | };
|
7006 | const onClickSubtitle = (event) => emit("clickSubtitle", event);
|
7007 | const renderSubtitle = () => {
|
7008 | if (props2.showSubtitle) {
|
7009 | const title = slots.subtitle ? slots.subtitle({
|
7010 | date: props2.date,
|
7011 | text: props2.subtitle
|
7012 | }) : props2.subtitle;
|
7013 | return vue.createVNode("div", {
|
7014 | "class": bem$15("header-subtitle"),
|
7015 | "onClick": onClickSubtitle
|
7016 | }, [title]);
|
7017 | }
|
7018 | };
|
7019 | const renderWeekDays = () => {
|
7020 | const {
|
7021 | firstDayOfWeek
|
7022 | } = props2;
|
7023 | const weekdays = t$g("weekdays");
|
7024 | const renderWeekDays2 = [...weekdays.slice(firstDayOfWeek, 7), ...weekdays.slice(0, firstDayOfWeek)];
|
7025 | return vue.createVNode("div", {
|
7026 | "class": bem$15("weekdays")
|
7027 | }, [renderWeekDays2.map((text) => vue.createVNode("span", {
|
7028 | "class": bem$15("weekday")
|
7029 | }, [text]))]);
|
7030 | };
|
7031 | return () => vue.createVNode("div", {
|
7032 | "class": bem$15("header")
|
7033 | }, [renderTitle(), renderSubtitle(), renderWeekDays()]);
|
7034 | }
|
7035 | });
|
7036 | const calendarProps = {
|
7037 | show: Boolean,
|
7038 | type: makeStringProp("single"),
|
7039 | title: String,
|
7040 | color: String,
|
7041 | round: truthProp,
|
7042 | readonly: Boolean,
|
7043 | poppable: truthProp,
|
7044 | maxRange: makeNumericProp(null),
|
7045 | position: makeStringProp("bottom"),
|
7046 | teleport: [String, Object],
|
7047 | showMark: truthProp,
|
7048 | showTitle: truthProp,
|
7049 | formatter: Function,
|
7050 | rowHeight: numericProp,
|
7051 | confirmText: String,
|
7052 | rangePrompt: String,
|
7053 | lazyRender: truthProp,
|
7054 | showConfirm: truthProp,
|
7055 | defaultDate: [Date, Array],
|
7056 | allowSameDay: Boolean,
|
7057 | showSubtitle: truthProp,
|
7058 | closeOnPopstate: truthProp,
|
7059 | showRangePrompt: truthProp,
|
7060 | confirmDisabledText: String,
|
7061 | closeOnClickOverlay: truthProp,
|
7062 | safeAreaInsetTop: Boolean,
|
7063 | safeAreaInsetBottom: truthProp,
|
7064 | minDate: {
|
7065 | type: Date,
|
7066 | validator: isDate,
|
7067 | default: getToday
|
7068 | },
|
7069 | maxDate: {
|
7070 | type: Date,
|
7071 | validator: isDate,
|
7072 | default: () => {
|
7073 | const now = getToday();
|
7074 | return new Date(now.getFullYear(), now.getMonth() + 6, now.getDate());
|
7075 | }
|
7076 | },
|
7077 | firstDayOfWeek: {
|
7078 | type: numericProp,
|
7079 | default: 0,
|
7080 | validator: (val) => val >= 0 && val <= 6
|
7081 | }
|
7082 | };
|
7083 | var stdin_default$1f = vue.defineComponent({
|
7084 | name: name$19,
|
7085 | props: calendarProps,
|
7086 | emits: ["select", "confirm", "unselect", "monthShow", "overRange", "update:show", "clickSubtitle", "clickDisabledDate"],
|
7087 | setup(props2, {
|
7088 | emit,
|
7089 | slots
|
7090 | }) {
|
7091 | const limitDateRange = (date, minDate = props2.minDate, maxDate = props2.maxDate) => {
|
7092 | if (compareDay(date, minDate) === -1) {
|
7093 | return minDate;
|
7094 | }
|
7095 | if (compareDay(date, maxDate) === 1) {
|
7096 | return maxDate;
|
7097 | }
|
7098 | return date;
|
7099 | };
|
7100 | const getInitialDate = (defaultDate = props2.defaultDate) => {
|
7101 | const {
|
7102 | type,
|
7103 | minDate,
|
7104 | maxDate,
|
7105 | allowSameDay
|
7106 | } = props2;
|
7107 | if (defaultDate === null) {
|
7108 | return defaultDate;
|
7109 | }
|
7110 | const now = getToday();
|
7111 | if (type === "range") {
|
7112 | if (!Array.isArray(defaultDate)) {
|
7113 | defaultDate = [];
|
7114 | }
|
7115 | const start2 = limitDateRange(defaultDate[0] || now, minDate, allowSameDay ? maxDate : getPrevDay(maxDate));
|
7116 | const end2 = limitDateRange(defaultDate[1] || now, allowSameDay ? minDate : getNextDay(minDate));
|
7117 | return [start2, end2];
|
7118 | }
|
7119 | if (type === "multiple") {
|
7120 | if (Array.isArray(defaultDate)) {
|
7121 | return defaultDate.map((date) => limitDateRange(date));
|
7122 | }
|
7123 | return [limitDateRange(now)];
|
7124 | }
|
7125 | if (!defaultDate || Array.isArray(defaultDate)) {
|
7126 | defaultDate = now;
|
7127 | }
|
7128 | return limitDateRange(defaultDate);
|
7129 | };
|
7130 | let bodyHeight;
|
7131 | const bodyRef = vue.ref();
|
7132 | const subtitle = vue.ref({
|
7133 | textFn: () => "",
|
7134 | date: void 0
|
7135 | });
|
7136 | const currentDate = vue.ref(getInitialDate());
|
7137 | const [monthRefs, setMonthRefs] = useRefs();
|
7138 | const dayOffset = vue.computed(() => props2.firstDayOfWeek ? +props2.firstDayOfWeek % 7 : 0);
|
7139 | const months = vue.computed(() => {
|
7140 | const months2 = [];
|
7141 | const cursor = new Date(props2.minDate);
|
7142 | cursor.setDate(1);
|
7143 | do {
|
7144 | months2.push(new Date(cursor));
|
7145 | cursor.setMonth(cursor.getMonth() + 1);
|
7146 | } while (compareMonth(cursor, props2.maxDate) !== 1);
|
7147 | return months2;
|
7148 | });
|
7149 | const buttonDisabled = vue.computed(() => {
|
7150 | if (currentDate.value) {
|
7151 | if (props2.type === "range") {
|
7152 | return !currentDate.value[0] || !currentDate.value[1];
|
7153 | }
|
7154 | if (props2.type === "multiple") {
|
7155 | return !currentDate.value.length;
|
7156 | }
|
7157 | }
|
7158 | return !currentDate.value;
|
7159 | });
|
7160 | const getSelectedDate = () => currentDate.value;
|
7161 | const onScroll = () => {
|
7162 | const top2 = getScrollTop(bodyRef.value);
|
7163 | const bottom2 = top2 + bodyHeight;
|
7164 | const heights = months.value.map((item, index) => monthRefs.value[index].getHeight());
|
7165 | const heightSum = heights.reduce((a, b) => a + b, 0);
|
7166 | if (bottom2 > heightSum && top2 > 0) {
|
7167 | return;
|
7168 | }
|
7169 | let height2 = 0;
|
7170 | let currentMonth;
|
7171 | const visibleRange = [-1, -1];
|
7172 | for (let i = 0; i < months.value.length; i++) {
|
7173 | const month = monthRefs.value[i];
|
7174 | const visible = height2 <= bottom2 && height2 + heights[i] >= top2;
|
7175 | if (visible) {
|
7176 | visibleRange[1] = i;
|
7177 | if (!currentMonth) {
|
7178 | currentMonth = month;
|
7179 | visibleRange[0] = i;
|
7180 | }
|
7181 | if (!monthRefs.value[i].showed) {
|
7182 | monthRefs.value[i].showed = true;
|
7183 | emit("monthShow", {
|
7184 | date: month.date,
|
7185 | title: month.getTitle()
|
7186 | });
|
7187 | }
|
7188 | }
|
7189 | height2 += heights[i];
|
7190 | }
|
7191 | months.value.forEach((month, index) => {
|
7192 | const visible = index >= visibleRange[0] - 1 && index <= visibleRange[1] + 1;
|
7193 | monthRefs.value[index].setVisible(visible);
|
7194 | });
|
7195 | if (currentMonth) {
|
7196 | subtitle.value = {
|
7197 | textFn: currentMonth.getTitle,
|
7198 | date: currentMonth.date
|
7199 | };
|
7200 | }
|
7201 | };
|
7202 | const scrollToDate = (targetDate) => {
|
7203 | raf(() => {
|
7204 | months.value.some((month, index) => {
|
7205 | if (compareMonth(month, targetDate) === 0) {
|
7206 | if (bodyRef.value) {
|
7207 | monthRefs.value[index].scrollToDate(bodyRef.value, targetDate);
|
7208 | }
|
7209 | return true;
|
7210 | }
|
7211 | return false;
|
7212 | });
|
7213 | onScroll();
|
7214 | });
|
7215 | };
|
7216 | const scrollToCurrentDate = () => {
|
7217 | if (props2.poppable && !props2.show) {
|
7218 | return;
|
7219 | }
|
7220 | if (currentDate.value) {
|
7221 | const targetDate = props2.type === "single" ? currentDate.value : currentDate.value[0];
|
7222 | if (isDate(targetDate)) {
|
7223 | scrollToDate(targetDate);
|
7224 | }
|
7225 | } else {
|
7226 | raf(onScroll);
|
7227 | }
|
7228 | };
|
7229 | const init = () => {
|
7230 | if (props2.poppable && !props2.show) {
|
7231 | return;
|
7232 | }
|
7233 | raf(() => {
|
7234 | bodyHeight = Math.floor(useRect(bodyRef).height);
|
7235 | });
|
7236 | scrollToCurrentDate();
|
7237 | };
|
7238 | const reset = (date = getInitialDate()) => {
|
7239 | currentDate.value = date;
|
7240 | scrollToCurrentDate();
|
7241 | };
|
7242 | const checkRange = (date) => {
|
7243 | const {
|
7244 | maxRange,
|
7245 | rangePrompt,
|
7246 | showRangePrompt
|
7247 | } = props2;
|
7248 | if (maxRange && calcDateNum(date) > +maxRange) {
|
7249 | if (showRangePrompt) {
|
7250 | showToast(rangePrompt || t$g("rangePrompt", maxRange));
|
7251 | }
|
7252 | emit("overRange");
|
7253 | return false;
|
7254 | }
|
7255 | return true;
|
7256 | };
|
7257 | const onConfirm = () => {
|
7258 | var _a;
|
7259 | return emit("confirm", (_a = currentDate.value) != null ? _a : cloneDates(currentDate.value));
|
7260 | };
|
7261 | const select = (date, complete) => {
|
7262 | const setCurrentDate = (date2) => {
|
7263 | currentDate.value = date2;
|
7264 | emit("select", cloneDates(date2));
|
7265 | };
|
7266 | if (complete && props2.type === "range") {
|
7267 | const valid = checkRange(date);
|
7268 | if (!valid) {
|
7269 | setCurrentDate([date[0], getDayByOffset(date[0], +props2.maxRange - 1)]);
|
7270 | return;
|
7271 | }
|
7272 | }
|
7273 | setCurrentDate(date);
|
7274 | if (complete && !props2.showConfirm) {
|
7275 | onConfirm();
|
7276 | }
|
7277 | };
|
7278 | const getDisabledDate = (disabledDays2, startDay, date) => {
|
7279 | var _a;
|
7280 | return (_a = disabledDays2.find((day) => compareDay(startDay, day.date) === -1 && compareDay(day.date, date) === -1)) == null ? void 0 : _a.date;
|
7281 | };
|
7282 | const disabledDays = vue.computed(() => monthRefs.value.reduce((arr, ref2) => {
|
7283 | var _a, _b;
|
7284 | arr.push(...(_b = (_a = ref2.disabledDays) == null ? void 0 : _a.value) != null ? _b : []);
|
7285 | return arr;
|
7286 | }, []));
|
7287 | const onClickDay = (item) => {
|
7288 | if (props2.readonly || !item.date) {
|
7289 | return;
|
7290 | }
|
7291 | const {
|
7292 | date
|
7293 | } = item;
|
7294 | const {
|
7295 | type
|
7296 | } = props2;
|
7297 | if (type === "range") {
|
7298 | if (!currentDate.value) {
|
7299 | select([date]);
|
7300 | return;
|
7301 | }
|
7302 | const [startDay, endDay] = currentDate.value;
|
7303 | if (startDay && !endDay) {
|
7304 | const compareToStart = compareDay(date, startDay);
|
7305 | if (compareToStart === 1) {
|
7306 | const disabledDay = getDisabledDate(disabledDays.value, startDay, date);
|
7307 | if (disabledDay) {
|
7308 | const endDay2 = getPrevDay(disabledDay);
|
7309 | if (compareDay(startDay, endDay2) === -1) {
|
7310 | select([startDay, endDay2]);
|
7311 | } else {
|
7312 | select([date]);
|
7313 | }
|
7314 | } else {
|
7315 | select([startDay, date], true);
|
7316 | }
|
7317 | } else if (compareToStart === -1) {
|
7318 | select([date]);
|
7319 | } else if (props2.allowSameDay) {
|
7320 | select([date, date], true);
|
7321 | }
|
7322 | } else {
|
7323 | select([date]);
|
7324 | }
|
7325 | } else if (type === "multiple") {
|
7326 | if (!currentDate.value) {
|
7327 | select([date]);
|
7328 | return;
|
7329 | }
|
7330 | const dates = currentDate.value;
|
7331 | const selectedIndex = dates.findIndex((dateItem) => compareDay(dateItem, date) === 0);
|
7332 | if (selectedIndex !== -1) {
|
7333 | const [unselectedDate] = dates.splice(selectedIndex, 1);
|
7334 | emit("unselect", cloneDate(unselectedDate));
|
7335 | } else if (props2.maxRange && dates.length >= +props2.maxRange) {
|
7336 | showToast(props2.rangePrompt || t$g("rangePrompt", props2.maxRange));
|
7337 | } else {
|
7338 | select([...dates, date]);
|
7339 | }
|
7340 | } else {
|
7341 | select(date, true);
|
7342 | }
|
7343 | };
|
7344 | const updateShow = (value) => emit("update:show", value);
|
7345 | const renderMonth = (date, index) => {
|
7346 | const showMonthTitle = index !== 0 || !props2.showSubtitle;
|
7347 | return vue.createVNode(stdin_default$1h, vue.mergeProps({
|
7348 | "ref": setMonthRefs(index),
|
7349 | "date": date,
|
7350 | "currentDate": currentDate.value,
|
7351 | "showMonthTitle": showMonthTitle,
|
7352 | "firstDayOfWeek": dayOffset.value
|
7353 | }, pick(props2, ["type", "color", "minDate", "maxDate", "showMark", "formatter", "rowHeight", "lazyRender", "showSubtitle", "allowSameDay"]), {
|
7354 | "onClick": onClickDay,
|
7355 | "onClickDisabledDate": (item) => emit("clickDisabledDate", item)
|
7356 | }), pick(slots, ["top-info", "bottom-info", "month-title"]));
|
7357 | };
|
7358 | const renderFooterButton = () => {
|
7359 | if (slots.footer) {
|
7360 | return slots.footer();
|
7361 | }
|
7362 | if (props2.showConfirm) {
|
7363 | const slot = slots["confirm-text"];
|
7364 | const disabled = buttonDisabled.value;
|
7365 | const text = disabled ? props2.confirmDisabledText : props2.confirmText;
|
7366 | return vue.createVNode(Button, {
|
7367 | "round": true,
|
7368 | "block": true,
|
7369 | "type": "primary",
|
7370 | "color": props2.color,
|
7371 | "class": bem$15("confirm"),
|
7372 | "disabled": disabled,
|
7373 | "nativeType": "button",
|
7374 | "onClick": onConfirm
|
7375 | }, {
|
7376 | default: () => [slot ? slot({
|
7377 | disabled
|
7378 | }) : text || t$g("confirm")]
|
7379 | });
|
7380 | }
|
7381 | };
|
7382 | const renderFooter = () => vue.createVNode("div", {
|
7383 | "class": [bem$15("footer"), {
|
7384 | "van-safe-area-bottom": props2.safeAreaInsetBottom
|
7385 | }]
|
7386 | }, [renderFooterButton()]);
|
7387 | const renderCalendar = () => {
|
7388 | const subTitle = subtitle.value.textFn();
|
7389 | return vue.createVNode("div", {
|
7390 | "class": bem$15()
|
7391 | }, [vue.createVNode(stdin_default$1g, {
|
7392 | "date": subtitle.value.date,
|
7393 | "title": props2.title,
|
7394 | "subtitle": subTitle,
|
7395 | "showTitle": props2.showTitle,
|
7396 | "showSubtitle": props2.showSubtitle,
|
7397 | "firstDayOfWeek": dayOffset.value,
|
7398 | "onClickSubtitle": (event) => emit("clickSubtitle", event)
|
7399 | }, pick(slots, ["title", "subtitle"])), vue.createVNode("div", {
|
7400 | "ref": bodyRef,
|
7401 | "class": bem$15("body"),
|
7402 | "onScroll": onScroll
|
7403 | }, [months.value.map(renderMonth)]), renderFooter()]);
|
7404 | };
|
7405 | vue.watch(() => props2.show, init);
|
7406 | vue.watch(() => [props2.type, props2.minDate, props2.maxDate], () => reset(getInitialDate(currentDate.value)));
|
7407 | vue.watch(() => props2.defaultDate, (value = null) => {
|
7408 | currentDate.value = value;
|
7409 | scrollToCurrentDate();
|
7410 | });
|
7411 | useExpose({
|
7412 | reset,
|
7413 | scrollToDate,
|
7414 | getSelectedDate
|
7415 | });
|
7416 | onMountedOrActivated(init);
|
7417 | return () => {
|
7418 | if (props2.poppable) {
|
7419 | return vue.createVNode(Popup, {
|
7420 | "show": props2.show,
|
7421 | "class": bem$15("popup"),
|
7422 | "round": props2.round,
|
7423 | "position": props2.position,
|
7424 | "closeable": props2.showTitle || props2.showSubtitle,
|
7425 | "teleport": props2.teleport,
|
7426 | "closeOnPopstate": props2.closeOnPopstate,
|
7427 | "safeAreaInsetTop": props2.safeAreaInsetTop,
|
7428 | "closeOnClickOverlay": props2.closeOnClickOverlay,
|
7429 | "onUpdate:show": updateShow
|
7430 | }, {
|
7431 | default: renderCalendar
|
7432 | });
|
7433 | }
|
7434 | return renderCalendar();
|
7435 | };
|
7436 | }
|
7437 | });
|
7438 | const Calendar = withInstall(stdin_default$1f);
|
7439 | const [name$15, bem$14] = createNamespace("image");
|
7440 | const imageProps = {
|
7441 | src: String,
|
7442 | alt: String,
|
7443 | fit: String,
|
7444 | position: String,
|
7445 | round: Boolean,
|
7446 | block: Boolean,
|
7447 | width: numericProp,
|
7448 | height: numericProp,
|
7449 | radius: numericProp,
|
7450 | lazyLoad: Boolean,
|
7451 | iconSize: numericProp,
|
7452 | showError: truthProp,
|
7453 | errorIcon: makeStringProp("photo-fail"),
|
7454 | iconPrefix: String,
|
7455 | showLoading: truthProp,
|
7456 | loadingIcon: makeStringProp("photo"),
|
7457 | crossorigin: String,
|
7458 | referrerpolicy: String
|
7459 | };
|
7460 | var stdin_default$1e = vue.defineComponent({
|
7461 | name: name$15,
|
7462 | props: imageProps,
|
7463 | emits: ["load", "error"],
|
7464 | setup(props2, {
|
7465 | emit,
|
7466 | slots
|
7467 | }) {
|
7468 | const error = vue.ref(false);
|
7469 | const loading = vue.ref(true);
|
7470 | const imageRef = vue.ref();
|
7471 | const {
|
7472 | $Lazyload
|
7473 | } = vue.getCurrentInstance().proxy;
|
7474 | const style = vue.computed(() => {
|
7475 | const style2 = {
|
7476 | width: addUnit(props2.width),
|
7477 | height: addUnit(props2.height)
|
7478 | };
|
7479 | if (isDef(props2.radius)) {
|
7480 | style2.overflow = "hidden";
|
7481 | style2.borderRadius = addUnit(props2.radius);
|
7482 | }
|
7483 | return style2;
|
7484 | });
|
7485 | vue.watch(() => props2.src, () => {
|
7486 | error.value = false;
|
7487 | loading.value = true;
|
7488 | });
|
7489 | const onLoad = (event) => {
|
7490 | if (loading.value) {
|
7491 | loading.value = false;
|
7492 | emit("load", event);
|
7493 | }
|
7494 | };
|
7495 | const triggerLoad = () => {
|
7496 | const loadEvent = new Event("load");
|
7497 | Object.defineProperty(loadEvent, "target", {
|
7498 | value: imageRef.value,
|
7499 | enumerable: true
|
7500 | });
|
7501 | onLoad(loadEvent);
|
7502 | };
|
7503 | const onError = (event) => {
|
7504 | error.value = true;
|
7505 | loading.value = false;
|
7506 | emit("error", event);
|
7507 | };
|
7508 | const renderIcon = (name2, className, slot) => {
|
7509 | if (slot) {
|
7510 | return slot();
|
7511 | }
|
7512 | return vue.createVNode(Icon, {
|
7513 | "name": name2,
|
7514 | "size": props2.iconSize,
|
7515 | "class": className,
|
7516 | "classPrefix": props2.iconPrefix
|
7517 | }, null);
|
7518 | };
|
7519 | const renderPlaceholder = () => {
|
7520 | if (loading.value && props2.showLoading) {
|
7521 | return vue.createVNode("div", {
|
7522 | "class": bem$14("loading")
|
7523 | }, [renderIcon(props2.loadingIcon, bem$14("loading-icon"), slots.loading)]);
|
7524 | }
|
7525 | if (error.value && props2.showError) {
|
7526 | return vue.createVNode("div", {
|
7527 | "class": bem$14("error")
|
7528 | }, [renderIcon(props2.errorIcon, bem$14("error-icon"), slots.error)]);
|
7529 | }
|
7530 | };
|
7531 | const renderImage = () => {
|
7532 | if (error.value || !props2.src) {
|
7533 | return;
|
7534 | }
|
7535 | const attrs = {
|
7536 | alt: props2.alt,
|
7537 | class: bem$14("img"),
|
7538 | style: {
|
7539 | objectFit: props2.fit,
|
7540 | objectPosition: props2.position
|
7541 | },
|
7542 | crossorigin: props2.crossorigin,
|
7543 | referrerpolicy: props2.referrerpolicy
|
7544 | };
|
7545 | if (props2.lazyLoad) {
|
7546 | return vue.withDirectives(vue.createVNode("img", vue.mergeProps({
|
7547 | "ref": imageRef
|
7548 | }, attrs), null), [[vue.resolveDirective("lazy"), props2.src]]);
|
7549 | }
|
7550 | return vue.createVNode("img", vue.mergeProps({
|
7551 | "ref": imageRef,
|
7552 | "src": props2.src,
|
7553 | "onLoad": onLoad,
|
7554 | "onError": onError
|
7555 | }, attrs), null);
|
7556 | };
|
7557 | const onLazyLoaded = ({
|
7558 | el
|
7559 | }) => {
|
7560 | const check = () => {
|
7561 | if (el === imageRef.value && loading.value) {
|
7562 | triggerLoad();
|
7563 | }
|
7564 | };
|
7565 | if (imageRef.value) {
|
7566 | check();
|
7567 | } else {
|
7568 | vue.nextTick(check);
|
7569 | }
|
7570 | };
|
7571 | const onLazyLoadError = ({
|
7572 | el
|
7573 | }) => {
|
7574 | if (el === imageRef.value && !error.value) {
|
7575 | onError();
|
7576 | }
|
7577 | };
|
7578 | if ($Lazyload && inBrowser$1) {
|
7579 | $Lazyload.$on("loaded", onLazyLoaded);
|
7580 | $Lazyload.$on("error", onLazyLoadError);
|
7581 | vue.onBeforeUnmount(() => {
|
7582 | $Lazyload.$off("loaded", onLazyLoaded);
|
7583 | $Lazyload.$off("error", onLazyLoadError);
|
7584 | });
|
7585 | }
|
7586 | vue.onMounted(() => {
|
7587 | vue.nextTick(() => {
|
7588 | var _a;
|
7589 | if (((_a = imageRef.value) == null ? void 0 : _a.complete) && !props2.lazyLoad) {
|
7590 | triggerLoad();
|
7591 | }
|
7592 | });
|
7593 | });
|
7594 | return () => {
|
7595 | var _a;
|
7596 | return vue.createVNode("div", {
|
7597 | "class": bem$14({
|
7598 | round: props2.round,
|
7599 | block: props2.block
|
7600 | }),
|
7601 | "style": style.value
|
7602 | }, [renderImage(), renderPlaceholder(), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
7603 | };
|
7604 | }
|
7605 | });
|
7606 | const Image$1 = withInstall(stdin_default$1e);
|
7607 | const [name$14, bem$13] = createNamespace("card");
|
7608 | const cardProps = {
|
7609 | tag: String,
|
7610 | num: numericProp,
|
7611 | desc: String,
|
7612 | thumb: String,
|
7613 | title: String,
|
7614 | price: numericProp,
|
7615 | centered: Boolean,
|
7616 | lazyLoad: Boolean,
|
7617 | currency: makeStringProp("¥"),
|
7618 | thumbLink: String,
|
7619 | originPrice: numericProp
|
7620 | };
|
7621 | var stdin_default$1d = vue.defineComponent({
|
7622 | name: name$14,
|
7623 | props: cardProps,
|
7624 | emits: ["clickThumb"],
|
7625 | setup(props2, {
|
7626 | slots,
|
7627 | emit
|
7628 | }) {
|
7629 | const renderTitle = () => {
|
7630 | if (slots.title) {
|
7631 | return slots.title();
|
7632 | }
|
7633 | if (props2.title) {
|
7634 | return vue.createVNode("div", {
|
7635 | "class": [bem$13("title"), "van-multi-ellipsis--l2"]
|
7636 | }, [props2.title]);
|
7637 | }
|
7638 | };
|
7639 | const renderThumbTag = () => {
|
7640 | if (slots.tag || props2.tag) {
|
7641 | return vue.createVNode("div", {
|
7642 | "class": bem$13("tag")
|
7643 | }, [slots.tag ? slots.tag() : vue.createVNode(Tag, {
|
7644 | "mark": true,
|
7645 | "type": "primary"
|
7646 | }, {
|
7647 | default: () => [props2.tag]
|
7648 | })]);
|
7649 | }
|
7650 | };
|
7651 | const renderThumbImage = () => {
|
7652 | if (slots.thumb) {
|
7653 | return slots.thumb();
|
7654 | }
|
7655 | return vue.createVNode(Image$1, {
|
7656 | "src": props2.thumb,
|
7657 | "fit": "cover",
|
7658 | "width": "100%",
|
7659 | "height": "100%",
|
7660 | "lazyLoad": props2.lazyLoad
|
7661 | }, null);
|
7662 | };
|
7663 | const renderThumb = () => {
|
7664 | if (slots.thumb || props2.thumb) {
|
7665 | return vue.createVNode("a", {
|
7666 | "href": props2.thumbLink,
|
7667 | "class": bem$13("thumb"),
|
7668 | "onClick": (event) => emit("clickThumb", event)
|
7669 | }, [renderThumbImage(), renderThumbTag()]);
|
7670 | }
|
7671 | };
|
7672 | const renderDesc = () => {
|
7673 | if (slots.desc) {
|
7674 | return slots.desc();
|
7675 | }
|
7676 | if (props2.desc) {
|
7677 | return vue.createVNode("div", {
|
7678 | "class": [bem$13("desc"), "van-ellipsis"]
|
7679 | }, [props2.desc]);
|
7680 | }
|
7681 | };
|
7682 | const renderPriceText = () => {
|
7683 | const priceArr = props2.price.toString().split(".");
|
7684 | return vue.createVNode("div", null, [vue.createVNode("span", {
|
7685 | "class": bem$13("price-currency")
|
7686 | }, [props2.currency]), vue.createVNode("span", {
|
7687 | "class": bem$13("price-integer")
|
7688 | }, [priceArr[0]]), vue.createTextVNode("."), vue.createVNode("span", {
|
7689 | "class": bem$13("price-decimal")
|
7690 | }, [priceArr[1]])]);
|
7691 | };
|
7692 | return () => {
|
7693 | var _a, _b, _c;
|
7694 | const showNum = slots.num || isDef(props2.num);
|
7695 | const showPrice = slots.price || isDef(props2.price);
|
7696 | const showOriginPrice = slots["origin-price"] || isDef(props2.originPrice);
|
7697 | const showBottom = showNum || showPrice || showOriginPrice || slots.bottom;
|
7698 | const Price = showPrice && vue.createVNode("div", {
|
7699 | "class": bem$13("price")
|
7700 | }, [slots.price ? slots.price() : renderPriceText()]);
|
7701 | const OriginPrice = showOriginPrice && vue.createVNode("div", {
|
7702 | "class": bem$13("origin-price")
|
7703 | }, [slots["origin-price"] ? slots["origin-price"]() : `${props2.currency} ${props2.originPrice}`]);
|
7704 | const Num = showNum && vue.createVNode("div", {
|
7705 | "class": bem$13("num")
|
7706 | }, [slots.num ? slots.num() : `x${props2.num}`]);
|
7707 | const Footer = slots.footer && vue.createVNode("div", {
|
7708 | "class": bem$13("footer")
|
7709 | }, [slots.footer()]);
|
7710 | const Bottom = showBottom && vue.createVNode("div", {
|
7711 | "class": bem$13("bottom")
|
7712 | }, [(_a = slots["price-top"]) == null ? void 0 : _a.call(slots), Price, OriginPrice, Num, (_b = slots.bottom) == null ? void 0 : _b.call(slots)]);
|
7713 | return vue.createVNode("div", {
|
7714 | "class": bem$13()
|
7715 | }, [vue.createVNode("div", {
|
7716 | "class": bem$13("header")
|
7717 | }, [renderThumb(), vue.createVNode("div", {
|
7718 | "class": bem$13("content", {
|
7719 | centered: props2.centered
|
7720 | })
|
7721 | }, [vue.createVNode("div", null, [renderTitle(), renderDesc(), (_c = slots.tags) == null ? void 0 : _c.call(slots)]), Bottom])]), Footer]);
|
7722 | };
|
7723 | }
|
7724 | });
|
7725 | const Card = withInstall(stdin_default$1d);
|
7726 | const [name$13, bem$12, t$f] = createNamespace("cascader");
|
7727 | const cascaderProps = {
|
7728 | title: String,
|
7729 | options: makeArrayProp(),
|
7730 | closeable: truthProp,
|
7731 | swipeable: truthProp,
|
7732 | closeIcon: makeStringProp("cross"),
|
7733 | showHeader: truthProp,
|
7734 | modelValue: numericProp,
|
7735 | fieldNames: Object,
|
7736 | placeholder: String,
|
7737 | activeColor: String
|
7738 | };
|
7739 | var stdin_default$1c = vue.defineComponent({
|
7740 | name: name$13,
|
7741 | props: cascaderProps,
|
7742 | emits: ["close", "change", "finish", "clickTab", "update:modelValue"],
|
7743 | setup(props2, {
|
7744 | slots,
|
7745 | emit
|
7746 | }) {
|
7747 | const tabs = vue.ref([]);
|
7748 | const activeTab = vue.ref(0);
|
7749 | const [selectedElementRefs, setSelectedElementRefs] = useRefs();
|
7750 | const {
|
7751 | text: textKey,
|
7752 | value: valueKey,
|
7753 | children: childrenKey
|
7754 | } = extend({
|
7755 | text: "text",
|
7756 | value: "value",
|
7757 | children: "children"
|
7758 | }, props2.fieldNames);
|
7759 | const getSelectedOptionsByValue = (options, value) => {
|
7760 | for (const option of options) {
|
7761 | if (option[valueKey] === value) {
|
7762 | return [option];
|
7763 | }
|
7764 | if (option[childrenKey]) {
|
7765 | const selectedOptions = getSelectedOptionsByValue(option[childrenKey], value);
|
7766 | if (selectedOptions) {
|
7767 | return [option, ...selectedOptions];
|
7768 | }
|
7769 | }
|
7770 | }
|
7771 | };
|
7772 | const updateTabs = () => {
|
7773 | const {
|
7774 | options,
|
7775 | modelValue
|
7776 | } = props2;
|
7777 | if (modelValue !== void 0) {
|
7778 | const selectedOptions = getSelectedOptionsByValue(options, modelValue);
|
7779 | if (selectedOptions) {
|
7780 | let optionsCursor = options;
|
7781 | tabs.value = selectedOptions.map((option) => {
|
7782 | const tab = {
|
7783 | options: optionsCursor,
|
7784 | selected: option
|
7785 | };
|
7786 | const next = optionsCursor.find((item) => item[valueKey] === option[valueKey]);
|
7787 | if (next) {
|
7788 | optionsCursor = next[childrenKey];
|
7789 | }
|
7790 | return tab;
|
7791 | });
|
7792 | if (optionsCursor) {
|
7793 | tabs.value.push({
|
7794 | options: optionsCursor,
|
7795 | selected: null
|
7796 | });
|
7797 | }
|
7798 | vue.nextTick(() => {
|
7799 | activeTab.value = tabs.value.length - 1;
|
7800 | });
|
7801 | return;
|
7802 | }
|
7803 | }
|
7804 | tabs.value = [{
|
7805 | options,
|
7806 | selected: null
|
7807 | }];
|
7808 | };
|
7809 | const onSelect = (option, tabIndex) => {
|
7810 | if (option.disabled) {
|
7811 | return;
|
7812 | }
|
7813 | tabs.value[tabIndex].selected = option;
|
7814 | if (tabs.value.length > tabIndex + 1) {
|
7815 | tabs.value = tabs.value.slice(0, tabIndex + 1);
|
7816 | }
|
7817 | if (option[childrenKey]) {
|
7818 | const nextTab = {
|
7819 | options: option[childrenKey],
|
7820 | selected: null
|
7821 | };
|
7822 | if (tabs.value[tabIndex + 1]) {
|
7823 | tabs.value[tabIndex + 1] = nextTab;
|
7824 | } else {
|
7825 | tabs.value.push(nextTab);
|
7826 | }
|
7827 | vue.nextTick(() => {
|
7828 | activeTab.value++;
|
7829 | });
|
7830 | }
|
7831 | const selectedOptions = tabs.value.map((tab) => tab.selected).filter(Boolean);
|
7832 | emit("update:modelValue", option[valueKey]);
|
7833 | const params = {
|
7834 | value: option[valueKey],
|
7835 | tabIndex,
|
7836 | selectedOptions
|
7837 | };
|
7838 | emit("change", params);
|
7839 | if (!option[childrenKey]) {
|
7840 | emit("finish", params);
|
7841 | }
|
7842 | };
|
7843 | const onClose = () => emit("close");
|
7844 | const onClickTab = ({
|
7845 | name: name2,
|
7846 | title
|
7847 | }) => emit("clickTab", name2, title);
|
7848 | const renderHeader = () => props2.showHeader ? vue.createVNode("div", {
|
7849 | "class": bem$12("header")
|
7850 | }, [vue.createVNode("h2", {
|
7851 | "class": bem$12("title")
|
7852 | }, [slots.title ? slots.title() : props2.title]), props2.closeable ? vue.createVNode(Icon, {
|
7853 | "name": props2.closeIcon,
|
7854 | "class": [bem$12("close-icon"), HAPTICS_FEEDBACK],
|
7855 | "onClick": onClose
|
7856 | }, null) : null]) : null;
|
7857 | const renderOption = (option, selectedOption, tabIndex) => {
|
7858 | const {
|
7859 | disabled
|
7860 | } = option;
|
7861 | const selected = !!(selectedOption && option[valueKey] === selectedOption[valueKey]);
|
7862 | const color = option.color || (selected ? props2.activeColor : void 0);
|
7863 | const Text = slots.option ? slots.option({
|
7864 | option,
|
7865 | selected
|
7866 | }) : vue.createVNode("span", null, [option[textKey]]);
|
7867 | return vue.createVNode("li", {
|
7868 | "ref": selected ? setSelectedElementRefs(tabIndex) : void 0,
|
7869 | "role": "menuitemradio",
|
7870 | "class": [bem$12("option", {
|
7871 | selected,
|
7872 | disabled
|
7873 | }), option.className],
|
7874 | "style": {
|
7875 | color
|
7876 | },
|
7877 | "tabindex": disabled ? void 0 : selected ? 0 : -1,
|
7878 | "aria-checked": selected,
|
7879 | "aria-disabled": disabled || void 0,
|
7880 | "onClick": () => onSelect(option, tabIndex)
|
7881 | }, [Text, selected ? vue.createVNode(Icon, {
|
7882 | "name": "success",
|
7883 | "class": bem$12("selected-icon")
|
7884 | }, null) : null]);
|
7885 | };
|
7886 | const renderOptions = (options, selectedOption, tabIndex) => vue.createVNode("ul", {
|
7887 | "role": "menu",
|
7888 | "class": bem$12("options")
|
7889 | }, [options.map((option) => renderOption(option, selectedOption, tabIndex))]);
|
7890 | const renderTab = (tab, tabIndex) => {
|
7891 | const {
|
7892 | options,
|
7893 | selected
|
7894 | } = tab;
|
7895 | const placeholder = props2.placeholder || t$f("select");
|
7896 | const title = selected ? selected[textKey] : placeholder;
|
7897 | return vue.createVNode(Tab, {
|
7898 | "title": title,
|
7899 | "titleClass": bem$12("tab", {
|
7900 | unselected: !selected
|
7901 | })
|
7902 | }, {
|
7903 | default: () => {
|
7904 | var _a, _b;
|
7905 | return [(_a = slots["options-top"]) == null ? void 0 : _a.call(slots, {
|
7906 | tabIndex
|
7907 | }), renderOptions(options, selected, tabIndex), (_b = slots["options-bottom"]) == null ? void 0 : _b.call(slots, {
|
7908 | tabIndex
|
7909 | })];
|
7910 | }
|
7911 | });
|
7912 | };
|
7913 | const renderTabs = () => vue.createVNode(Tabs, {
|
7914 | "active": activeTab.value,
|
7915 | "onUpdate:active": ($event) => activeTab.value = $event,
|
7916 | "shrink": true,
|
7917 | "animated": true,
|
7918 | "class": bem$12("tabs"),
|
7919 | "color": props2.activeColor,
|
7920 | "swipeable": props2.swipeable,
|
7921 | "onClickTab": onClickTab
|
7922 | }, {
|
7923 | default: () => [tabs.value.map(renderTab)]
|
7924 | });
|
7925 | const scrollIntoView = (el) => {
|
7926 | const scrollParent = el.parentElement;
|
7927 | if (scrollParent) {
|
7928 | scrollParent.scrollTop = el.offsetTop - (scrollParent.offsetHeight - el.offsetHeight) / 2;
|
7929 | }
|
7930 | };
|
7931 | updateTabs();
|
7932 | vue.watch(activeTab, (value) => {
|
7933 | const el = selectedElementRefs.value[value];
|
7934 | if (el)
|
7935 | scrollIntoView(el);
|
7936 | });
|
7937 | vue.watch(() => props2.options, updateTabs, {
|
7938 | deep: true
|
7939 | });
|
7940 | vue.watch(() => props2.modelValue, (value) => {
|
7941 | if (value !== void 0) {
|
7942 | const values = tabs.value.map((tab) => {
|
7943 | var _a;
|
7944 | return (_a = tab.selected) == null ? void 0 : _a[valueKey];
|
7945 | });
|
7946 | if (values.includes(value)) {
|
7947 | return;
|
7948 | }
|
7949 | }
|
7950 | updateTabs();
|
7951 | });
|
7952 | return () => vue.createVNode("div", {
|
7953 | "class": bem$12()
|
7954 | }, [renderHeader(), renderTabs()]);
|
7955 | }
|
7956 | });
|
7957 | const Cascader = withInstall(stdin_default$1c);
|
7958 | const [name$12, bem$11] = createNamespace("cell-group");
|
7959 | const cellGroupProps = {
|
7960 | title: String,
|
7961 | inset: Boolean,
|
7962 | border: truthProp
|
7963 | };
|
7964 | var stdin_default$1b = vue.defineComponent({
|
7965 | name: name$12,
|
7966 | inheritAttrs: false,
|
7967 | props: cellGroupProps,
|
7968 | setup(props2, {
|
7969 | slots,
|
7970 | attrs
|
7971 | }) {
|
7972 | const renderGroup = () => {
|
7973 | var _a;
|
7974 | return vue.createVNode("div", vue.mergeProps({
|
7975 | "class": [bem$11({
|
7976 | inset: props2.inset
|
7977 | }), {
|
7978 | [BORDER_TOP_BOTTOM]: props2.border && !props2.inset
|
7979 | }]
|
7980 | }, attrs, useScopeId()), [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
7981 | };
|
7982 | const renderTitle = () => vue.createVNode("div", {
|
7983 | "class": bem$11("title", {
|
7984 | inset: props2.inset
|
7985 | })
|
7986 | }, [slots.title ? slots.title() : props2.title]);
|
7987 | return () => {
|
7988 | if (props2.title || slots.title) {
|
7989 | return vue.createVNode(vue.Fragment, null, [renderTitle(), renderGroup()]);
|
7990 | }
|
7991 | return renderGroup();
|
7992 | };
|
7993 | }
|
7994 | });
|
7995 | const CellGroup = withInstall(stdin_default$1b);
|
7996 | const [name$11, bem$10] = createNamespace("checkbox-group");
|
7997 | const checkboxGroupProps = {
|
7998 | max: numericProp,
|
7999 | shape: makeStringProp("round"),
|
8000 | disabled: Boolean,
|
8001 | iconSize: numericProp,
|
8002 | direction: String,
|
8003 | modelValue: makeArrayProp(),
|
8004 | checkedColor: String
|
8005 | };
|
8006 | const CHECKBOX_GROUP_KEY = Symbol(name$11);
|
8007 | var stdin_default$1a = vue.defineComponent({
|
8008 | name: name$11,
|
8009 | props: checkboxGroupProps,
|
8010 | emits: ["change", "update:modelValue"],
|
8011 | setup(props2, {
|
8012 | emit,
|
8013 | slots
|
8014 | }) {
|
8015 | const {
|
8016 | children,
|
8017 | linkChildren
|
8018 | } = useChildren(CHECKBOX_GROUP_KEY);
|
8019 | const updateValue = (value) => emit("update:modelValue", value);
|
8020 | const toggleAll = (options = {}) => {
|
8021 | if (typeof options === "boolean") {
|
8022 | options = {
|
8023 | checked: options
|
8024 | };
|
8025 | }
|
8026 | const {
|
8027 | checked,
|
8028 | skipDisabled
|
8029 | } = options;
|
8030 | const checkedChildren = children.filter((item) => {
|
8031 | if (!item.props.bindGroup) {
|
8032 | return false;
|
8033 | }
|
8034 | if (item.props.disabled && skipDisabled) {
|
8035 | return item.checked.value;
|
8036 | }
|
8037 | return checked != null ? checked : !item.checked.value;
|
8038 | });
|
8039 | const names = checkedChildren.map((item) => item.name);
|
8040 | updateValue(names);
|
8041 | };
|
8042 | vue.watch(() => props2.modelValue, (value) => emit("change", value));
|
8043 | useExpose({
|
8044 | toggleAll
|
8045 | });
|
8046 | useCustomFieldValue(() => props2.modelValue);
|
8047 | linkChildren({
|
8048 | props: props2,
|
8049 | updateValue
|
8050 | });
|
8051 | return () => {
|
8052 | var _a;
|
8053 | return vue.createVNode("div", {
|
8054 | "class": bem$10([props2.direction])
|
8055 | }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
8056 | };
|
8057 | }
|
8058 | });
|
8059 | const [name$10, bem$$] = createNamespace("checkbox");
|
8060 | const checkboxProps = extend({}, checkerProps, {
|
8061 | shape: String,
|
8062 | bindGroup: truthProp,
|
8063 | indeterminate: {
|
8064 | type: Boolean,
|
8065 | default: null
|
8066 | }
|
8067 | });
|
8068 | var stdin_default$19 = vue.defineComponent({
|
8069 | name: name$10,
|
8070 | props: checkboxProps,
|
8071 | emits: ["change", "update:modelValue"],
|
8072 | setup(props2, {
|
8073 | emit,
|
8074 | slots
|
8075 | }) {
|
8076 | const {
|
8077 | parent
|
8078 | } = useParent(CHECKBOX_GROUP_KEY);
|
8079 | const setParentValue = (checked2) => {
|
8080 | const {
|
8081 | name: name2
|
8082 | } = props2;
|
8083 | const {
|
8084 | max,
|
8085 | modelValue
|
8086 | } = parent.props;
|
8087 | const value = modelValue.slice();
|
8088 | if (checked2) {
|
8089 | const overlimit = max && value.length >= +max;
|
8090 | if (!overlimit && !value.includes(name2)) {
|
8091 | value.push(name2);
|
8092 | if (props2.bindGroup) {
|
8093 | parent.updateValue(value);
|
8094 | }
|
8095 | }
|
8096 | } else {
|
8097 | const index = value.indexOf(name2);
|
8098 | if (index !== -1) {
|
8099 | value.splice(index, 1);
|
8100 | if (props2.bindGroup) {
|
8101 | parent.updateValue(value);
|
8102 | }
|
8103 | }
|
8104 | }
|
8105 | };
|
8106 | const checked = vue.computed(() => {
|
8107 | if (parent && props2.bindGroup) {
|
8108 | return parent.props.modelValue.indexOf(props2.name) !== -1;
|
8109 | }
|
8110 | return !!props2.modelValue;
|
8111 | });
|
8112 | const toggle = (newValue = !checked.value) => {
|
8113 | if (parent && props2.bindGroup) {
|
8114 | setParentValue(newValue);
|
8115 | } else {
|
8116 | emit("update:modelValue", newValue);
|
8117 | }
|
8118 | if (props2.indeterminate !== null)
|
8119 | emit("change", newValue);
|
8120 | };
|
8121 | vue.watch(() => props2.modelValue, (value) => {
|
8122 | if (props2.indeterminate === null)
|
8123 | emit("change", value);
|
8124 | });
|
8125 | useExpose({
|
8126 | toggle,
|
8127 | props: props2,
|
8128 | checked
|
8129 | });
|
8130 | useCustomFieldValue(() => props2.modelValue);
|
8131 | return () => vue.createVNode(stdin_default$1o, vue.mergeProps({
|
8132 | "bem": bem$$,
|
8133 | "role": "checkbox",
|
8134 | "parent": parent,
|
8135 | "checked": checked.value,
|
8136 | "onToggle": toggle
|
8137 | }, props2), pick(slots, ["default", "icon"]));
|
8138 | }
|
8139 | });
|
8140 | const Checkbox = withInstall(stdin_default$19);
|
8141 | const CheckboxGroup = withInstall(stdin_default$1a);
|
8142 | const [name$$, bem$_] = createNamespace("circle");
|
8143 | let uid = 0;
|
8144 | const format = (rate) => Math.min(Math.max(+rate, 0), 100);
|
8145 | function getPath(clockwise, viewBoxSize) {
|
8146 | const sweepFlag = clockwise ? 1 : 0;
|
8147 | return `M ${viewBoxSize / 2} ${viewBoxSize / 2} m 0, -500 a 500, 500 0 1, ${sweepFlag} 0, 1000 a 500, 500 0 1, ${sweepFlag} 0, -1000`;
|
8148 | }
|
8149 | const circleProps = {
|
8150 | text: String,
|
8151 | size: numericProp,
|
8152 | fill: makeStringProp("none"),
|
8153 | rate: makeNumericProp(100),
|
8154 | speed: makeNumericProp(0),
|
8155 | color: [String, Object],
|
8156 | clockwise: truthProp,
|
8157 | layerColor: String,
|
8158 | currentRate: makeNumberProp(0),
|
8159 | strokeWidth: makeNumericProp(40),
|
8160 | strokeLinecap: String,
|
8161 | startPosition: makeStringProp("top")
|
8162 | };
|
8163 | var stdin_default$18 = vue.defineComponent({
|
8164 | name: name$$,
|
8165 | props: circleProps,
|
8166 | emits: ["update:currentRate"],
|
8167 | setup(props2, {
|
8168 | emit,
|
8169 | slots
|
8170 | }) {
|
8171 | const id = `van-circle-${uid++}`;
|
8172 | const viewBoxSize = vue.computed(() => +props2.strokeWidth + 1e3);
|
8173 | const path = vue.computed(() => getPath(props2.clockwise, viewBoxSize.value));
|
8174 | const svgStyle = vue.computed(() => {
|
8175 | const ROTATE_ANGLE_MAP = {
|
8176 | top: 0,
|
8177 | right: 90,
|
8178 | bottom: 180,
|
8179 | left: 270
|
8180 | };
|
8181 | const angleValue = ROTATE_ANGLE_MAP[props2.startPosition];
|
8182 | if (angleValue) {
|
8183 | return {
|
8184 | transform: `rotate(${angleValue}deg)`
|
8185 | };
|
8186 | }
|
8187 | });
|
8188 | vue.watch(() => props2.rate, (rate) => {
|
8189 | let rafId;
|
8190 | const startTime = Date.now();
|
8191 | const startRate = props2.currentRate;
|
8192 | const endRate = format(rate);
|
8193 | const duration = Math.abs((startRate - endRate) * 1e3 / +props2.speed);
|
8194 | const animate = () => {
|
8195 | const now = Date.now();
|
8196 | const progress = Math.min((now - startTime) / duration, 1);
|
8197 | const rate2 = progress * (endRate - startRate) + startRate;
|
8198 | emit("update:currentRate", format(parseFloat(rate2.toFixed(1))));
|
8199 | if (endRate > startRate ? rate2 < endRate : rate2 > endRate) {
|
8200 | rafId = raf(animate);
|
8201 | }
|
8202 | };
|
8203 | if (props2.speed) {
|
8204 | if (rafId) {
|
8205 | cancelRaf(rafId);
|
8206 | }
|
8207 | rafId = raf(animate);
|
8208 | } else {
|
8209 | emit("update:currentRate", endRate);
|
8210 | }
|
8211 | }, {
|
8212 | immediate: true
|
8213 | });
|
8214 | const renderHover = () => {
|
8215 | const PERIMETER = 3140;
|
8216 | const {
|
8217 | strokeWidth,
|
8218 | currentRate,
|
8219 | strokeLinecap
|
8220 | } = props2;
|
8221 | const offset2 = PERIMETER * currentRate / 100;
|
8222 | const color = isObject$1(props2.color) ? `url(#${id})` : props2.color;
|
8223 | const style = {
|
8224 | stroke: color,
|
8225 | strokeWidth: `${+strokeWidth + 1}px`,
|
8226 | strokeLinecap,
|
8227 | strokeDasharray: `${offset2}px ${PERIMETER}px`
|
8228 | };
|
8229 | return vue.createVNode("path", {
|
8230 | "d": path.value,
|
8231 | "style": style,
|
8232 | "class": bem$_("hover"),
|
8233 | "stroke": color
|
8234 | }, null);
|
8235 | };
|
8236 | const renderLayer = () => {
|
8237 | const style = {
|
8238 | fill: props2.fill,
|
8239 | stroke: props2.layerColor,
|
8240 | strokeWidth: `${props2.strokeWidth}px`
|
8241 | };
|
8242 | return vue.createVNode("path", {
|
8243 | "class": bem$_("layer"),
|
8244 | "style": style,
|
8245 | "d": path.value
|
8246 | }, null);
|
8247 | };
|
8248 | const renderGradient = () => {
|
8249 | const {
|
8250 | color
|
8251 | } = props2;
|
8252 | if (!isObject$1(color)) {
|
8253 | return;
|
8254 | }
|
8255 | const Stops = Object.keys(color).sort((a, b) => parseFloat(a) - parseFloat(b)).map((key, index) => vue.createVNode("stop", {
|
8256 | "key": index,
|
8257 | "offset": key,
|
8258 | "stop-color": color[key]
|
8259 | }, null));
|
8260 | return vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
|
8261 | "id": id,
|
8262 | "x1": "100%",
|
8263 | "y1": "0%",
|
8264 | "x2": "0%",
|
8265 | "y2": "0%"
|
8266 | }, [Stops])]);
|
8267 | };
|
8268 | const renderText = () => {
|
8269 | if (slots.default) {
|
8270 | return slots.default();
|
8271 | }
|
8272 | if (props2.text) {
|
8273 | return vue.createVNode("div", {
|
8274 | "class": bem$_("text")
|
8275 | }, [props2.text]);
|
8276 | }
|
8277 | };
|
8278 | return () => vue.createVNode("div", {
|
8279 | "class": bem$_(),
|
8280 | "style": getSizeStyle(props2.size)
|
8281 | }, [vue.createVNode("svg", {
|
8282 | "viewBox": `0 0 ${viewBoxSize.value} ${viewBoxSize.value}`,
|
8283 | "style": svgStyle.value
|
8284 | }, [renderGradient(), renderLayer(), renderHover()]), renderText()]);
|
8285 | }
|
8286 | });
|
8287 | const Circle = withInstall(stdin_default$18);
|
8288 | const [name$_, bem$Z] = createNamespace("row");
|
8289 | const ROW_KEY = Symbol(name$_);
|
8290 | const rowProps = {
|
8291 | tag: makeStringProp("div"),
|
8292 | wrap: truthProp,
|
8293 | align: String,
|
8294 | gutter: {
|
8295 | type: [String, Number, Array],
|
8296 | default: 0
|
8297 | },
|
8298 | justify: String
|
8299 | };
|
8300 | var stdin_default$17 = vue.defineComponent({
|
8301 | name: name$_,
|
8302 | props: rowProps,
|
8303 | setup(props2, {
|
8304 | slots
|
8305 | }) {
|
8306 | const {
|
8307 | children,
|
8308 | linkChildren
|
8309 | } = useChildren(ROW_KEY);
|
8310 | const groups = vue.computed(() => {
|
8311 | const groups2 = [[]];
|
8312 | let totalSpan = 0;
|
8313 | children.forEach((child, index) => {
|
8314 | totalSpan += Number(child.span);
|
8315 | if (totalSpan > 24) {
|
8316 | groups2.push([index]);
|
8317 | totalSpan -= 24;
|
8318 | } else {
|
8319 | groups2[groups2.length - 1].push(index);
|
8320 | }
|
8321 | });
|
8322 | return groups2;
|
8323 | });
|
8324 | const spaces = vue.computed(() => {
|
8325 | let gutter = 0;
|
8326 | if (Array.isArray(props2.gutter)) {
|
8327 | gutter = Number(props2.gutter[0]) || 0;
|
8328 | } else {
|
8329 | gutter = Number(props2.gutter);
|
8330 | }
|
8331 | const spaces2 = [];
|
8332 | if (!gutter) {
|
8333 | return spaces2;
|
8334 | }
|
8335 | groups.value.forEach((group) => {
|
8336 | const averagePadding = gutter * (group.length - 1) / group.length;
|
8337 | group.forEach((item, index) => {
|
8338 | if (index === 0) {
|
8339 | spaces2.push({
|
8340 | right: averagePadding
|
8341 | });
|
8342 | } else {
|
8343 | const left2 = gutter - spaces2[item - 1].right;
|
8344 | const right2 = averagePadding - left2;
|
8345 | spaces2.push({
|
8346 | left: left2,
|
8347 | right: right2
|
8348 | });
|
8349 | }
|
8350 | });
|
8351 | });
|
8352 | return spaces2;
|
8353 | });
|
8354 | const verticalSpaces = vue.computed(() => {
|
8355 | const {
|
8356 | gutter
|
8357 | } = props2;
|
8358 | const spaces2 = [];
|
8359 | if (Array.isArray(gutter) && gutter.length > 1) {
|
8360 | const bottom2 = Number(gutter[1]) || 0;
|
8361 | if (bottom2 <= 0) {
|
8362 | return spaces2;
|
8363 | }
|
8364 | groups.value.forEach((group, index) => {
|
8365 | if (index === groups.value.length - 1)
|
8366 | return;
|
8367 | group.forEach(() => {
|
8368 | spaces2.push({
|
8369 | bottom: bottom2
|
8370 | });
|
8371 | });
|
8372 | });
|
8373 | }
|
8374 | return spaces2;
|
8375 | });
|
8376 | linkChildren({
|
8377 | spaces,
|
8378 | verticalSpaces
|
8379 | });
|
8380 | return () => {
|
8381 | const {
|
8382 | tag,
|
8383 | wrap,
|
8384 | align,
|
8385 | justify
|
8386 | } = props2;
|
8387 | return vue.createVNode(tag, {
|
8388 | "class": bem$Z({
|
8389 | [`align-${align}`]: align,
|
8390 | [`justify-${justify}`]: justify,
|
8391 | nowrap: !wrap
|
8392 | })
|
8393 | }, {
|
8394 | default: () => {
|
8395 | var _a;
|
8396 | return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
|
8397 | }
|
8398 | });
|
8399 | };
|
8400 | }
|
8401 | });
|
8402 | const [name$Z, bem$Y] = createNamespace("col");
|
8403 | const colProps = {
|
8404 | tag: makeStringProp("div"),
|
8405 | span: makeNumericProp(0),
|
8406 | offset: numericProp
|
8407 | };
|
8408 | var stdin_default$16 = vue.defineComponent({
|
8409 | name: name$Z,
|
8410 | props: colProps,
|
8411 | setup(props2, {
|
8412 | slots
|
8413 | }) {
|
8414 | const {
|
8415 | parent,
|
8416 | index
|
8417 | } = useParent(ROW_KEY);
|
8418 | const style = vue.computed(() => {
|
8419 | if (!parent) {
|
8420 | return;
|
8421 | }
|
8422 | const {
|
8423 | spaces,
|
8424 | verticalSpaces
|
8425 | } = parent;
|
8426 | let styles = {};
|
8427 | if (spaces && spaces.value && spaces.value[index.value]) {
|
8428 | const {
|
8429 | left: left2,
|
8430 | right: right2
|
8431 | } = spaces.value[index.value];
|
8432 | styles = {
|
8433 | paddingLeft: left2 ? `${left2}px` : null,
|
8434 | paddingRight: right2 ? `${right2}px` : null
|
8435 | };
|
8436 | }
|
8437 | const {
|
8438 | bottom: bottom2
|
8439 | } = verticalSpaces.value[index.value] || {};
|
8440 | return extend(styles, {
|
8441 | marginBottom: bottom2 ? `${bottom2}px` : null
|
8442 | });
|
8443 | });
|
8444 | return () => {
|
8445 | const {
|
8446 | tag,
|
8447 | span,
|
8448 | offset: offset2
|
8449 | } = props2;
|
8450 | return vue.createVNode(tag, {
|
8451 | "style": style.value,
|
8452 | "class": bem$Y({
|
8453 | [span]: span,
|
8454 | [`offset-${offset2}`]: offset2
|
8455 | })
|
8456 | }, {
|
8457 | default: () => {
|
8458 | var _a;
|
8459 | return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
|
8460 | }
|
8461 | });
|
8462 | };
|
8463 | }
|
8464 | });
|
8465 | const Col = withInstall(stdin_default$16);
|
8466 | const [name$Y, bem$X] = createNamespace("collapse");
|
8467 | const COLLAPSE_KEY = Symbol(name$Y);
|
8468 | const collapseProps = {
|
8469 | border: truthProp,
|
8470 | accordion: Boolean,
|
8471 | modelValue: {
|
8472 | type: [String, Number, Array],
|
8473 | default: ""
|
8474 | }
|
8475 | };
|
8476 | var stdin_default$15 = vue.defineComponent({
|
8477 | name: name$Y,
|
8478 | props: collapseProps,
|
8479 | emits: ["change", "update:modelValue"],
|
8480 | setup(props2, {
|
8481 | emit,
|
8482 | slots
|
8483 | }) {
|
8484 | const {
|
8485 | linkChildren,
|
8486 | children
|
8487 | } = useChildren(COLLAPSE_KEY);
|
8488 | const updateName = (name2) => {
|
8489 | emit("change", name2);
|
8490 | emit("update:modelValue", name2);
|
8491 | };
|
8492 | const toggle = (name2, expanded) => {
|
8493 | const {
|
8494 | accordion,
|
8495 | modelValue
|
8496 | } = props2;
|
8497 | if (accordion) {
|
8498 | updateName(name2 === modelValue ? "" : name2);
|
8499 | } else if (expanded) {
|
8500 | updateName(modelValue.concat(name2));
|
8501 | } else {
|
8502 | updateName(modelValue.filter((activeName) => activeName !== name2));
|
8503 | }
|
8504 | };
|
8505 | const toggleAll = (options = {}) => {
|
8506 | if (props2.accordion) {
|
8507 | return;
|
8508 | }
|
8509 | if (typeof options === "boolean") {
|
8510 | options = {
|
8511 | expanded: options
|
8512 | };
|
8513 | }
|
8514 | const {
|
8515 | expanded,
|
8516 | skipDisabled
|
8517 | } = options;
|
8518 | const expandedChildren = children.filter((item) => {
|
8519 | if (item.disabled && skipDisabled) {
|
8520 | return item.expanded.value;
|
8521 | }
|
8522 | return expanded != null ? expanded : !item.expanded.value;
|
8523 | });
|
8524 | const names = expandedChildren.map((item) => item.itemName.value);
|
8525 | updateName(names);
|
8526 | };
|
8527 | const isExpanded = (name2) => {
|
8528 | const {
|
8529 | accordion,
|
8530 | modelValue
|
8531 | } = props2;
|
8532 | return accordion ? modelValue === name2 : modelValue.includes(name2);
|
8533 | };
|
8534 | useExpose({
|
8535 | toggleAll
|
8536 | });
|
8537 | linkChildren({
|
8538 | toggle,
|
8539 | isExpanded
|
8540 | });
|
8541 | return () => {
|
8542 | var _a;
|
8543 | return vue.createVNode("div", {
|
8544 | "class": [bem$X(), {
|
8545 | [BORDER_TOP_BOTTOM]: props2.border
|
8546 | }]
|
8547 | }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
8548 | };
|
8549 | }
|
8550 | });
|
8551 | const Collapse = withInstall(stdin_default$15);
|
8552 | const [name$X, bem$W] = createNamespace("collapse-item");
|
8553 | const CELL_SLOTS = ["icon", "title", "value", "label", "right-icon"];
|
8554 | const collapseItemProps = extend({}, cellSharedProps, {
|
8555 | name: numericProp,
|
8556 | isLink: truthProp,
|
8557 | disabled: Boolean,
|
8558 | readonly: Boolean,
|
8559 | lazyRender: truthProp
|
8560 | });
|
8561 | var stdin_default$14 = vue.defineComponent({
|
8562 | name: name$X,
|
8563 | props: collapseItemProps,
|
8564 | setup(props2, {
|
8565 | slots
|
8566 | }) {
|
8567 | const wrapperRef = vue.ref();
|
8568 | const contentRef = vue.ref();
|
8569 | const {
|
8570 | parent,
|
8571 | index
|
8572 | } = useParent(COLLAPSE_KEY);
|
8573 | if (!parent) {
|
8574 | return;
|
8575 | }
|
8576 | const name2 = vue.computed(() => {
|
8577 | var _a;
|
8578 | return (_a = props2.name) != null ? _a : index.value;
|
8579 | });
|
8580 | const expanded = vue.computed(() => parent.isExpanded(name2.value));
|
8581 | const show = vue.ref(expanded.value);
|
8582 | const lazyRender = useLazyRender(() => show.value || !props2.lazyRender);
|
8583 | const onTransitionEnd = () => {
|
8584 | if (!expanded.value) {
|
8585 | show.value = false;
|
8586 | } else if (wrapperRef.value) {
|
8587 | wrapperRef.value.style.height = "";
|
8588 | }
|
8589 | };
|
8590 | vue.watch(expanded, (value, oldValue) => {
|
8591 | if (oldValue === null) {
|
8592 | return;
|
8593 | }
|
8594 | if (value) {
|
8595 | show.value = true;
|
8596 | }
|
8597 | const tick = value ? vue.nextTick : raf;
|
8598 | tick(() => {
|
8599 | if (!contentRef.value || !wrapperRef.value) {
|
8600 | return;
|
8601 | }
|
8602 | const {
|
8603 | offsetHeight
|
8604 | } = contentRef.value;
|
8605 | if (offsetHeight) {
|
8606 | const contentHeight = `${offsetHeight}px`;
|
8607 | wrapperRef.value.style.height = value ? "0" : contentHeight;
|
8608 | doubleRaf(() => {
|
8609 | if (wrapperRef.value) {
|
8610 | wrapperRef.value.style.height = value ? contentHeight : "0";
|
8611 | }
|
8612 | });
|
8613 | } else {
|
8614 | onTransitionEnd();
|
8615 | }
|
8616 | });
|
8617 | });
|
8618 | const toggle = (newValue = !expanded.value) => {
|
8619 | parent.toggle(name2.value, newValue);
|
8620 | };
|
8621 | const onClickTitle = () => {
|
8622 | if (!props2.disabled && !props2.readonly) {
|
8623 | toggle();
|
8624 | }
|
8625 | };
|
8626 | const renderTitle = () => {
|
8627 | const {
|
8628 | border,
|
8629 | disabled,
|
8630 | readonly
|
8631 | } = props2;
|
8632 | const attrs = pick(props2, Object.keys(cellSharedProps));
|
8633 | if (readonly) {
|
8634 | attrs.isLink = false;
|
8635 | }
|
8636 | if (disabled || readonly) {
|
8637 | attrs.clickable = false;
|
8638 | }
|
8639 | return vue.createVNode(Cell, vue.mergeProps({
|
8640 | "role": "button",
|
8641 | "class": bem$W("title", {
|
8642 | disabled,
|
8643 | expanded: expanded.value,
|
8644 | borderless: !border
|
8645 | }),
|
8646 | "aria-expanded": String(expanded.value),
|
8647 | "onClick": onClickTitle
|
8648 | }, attrs), pick(slots, CELL_SLOTS));
|
8649 | };
|
8650 | const renderContent = lazyRender(() => {
|
8651 | var _a;
|
8652 | return vue.withDirectives(vue.createVNode("div", {
|
8653 | "ref": wrapperRef,
|
8654 | "class": bem$W("wrapper"),
|
8655 | "onTransitionend": onTransitionEnd
|
8656 | }, [vue.createVNode("div", {
|
8657 | "ref": contentRef,
|
8658 | "class": bem$W("content")
|
8659 | }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]), [[vue.vShow, show.value]]);
|
8660 | });
|
8661 | useExpose({
|
8662 | toggle,
|
8663 | expanded,
|
8664 | itemName: name2
|
8665 | });
|
8666 | return () => vue.createVNode("div", {
|
8667 | "class": [bem$W({
|
8668 | border: index.value && props2.border
|
8669 | })]
|
8670 | }, [renderTitle(), renderContent()]);
|
8671 | }
|
8672 | });
|
8673 | const CollapseItem = withInstall(stdin_default$14);
|
8674 | const ConfigProvider = withInstall(stdin_default$1S);
|
8675 | const [name$W, bem$V, t$e] = createNamespace("contact-card");
|
8676 | const contactCardProps = {
|
8677 | tel: String,
|
8678 | name: String,
|
8679 | type: makeStringProp("add"),
|
8680 | addText: String,
|
8681 | editable: truthProp
|
8682 | };
|
8683 | var stdin_default$13 = vue.defineComponent({
|
8684 | name: name$W,
|
8685 | props: contactCardProps,
|
8686 | emits: ["click"],
|
8687 | setup(props2, {
|
8688 | emit
|
8689 | }) {
|
8690 | const onClick = (event) => {
|
8691 | if (props2.editable) {
|
8692 | emit("click", event);
|
8693 | }
|
8694 | };
|
8695 | const renderContent = () => {
|
8696 | if (props2.type === "add") {
|
8697 | return props2.addText || t$e("addContact");
|
8698 | }
|
8699 | return [vue.createVNode("div", null, [`${t$e("name")}:${props2.name}`]), vue.createVNode("div", null, [`${t$e("tel")}:${props2.tel}`])];
|
8700 | };
|
8701 | return () => vue.createVNode(Cell, {
|
8702 | "center": true,
|
8703 | "icon": props2.type === "edit" ? "contact" : "add-square",
|
8704 | "class": bem$V([props2.type]),
|
8705 | "border": false,
|
8706 | "isLink": props2.editable,
|
8707 | "titleClass": bem$V("title"),
|
8708 | "onClick": onClick
|
8709 | }, {
|
8710 | title: renderContent
|
8711 | });
|
8712 | }
|
8713 | });
|
8714 | const ContactCard = withInstall(stdin_default$13);
|
8715 | const [name$V, bem$U, t$d] = createNamespace("contact-edit");
|
8716 | const DEFAULT_CONTACT = {
|
8717 | tel: "",
|
8718 | name: ""
|
8719 | };
|
8720 | const contactEditProps = {
|
8721 | isEdit: Boolean,
|
8722 | isSaving: Boolean,
|
8723 | isDeleting: Boolean,
|
8724 | showSetDefault: Boolean,
|
8725 | setDefaultLabel: String,
|
8726 | contactInfo: {
|
8727 | type: Object,
|
8728 | default: () => extend({}, DEFAULT_CONTACT)
|
8729 | },
|
8730 | telValidator: {
|
8731 | type: Function,
|
8732 | default: isMobile
|
8733 | }
|
8734 | };
|
8735 | var stdin_default$12 = vue.defineComponent({
|
8736 | name: name$V,
|
8737 | props: contactEditProps,
|
8738 | emits: ["save", "delete", "changeDefault"],
|
8739 | setup(props2, {
|
8740 | emit
|
8741 | }) {
|
8742 | const contact = vue.reactive(extend({}, DEFAULT_CONTACT, props2.contactInfo));
|
8743 | const onSave = () => {
|
8744 | if (!props2.isSaving) {
|
8745 | emit("save", contact);
|
8746 | }
|
8747 | };
|
8748 | const onDelete = () => emit("delete", contact);
|
8749 | const renderButtons = () => vue.createVNode("div", {
|
8750 | "class": bem$U("buttons")
|
8751 | }, [vue.createVNode(Button, {
|
8752 | "block": true,
|
8753 | "round": true,
|
8754 | "type": "primary",
|
8755 | "text": t$d("save"),
|
8756 | "class": bem$U("button"),
|
8757 | "loading": props2.isSaving,
|
8758 | "nativeType": "submit"
|
8759 | }, null), props2.isEdit && vue.createVNode(Button, {
|
8760 | "block": true,
|
8761 | "round": true,
|
8762 | "text": t$d("delete"),
|
8763 | "class": bem$U("button"),
|
8764 | "loading": props2.isDeleting,
|
8765 | "onClick": onDelete
|
8766 | }, null)]);
|
8767 | const renderSwitch = () => vue.createVNode(Switch, {
|
8768 | "modelValue": contact.isDefault,
|
8769 | "onUpdate:modelValue": ($event) => contact.isDefault = $event,
|
8770 | "onChange": (checked) => emit("changeDefault", checked)
|
8771 | }, null);
|
8772 | const renderSetDefault = () => {
|
8773 | if (props2.showSetDefault) {
|
8774 | return vue.createVNode(Cell, {
|
8775 | "title": props2.setDefaultLabel,
|
8776 | "class": bem$U("switch-cell"),
|
8777 | "border": false
|
8778 | }, {
|
8779 | "right-icon": renderSwitch
|
8780 | });
|
8781 | }
|
8782 | };
|
8783 | vue.watch(() => props2.contactInfo, (value) => extend(contact, DEFAULT_CONTACT, value));
|
8784 | return () => vue.createVNode(Form, {
|
8785 | "class": bem$U(),
|
8786 | "onSubmit": onSave
|
8787 | }, {
|
8788 | default: () => [vue.createVNode("div", {
|
8789 | "class": bem$U("fields")
|
8790 | }, [vue.createVNode(Field, {
|
8791 | "modelValue": contact.name,
|
8792 | "onUpdate:modelValue": ($event) => contact.name = $event,
|
8793 | "clearable": true,
|
8794 | "label": t$d("name"),
|
8795 | "rules": [{
|
8796 | required: true,
|
8797 | message: t$d("nameEmpty")
|
8798 | }],
|
8799 | "maxlength": "30",
|
8800 | "placeholder": t$d("name")
|
8801 | }, null), vue.createVNode(Field, {
|
8802 | "modelValue": contact.tel,
|
8803 | "onUpdate:modelValue": ($event) => contact.tel = $event,
|
8804 | "clearable": true,
|
8805 | "type": "tel",
|
8806 | "label": t$d("tel"),
|
8807 | "rules": [{
|
8808 | validator: props2.telValidator,
|
8809 | message: t$d("telInvalid")
|
8810 | }],
|
8811 | "placeholder": t$d("tel")
|
8812 | }, null)]), renderSetDefault(), renderButtons()]
|
8813 | });
|
8814 | }
|
8815 | });
|
8816 | const ContactEdit = withInstall(stdin_default$12);
|
8817 | const [name$U, bem$T, t$c] = createNamespace("contact-list");
|
8818 | const contactListProps = {
|
8819 | list: Array,
|
8820 | addText: String,
|
8821 | modelValue: unknownProp,
|
8822 | defaultTagText: String
|
8823 | };
|
8824 | var stdin_default$11 = vue.defineComponent({
|
8825 | name: name$U,
|
8826 | props: contactListProps,
|
8827 | emits: ["add", "edit", "select", "update:modelValue"],
|
8828 | setup(props2, {
|
8829 | emit
|
8830 | }) {
|
8831 | const renderItem = (item, index) => {
|
8832 | const onClick = () => {
|
8833 | emit("update:modelValue", item.id);
|
8834 | emit("select", item, index);
|
8835 | };
|
8836 | const renderRightIcon = () => vue.createVNode(Radio, {
|
8837 | "class": bem$T("radio"),
|
8838 | "name": item.id,
|
8839 | "iconSize": 18
|
8840 | }, null);
|
8841 | const renderEditIcon = () => vue.createVNode(Icon, {
|
8842 | "name": "edit",
|
8843 | "class": bem$T("edit"),
|
8844 | "onClick": (event) => {
|
8845 | event.stopPropagation();
|
8846 | emit("edit", item, index);
|
8847 | }
|
8848 | }, null);
|
8849 | const renderContent = () => {
|
8850 | const nodes = [`${item.name},${item.tel}`];
|
8851 | if (item.isDefault && props2.defaultTagText) {
|
8852 | nodes.push(vue.createVNode(Tag, {
|
8853 | "type": "primary",
|
8854 | "round": true,
|
8855 | "class": bem$T("item-tag")
|
8856 | }, {
|
8857 | default: () => [props2.defaultTagText]
|
8858 | }));
|
8859 | }
|
8860 | return nodes;
|
8861 | };
|
8862 | return vue.createVNode(Cell, {
|
8863 | "key": item.id,
|
8864 | "isLink": true,
|
8865 | "center": true,
|
8866 | "class": bem$T("item"),
|
8867 | "titleClass": bem$T("item-title"),
|
8868 | "onClick": onClick
|
8869 | }, {
|
8870 | icon: renderEditIcon,
|
8871 | title: renderContent,
|
8872 | "right-icon": renderRightIcon
|
8873 | });
|
8874 | };
|
8875 | return () => vue.createVNode("div", {
|
8876 | "class": bem$T()
|
8877 | }, [vue.createVNode(RadioGroup, {
|
8878 | "modelValue": props2.modelValue,
|
8879 | "class": bem$T("group")
|
8880 | }, {
|
8881 | default: () => [props2.list && props2.list.map(renderItem)]
|
8882 | }), vue.createVNode("div", {
|
8883 | "class": [bem$T("bottom"), "van-safe-area-bottom"]
|
8884 | }, [vue.createVNode(Button, {
|
8885 | "round": true,
|
8886 | "block": true,
|
8887 | "type": "primary",
|
8888 | "class": bem$T("add"),
|
8889 | "text": props2.addText || t$c("addContact"),
|
8890 | "onClick": () => emit("add")
|
8891 | }, null)])]);
|
8892 | }
|
8893 | });
|
8894 | const ContactList = withInstall(stdin_default$11);
|
8895 | function parseFormat(format2, currentTime) {
|
8896 | const { days } = currentTime;
|
8897 | let { hours, minutes, seconds, milliseconds } = currentTime;
|
8898 | if (format2.includes("DD")) {
|
8899 | format2 = format2.replace("DD", padZero(days));
|
8900 | } else {
|
8901 | hours += days * 24;
|
8902 | }
|
8903 | if (format2.includes("HH")) {
|
8904 | format2 = format2.replace("HH", padZero(hours));
|
8905 | } else {
|
8906 | minutes += hours * 60;
|
8907 | }
|
8908 | if (format2.includes("mm")) {
|
8909 | format2 = format2.replace("mm", padZero(minutes));
|
8910 | } else {
|
8911 | seconds += minutes * 60;
|
8912 | }
|
8913 | if (format2.includes("ss")) {
|
8914 | format2 = format2.replace("ss", padZero(seconds));
|
8915 | } else {
|
8916 | milliseconds += seconds * 1e3;
|
8917 | }
|
8918 | if (format2.includes("S")) {
|
8919 | const ms = padZero(milliseconds, 3);
|
8920 | if (format2.includes("SSS")) {
|
8921 | format2 = format2.replace("SSS", ms);
|
8922 | } else if (format2.includes("SS")) {
|
8923 | format2 = format2.replace("SS", ms.slice(0, 2));
|
8924 | } else {
|
8925 | format2 = format2.replace("S", ms.charAt(0));
|
8926 | }
|
8927 | }
|
8928 | return format2;
|
8929 | }
|
8930 | const [name$T, bem$S] = createNamespace("count-down");
|
8931 | const countDownProps = {
|
8932 | time: makeNumericProp(0),
|
8933 | format: makeStringProp("HH:mm:ss"),
|
8934 | autoStart: truthProp,
|
8935 | millisecond: Boolean
|
8936 | };
|
8937 | var stdin_default$10 = vue.defineComponent({
|
8938 | name: name$T,
|
8939 | props: countDownProps,
|
8940 | emits: ["change", "finish"],
|
8941 | setup(props2, {
|
8942 | emit,
|
8943 | slots
|
8944 | }) {
|
8945 | const {
|
8946 | start: start2,
|
8947 | pause,
|
8948 | reset,
|
8949 | current: current2
|
8950 | } = useCountDown({
|
8951 | time: +props2.time,
|
8952 | millisecond: props2.millisecond,
|
8953 | onChange: (current22) => emit("change", current22),
|
8954 | onFinish: () => emit("finish")
|
8955 | });
|
8956 | const timeText = vue.computed(() => parseFormat(props2.format, current2.value));
|
8957 | const resetTime = () => {
|
8958 | reset(+props2.time);
|
8959 | if (props2.autoStart) {
|
8960 | start2();
|
8961 | }
|
8962 | };
|
8963 | vue.watch(() => props2.time, resetTime, {
|
8964 | immediate: true
|
8965 | });
|
8966 | useExpose({
|
8967 | start: start2,
|
8968 | pause,
|
8969 | reset: resetTime
|
8970 | });
|
8971 | return () => vue.createVNode("div", {
|
8972 | "role": "timer",
|
8973 | "class": bem$S()
|
8974 | }, [slots.default ? slots.default(current2.value) : timeText.value]);
|
8975 | }
|
8976 | });
|
8977 | const CountDown = withInstall(stdin_default$10);
|
8978 | function getDate(timeStamp) {
|
8979 | const date = new Date(timeStamp * 1e3);
|
8980 | return `${date.getFullYear()}.${padZero(date.getMonth() + 1)}.${padZero(
|
8981 | date.getDate()
|
8982 | )}`;
|
8983 | }
|
8984 | const formatDiscount = (discount) => (discount / 10).toFixed(discount % 10 === 0 ? 0 : 1);
|
8985 | const formatAmount = (amount) => (amount / 100).toFixed(amount % 100 === 0 ? 0 : amount % 10 === 0 ? 1 : 2);
|
8986 | const [name$S, bem$R, t$b] = createNamespace("coupon");
|
8987 | var stdin_default$$ = vue.defineComponent({
|
8988 | name: name$S,
|
8989 | props: {
|
8990 | chosen: Boolean,
|
8991 | coupon: makeRequiredProp(Object),
|
8992 | disabled: Boolean,
|
8993 | currency: makeStringProp("¥")
|
8994 | },
|
8995 | setup(props2) {
|
8996 | const validPeriod = vue.computed(() => {
|
8997 | const {
|
8998 | startAt,
|
8999 | endAt
|
9000 | } = props2.coupon;
|
9001 | return `${getDate(startAt)} - ${getDate(endAt)}`;
|
9002 | });
|
9003 | const faceAmount = vue.computed(() => {
|
9004 | const {
|
9005 | coupon,
|
9006 | currency
|
9007 | } = props2;
|
9008 | if (coupon.valueDesc) {
|
9009 | return [coupon.valueDesc, vue.createVNode("span", null, [coupon.unitDesc || ""])];
|
9010 | }
|
9011 | if (coupon.denominations) {
|
9012 | const denominations = formatAmount(coupon.denominations);
|
9013 | return [vue.createVNode("span", null, [currency]), ` ${denominations}`];
|
9014 | }
|
9015 | if (coupon.discount) {
|
9016 | return t$b("discount", formatDiscount(coupon.discount));
|
9017 | }
|
9018 | return "";
|
9019 | });
|
9020 | const conditionMessage = vue.computed(() => {
|
9021 | const condition = formatAmount(props2.coupon.originCondition || 0);
|
9022 | return condition === "0" ? t$b("unlimited") : t$b("condition", condition);
|
9023 | });
|
9024 | return () => {
|
9025 | const {
|
9026 | chosen,
|
9027 | coupon,
|
9028 | disabled
|
9029 | } = props2;
|
9030 | const description = disabled && coupon.reason || coupon.description;
|
9031 | return vue.createVNode("div", {
|
9032 | "class": bem$R({
|
9033 | disabled
|
9034 | })
|
9035 | }, [vue.createVNode("div", {
|
9036 | "class": bem$R("content")
|
9037 | }, [vue.createVNode("div", {
|
9038 | "class": bem$R("head")
|
9039 | }, [vue.createVNode("h2", {
|
9040 | "class": bem$R("amount")
|
9041 | }, [faceAmount.value]), vue.createVNode("p", {
|
9042 | "class": bem$R("condition")
|
9043 | }, [coupon.condition || conditionMessage.value])]), vue.createVNode("div", {
|
9044 | "class": bem$R("body")
|
9045 | }, [vue.createVNode("p", {
|
9046 | "class": bem$R("name")
|
9047 | }, [coupon.name]), vue.createVNode("p", {
|
9048 | "class": bem$R("valid")
|
9049 | }, [validPeriod.value]), !disabled && vue.createVNode(Checkbox, {
|
9050 | "class": bem$R("corner"),
|
9051 | "modelValue": chosen
|
9052 | }, null)])]), description && vue.createVNode("p", {
|
9053 | "class": bem$R("description")
|
9054 | }, [description])]);
|
9055 | };
|
9056 | }
|
9057 | });
|
9058 | const Coupon = withInstall(stdin_default$$);
|
9059 | const [name$R, bem$Q, t$a] = createNamespace("coupon-cell");
|
9060 | const couponCellProps = {
|
9061 | title: String,
|
9062 | border: truthProp,
|
9063 | editable: truthProp,
|
9064 | coupons: makeArrayProp(),
|
9065 | currency: makeStringProp("¥"),
|
9066 | chosenCoupon: makeNumericProp(-1)
|
9067 | };
|
9068 | function formatValue({
|
9069 | coupons,
|
9070 | chosenCoupon,
|
9071 | currency
|
9072 | }) {
|
9073 | const coupon = coupons[+chosenCoupon];
|
9074 | if (coupon) {
|
9075 | let value = 0;
|
9076 | if (isDef(coupon.value)) {
|
9077 | ({
|
9078 | value
|
9079 | } = coupon);
|
9080 | } else if (isDef(coupon.denominations)) {
|
9081 | value = coupon.denominations;
|
9082 | }
|
9083 | return `-${currency} ${(value / 100).toFixed(2)}`;
|
9084 | }
|
9085 | return coupons.length === 0 ? t$a("noCoupon") : t$a("count", coupons.length);
|
9086 | }
|
9087 | var stdin_default$_ = vue.defineComponent({
|
9088 | name: name$R,
|
9089 | props: couponCellProps,
|
9090 | setup(props2) {
|
9091 | return () => {
|
9092 | const selected = props2.coupons[+props2.chosenCoupon];
|
9093 | return vue.createVNode(Cell, {
|
9094 | "class": bem$Q(),
|
9095 | "value": formatValue(props2),
|
9096 | "title": props2.title || t$a("title"),
|
9097 | "border": props2.border,
|
9098 | "isLink": props2.editable,
|
9099 | "valueClass": bem$Q("value", {
|
9100 | selected
|
9101 | })
|
9102 | }, null);
|
9103 | };
|
9104 | }
|
9105 | });
|
9106 | const CouponCell = withInstall(stdin_default$_);
|
9107 | const [name$Q, bem$P] = createNamespace("empty");
|
9108 | const emptyProps = {
|
9109 | image: makeStringProp("default"),
|
9110 | imageSize: [Number, String, Array],
|
9111 | description: String
|
9112 | };
|
9113 | var stdin_default$Z = vue.defineComponent({
|
9114 | name: name$Q,
|
9115 | props: emptyProps,
|
9116 | setup(props2, {
|
9117 | slots
|
9118 | }) {
|
9119 | const renderDescription = () => {
|
9120 | const description = slots.description ? slots.description() : props2.description;
|
9121 | if (description) {
|
9122 | return vue.createVNode("p", {
|
9123 | "class": bem$P("description")
|
9124 | }, [description]);
|
9125 | }
|
9126 | };
|
9127 | const renderBottom = () => {
|
9128 | if (slots.default) {
|
9129 | return vue.createVNode("div", {
|
9130 | "class": bem$P("bottom")
|
9131 | }, [slots.default()]);
|
9132 | }
|
9133 | };
|
9134 | const baseId = useId();
|
9135 | const getId = (num) => `${baseId}-${num}`;
|
9136 | const getUrlById = (num) => `url(#${getId(num)})`;
|
9137 | const renderStop = (color, offset2, opacity) => vue.createVNode("stop", {
|
9138 | "stop-color": color,
|
9139 | "offset": `${offset2}%`,
|
9140 | "stop-opacity": opacity
|
9141 | }, null);
|
9142 | const renderStops = (fromColor, toColor) => [renderStop(fromColor, 0), renderStop(toColor, 100)];
|
9143 | const renderShadow = (id) => [vue.createVNode("defs", null, [vue.createVNode("radialGradient", {
|
9144 | "id": getId(id),
|
9145 | "cx": "50%",
|
9146 | "cy": "54%",
|
9147 | "fx": "50%",
|
9148 | "fy": "54%",
|
9149 | "r": "297%",
|
9150 | "gradientTransform": "matrix(-.16 0 0 -.33 .58 .72)"
|
9151 | }, [renderStop("#EBEDF0", 0), renderStop("#F2F3F5", 100, 0.3)])]), vue.createVNode("ellipse", {
|
9152 | "fill": getUrlById(id),
|
9153 | "opacity": ".8",
|
9154 | "cx": "80",
|
9155 | "cy": "140",
|
9156 | "rx": "46",
|
9157 | "ry": "8"
|
9158 | }, null)];
|
9159 | const renderBuilding = () => [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
|
9160 | "id": getId("a"),
|
9161 | "x1": "64%",
|
9162 | "y1": "100%",
|
9163 | "x2": "64%"
|
9164 | }, [renderStop("#FFF", 0, 0.5), renderStop("#F2F3F5", 100)])]), vue.createVNode("g", {
|
9165 | "opacity": ".8"
|
9166 | }, [vue.createVNode("path", {
|
9167 | "d": "M36 131V53H16v20H2v58h34z",
|
9168 | "fill": getUrlById("a")
|
9169 | }, null), vue.createVNode("path", {
|
9170 | "d": "M123 15h22v14h9v77h-31V15z",
|
9171 | "fill": getUrlById("a")
|
9172 | }, null)])];
|
9173 | const renderCloud = () => [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
|
9174 | "id": getId("b"),
|
9175 | "x1": "64%",
|
9176 | "y1": "97%",
|
9177 | "x2": "64%",
|
9178 | "y2": "0%"
|
9179 | }, [renderStop("#F2F3F5", 0, 0.3), renderStop("#F2F3F5", 100)])]), vue.createVNode("g", {
|
9180 | "opacity": ".8"
|
9181 | }, [vue.createVNode("path", {
|
9182 | "d": "M87 6c3 0 7 3 8 6a8 8 0 1 1-1 16H80a7 7 0 0 1-8-6c0-4 3-7 6-7 0-5 4-9 9-9Z",
|
9183 | "fill": getUrlById("b")
|
9184 | }, null), vue.createVNode("path", {
|
9185 | "d": "M19 23c2 0 3 1 4 3 2 0 4 2 4 4a4 4 0 0 1-4 3v1h-7v-1l-1 1c-2 0-3-2-3-4 0-1 1-3 3-3 0-2 2-4 4-4Z",
|
9186 | "fill": getUrlById("b")
|
9187 | }, null)])];
|
9188 | const renderNetwork = () => vue.createVNode("svg", {
|
9189 | "viewBox": "0 0 160 160"
|
9190 | }, [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
|
9191 | "id": getId(1),
|
9192 | "x1": "64%",
|
9193 | "y1": "100%",
|
9194 | "x2": "64%"
|
9195 | }, [renderStop("#FFF", 0, 0.5), renderStop("#F2F3F5", 100)]), vue.createVNode("linearGradient", {
|
9196 | "id": getId(2),
|
9197 | "x1": "50%",
|
9198 | "x2": "50%",
|
9199 | "y2": "84%"
|
9200 | }, [renderStop("#EBEDF0", 0), renderStop("#DCDEE0", 100, 0)]), vue.createVNode("linearGradient", {
|
9201 | "id": getId(3),
|
9202 | "x1": "100%",
|
9203 | "x2": "100%",
|
9204 | "y2": "100%"
|
9205 | }, [renderStops("#EAEDF0", "#DCDEE0")]), vue.createVNode("radialGradient", {
|
9206 | "id": getId(4),
|
9207 | "cx": "50%",
|
9208 | "cy": "0%",
|
9209 | "fx": "50%",
|
9210 | "fy": "0%",
|
9211 | "r": "100%",
|
9212 | "gradientTransform": "matrix(0 1 -.54 0 .5 -.5)"
|
9213 | }, [renderStop("#EBEDF0", 0), renderStop("#FFF", 100, 0)])]), vue.createVNode("g", {
|
9214 | "fill": "none"
|
9215 | }, [renderBuilding(), vue.createVNode("path", {
|
9216 | "fill": getUrlById(4),
|
9217 | "d": "M0 139h160v21H0z"
|
9218 | }, null), vue.createVNode("path", {
|
9219 | "d": "M80 54a7 7 0 0 1 3 13v27l-2 2h-2a2 2 0 0 1-2-2V67a7 7 0 0 1 3-13z",
|
9220 | "fill": getUrlById(2)
|
9221 | }, null), vue.createVNode("g", {
|
9222 | "opacity": ".6",
|
9223 | "stroke-linecap": "round",
|
9224 | "stroke-width": "7"
|
9225 | }, [vue.createVNode("path", {
|
9226 | "d": "M64 47a19 19 0 0 0-5 13c0 5 2 10 5 13",
|
9227 | "stroke": getUrlById(3)
|
9228 | }, null), vue.createVNode("path", {
|
9229 | "d": "M53 36a34 34 0 0 0 0 48",
|
9230 | "stroke": getUrlById(3)
|
9231 | }, null), vue.createVNode("path", {
|
9232 | "d": "M95 73a19 19 0 0 0 6-13c0-5-2-9-6-13",
|
9233 | "stroke": getUrlById(3)
|
9234 | }, null), vue.createVNode("path", {
|
9235 | "d": "M106 84a34 34 0 0 0 0-48",
|
9236 | "stroke": getUrlById(3)
|
9237 | }, null)]), vue.createVNode("g", {
|
9238 | "transform": "translate(31 105)"
|
9239 | }, [vue.createVNode("rect", {
|
9240 | "fill": "#EBEDF0",
|
9241 | "width": "98",
|
9242 | "height": "34",
|
9243 | "rx": "2"
|
9244 | }, null), vue.createVNode("rect", {
|
9245 | "fill": "#FFF",
|
9246 | "x": "9",
|
9247 | "y": "8",
|
9248 | "width": "80",
|
9249 | "height": "18",
|
9250 | "rx": "1.1"
|
9251 | }, null), vue.createVNode("rect", {
|
9252 | "fill": "#EBEDF0",
|
9253 | "x": "15",
|
9254 | "y": "12",
|
9255 | "width": "18",
|
9256 | "height": "6",
|
9257 | "rx": "1.1"
|
9258 | }, null)])])]);
|
9259 | const renderMaterial = () => vue.createVNode("svg", {
|
9260 | "viewBox": "0 0 160 160"
|
9261 | }, [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
|
9262 | "x1": "50%",
|
9263 | "x2": "50%",
|
9264 | "y2": "100%",
|
9265 | "id": getId(5)
|
9266 | }, [renderStops("#F2F3F5", "#DCDEE0")]), vue.createVNode("linearGradient", {
|
9267 | "x1": "95%",
|
9268 | "y1": "48%",
|
9269 | "x2": "5.5%",
|
9270 | "y2": "51%",
|
9271 | "id": getId(6)
|
9272 | }, [renderStops("#EAEDF1", "#DCDEE0")]), vue.createVNode("linearGradient", {
|
9273 | "y1": "45%",
|
9274 | "x2": "100%",
|
9275 | "y2": "54%",
|
9276 | "id": getId(7)
|
9277 | }, [renderStops("#EAEDF1", "#DCDEE0")])]), renderBuilding(), renderCloud(), vue.createVNode("g", {
|
9278 | "transform": "translate(36 50)",
|
9279 | "fill": "none"
|
9280 | }, [vue.createVNode("g", {
|
9281 | "transform": "translate(8)"
|
9282 | }, [vue.createVNode("rect", {
|
9283 | "fill": "#EBEDF0",
|
9284 | "opacity": ".6",
|
9285 | "x": "38",
|
9286 | "y": "13",
|
9287 | "width": "36",
|
9288 | "height": "53",
|
9289 | "rx": "2"
|
9290 | }, null), vue.createVNode("rect", {
|
9291 | "fill": getUrlById(5),
|
9292 | "width": "64",
|
9293 | "height": "66",
|
9294 | "rx": "2"
|
9295 | }, null), vue.createVNode("rect", {
|
9296 | "fill": "#FFF",
|
9297 | "x": "6",
|
9298 | "y": "6",
|
9299 | "width": "52",
|
9300 | "height": "55",
|
9301 | "rx": "1"
|
9302 | }, null), vue.createVNode("g", {
|
9303 | "transform": "translate(15 17)",
|
9304 | "fill": getUrlById(6)
|
9305 | }, [vue.createVNode("rect", {
|
9306 | "width": "34",
|
9307 | "height": "6",
|
9308 | "rx": "1"
|
9309 | }, null), vue.createVNode("path", {
|
9310 | "d": "M0 14h34v6H0z"
|
9311 | }, null), vue.createVNode("rect", {
|
9312 | "y": "28",
|
9313 | "width": "34",
|
9314 | "height": "6",
|
9315 | "rx": "1"
|
9316 | }, null)])]), vue.createVNode("rect", {
|
9317 | "fill": getUrlById(7),
|
9318 | "y": "61",
|
9319 | "width": "88",
|
9320 | "height": "28",
|
9321 | "rx": "1"
|
9322 | }, null), vue.createVNode("rect", {
|
9323 | "fill": "#F7F8FA",
|
9324 | "x": "29",
|
9325 | "y": "72",
|
9326 | "width": "30",
|
9327 | "height": "6",
|
9328 | "rx": "1"
|
9329 | }, null)])]);
|
9330 | const renderError = () => vue.createVNode("svg", {
|
9331 | "viewBox": "0 0 160 160"
|
9332 | }, [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
|
9333 | "x1": "50%",
|
9334 | "x2": "50%",
|
9335 | "y2": "100%",
|
9336 | "id": getId(8)
|
9337 | }, [renderStops("#EAEDF1", "#DCDEE0")])]), renderBuilding(), renderCloud(), renderShadow("c"), vue.createVNode("path", {
|
9338 | "d": "m59 60 21 21 21-21h3l9 9v3L92 93l21 21v3l-9 9h-3l-21-21-21 21h-3l-9-9v-3l21-21-21-21v-3l9-9h3Z",
|
9339 | "fill": getUrlById(8)
|
9340 | }, null)]);
|
9341 | const renderSearch = () => vue.createVNode("svg", {
|
9342 | "viewBox": "0 0 160 160"
|
9343 | }, [vue.createVNode("defs", null, [vue.createVNode("linearGradient", {
|
9344 | "x1": "50%",
|
9345 | "y1": "100%",
|
9346 | "x2": "50%",
|
9347 | "id": getId(9)
|
9348 | }, [renderStops("#EEE", "#D8D8D8")]), vue.createVNode("linearGradient", {
|
9349 | "x1": "100%",
|
9350 | "y1": "50%",
|
9351 | "y2": "50%",
|
9352 | "id": getId(10)
|
9353 | }, [renderStops("#F2F3F5", "#DCDEE0")]), vue.createVNode("linearGradient", {
|
9354 | "x1": "50%",
|
9355 | "x2": "50%",
|
9356 | "y2": "100%",
|
9357 | "id": getId(11)
|
9358 | }, [renderStops("#F2F3F5", "#DCDEE0")]), vue.createVNode("linearGradient", {
|
9359 | "x1": "50%",
|
9360 | "x2": "50%",
|
9361 | "y2": "100%",
|
9362 | "id": getId(12)
|
9363 | }, [renderStops("#FFF", "#F7F8FA")])]), renderBuilding(), renderCloud(), renderShadow("d"), vue.createVNode("g", {
|
9364 | "transform": "rotate(-45 113 -4)",
|
9365 | "fill": "none"
|
9366 | }, [vue.createVNode("rect", {
|
9367 | "fill": getUrlById(9),
|
9368 | "x": "24",
|
9369 | "y": "52.8",
|
9370 | "width": "5.8",
|
9371 | "height": "19",
|
9372 | "rx": "1"
|
9373 | }, null), vue.createVNode("rect", {
|
9374 | "fill": getUrlById(10),
|
9375 | "x": "22.1",
|
9376 | "y": "67.3",
|
9377 | "width": "9.9",
|
9378 | "height": "28",
|
9379 | "rx": "1"
|
9380 | }, null), vue.createVNode("circle", {
|
9381 | "stroke": getUrlById(11),
|
9382 | "stroke-width": "8",
|
9383 | "cx": "27",
|
9384 | "cy": "27",
|
9385 | "r": "27"
|
9386 | }, null), vue.createVNode("circle", {
|
9387 | "fill": getUrlById(12),
|
9388 | "cx": "27",
|
9389 | "cy": "27",
|
9390 | "r": "16"
|
9391 | }, null), vue.createVNode("path", {
|
9392 | "d": "M37 7c-8 0-15 5-16 12",
|
9393 | "stroke": getUrlById(11),
|
9394 | "stroke-width": "3",
|
9395 | "opacity": ".5",
|
9396 | "stroke-linecap": "round",
|
9397 | "transform": "rotate(45 29 13)"
|
9398 | }, null)])]);
|
9399 | const renderImage = () => {
|
9400 | var _a;
|
9401 | if (slots.image) {
|
9402 | return slots.image();
|
9403 | }
|
9404 | const PRESET_IMAGES = {
|
9405 | error: renderError,
|
9406 | search: renderSearch,
|
9407 | network: renderNetwork,
|
9408 | default: renderMaterial
|
9409 | };
|
9410 | return ((_a = PRESET_IMAGES[props2.image]) == null ? void 0 : _a.call(PRESET_IMAGES)) || vue.createVNode("img", {
|
9411 | "src": props2.image
|
9412 | }, null);
|
9413 | };
|
9414 | return () => vue.createVNode("div", {
|
9415 | "class": bem$P()
|
9416 | }, [vue.createVNode("div", {
|
9417 | "class": bem$P("image"),
|
9418 | "style": getSizeStyle(props2.imageSize)
|
9419 | }, [renderImage()]), renderDescription(), renderBottom()]);
|
9420 | }
|
9421 | });
|
9422 | const Empty = withInstall(stdin_default$Z);
|
9423 | const [name$P, bem$O, t$9] = createNamespace("coupon-list");
|
9424 | const couponListProps = {
|
9425 | code: makeStringProp(""),
|
9426 | coupons: makeArrayProp(),
|
9427 | currency: makeStringProp("¥"),
|
9428 | showCount: truthProp,
|
9429 | emptyImage: String,
|
9430 | chosenCoupon: makeNumberProp(-1),
|
9431 | enabledTitle: String,
|
9432 | disabledTitle: String,
|
9433 | disabledCoupons: makeArrayProp(),
|
9434 | showExchangeBar: truthProp,
|
9435 | showCloseButton: truthProp,
|
9436 | closeButtonText: String,
|
9437 | inputPlaceholder: String,
|
9438 | exchangeMinLength: makeNumberProp(1),
|
9439 | exchangeButtonText: String,
|
9440 | displayedCouponIndex: makeNumberProp(-1),
|
9441 | exchangeButtonLoading: Boolean,
|
9442 | exchangeButtonDisabled: Boolean
|
9443 | };
|
9444 | var stdin_default$Y = vue.defineComponent({
|
9445 | name: name$P,
|
9446 | props: couponListProps,
|
9447 | emits: ["change", "exchange", "update:code"],
|
9448 | setup(props2, {
|
9449 | emit,
|
9450 | slots
|
9451 | }) {
|
9452 | const [couponRefs, setCouponRefs] = useRefs();
|
9453 | const root = vue.ref();
|
9454 | const barRef = vue.ref();
|
9455 | const activeTab = vue.ref(0);
|
9456 | const listHeight = vue.ref(0);
|
9457 | const currentCode = vue.ref(props2.code);
|
9458 | const buttonDisabled = vue.computed(() => !props2.exchangeButtonLoading && (props2.exchangeButtonDisabled || !currentCode.value || currentCode.value.length < props2.exchangeMinLength));
|
9459 | const updateListHeight = () => {
|
9460 | const TABS_HEIGHT = 44;
|
9461 | const rootHeight = useRect(root).height;
|
9462 | const headerHeight = useRect(barRef).height + TABS_HEIGHT;
|
9463 | listHeight.value = (rootHeight > headerHeight ? rootHeight : windowHeight.value) - headerHeight;
|
9464 | };
|
9465 | const onExchange = () => {
|
9466 | emit("exchange", currentCode.value);
|
9467 | if (!props2.code) {
|
9468 | currentCode.value = "";
|
9469 | }
|
9470 | };
|
9471 | const scrollToCoupon = (index) => {
|
9472 | vue.nextTick(() => {
|
9473 | var _a;
|
9474 | return (_a = couponRefs.value[index]) == null ? void 0 : _a.scrollIntoView();
|
9475 | });
|
9476 | };
|
9477 | const renderEmpty = () => vue.createVNode(Empty, {
|
9478 | "image": props2.emptyImage
|
9479 | }, {
|
9480 | default: () => [vue.createVNode("p", {
|
9481 | "class": bem$O("empty-tip")
|
9482 | }, [t$9("noCoupon")])]
|
9483 | });
|
9484 | const renderExchangeBar = () => {
|
9485 | if (props2.showExchangeBar) {
|
9486 | return vue.createVNode("div", {
|
9487 | "ref": barRef,
|
9488 | "class": bem$O("exchange-bar")
|
9489 | }, [vue.createVNode(Field, {
|
9490 | "modelValue": currentCode.value,
|
9491 | "onUpdate:modelValue": ($event) => currentCode.value = $event,
|
9492 | "clearable": true,
|
9493 | "border": false,
|
9494 | "class": bem$O("field"),
|
9495 | "placeholder": props2.inputPlaceholder || t$9("placeholder"),
|
9496 | "maxlength": "20"
|
9497 | }, null), vue.createVNode(Button, {
|
9498 | "plain": true,
|
9499 | "type": "primary",
|
9500 | "class": bem$O("exchange"),
|
9501 | "text": props2.exchangeButtonText || t$9("exchange"),
|
9502 | "loading": props2.exchangeButtonLoading,
|
9503 | "disabled": buttonDisabled.value,
|
9504 | "onClick": onExchange
|
9505 | }, null)]);
|
9506 | }
|
9507 | };
|
9508 | const renderCouponTab = () => {
|
9509 | const {
|
9510 | coupons
|
9511 | } = props2;
|
9512 | const count = props2.showCount ? ` (${coupons.length})` : "";
|
9513 | const title = (props2.enabledTitle || t$9("enable")) + count;
|
9514 | return vue.createVNode(Tab, {
|
9515 | "title": title
|
9516 | }, {
|
9517 | default: () => {
|
9518 | var _a;
|
9519 | return [vue.createVNode("div", {
|
9520 | "class": bem$O("list", {
|
9521 | "with-bottom": props2.showCloseButton
|
9522 | }),
|
9523 | "style": {
|
9524 | height: `${listHeight.value}px`
|
9525 | }
|
9526 | }, [coupons.map((coupon, index) => vue.createVNode(Coupon, {
|
9527 | "key": coupon.id,
|
9528 | "ref": setCouponRefs(index),
|
9529 | "coupon": coupon,
|
9530 | "chosen": index === props2.chosenCoupon,
|
9531 | "currency": props2.currency,
|
9532 | "onClick": () => emit("change", index)
|
9533 | }, null)), !coupons.length && renderEmpty(), (_a = slots["list-footer"]) == null ? void 0 : _a.call(slots)])];
|
9534 | }
|
9535 | });
|
9536 | };
|
9537 | const renderDisabledTab = () => {
|
9538 | const {
|
9539 | disabledCoupons
|
9540 | } = props2;
|
9541 | const count = props2.showCount ? ` (${disabledCoupons.length})` : "";
|
9542 | const title = (props2.disabledTitle || t$9("disabled")) + count;
|
9543 | return vue.createVNode(Tab, {
|
9544 | "title": title
|
9545 | }, {
|
9546 | default: () => {
|
9547 | var _a;
|
9548 | return [vue.createVNode("div", {
|
9549 | "class": bem$O("list", {
|
9550 | "with-bottom": props2.showCloseButton
|
9551 | }),
|
9552 | "style": {
|
9553 | height: `${listHeight.value}px`
|
9554 | }
|
9555 | }, [disabledCoupons.map((coupon) => vue.createVNode(Coupon, {
|
9556 | "disabled": true,
|
9557 | "key": coupon.id,
|
9558 | "coupon": coupon,
|
9559 | "currency": props2.currency
|
9560 | }, null)), !disabledCoupons.length && renderEmpty(), (_a = slots["disabled-list-footer"]) == null ? void 0 : _a.call(slots)])];
|
9561 | }
|
9562 | });
|
9563 | };
|
9564 | vue.watch(() => props2.code, (value) => {
|
9565 | currentCode.value = value;
|
9566 | });
|
9567 | vue.watch(windowHeight, updateListHeight);
|
9568 | vue.watch(currentCode, (value) => emit("update:code", value));
|
9569 | vue.watch(() => props2.displayedCouponIndex, scrollToCoupon);
|
9570 | vue.onMounted(() => {
|
9571 | updateListHeight();
|
9572 | scrollToCoupon(props2.displayedCouponIndex);
|
9573 | });
|
9574 | return () => vue.createVNode("div", {
|
9575 | "ref": root,
|
9576 | "class": bem$O()
|
9577 | }, [renderExchangeBar(), vue.createVNode(Tabs, {
|
9578 | "active": activeTab.value,
|
9579 | "onUpdate:active": ($event) => activeTab.value = $event,
|
9580 | "class": bem$O("tab")
|
9581 | }, {
|
9582 | default: () => [renderCouponTab(), renderDisabledTab()]
|
9583 | }), vue.createVNode("div", {
|
9584 | "class": bem$O("bottom")
|
9585 | }, [vue.withDirectives(vue.createVNode(Button, {
|
9586 | "round": true,
|
9587 | "block": true,
|
9588 | "type": "primary",
|
9589 | "class": bem$O("close"),
|
9590 | "text": props2.closeButtonText || t$9("close"),
|
9591 | "onClick": () => emit("change", -1)
|
9592 | }, null), [[vue.vShow, props2.showCloseButton]])])]);
|
9593 | }
|
9594 | });
|
9595 | const CouponList = withInstall(stdin_default$Y);
|
9596 | const currentYear = ( new Date()).getFullYear();
|
9597 | const [name$O] = createNamespace("date-picker");
|
9598 | const datePickerProps = extend({}, sharedProps, {
|
9599 | columnsType: {
|
9600 | type: Array,
|
9601 | default: () => ["year", "month", "day"]
|
9602 | },
|
9603 | minDate: {
|
9604 | type: Date,
|
9605 | default: () => new Date(currentYear - 10, 0, 1),
|
9606 | validator: isDate
|
9607 | },
|
9608 | maxDate: {
|
9609 | type: Date,
|
9610 | default: () => new Date(currentYear + 10, 11, 31),
|
9611 | validator: isDate
|
9612 | }
|
9613 | });
|
9614 | var stdin_default$X = vue.defineComponent({
|
9615 | name: name$O,
|
9616 | props: datePickerProps,
|
9617 | emits: ["confirm", "cancel", "change", "update:modelValue"],
|
9618 | setup(props2, {
|
9619 | emit,
|
9620 | slots
|
9621 | }) {
|
9622 | const currentValues = vue.ref(props2.modelValue);
|
9623 | const updatedByExternalSources = vue.ref(false);
|
9624 | const genYearOptions = () => {
|
9625 | const minYear = props2.minDate.getFullYear();
|
9626 | const maxYear = props2.maxDate.getFullYear();
|
9627 | return genOptions(minYear, maxYear, "year", props2.formatter, props2.filter);
|
9628 | };
|
9629 | const isMinYear = (year) => year === props2.minDate.getFullYear();
|
9630 | const isMaxYear = (year) => year === props2.maxDate.getFullYear();
|
9631 | const isMinMonth = (month) => month === props2.minDate.getMonth() + 1;
|
9632 | const isMaxMonth = (month) => month === props2.maxDate.getMonth() + 1;
|
9633 | const getValue = (type) => {
|
9634 | const {
|
9635 | minDate,
|
9636 | columnsType
|
9637 | } = props2;
|
9638 | const index = columnsType.indexOf(type);
|
9639 | const value = updatedByExternalSources.value ? props2.modelValue[index] : currentValues.value[index];
|
9640 | if (value) {
|
9641 | return +value;
|
9642 | }
|
9643 | switch (type) {
|
9644 | case "year":
|
9645 | return minDate.getFullYear();
|
9646 | case "month":
|
9647 | return minDate.getMonth() + 1;
|
9648 | case "day":
|
9649 | return minDate.getDate();
|
9650 | }
|
9651 | };
|
9652 | const genMonthOptions = () => {
|
9653 | const year = getValue("year");
|
9654 | const minMonth = isMinYear(year) ? props2.minDate.getMonth() + 1 : 1;
|
9655 | const maxMonth = isMaxYear(year) ? props2.maxDate.getMonth() + 1 : 12;
|
9656 | return genOptions(minMonth, maxMonth, "month", props2.formatter, props2.filter);
|
9657 | };
|
9658 | const genDayOptions = () => {
|
9659 | const year = getValue("year");
|
9660 | const month = getValue("month");
|
9661 | const minDate = isMinYear(year) && isMinMonth(month) ? props2.minDate.getDate() : 1;
|
9662 | const maxDate = isMaxYear(year) && isMaxMonth(month) ? props2.maxDate.getDate() : getMonthEndDay(year, month);
|
9663 | return genOptions(minDate, maxDate, "day", props2.formatter, props2.filter);
|
9664 | };
|
9665 | const columns = vue.computed(() => props2.columnsType.map((type) => {
|
9666 | switch (type) {
|
9667 | case "year":
|
9668 | return genYearOptions();
|
9669 | case "month":
|
9670 | return genMonthOptions();
|
9671 | case "day":
|
9672 | return genDayOptions();
|
9673 | default:
|
9674 | return [];
|
9675 | }
|
9676 | }));
|
9677 | vue.watch(currentValues, (newValues) => {
|
9678 | if (!isSameValue(newValues, props2.modelValue)) {
|
9679 | emit("update:modelValue", newValues);
|
9680 | }
|
9681 | });
|
9682 | vue.watch(() => props2.modelValue, (newValues, oldValues) => {
|
9683 | updatedByExternalSources.value = isSameValue(oldValues, currentValues.value);
|
9684 | newValues = formatValueRange(newValues, columns.value);
|
9685 | if (!isSameValue(newValues, currentValues.value)) {
|
9686 | currentValues.value = newValues;
|
9687 | }
|
9688 | updatedByExternalSources.value = false;
|
9689 | }, {
|
9690 | immediate: true
|
9691 | });
|
9692 | const onChange = (...args) => emit("change", ...args);
|
9693 | const onCancel = (...args) => emit("cancel", ...args);
|
9694 | const onConfirm = (...args) => emit("confirm", ...args);
|
9695 | return () => vue.createVNode(Picker, vue.mergeProps({
|
9696 | "modelValue": currentValues.value,
|
9697 | "onUpdate:modelValue": ($event) => currentValues.value = $event,
|
9698 | "columns": columns.value,
|
9699 | "onChange": onChange,
|
9700 | "onCancel": onCancel,
|
9701 | "onConfirm": onConfirm
|
9702 | }, pick(props2, pickerInheritKeys)), slots);
|
9703 | }
|
9704 | });
|
9705 | const DatePicker = withInstall(stdin_default$X);
|
9706 | const [name$N, bem$N, t$8] = createNamespace("dialog");
|
9707 | const dialogProps = extend({}, popupSharedProps, {
|
9708 | title: String,
|
9709 | theme: String,
|
9710 | width: numericProp,
|
9711 | message: [String, Function],
|
9712 | callback: Function,
|
9713 | allowHtml: Boolean,
|
9714 | className: unknownProp,
|
9715 | transition: makeStringProp("van-dialog-bounce"),
|
9716 | messageAlign: String,
|
9717 | closeOnPopstate: truthProp,
|
9718 | showCancelButton: Boolean,
|
9719 | cancelButtonText: String,
|
9720 | cancelButtonColor: String,
|
9721 | cancelButtonDisabled: Boolean,
|
9722 | confirmButtonText: String,
|
9723 | confirmButtonColor: String,
|
9724 | confirmButtonDisabled: Boolean,
|
9725 | showConfirmButton: truthProp,
|
9726 | closeOnClickOverlay: Boolean
|
9727 | });
|
9728 | const popupInheritKeys$1 = [...popupSharedPropKeys, "transition", "closeOnPopstate"];
|
9729 | var stdin_default$W = vue.defineComponent({
|
9730 | name: name$N,
|
9731 | props: dialogProps,
|
9732 | emits: ["confirm", "cancel", "keydown", "update:show"],
|
9733 | setup(props2, {
|
9734 | emit,
|
9735 | slots
|
9736 | }) {
|
9737 | const root = vue.ref();
|
9738 | const loading = vue.reactive({
|
9739 | confirm: false,
|
9740 | cancel: false
|
9741 | });
|
9742 | const updateShow = (value) => emit("update:show", value);
|
9743 | const close = (action) => {
|
9744 | var _a;
|
9745 | updateShow(false);
|
9746 | (_a = props2.callback) == null ? void 0 : _a.call(props2, action);
|
9747 | };
|
9748 | const getActionHandler = (action) => () => {
|
9749 | if (!props2.show) {
|
9750 | return;
|
9751 | }
|
9752 | emit(action);
|
9753 | if (props2.beforeClose) {
|
9754 | loading[action] = true;
|
9755 | callInterceptor(props2.beforeClose, {
|
9756 | args: [action],
|
9757 | done() {
|
9758 | close(action);
|
9759 | loading[action] = false;
|
9760 | },
|
9761 | canceled() {
|
9762 | loading[action] = false;
|
9763 | }
|
9764 | });
|
9765 | } else {
|
9766 | close(action);
|
9767 | }
|
9768 | };
|
9769 | const onCancel = getActionHandler("cancel");
|
9770 | const onConfirm = getActionHandler("confirm");
|
9771 | const onKeydown = vue.withKeys((event) => {
|
9772 | var _a, _b;
|
9773 | if (event.target !== ((_b = (_a = root.value) == null ? void 0 : _a.popupRef) == null ? void 0 : _b.value)) {
|
9774 | return;
|
9775 | }
|
9776 | const onEventType = {
|
9777 | Enter: props2.showConfirmButton ? onConfirm : noop,
|
9778 | Escape: props2.showCancelButton ? onCancel : noop
|
9779 | };
|
9780 | onEventType[event.key]();
|
9781 | emit("keydown", event);
|
9782 | }, ["enter", "esc"]);
|
9783 | const renderTitle = () => {
|
9784 | const title = slots.title ? slots.title() : props2.title;
|
9785 | if (title) {
|
9786 | return vue.createVNode("div", {
|
9787 | "class": bem$N("header", {
|
9788 | isolated: !props2.message && !slots.default
|
9789 | })
|
9790 | }, [title]);
|
9791 | }
|
9792 | };
|
9793 | const renderMessage = (hasTitle) => {
|
9794 | const {
|
9795 | message,
|
9796 | allowHtml,
|
9797 | messageAlign
|
9798 | } = props2;
|
9799 | const classNames = bem$N("message", {
|
9800 | "has-title": hasTitle,
|
9801 | [messageAlign]: messageAlign
|
9802 | });
|
9803 | const content = isFunction(message) ? message() : message;
|
9804 | if (allowHtml && typeof content === "string") {
|
9805 | return vue.createVNode("div", {
|
9806 | "class": classNames,
|
9807 | "innerHTML": content
|
9808 | }, null);
|
9809 | }
|
9810 | return vue.createVNode("div", {
|
9811 | "class": classNames
|
9812 | }, [content]);
|
9813 | };
|
9814 | const renderContent = () => {
|
9815 | if (slots.default) {
|
9816 | return vue.createVNode("div", {
|
9817 | "class": bem$N("content")
|
9818 | }, [slots.default()]);
|
9819 | }
|
9820 | const {
|
9821 | title,
|
9822 | message,
|
9823 | allowHtml
|
9824 | } = props2;
|
9825 | if (message) {
|
9826 | const hasTitle = !!(title || slots.title);
|
9827 | return vue.createVNode("div", {
|
9828 | "key": allowHtml ? 1 : 0,
|
9829 | "class": bem$N("content", {
|
9830 | isolated: !hasTitle
|
9831 | })
|
9832 | }, [renderMessage(hasTitle)]);
|
9833 | }
|
9834 | };
|
9835 | const renderButtons = () => vue.createVNode("div", {
|
9836 | "class": [BORDER_TOP, bem$N("footer")]
|
9837 | }, [props2.showCancelButton && vue.createVNode(Button, {
|
9838 | "size": "large",
|
9839 | "text": props2.cancelButtonText || t$8("cancel"),
|
9840 | "class": bem$N("cancel"),
|
9841 | "style": {
|
9842 | color: props2.cancelButtonColor
|
9843 | },
|
9844 | "loading": loading.cancel,
|
9845 | "disabled": props2.cancelButtonDisabled,
|
9846 | "onClick": onCancel
|
9847 | }, null), props2.showConfirmButton && vue.createVNode(Button, {
|
9848 | "size": "large",
|
9849 | "text": props2.confirmButtonText || t$8("confirm"),
|
9850 | "class": [bem$N("confirm"), {
|
9851 | [BORDER_LEFT]: props2.showCancelButton
|
9852 | }],
|
9853 | "style": {
|
9854 | color: props2.confirmButtonColor
|
9855 | },
|
9856 | "loading": loading.confirm,
|
9857 | "disabled": props2.confirmButtonDisabled,
|
9858 | "onClick": onConfirm
|
9859 | }, null)]);
|
9860 | const renderRoundButtons = () => vue.createVNode(ActionBar, {
|
9861 | "class": bem$N("footer")
|
9862 | }, {
|
9863 | default: () => [props2.showCancelButton && vue.createVNode(ActionBarButton, {
|
9864 | "type": "warning",
|
9865 | "text": props2.cancelButtonText || t$8("cancel"),
|
9866 | "class": bem$N("cancel"),
|
9867 | "color": props2.cancelButtonColor,
|
9868 | "loading": loading.cancel,
|
9869 | "disabled": props2.cancelButtonDisabled,
|
9870 | "onClick": onCancel
|
9871 | }, null), props2.showConfirmButton && vue.createVNode(ActionBarButton, {
|
9872 | "type": "danger",
|
9873 | "text": props2.confirmButtonText || t$8("confirm"),
|
9874 | "class": bem$N("confirm"),
|
9875 | "color": props2.confirmButtonColor,
|
9876 | "loading": loading.confirm,
|
9877 | "disabled": props2.confirmButtonDisabled,
|
9878 | "onClick": onConfirm
|
9879 | }, null)]
|
9880 | });
|
9881 | const renderFooter = () => {
|
9882 | if (slots.footer) {
|
9883 | return slots.footer();
|
9884 | }
|
9885 | return props2.theme === "round-button" ? renderRoundButtons() : renderButtons();
|
9886 | };
|
9887 | return () => {
|
9888 | const {
|
9889 | width: width2,
|
9890 | title,
|
9891 | theme,
|
9892 | message,
|
9893 | className
|
9894 | } = props2;
|
9895 | return vue.createVNode(Popup, vue.mergeProps({
|
9896 | "ref": root,
|
9897 | "role": "dialog",
|
9898 | "class": [bem$N([theme]), className],
|
9899 | "style": {
|
9900 | width: addUnit(width2)
|
9901 | },
|
9902 | "tabindex": 0,
|
9903 | "aria-labelledby": title || message,
|
9904 | "onKeydown": onKeydown,
|
9905 | "onUpdate:show": updateShow
|
9906 | }, pick(props2, popupInheritKeys$1)), {
|
9907 | default: () => [renderTitle(), renderContent(), renderFooter()]
|
9908 | });
|
9909 | };
|
9910 | }
|
9911 | });
|
9912 | let instance$2;
|
9913 | const DEFAULT_OPTIONS$1 = {
|
9914 | title: "",
|
9915 | width: "",
|
9916 | theme: null,
|
9917 | message: "",
|
9918 | overlay: true,
|
9919 | callback: null,
|
9920 | teleport: "body",
|
9921 | className: "",
|
9922 | allowHtml: false,
|
9923 | lockScroll: true,
|
9924 | transition: void 0,
|
9925 | beforeClose: null,
|
9926 | overlayClass: "",
|
9927 | overlayStyle: void 0,
|
9928 | messageAlign: "",
|
9929 | cancelButtonText: "",
|
9930 | cancelButtonColor: null,
|
9931 | cancelButtonDisabled: false,
|
9932 | confirmButtonText: "",
|
9933 | confirmButtonColor: null,
|
9934 | confirmButtonDisabled: false,
|
9935 | showConfirmButton: true,
|
9936 | showCancelButton: false,
|
9937 | closeOnPopstate: true,
|
9938 | closeOnClickOverlay: false
|
9939 | };
|
9940 | let currentOptions$1 = extend({}, DEFAULT_OPTIONS$1);
|
9941 | function initInstance$2() {
|
9942 | const Wrapper = {
|
9943 | setup() {
|
9944 | const {
|
9945 | state,
|
9946 | toggle
|
9947 | } = usePopupState();
|
9948 | return () => vue.createVNode(stdin_default$W, vue.mergeProps(state, {
|
9949 | "onUpdate:show": toggle
|
9950 | }), null);
|
9951 | }
|
9952 | };
|
9953 | ({
|
9954 | instance: instance$2
|
9955 | } = mountComponent(Wrapper));
|
9956 | }
|
9957 | function showDialog(options) {
|
9958 | if (!inBrowser$1) {
|
9959 | return Promise.resolve(void 0);
|
9960 | }
|
9961 | return new Promise((resolve, reject) => {
|
9962 | if (!instance$2) {
|
9963 | initInstance$2();
|
9964 | }
|
9965 | instance$2.open(extend({}, currentOptions$1, options, {
|
9966 | callback: (action) => {
|
9967 | (action === "confirm" ? resolve : reject)(action);
|
9968 | }
|
9969 | }));
|
9970 | });
|
9971 | }
|
9972 | const setDialogDefaultOptions = (options) => {
|
9973 | extend(currentOptions$1, options);
|
9974 | };
|
9975 | const resetDialogDefaultOptions = () => {
|
9976 | currentOptions$1 = extend({}, DEFAULT_OPTIONS$1);
|
9977 | };
|
9978 | const showConfirmDialog = (options) => showDialog(extend({
|
9979 | showCancelButton: true
|
9980 | }, options));
|
9981 | const closeDialog = () => {
|
9982 | if (instance$2) {
|
9983 | instance$2.toggle(false);
|
9984 | }
|
9985 | };
|
9986 | const Dialog = withInstall(stdin_default$W);
|
9987 | const [name$M, bem$M] = createNamespace("divider");
|
9988 | const dividerProps = {
|
9989 | dashed: Boolean,
|
9990 | hairline: truthProp,
|
9991 | vertical: Boolean,
|
9992 | contentPosition: makeStringProp("center")
|
9993 | };
|
9994 | var stdin_default$V = vue.defineComponent({
|
9995 | name: name$M,
|
9996 | props: dividerProps,
|
9997 | setup(props2, {
|
9998 | slots
|
9999 | }) {
|
10000 | return () => {
|
10001 | var _a;
|
10002 | return vue.createVNode("div", {
|
10003 | "role": "separator",
|
10004 | "class": bem$M({
|
10005 | dashed: props2.dashed,
|
10006 | hairline: props2.hairline,
|
10007 | vertical: props2.vertical,
|
10008 | [`content-${props2.contentPosition}`]: !!slots.default && !props2.vertical
|
10009 | })
|
10010 | }, [!props2.vertical && ((_a = slots.default) == null ? void 0 : _a.call(slots))]);
|
10011 | };
|
10012 | }
|
10013 | });
|
10014 | const Divider = withInstall(stdin_default$V);
|
10015 | const [name$L, bem$L] = createNamespace("dropdown-menu");
|
10016 | const dropdownMenuProps = {
|
10017 | overlay: truthProp,
|
10018 | zIndex: numericProp,
|
10019 | duration: makeNumericProp(0.2),
|
10020 | direction: makeStringProp("down"),
|
10021 | activeColor: String,
|
10022 | autoLocate: Boolean,
|
10023 | closeOnClickOutside: truthProp,
|
10024 | closeOnClickOverlay: truthProp,
|
10025 | swipeThreshold: numericProp
|
10026 | };
|
10027 | const DROPDOWN_KEY = Symbol(name$L);
|
10028 | var stdin_default$U = vue.defineComponent({
|
10029 | name: name$L,
|
10030 | props: dropdownMenuProps,
|
10031 | setup(props2, {
|
10032 | slots
|
10033 | }) {
|
10034 | const id = useId();
|
10035 | const root = vue.ref();
|
10036 | const barRef = vue.ref();
|
10037 | const offset2 = vue.ref(0);
|
10038 | const {
|
10039 | children,
|
10040 | linkChildren
|
10041 | } = useChildren(DROPDOWN_KEY);
|
10042 | const scrollParent = useScrollParent(root);
|
10043 | const opened = vue.computed(() => children.some((item) => item.state.showWrapper));
|
10044 | const scrollable = vue.computed(() => props2.swipeThreshold && children.length > +props2.swipeThreshold);
|
10045 | const barStyle = vue.computed(() => {
|
10046 | if (opened.value && isDef(props2.zIndex)) {
|
10047 | return {
|
10048 | zIndex: +props2.zIndex + 1
|
10049 | };
|
10050 | }
|
10051 | });
|
10052 | const close = () => {
|
10053 | children.forEach((item) => {
|
10054 | item.toggle(false);
|
10055 | });
|
10056 | };
|
10057 | const onClickAway = () => {
|
10058 | if (props2.closeOnClickOutside) {
|
10059 | close();
|
10060 | }
|
10061 | };
|
10062 | const updateOffset = () => {
|
10063 | if (barRef.value) {
|
10064 | const rect = useRect(barRef);
|
10065 | if (props2.direction === "down") {
|
10066 | offset2.value = rect.bottom;
|
10067 | } else {
|
10068 | offset2.value = windowHeight.value - rect.top;
|
10069 | }
|
10070 | }
|
10071 | };
|
10072 | const onScroll = () => {
|
10073 | if (opened.value) {
|
10074 | updateOffset();
|
10075 | }
|
10076 | };
|
10077 | const toggleItem = (active) => {
|
10078 | children.forEach((item, index) => {
|
10079 | if (index === active) {
|
10080 | item.toggle();
|
10081 | } else if (item.state.showPopup) {
|
10082 | item.toggle(false, {
|
10083 | immediate: true
|
10084 | });
|
10085 | }
|
10086 | });
|
10087 | };
|
10088 | const renderTitle = (item, index) => {
|
10089 | const {
|
10090 | showPopup
|
10091 | } = item.state;
|
10092 | const {
|
10093 | disabled,
|
10094 | titleClass
|
10095 | } = item;
|
10096 | return vue.createVNode("div", {
|
10097 | "id": `${id}-${index}`,
|
10098 | "role": "button",
|
10099 | "tabindex": disabled ? void 0 : 0,
|
10100 | "class": [bem$L("item", {
|
10101 | disabled,
|
10102 | grow: scrollable.value
|
10103 | }), {
|
10104 | [HAPTICS_FEEDBACK]: !disabled
|
10105 | }],
|
10106 | "onClick": () => {
|
10107 | if (!disabled) {
|
10108 | toggleItem(index);
|
10109 | }
|
10110 | }
|
10111 | }, [vue.createVNode("span", {
|
10112 | "class": [bem$L("title", {
|
10113 | down: showPopup === (props2.direction === "down"),
|
10114 | active: showPopup
|
10115 | }), titleClass],
|
10116 | "style": {
|
10117 | color: showPopup ? props2.activeColor : ""
|
10118 | }
|
10119 | }, [vue.createVNode("div", {
|
10120 | "class": "van-ellipsis"
|
10121 | }, [item.renderTitle()])])]);
|
10122 | };
|
10123 | useExpose({
|
10124 | close
|
10125 | });
|
10126 | linkChildren({
|
10127 | id,
|
10128 | props: props2,
|
10129 | offset: offset2,
|
10130 | updateOffset
|
10131 | });
|
10132 | useClickAway(root, onClickAway);
|
10133 | useEventListener("scroll", onScroll, {
|
10134 | target: scrollParent,
|
10135 | passive: true
|
10136 | });
|
10137 | return () => {
|
10138 | var _a;
|
10139 | return vue.createVNode("div", {
|
10140 | "ref": root,
|
10141 | "class": bem$L()
|
10142 | }, [vue.createVNode("div", {
|
10143 | "ref": barRef,
|
10144 | "style": barStyle.value,
|
10145 | "class": bem$L("bar", {
|
10146 | opened: opened.value,
|
10147 | scrollable: scrollable.value
|
10148 | })
|
10149 | }, [children.map(renderTitle)]), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
10150 | };
|
10151 | }
|
10152 | });
|
10153 | const [name$K, bem$K] = createNamespace("dropdown-item");
|
10154 | const dropdownItemProps = {
|
10155 | title: String,
|
10156 | options: makeArrayProp(),
|
10157 | disabled: Boolean,
|
10158 | teleport: [String, Object],
|
10159 | lazyRender: truthProp,
|
10160 | modelValue: unknownProp,
|
10161 | titleClass: unknownProp
|
10162 | };
|
10163 | var stdin_default$T = vue.defineComponent({
|
10164 | name: name$K,
|
10165 | inheritAttrs: false,
|
10166 | props: dropdownItemProps,
|
10167 | emits: ["open", "opened", "close", "closed", "change", "update:modelValue"],
|
10168 | setup(props2, {
|
10169 | emit,
|
10170 | slots,
|
10171 | attrs
|
10172 | }) {
|
10173 | const state = vue.reactive({
|
10174 | showPopup: false,
|
10175 | transition: true,
|
10176 | showWrapper: false
|
10177 | });
|
10178 | const wrapperRef = vue.ref();
|
10179 | const {
|
10180 | parent,
|
10181 | index
|
10182 | } = useParent(DROPDOWN_KEY);
|
10183 | if (!parent) {
|
10184 | return;
|
10185 | }
|
10186 | const getEmitter = (name2) => () => emit(name2);
|
10187 | const onOpen = getEmitter("open");
|
10188 | const onClose = getEmitter("close");
|
10189 | const onOpened = getEmitter("opened");
|
10190 | const onClosed = () => {
|
10191 | state.showWrapper = false;
|
10192 | emit("closed");
|
10193 | };
|
10194 | const onClickWrapper = (event) => {
|
10195 | if (props2.teleport) {
|
10196 | event.stopPropagation();
|
10197 | }
|
10198 | };
|
10199 | const toggle = (show = !state.showPopup, options = {}) => {
|
10200 | if (show === state.showPopup) {
|
10201 | return;
|
10202 | }
|
10203 | state.showPopup = show;
|
10204 | state.transition = !options.immediate;
|
10205 | if (show) {
|
10206 | parent.updateOffset();
|
10207 | state.showWrapper = true;
|
10208 | }
|
10209 | };
|
10210 | const renderTitle = () => {
|
10211 | if (slots.title) {
|
10212 | return slots.title();
|
10213 | }
|
10214 | if (props2.title) {
|
10215 | return props2.title;
|
10216 | }
|
10217 | const match = props2.options.find((option) => option.value === props2.modelValue);
|
10218 | return match ? match.text : "";
|
10219 | };
|
10220 | const renderOption = (option) => {
|
10221 | const {
|
10222 | activeColor
|
10223 | } = parent.props;
|
10224 | const active = option.value === props2.modelValue;
|
10225 | const onClick = () => {
|
10226 | state.showPopup = false;
|
10227 | if (option.value !== props2.modelValue) {
|
10228 | emit("update:modelValue", option.value);
|
10229 | emit("change", option.value);
|
10230 | }
|
10231 | };
|
10232 | const renderIcon = () => {
|
10233 | if (active) {
|
10234 | return vue.createVNode(Icon, {
|
10235 | "class": bem$K("icon"),
|
10236 | "color": activeColor,
|
10237 | "name": "success"
|
10238 | }, null);
|
10239 | }
|
10240 | };
|
10241 | return vue.createVNode(Cell, {
|
10242 | "role": "menuitem",
|
10243 | "key": String(option.value),
|
10244 | "icon": option.icon,
|
10245 | "title": option.text,
|
10246 | "class": bem$K("option", {
|
10247 | active
|
10248 | }),
|
10249 | "style": {
|
10250 | color: active ? activeColor : ""
|
10251 | },
|
10252 | "tabindex": active ? 0 : -1,
|
10253 | "clickable": true,
|
10254 | "onClick": onClick
|
10255 | }, {
|
10256 | value: renderIcon
|
10257 | });
|
10258 | };
|
10259 | const renderContent = () => {
|
10260 | const {
|
10261 | offset: offset2
|
10262 | } = parent;
|
10263 | const {
|
10264 | autoLocate,
|
10265 | zIndex,
|
10266 | overlay,
|
10267 | duration,
|
10268 | direction,
|
10269 | closeOnClickOverlay
|
10270 | } = parent.props;
|
10271 | const style = getZIndexStyle(zIndex);
|
10272 | let offsetValue = offset2.value;
|
10273 | if (autoLocate && wrapperRef.value) {
|
10274 | const offsetParent = getContainingBlock$1(wrapperRef.value);
|
10275 | if (offsetParent) {
|
10276 | offsetValue -= useRect(offsetParent).top;
|
10277 | }
|
10278 | }
|
10279 | if (direction === "down") {
|
10280 | style.top = `${offsetValue}px`;
|
10281 | } else {
|
10282 | style.bottom = `${offsetValue}px`;
|
10283 | }
|
10284 | return vue.withDirectives(vue.createVNode("div", vue.mergeProps({
|
10285 | "ref": wrapperRef,
|
10286 | "style": style,
|
10287 | "class": bem$K([direction]),
|
10288 | "onClick": onClickWrapper
|
10289 | }, attrs), [vue.createVNode(Popup, {
|
10290 | "show": state.showPopup,
|
10291 | "onUpdate:show": ($event) => state.showPopup = $event,
|
10292 | "role": "menu",
|
10293 | "class": bem$K("content"),
|
10294 | "overlay": overlay,
|
10295 | "position": direction === "down" ? "top" : "bottom",
|
10296 | "duration": state.transition ? duration : 0,
|
10297 | "lazyRender": props2.lazyRender,
|
10298 | "overlayStyle": {
|
10299 | position: "absolute"
|
10300 | },
|
10301 | "aria-labelledby": `${parent.id}-${index.value}`,
|
10302 | "closeOnClickOverlay": closeOnClickOverlay,
|
10303 | "onOpen": onOpen,
|
10304 | "onClose": onClose,
|
10305 | "onOpened": onOpened,
|
10306 | "onClosed": onClosed
|
10307 | }, {
|
10308 | default: () => {
|
10309 | var _a;
|
10310 | return [props2.options.map(renderOption), (_a = slots.default) == null ? void 0 : _a.call(slots)];
|
10311 | }
|
10312 | })]), [[vue.vShow, state.showWrapper]]);
|
10313 | };
|
10314 | useExpose({
|
10315 | state,
|
10316 | toggle,
|
10317 | renderTitle
|
10318 | });
|
10319 | return () => {
|
10320 | if (props2.teleport) {
|
10321 | return vue.createVNode(vue.Teleport, {
|
10322 | "to": props2.teleport
|
10323 | }, {
|
10324 | default: () => [renderContent()]
|
10325 | });
|
10326 | }
|
10327 | return renderContent();
|
10328 | };
|
10329 | }
|
10330 | });
|
10331 | const DropdownItem = withInstall(stdin_default$T);
|
10332 | const DropdownMenu = withInstall(stdin_default$U);
|
10333 | const floatingBubbleProps = {
|
10334 | gap: makeNumberProp(24),
|
10335 | icon: String,
|
10336 | axis: makeStringProp("y"),
|
10337 | magnetic: String,
|
10338 | offset: {
|
10339 | type: Object,
|
10340 | default: () => ({
|
10341 | x: -1,
|
10342 | y: -1
|
10343 | })
|
10344 | },
|
10345 | teleport: {
|
10346 | type: [String, Object],
|
10347 | default: "body"
|
10348 | }
|
10349 | };
|
10350 | const [name$J, bem$J] = createNamespace("floating-bubble");
|
10351 | var stdin_default$S = vue.defineComponent({
|
10352 | name: name$J,
|
10353 | inheritAttrs: false,
|
10354 | props: floatingBubbleProps,
|
10355 | emits: ["click", "update:offset", "offsetChange"],
|
10356 | setup(props2, {
|
10357 | slots,
|
10358 | emit,
|
10359 | attrs
|
10360 | }) {
|
10361 | const rootRef = vue.ref();
|
10362 | const state = vue.ref({
|
10363 | x: 0,
|
10364 | y: 0,
|
10365 | width: 0,
|
10366 | height: 0
|
10367 | });
|
10368 | const boundary = vue.computed(() => ({
|
10369 | top: props2.gap,
|
10370 | right: windowWidth.value - state.value.width - props2.gap,
|
10371 | bottom: windowHeight.value - state.value.height - props2.gap,
|
10372 | left: props2.gap
|
10373 | }));
|
10374 | const dragging = vue.ref(false);
|
10375 | let initialized = false;
|
10376 | const rootStyle = vue.computed(() => {
|
10377 | const style = {};
|
10378 | const x = addUnit(state.value.x);
|
10379 | const y = addUnit(state.value.y);
|
10380 | style.transform = `translate3d(${x}, ${y}, 0)`;
|
10381 | if (dragging.value || !initialized) {
|
10382 | style.transition = "none";
|
10383 | }
|
10384 | return style;
|
10385 | });
|
10386 | const updateState = () => {
|
10387 | if (!show.value)
|
10388 | return;
|
10389 | const {
|
10390 | width: width2,
|
10391 | height: height2
|
10392 | } = useRect(rootRef.value);
|
10393 | const {
|
10394 | offset: offset2
|
10395 | } = props2;
|
10396 | state.value = {
|
10397 | x: offset2.x > -1 ? offset2.x : windowWidth.value - width2 - props2.gap,
|
10398 | y: offset2.y > -1 ? offset2.y : windowHeight.value - height2 - props2.gap,
|
10399 | width: width2,
|
10400 | height: height2
|
10401 | };
|
10402 | };
|
10403 | const touch = useTouch();
|
10404 | let prevX = 0;
|
10405 | let prevY = 0;
|
10406 | const onTouchStart = (e) => {
|
10407 | touch.start(e);
|
10408 | dragging.value = true;
|
10409 | prevX = state.value.x;
|
10410 | prevY = state.value.y;
|
10411 | };
|
10412 | const onTouchMove = (e) => {
|
10413 | e.preventDefault();
|
10414 | touch.move(e);
|
10415 | if (props2.axis === "lock")
|
10416 | return;
|
10417 | if (!touch.isTap.value) {
|
10418 | if (props2.axis === "x" || props2.axis === "xy") {
|
10419 | let nextX = prevX + touch.deltaX.value;
|
10420 | if (nextX < boundary.value.left)
|
10421 | nextX = boundary.value.left;
|
10422 | if (nextX > boundary.value.right)
|
10423 | nextX = boundary.value.right;
|
10424 | state.value.x = nextX;
|
10425 | }
|
10426 | if (props2.axis === "y" || props2.axis === "xy") {
|
10427 | let nextY = prevY + touch.deltaY.value;
|
10428 | if (nextY < boundary.value.top)
|
10429 | nextY = boundary.value.top;
|
10430 | if (nextY > boundary.value.bottom)
|
10431 | nextY = boundary.value.bottom;
|
10432 | state.value.y = nextY;
|
10433 | }
|
10434 | const offset2 = pick(state.value, ["x", "y"]);
|
10435 | emit("update:offset", offset2);
|
10436 | }
|
10437 | };
|
10438 | useEventListener("touchmove", onTouchMove, {
|
10439 | target: rootRef
|
10440 | });
|
10441 | const onTouchEnd = () => {
|
10442 | dragging.value = false;
|
10443 | vue.nextTick(() => {
|
10444 | if (props2.magnetic === "x") {
|
10445 | const nextX = closest([boundary.value.left, boundary.value.right], state.value.x);
|
10446 | state.value.x = nextX;
|
10447 | }
|
10448 | if (props2.magnetic === "y") {
|
10449 | const nextY = closest([boundary.value.top, boundary.value.bottom], state.value.y);
|
10450 | state.value.y = nextY;
|
10451 | }
|
10452 | if (!touch.isTap.value) {
|
10453 | const offset2 = pick(state.value, ["x", "y"]);
|
10454 | emit("update:offset", offset2);
|
10455 | if (prevX !== offset2.x || prevY !== offset2.y) {
|
10456 | emit("offsetChange", offset2);
|
10457 | }
|
10458 | }
|
10459 | });
|
10460 | };
|
10461 | const onClick = (e) => {
|
10462 | if (touch.isTap.value)
|
10463 | emit("click", e);
|
10464 | else
|
10465 | e.stopPropagation();
|
10466 | };
|
10467 | vue.onMounted(() => {
|
10468 | updateState();
|
10469 | vue.nextTick(() => {
|
10470 | initialized = true;
|
10471 | });
|
10472 | });
|
10473 | vue.watch([windowWidth, windowHeight, () => props2.gap, () => props2.offset], updateState);
|
10474 | const show = vue.ref(true);
|
10475 | vue.onActivated(() => {
|
10476 | show.value = true;
|
10477 | });
|
10478 | vue.onDeactivated(() => {
|
10479 | if (props2.teleport) {
|
10480 | show.value = false;
|
10481 | }
|
10482 | });
|
10483 | return () => {
|
10484 | const Content = vue.withDirectives(vue.createVNode("div", vue.mergeProps({
|
10485 | "class": bem$J(),
|
10486 | "ref": rootRef,
|
10487 | "onTouchstartPassive": onTouchStart,
|
10488 | "onTouchend": onTouchEnd,
|
10489 | "onTouchcancel": onTouchEnd,
|
10490 | "onClickCapture": onClick,
|
10491 | "style": rootStyle.value
|
10492 | }, attrs), [slots.default ? slots.default() : vue.createVNode(stdin_default$1Q, {
|
10493 | "name": props2.icon,
|
10494 | "class": bem$J("icon")
|
10495 | }, null)]), [[vue.vShow, show.value]]);
|
10496 | return props2.teleport ? vue.createVNode(vue.Teleport, {
|
10497 | "to": props2.teleport
|
10498 | }, {
|
10499 | default: () => [Content]
|
10500 | }) : Content;
|
10501 | };
|
10502 | }
|
10503 | });
|
10504 | const FloatingBubble = withInstall(stdin_default$S);
|
10505 | const floatingPanelProps = {
|
10506 | height: makeNumericProp(0),
|
10507 | anchors: makeArrayProp(),
|
10508 | duration: makeNumericProp(0.3),
|
10509 | contentDraggable: truthProp,
|
10510 | lockScroll: Boolean,
|
10511 | safeAreaInsetBottom: truthProp
|
10512 | };
|
10513 | const [name$I, bem$I] = createNamespace("floating-panel");
|
10514 | var stdin_default$R = vue.defineComponent({
|
10515 | name: name$I,
|
10516 | props: floatingPanelProps,
|
10517 | emits: ["heightChange", "update:height"],
|
10518 | setup(props2, {
|
10519 | emit,
|
10520 | slots
|
10521 | }) {
|
10522 | const DAMP = 0.2;
|
10523 | const rootRef = vue.ref();
|
10524 | const contentRef = vue.ref();
|
10525 | const height2 = useSyncPropRef(() => +props2.height, (value) => emit("update:height", value));
|
10526 | const boundary = vue.computed(() => {
|
10527 | var _a, _b;
|
10528 | return {
|
10529 | min: (_a = props2.anchors[0]) != null ? _a : 100,
|
10530 | max: (_b = props2.anchors[props2.anchors.length - 1]) != null ? _b : Math.round(windowHeight.value * 0.6)
|
10531 | };
|
10532 | });
|
10533 | const anchors = vue.computed(() => props2.anchors.length >= 2 ? props2.anchors : [boundary.value.min, boundary.value.max]);
|
10534 | const dragging = vue.ref(false);
|
10535 | const rootStyle = vue.computed(() => ({
|
10536 | height: addUnit(boundary.value.max),
|
10537 | transform: `translateY(calc(100% + ${addUnit(-height2.value)}))`,
|
10538 | transition: !dragging.value ? `transform ${props2.duration}s cubic-bezier(0.18, 0.89, 0.32, 1.28)` : "none"
|
10539 | }));
|
10540 | const ease = (moveY) => {
|
10541 | const absDistance = Math.abs(moveY);
|
10542 | const {
|
10543 | min,
|
10544 | max
|
10545 | } = boundary.value;
|
10546 | if (absDistance > max) {
|
10547 | return -(max + (absDistance - max) * DAMP);
|
10548 | }
|
10549 | if (absDistance < min) {
|
10550 | return -(min - (min - absDistance) * DAMP);
|
10551 | }
|
10552 | return moveY;
|
10553 | };
|
10554 | let startY;
|
10555 | let maxScroll = -1;
|
10556 | const touch = useTouch();
|
10557 | const onTouchstart = (e) => {
|
10558 | touch.start(e);
|
10559 | dragging.value = true;
|
10560 | startY = -height2.value;
|
10561 | maxScroll = -1;
|
10562 | };
|
10563 | const onTouchmove = (e) => {
|
10564 | var _a;
|
10565 | touch.move(e);
|
10566 | const target = e.target;
|
10567 | if (contentRef.value === target || ((_a = contentRef.value) == null ? void 0 : _a.contains(target))) {
|
10568 | const {
|
10569 | scrollTop
|
10570 | } = contentRef.value;
|
10571 | maxScroll = Math.max(maxScroll, scrollTop);
|
10572 | if (!props2.contentDraggable)
|
10573 | return;
|
10574 | if (-startY < boundary.value.max) {
|
10575 | preventDefault(e, true);
|
10576 | } else if (!(scrollTop <= 0 && touch.deltaY.value > 0) || maxScroll > 0) {
|
10577 | return;
|
10578 | }
|
10579 | }
|
10580 | const moveY = touch.deltaY.value + startY;
|
10581 | height2.value = -ease(moveY);
|
10582 | };
|
10583 | const onTouchend = () => {
|
10584 | maxScroll = -1;
|
10585 | dragging.value = false;
|
10586 | height2.value = closest(anchors.value, height2.value);
|
10587 | if (height2.value !== -startY) {
|
10588 | emit("heightChange", {
|
10589 | height: height2.value
|
10590 | });
|
10591 | }
|
10592 | };
|
10593 | vue.watch(boundary, () => {
|
10594 | height2.value = closest(anchors.value, height2.value);
|
10595 | }, {
|
10596 | immediate: true
|
10597 | });
|
10598 | useLockScroll(rootRef, () => props2.lockScroll || dragging.value);
|
10599 | useEventListener("touchmove", onTouchmove, {
|
10600 | target: rootRef
|
10601 | });
|
10602 | return () => {
|
10603 | var _a;
|
10604 | return vue.createVNode("div", {
|
10605 | "class": [bem$I(), {
|
10606 | "van-safe-area-bottom": props2.safeAreaInsetBottom
|
10607 | }],
|
10608 | "ref": rootRef,
|
10609 | "style": rootStyle.value,
|
10610 | "onTouchstartPassive": onTouchstart,
|
10611 | "onTouchend": onTouchend,
|
10612 | "onTouchcancel": onTouchend
|
10613 | }, [vue.createVNode("div", {
|
10614 | "class": bem$I("header")
|
10615 | }, [vue.createVNode("div", {
|
10616 | "class": bem$I("header-bar")
|
10617 | }, null)]), vue.createVNode("div", {
|
10618 | "class": bem$I("content"),
|
10619 | "ref": contentRef
|
10620 | }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
|
10621 | };
|
10622 | }
|
10623 | });
|
10624 | const FloatingPanel = withInstall(stdin_default$R);
|
10625 | const [name$H, bem$H] = createNamespace("grid");
|
10626 | const gridProps = {
|
10627 | square: Boolean,
|
10628 | center: truthProp,
|
10629 | border: truthProp,
|
10630 | gutter: numericProp,
|
10631 | reverse: Boolean,
|
10632 | iconSize: numericProp,
|
10633 | direction: String,
|
10634 | clickable: Boolean,
|
10635 | columnNum: makeNumericProp(4)
|
10636 | };
|
10637 | const GRID_KEY = Symbol(name$H);
|
10638 | var stdin_default$Q = vue.defineComponent({
|
10639 | name: name$H,
|
10640 | props: gridProps,
|
10641 | setup(props2, {
|
10642 | slots
|
10643 | }) {
|
10644 | const {
|
10645 | linkChildren
|
10646 | } = useChildren(GRID_KEY);
|
10647 | linkChildren({
|
10648 | props: props2
|
10649 | });
|
10650 | return () => {
|
10651 | var _a;
|
10652 | return vue.createVNode("div", {
|
10653 | "style": {
|
10654 | paddingLeft: addUnit(props2.gutter)
|
10655 | },
|
10656 | "class": [bem$H(), {
|
10657 | [BORDER_TOP]: props2.border && !props2.gutter
|
10658 | }]
|
10659 | }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
10660 | };
|
10661 | }
|
10662 | });
|
10663 | const Grid = withInstall(stdin_default$Q);
|
10664 | const [name$G, bem$G] = createNamespace("grid-item");
|
10665 | const gridItemProps = extend({}, routeProps, {
|
10666 | dot: Boolean,
|
10667 | text: String,
|
10668 | icon: String,
|
10669 | badge: numericProp,
|
10670 | iconColor: String,
|
10671 | iconPrefix: String,
|
10672 | badgeProps: Object
|
10673 | });
|
10674 | var stdin_default$P = vue.defineComponent({
|
10675 | name: name$G,
|
10676 | props: gridItemProps,
|
10677 | setup(props2, {
|
10678 | slots
|
10679 | }) {
|
10680 | const {
|
10681 | parent,
|
10682 | index
|
10683 | } = useParent(GRID_KEY);
|
10684 | const route2 = useRoute();
|
10685 | if (!parent) {
|
10686 | return;
|
10687 | }
|
10688 | const rootStyle = vue.computed(() => {
|
10689 | const {
|
10690 | square,
|
10691 | gutter,
|
10692 | columnNum
|
10693 | } = parent.props;
|
10694 | const percent = `${100 / +columnNum}%`;
|
10695 | const style = {
|
10696 | flexBasis: percent
|
10697 | };
|
10698 | if (square) {
|
10699 | style.paddingTop = percent;
|
10700 | } else if (gutter) {
|
10701 | const gutterValue = addUnit(gutter);
|
10702 | style.paddingRight = gutterValue;
|
10703 | if (index.value >= +columnNum) {
|
10704 | style.marginTop = gutterValue;
|
10705 | }
|
10706 | }
|
10707 | return style;
|
10708 | });
|
10709 | const contentStyle = vue.computed(() => {
|
10710 | const {
|
10711 | square,
|
10712 | gutter
|
10713 | } = parent.props;
|
10714 | if (square && gutter) {
|
10715 | const gutterValue = addUnit(gutter);
|
10716 | return {
|
10717 | right: gutterValue,
|
10718 | bottom: gutterValue,
|
10719 | height: "auto"
|
10720 | };
|
10721 | }
|
10722 | });
|
10723 | const renderIcon = () => {
|
10724 | if (slots.icon) {
|
10725 | return vue.createVNode(Badge, vue.mergeProps({
|
10726 | "dot": props2.dot,
|
10727 | "content": props2.badge
|
10728 | }, props2.badgeProps), {
|
10729 | default: slots.icon
|
10730 | });
|
10731 | }
|
10732 | if (props2.icon) {
|
10733 | return vue.createVNode(Icon, {
|
10734 | "dot": props2.dot,
|
10735 | "name": props2.icon,
|
10736 | "size": parent.props.iconSize,
|
10737 | "badge": props2.badge,
|
10738 | "class": bem$G("icon"),
|
10739 | "color": props2.iconColor,
|
10740 | "badgeProps": props2.badgeProps,
|
10741 | "classPrefix": props2.iconPrefix
|
10742 | }, null);
|
10743 | }
|
10744 | };
|
10745 | const renderText = () => {
|
10746 | if (slots.text) {
|
10747 | return slots.text();
|
10748 | }
|
10749 | if (props2.text) {
|
10750 | return vue.createVNode("span", {
|
10751 | "class": bem$G("text")
|
10752 | }, [props2.text]);
|
10753 | }
|
10754 | };
|
10755 | const renderContent = () => {
|
10756 | if (slots.default) {
|
10757 | return slots.default();
|
10758 | }
|
10759 | return [renderIcon(), renderText()];
|
10760 | };
|
10761 | return () => {
|
10762 | const {
|
10763 | center,
|
10764 | border,
|
10765 | square,
|
10766 | gutter,
|
10767 | reverse,
|
10768 | direction,
|
10769 | clickable
|
10770 | } = parent.props;
|
10771 | const classes = [bem$G("content", [direction, {
|
10772 | center,
|
10773 | square,
|
10774 | reverse,
|
10775 | clickable,
|
10776 | surround: border && gutter
|
10777 | }]), {
|
10778 | [BORDER]: border
|
10779 | }];
|
10780 | return vue.createVNode("div", {
|
10781 | "class": [bem$G({
|
10782 | square
|
10783 | })],
|
10784 | "style": rootStyle.value
|
10785 | }, [vue.createVNode("div", {
|
10786 | "role": clickable ? "button" : void 0,
|
10787 | "class": classes,
|
10788 | "style": contentStyle.value,
|
10789 | "tabindex": clickable ? 0 : void 0,
|
10790 | "onClick": route2
|
10791 | }, [renderContent()])]);
|
10792 | };
|
10793 | }
|
10794 | });
|
10795 | const GridItem = withInstall(stdin_default$P);
|
10796 | const [name$F, bem$F] = createNamespace("highlight");
|
10797 | const highlightProps = {
|
10798 | autoEscape: truthProp,
|
10799 | caseSensitive: Boolean,
|
10800 | highlightClass: String,
|
10801 | highlightTag: makeStringProp("span"),
|
10802 | keywords: makeRequiredProp([String, Array]),
|
10803 | sourceString: makeStringProp(""),
|
10804 | tag: makeStringProp("div"),
|
10805 | unhighlightClass: String,
|
10806 | unhighlightTag: makeStringProp("span")
|
10807 | };
|
10808 | var stdin_default$O = vue.defineComponent({
|
10809 | name: name$F,
|
10810 | props: highlightProps,
|
10811 | setup(props2) {
|
10812 | const highlightChunks = vue.computed(() => {
|
10813 | const {
|
10814 | autoEscape,
|
10815 | caseSensitive,
|
10816 | keywords,
|
10817 | sourceString
|
10818 | } = props2;
|
10819 | const flags = caseSensitive ? "g" : "gi";
|
10820 | const _keywords = Array.isArray(keywords) ? keywords : [keywords];
|
10821 | let chunks = _keywords.filter((keyword) => keyword).reduce((chunks2, keyword) => {
|
10822 | if (autoEscape) {
|
10823 | keyword = keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
10824 | }
|
10825 | const regex = new RegExp(keyword, flags);
|
10826 | let match;
|
10827 | while (match = regex.exec(sourceString)) {
|
10828 | const start2 = match.index;
|
10829 | const end2 = regex.lastIndex;
|
10830 | if (start2 >= end2) {
|
10831 | regex.lastIndex++;
|
10832 | continue;
|
10833 | }
|
10834 | chunks2.push({
|
10835 | start: start2,
|
10836 | end: end2,
|
10837 | highlight: true
|
10838 | });
|
10839 | }
|
10840 | return chunks2;
|
10841 | }, []);
|
10842 | chunks = chunks.sort((a, b) => a.start - b.start).reduce((chunks2, currentChunk) => {
|
10843 | const prevChunk = chunks2[chunks2.length - 1];
|
10844 | if (!prevChunk || currentChunk.start > prevChunk.end) {
|
10845 | const unhighlightStart = prevChunk ? prevChunk.end : 0;
|
10846 | const unhighlightEnd = currentChunk.start;
|
10847 | if (unhighlightStart !== unhighlightEnd) {
|
10848 | chunks2.push({
|
10849 | start: unhighlightStart,
|
10850 | end: unhighlightEnd,
|
10851 | highlight: false
|
10852 | });
|
10853 | }
|
10854 | chunks2.push(currentChunk);
|
10855 | } else {
|
10856 | prevChunk.end = Math.max(prevChunk.end, currentChunk.end);
|
10857 | }
|
10858 | return chunks2;
|
10859 | }, []);
|
10860 | const lastChunk = chunks[chunks.length - 1];
|
10861 | if (lastChunk && lastChunk.end < sourceString.length) {
|
10862 | chunks.push({
|
10863 | start: lastChunk.end,
|
10864 | end: sourceString.length,
|
10865 | highlight: false
|
10866 | });
|
10867 | }
|
10868 | return chunks;
|
10869 | });
|
10870 | const renderContent = () => {
|
10871 | const {
|
10872 | sourceString,
|
10873 | highlightClass,
|
10874 | unhighlightClass,
|
10875 | highlightTag,
|
10876 | unhighlightTag
|
10877 | } = props2;
|
10878 | return highlightChunks.value.map((chunk) => {
|
10879 | const {
|
10880 | start: start2,
|
10881 | end: end2,
|
10882 | highlight
|
10883 | } = chunk;
|
10884 | const text = sourceString.slice(start2, end2);
|
10885 | if (highlight) {
|
10886 | return vue.createVNode(highlightTag, {
|
10887 | "class": [bem$F("tag"), highlightClass]
|
10888 | }, {
|
10889 | default: () => [text]
|
10890 | });
|
10891 | }
|
10892 | return vue.createVNode(unhighlightTag, {
|
10893 | "class": unhighlightClass
|
10894 | }, {
|
10895 | default: () => [text]
|
10896 | });
|
10897 | });
|
10898 | };
|
10899 | return () => {
|
10900 | const {
|
10901 | tag
|
10902 | } = props2;
|
10903 | return vue.createVNode(tag, {
|
10904 | "class": bem$F()
|
10905 | }, {
|
10906 | default: () => [renderContent()]
|
10907 | });
|
10908 | };
|
10909 | }
|
10910 | });
|
10911 | const Highlight = withInstall(stdin_default$O);
|
10912 | const getDistance = (touches) => Math.sqrt((touches[0].clientX - touches[1].clientX) ** 2 + (touches[0].clientY - touches[1].clientY) ** 2);
|
10913 | const getCenter = (touches) => ({
|
10914 | x: (touches[0].clientX + touches[1].clientX) / 2,
|
10915 | y: (touches[0].clientY + touches[1].clientY) / 2
|
10916 | });
|
10917 | const bem$E = createNamespace("image-preview")[1];
|
10918 | const longImageRatio = 2.6;
|
10919 | const imagePreviewItemProps = {
|
10920 | src: String,
|
10921 | show: Boolean,
|
10922 | active: Number,
|
10923 | minZoom: makeRequiredProp(numericProp),
|
10924 | maxZoom: makeRequiredProp(numericProp),
|
10925 | rootWidth: makeRequiredProp(Number),
|
10926 | rootHeight: makeRequiredProp(Number),
|
10927 | disableZoom: Boolean,
|
10928 | doubleScale: Boolean,
|
10929 | closeOnClickImage: Boolean,
|
10930 | closeOnClickOverlay: Boolean,
|
10931 | vertical: Boolean
|
10932 | };
|
10933 | var stdin_default$N = vue.defineComponent({
|
10934 | props: imagePreviewItemProps,
|
10935 | emits: ["scale", "close", "longPress"],
|
10936 | setup(props2, {
|
10937 | emit,
|
10938 | slots
|
10939 | }) {
|
10940 | const state = vue.reactive({
|
10941 | scale: 1,
|
10942 | moveX: 0,
|
10943 | moveY: 0,
|
10944 | moving: false,
|
10945 | zooming: false,
|
10946 | initializing: false,
|
10947 | imageRatio: 0
|
10948 | });
|
10949 | const touch = useTouch();
|
10950 | const imageRef = vue.ref();
|
10951 | const swipeItem = vue.ref();
|
10952 | const vertical = vue.ref(false);
|
10953 | const isLongImage = vue.ref(false);
|
10954 | let initialMoveY = 0;
|
10955 | const imageStyle = vue.computed(() => {
|
10956 | const {
|
10957 | scale,
|
10958 | moveX,
|
10959 | moveY,
|
10960 | moving,
|
10961 | zooming,
|
10962 | initializing
|
10963 | } = state;
|
10964 | const style = {
|
10965 | transitionDuration: zooming || moving || initializing ? "0s" : ".3s"
|
10966 | };
|
10967 | if (scale !== 1 || isLongImage.value) {
|
10968 | style.transform = `matrix(${scale}, 0, 0, ${scale}, ${moveX}, ${moveY})`;
|
10969 | }
|
10970 | return style;
|
10971 | });
|
10972 | const maxMoveX = vue.computed(() => {
|
10973 | if (state.imageRatio) {
|
10974 | const {
|
10975 | rootWidth,
|
10976 | rootHeight
|
10977 | } = props2;
|
10978 | const displayWidth = vertical.value ? rootHeight / state.imageRatio : rootWidth;
|
10979 | return Math.max(0, (state.scale * displayWidth - rootWidth) / 2);
|
10980 | }
|
10981 | return 0;
|
10982 | });
|
10983 | const maxMoveY = vue.computed(() => {
|
10984 | if (state.imageRatio) {
|
10985 | const {
|
10986 | rootWidth,
|
10987 | rootHeight
|
10988 | } = props2;
|
10989 | const displayHeight = vertical.value ? rootHeight : rootWidth * state.imageRatio;
|
10990 | return Math.max(0, (state.scale * displayHeight - rootHeight) / 2);
|
10991 | }
|
10992 | return 0;
|
10993 | });
|
10994 | const setScale = (scale, center) => {
|
10995 | var _a;
|
10996 | scale = clamp(scale, +props2.minZoom, +props2.maxZoom + 1);
|
10997 | if (scale !== state.scale) {
|
10998 | const ratio = scale / state.scale;
|
10999 | state.scale = scale;
|
11000 | if (center) {
|
11001 | const imageRect = useRect((_a = imageRef.value) == null ? void 0 : _a.$el);
|
11002 | const origin = {
|
11003 | x: imageRect.width * 0.5,
|
11004 | y: imageRect.height * 0.5
|
11005 | };
|
11006 | const moveX = state.moveX - (center.x - imageRect.left - origin.x) * (ratio - 1);
|
11007 | const moveY = state.moveY - (center.y - imageRect.top - origin.y) * (ratio - 1);
|
11008 | state.moveX = clamp(moveX, -maxMoveX.value, maxMoveX.value);
|
11009 | state.moveY = clamp(moveY, -maxMoveY.value, maxMoveY.value);
|
11010 | } else {
|
11011 | state.moveX = 0;
|
11012 | state.moveY = isLongImage.value ? initialMoveY : 0;
|
11013 | }
|
11014 | emit("scale", {
|
11015 | scale,
|
11016 | index: props2.active
|
11017 | });
|
11018 | }
|
11019 | };
|
11020 | const resetScale = () => {
|
11021 | setScale(1);
|
11022 | };
|
11023 | const toggleScale = () => {
|
11024 | const scale = state.scale > 1 ? 1 : 2;
|
11025 | setScale(scale, scale === 2 || isLongImage.value ? {
|
11026 | x: touch.startX.value,
|
11027 | y: touch.startY.value
|
11028 | } : void 0);
|
11029 | };
|
11030 | let fingerNum;
|
11031 | let startMoveX;
|
11032 | let startMoveY;
|
11033 | let startScale;
|
11034 | let startDistance;
|
11035 | let lastCenter;
|
11036 | let doubleTapTimer;
|
11037 | let touchStartTime;
|
11038 | let isImageMoved = false;
|
11039 | const onTouchStart = (event) => {
|
11040 | const {
|
11041 | touches
|
11042 | } = event;
|
11043 | fingerNum = touches.length;
|
11044 | if (fingerNum === 2 && props2.disableZoom) {
|
11045 | return;
|
11046 | }
|
11047 | const {
|
11048 | offsetX
|
11049 | } = touch;
|
11050 | touch.start(event);
|
11051 | startMoveX = state.moveX;
|
11052 | startMoveY = state.moveY;
|
11053 | touchStartTime = Date.now();
|
11054 | isImageMoved = false;
|
11055 | state.moving = fingerNum === 1 && (state.scale !== 1 || isLongImage.value);
|
11056 | state.zooming = fingerNum === 2 && !offsetX.value;
|
11057 | if (state.zooming) {
|
11058 | startScale = state.scale;
|
11059 | startDistance = getDistance(touches);
|
11060 | }
|
11061 | };
|
11062 | const onTouchMove = (event) => {
|
11063 | const {
|
11064 | touches
|
11065 | } = event;
|
11066 | touch.move(event);
|
11067 | if (state.moving) {
|
11068 | const {
|
11069 | deltaX,
|
11070 | deltaY
|
11071 | } = touch;
|
11072 | const moveX = deltaX.value + startMoveX;
|
11073 | const moveY = deltaY.value + startMoveY;
|
11074 | if ((props2.vertical ? touch.isVertical() && Math.abs(moveY) > maxMoveY.value : touch.isHorizontal() && Math.abs(moveX) > maxMoveX.value) && !isImageMoved) {
|
11075 | state.moving = false;
|
11076 | return;
|
11077 | }
|
11078 | isImageMoved = true;
|
11079 | preventDefault(event, true);
|
11080 | state.moveX = clamp(moveX, -maxMoveX.value, maxMoveX.value);
|
11081 | state.moveY = clamp(moveY, -maxMoveY.value, maxMoveY.value);
|
11082 | }
|
11083 | if (state.zooming) {
|
11084 | preventDefault(event, true);
|
11085 | if (touches.length === 2) {
|
11086 | const distance = getDistance(touches);
|
11087 | const scale = startScale * distance / startDistance;
|
11088 | lastCenter = getCenter(touches);
|
11089 | setScale(scale, lastCenter);
|
11090 | }
|
11091 | }
|
11092 | };
|
11093 | const checkClose = (event) => {
|
11094 | var _a;
|
11095 | const swipeItemEl = (_a = swipeItem.value) == null ? void 0 : _a.$el;
|
11096 | const imageEl = swipeItemEl.firstElementChild;
|
11097 | const isClickOverlay = event.target === swipeItemEl;
|
11098 | const isClickImage = imageEl == null ? void 0 : imageEl.contains(event.target);
|
11099 | if (!props2.closeOnClickImage && isClickImage)
|
11100 | return;
|
11101 | if (!props2.closeOnClickOverlay && isClickOverlay)
|
11102 | return;
|
11103 | emit("close");
|
11104 | };
|
11105 | const checkTap = (event) => {
|
11106 | if (fingerNum > 1) {
|
11107 | return;
|
11108 | }
|
11109 | const deltaTime = Date.now() - touchStartTime;
|
11110 | const TAP_TIME = 250;
|
11111 | if (touch.isTap.value) {
|
11112 | if (deltaTime < TAP_TIME) {
|
11113 | if (props2.doubleScale) {
|
11114 | if (doubleTapTimer) {
|
11115 | clearTimeout(doubleTapTimer);
|
11116 | doubleTapTimer = null;
|
11117 | toggleScale();
|
11118 | } else {
|
11119 | doubleTapTimer = setTimeout(() => {
|
11120 | checkClose(event);
|
11121 | doubleTapTimer = null;
|
11122 | }, TAP_TIME);
|
11123 | }
|
11124 | } else {
|
11125 | checkClose(event);
|
11126 | }
|
11127 | } else if (deltaTime > LONG_PRESS_START_TIME) {
|
11128 | emit("longPress");
|
11129 | }
|
11130 | }
|
11131 | };
|
11132 | const onTouchEnd = (event) => {
|
11133 | let stopPropagation2 = false;
|
11134 | if (state.moving || state.zooming) {
|
11135 | stopPropagation2 = true;
|
11136 | if (state.moving && startMoveX === state.moveX && startMoveY === state.moveY) {
|
11137 | stopPropagation2 = false;
|
11138 | }
|
11139 | if (!event.touches.length) {
|
11140 | if (state.zooming) {
|
11141 | state.moveX = clamp(state.moveX, -maxMoveX.value, maxMoveX.value);
|
11142 | state.moveY = clamp(state.moveY, -maxMoveY.value, maxMoveY.value);
|
11143 | state.zooming = false;
|
11144 | }
|
11145 | state.moving = false;
|
11146 | startMoveX = 0;
|
11147 | startMoveY = 0;
|
11148 | startScale = 1;
|
11149 | if (state.scale < 1) {
|
11150 | resetScale();
|
11151 | }
|
11152 | const maxZoom = +props2.maxZoom;
|
11153 | if (state.scale > maxZoom) {
|
11154 | setScale(maxZoom, lastCenter);
|
11155 | }
|
11156 | }
|
11157 | }
|
11158 | preventDefault(event, stopPropagation2);
|
11159 | checkTap(event);
|
11160 | touch.reset();
|
11161 | };
|
11162 | const resize = () => {
|
11163 | const {
|
11164 | rootWidth,
|
11165 | rootHeight
|
11166 | } = props2;
|
11167 | const rootRatio = rootHeight / rootWidth;
|
11168 | const {
|
11169 | imageRatio
|
11170 | } = state;
|
11171 | vertical.value = state.imageRatio > rootRatio && imageRatio < longImageRatio;
|
11172 | isLongImage.value = state.imageRatio > rootRatio && imageRatio >= longImageRatio;
|
11173 | if (isLongImage.value) {
|
11174 | initialMoveY = (imageRatio * rootWidth - rootHeight) / 2;
|
11175 | state.moveY = initialMoveY;
|
11176 | state.initializing = true;
|
11177 | raf(() => {
|
11178 | state.initializing = false;
|
11179 | });
|
11180 | }
|
11181 | resetScale();
|
11182 | };
|
11183 | const onLoad = (event) => {
|
11184 | const {
|
11185 | naturalWidth,
|
11186 | naturalHeight
|
11187 | } = event.target;
|
11188 | state.imageRatio = naturalHeight / naturalWidth;
|
11189 | resize();
|
11190 | };
|
11191 | vue.watch(() => props2.active, resetScale);
|
11192 | vue.watch(() => props2.show, (value) => {
|
11193 | if (!value) {
|
11194 | resetScale();
|
11195 | }
|
11196 | });
|
11197 | vue.watch(() => [props2.rootWidth, props2.rootHeight], resize);
|
11198 | useEventListener("touchmove", onTouchMove, {
|
11199 | target: vue.computed(() => {
|
11200 | var _a;
|
11201 | return (_a = swipeItem.value) == null ? void 0 : _a.$el;
|
11202 | })
|
11203 | });
|
11204 | useExpose({
|
11205 | resetScale
|
11206 | });
|
11207 | return () => {
|
11208 | const imageSlots = {
|
11209 | loading: () => vue.createVNode(Loading, {
|
11210 | "type": "spinner"
|
11211 | }, null)
|
11212 | };
|
11213 | return vue.createVNode(SwipeItem, {
|
11214 | "ref": swipeItem,
|
11215 | "class": bem$E("swipe-item"),
|
11216 | "onTouchstartPassive": onTouchStart,
|
11217 | "onTouchend": onTouchEnd,
|
11218 | "onTouchcancel": onTouchEnd
|
11219 | }, {
|
11220 | default: () => [slots.image ? vue.createVNode("div", {
|
11221 | "class": bem$E("image-wrap")
|
11222 | }, [slots.image({
|
11223 | src: props2.src
|
11224 | })]) : vue.createVNode(Image$1, {
|
11225 | "ref": imageRef,
|
11226 | "src": props2.src,
|
11227 | "fit": "contain",
|
11228 | "class": bem$E("image", {
|
11229 | vertical: vertical.value
|
11230 | }),
|
11231 | "style": imageStyle.value,
|
11232 | "onLoad": onLoad
|
11233 | }, imageSlots)]
|
11234 | });
|
11235 | };
|
11236 | }
|
11237 | });
|
11238 | const [name$E, bem$D] = createNamespace("image-preview");
|
11239 | const popupProps$1 = ["show", "teleport", "transition", "overlayStyle", "closeOnPopstate"];
|
11240 | const imagePreviewProps = {
|
11241 | show: Boolean,
|
11242 | loop: truthProp,
|
11243 | images: makeArrayProp(),
|
11244 | minZoom: makeNumericProp(1 / 3),
|
11245 | maxZoom: makeNumericProp(3),
|
11246 | overlay: truthProp,
|
11247 | vertical: Boolean,
|
11248 | closeable: Boolean,
|
11249 | showIndex: truthProp,
|
11250 | className: unknownProp,
|
11251 | closeIcon: makeStringProp("clear"),
|
11252 | transition: String,
|
11253 | beforeClose: Function,
|
11254 | doubleScale: truthProp,
|
11255 | overlayClass: unknownProp,
|
11256 | overlayStyle: Object,
|
11257 | swipeDuration: makeNumericProp(300),
|
11258 | startPosition: makeNumericProp(0),
|
11259 | showIndicators: Boolean,
|
11260 | closeOnPopstate: truthProp,
|
11261 | closeOnClickImage: truthProp,
|
11262 | closeOnClickOverlay: truthProp,
|
11263 | closeIconPosition: makeStringProp("top-right"),
|
11264 | teleport: [String, Object]
|
11265 | };
|
11266 | var stdin_default$M = vue.defineComponent({
|
11267 | name: name$E,
|
11268 | props: imagePreviewProps,
|
11269 | emits: ["scale", "close", "closed", "change", "longPress", "update:show"],
|
11270 | setup(props2, {
|
11271 | emit,
|
11272 | slots
|
11273 | }) {
|
11274 | const swipeRef = vue.ref();
|
11275 | const activedPreviewItemRef = vue.ref();
|
11276 | const state = vue.reactive({
|
11277 | active: 0,
|
11278 | rootWidth: 0,
|
11279 | rootHeight: 0,
|
11280 | disableZoom: false
|
11281 | });
|
11282 | const resize = () => {
|
11283 | if (swipeRef.value) {
|
11284 | const rect = useRect(swipeRef.value.$el);
|
11285 | state.rootWidth = rect.width;
|
11286 | state.rootHeight = rect.height;
|
11287 | swipeRef.value.resize();
|
11288 | }
|
11289 | };
|
11290 | const emitScale = (args) => emit("scale", args);
|
11291 | const updateShow = (show) => emit("update:show", show);
|
11292 | const emitClose = () => {
|
11293 | callInterceptor(props2.beforeClose, {
|
11294 | args: [state.active],
|
11295 | done: () => updateShow(false)
|
11296 | });
|
11297 | };
|
11298 | const setActive = (active) => {
|
11299 | if (active !== state.active) {
|
11300 | state.active = active;
|
11301 | emit("change", active);
|
11302 | }
|
11303 | };
|
11304 | const renderIndex = () => {
|
11305 | if (props2.showIndex) {
|
11306 | return vue.createVNode("div", {
|
11307 | "class": bem$D("index")
|
11308 | }, [slots.index ? slots.index({
|
11309 | index: state.active
|
11310 | }) : `${state.active + 1} / ${props2.images.length}`]);
|
11311 | }
|
11312 | };
|
11313 | const renderCover = () => {
|
11314 | if (slots.cover) {
|
11315 | return vue.createVNode("div", {
|
11316 | "class": bem$D("cover")
|
11317 | }, [slots.cover()]);
|
11318 | }
|
11319 | };
|
11320 | const onDragStart = () => {
|
11321 | state.disableZoom = true;
|
11322 | };
|
11323 | const onDragEnd = () => {
|
11324 | state.disableZoom = false;
|
11325 | };
|
11326 | const renderImages = () => vue.createVNode(Swipe, {
|
11327 | "ref": swipeRef,
|
11328 | "lazyRender": true,
|
11329 | "loop": props2.loop,
|
11330 | "class": bem$D("swipe"),
|
11331 | "vertical": props2.vertical,
|
11332 | "duration": props2.swipeDuration,
|
11333 | "initialSwipe": props2.startPosition,
|
11334 | "showIndicators": props2.showIndicators,
|
11335 | "indicatorColor": "white",
|
11336 | "onChange": setActive,
|
11337 | "onDragEnd": onDragEnd,
|
11338 | "onDragStart": onDragStart
|
11339 | }, {
|
11340 | default: () => [props2.images.map((image, index) => vue.createVNode(stdin_default$N, {
|
11341 | "ref": (item) => {
|
11342 | if (index === state.active) {
|
11343 | activedPreviewItemRef.value = item;
|
11344 | }
|
11345 | },
|
11346 | "src": image,
|
11347 | "show": props2.show,
|
11348 | "active": state.active,
|
11349 | "maxZoom": props2.maxZoom,
|
11350 | "minZoom": props2.minZoom,
|
11351 | "rootWidth": state.rootWidth,
|
11352 | "rootHeight": state.rootHeight,
|
11353 | "disableZoom": state.disableZoom,
|
11354 | "doubleScale": props2.doubleScale,
|
11355 | "closeOnClickImage": props2.closeOnClickImage,
|
11356 | "closeOnClickOverlay": props2.closeOnClickOverlay,
|
11357 | "vertical": props2.vertical,
|
11358 | "onScale": emitScale,
|
11359 | "onClose": emitClose,
|
11360 | "onLongPress": () => emit("longPress", {
|
11361 | index
|
11362 | })
|
11363 | }, {
|
11364 | image: slots.image
|
11365 | }))]
|
11366 | });
|
11367 | const renderClose = () => {
|
11368 | if (props2.closeable) {
|
11369 | return vue.createVNode(Icon, {
|
11370 | "role": "button",
|
11371 | "name": props2.closeIcon,
|
11372 | "class": [bem$D("close-icon", props2.closeIconPosition), HAPTICS_FEEDBACK],
|
11373 | "onClick": emitClose
|
11374 | }, null);
|
11375 | }
|
11376 | };
|
11377 | const onClosed = () => emit("closed");
|
11378 | const swipeTo = (index, options) => {
|
11379 | var _a;
|
11380 | return (_a = swipeRef.value) == null ? void 0 : _a.swipeTo(index, options);
|
11381 | };
|
11382 | useExpose({
|
11383 | resetScale: () => {
|
11384 | var _a;
|
11385 | (_a = activedPreviewItemRef.value) == null ? void 0 : _a.resetScale();
|
11386 | },
|
11387 | swipeTo
|
11388 | });
|
11389 | vue.onMounted(resize);
|
11390 | vue.watch([windowWidth, windowHeight], resize);
|
11391 | vue.watch(() => props2.startPosition, (value) => setActive(+value));
|
11392 | vue.watch(() => props2.show, (value) => {
|
11393 | const {
|
11394 | images,
|
11395 | startPosition
|
11396 | } = props2;
|
11397 | if (value) {
|
11398 | setActive(+startPosition);
|
11399 | vue.nextTick(() => {
|
11400 | resize();
|
11401 | swipeTo(+startPosition, {
|
11402 | immediate: true
|
11403 | });
|
11404 | });
|
11405 | } else {
|
11406 | emit("close", {
|
11407 | index: state.active,
|
11408 | url: images[state.active]
|
11409 | });
|
11410 | }
|
11411 | });
|
11412 | return () => vue.createVNode(Popup, vue.mergeProps({
|
11413 | "class": [bem$D(), props2.className],
|
11414 | "overlayClass": [bem$D("overlay"), props2.overlayClass],
|
11415 | "onClosed": onClosed,
|
11416 | "onUpdate:show": updateShow
|
11417 | }, pick(props2, popupProps$1)), {
|
11418 | default: () => [renderClose(), renderImages(), renderIndex(), renderCover()]
|
11419 | });
|
11420 | }
|
11421 | });
|
11422 | let instance$1;
|
11423 | const defaultConfig = {
|
11424 | loop: true,
|
11425 | images: [],
|
11426 | maxZoom: 3,
|
11427 | minZoom: 1 / 3,
|
11428 | onScale: void 0,
|
11429 | onClose: void 0,
|
11430 | onChange: void 0,
|
11431 | vertical: false,
|
11432 | teleport: "body",
|
11433 | className: "",
|
11434 | showIndex: true,
|
11435 | closeable: false,
|
11436 | closeIcon: "clear",
|
11437 | transition: void 0,
|
11438 | beforeClose: void 0,
|
11439 | doubleScale: true,
|
11440 | overlayStyle: void 0,
|
11441 | overlayClass: void 0,
|
11442 | startPosition: 0,
|
11443 | swipeDuration: 300,
|
11444 | showIndicators: false,
|
11445 | closeOnPopstate: true,
|
11446 | closeOnClickOverlay: true,
|
11447 | closeIconPosition: "top-right"
|
11448 | };
|
11449 | function initInstance$1() {
|
11450 | ({
|
11451 | instance: instance$1
|
11452 | } = mountComponent({
|
11453 | setup() {
|
11454 | const {
|
11455 | state,
|
11456 | toggle
|
11457 | } = usePopupState();
|
11458 | const onClosed = () => {
|
11459 | state.images = [];
|
11460 | };
|
11461 | return () => vue.createVNode(stdin_default$M, vue.mergeProps(state, {
|
11462 | "onClosed": onClosed,
|
11463 | "onUpdate:show": toggle
|
11464 | }), null);
|
11465 | }
|
11466 | }));
|
11467 | }
|
11468 | const showImagePreview = (options, startPosition = 0) => {
|
11469 | if (!inBrowser$1) {
|
11470 | return;
|
11471 | }
|
11472 | if (!instance$1) {
|
11473 | initInstance$1();
|
11474 | }
|
11475 | options = Array.isArray(options) ? {
|
11476 | images: options,
|
11477 | startPosition
|
11478 | } : options;
|
11479 | instance$1.open(extend({}, defaultConfig, options));
|
11480 | return instance$1;
|
11481 | };
|
11482 | const ImagePreview = withInstall(stdin_default$M);
|
11483 | function genAlphabet() {
|
11484 | const charCodeOfA = "A".charCodeAt(0);
|
11485 | const indexList = Array(26).fill("").map((_, i) => String.fromCharCode(charCodeOfA + i));
|
11486 | return indexList;
|
11487 | }
|
11488 | const [name$D, bem$C] = createNamespace("index-bar");
|
11489 | const indexBarProps = {
|
11490 | sticky: truthProp,
|
11491 | zIndex: numericProp,
|
11492 | teleport: [String, Object],
|
11493 | highlightColor: String,
|
11494 | stickyOffsetTop: makeNumberProp(0),
|
11495 | indexList: {
|
11496 | type: Array,
|
11497 | default: genAlphabet
|
11498 | }
|
11499 | };
|
11500 | const INDEX_BAR_KEY = Symbol(name$D);
|
11501 | var stdin_default$L = vue.defineComponent({
|
11502 | name: name$D,
|
11503 | props: indexBarProps,
|
11504 | emits: ["select", "change"],
|
11505 | setup(props2, {
|
11506 | emit,
|
11507 | slots
|
11508 | }) {
|
11509 | const root = vue.ref();
|
11510 | const sidebar = vue.ref();
|
11511 | const activeAnchor = vue.ref("");
|
11512 | const touch = useTouch();
|
11513 | const scrollParent = useScrollParent(root);
|
11514 | const {
|
11515 | children,
|
11516 | linkChildren
|
11517 | } = useChildren(INDEX_BAR_KEY);
|
11518 | let selectActiveIndex;
|
11519 | linkChildren({
|
11520 | props: props2
|
11521 | });
|
11522 | const sidebarStyle = vue.computed(() => {
|
11523 | if (isDef(props2.zIndex)) {
|
11524 | return {
|
11525 | zIndex: +props2.zIndex + 1
|
11526 | };
|
11527 | }
|
11528 | });
|
11529 | const highlightStyle = vue.computed(() => {
|
11530 | if (props2.highlightColor) {
|
11531 | return {
|
11532 | color: props2.highlightColor
|
11533 | };
|
11534 | }
|
11535 | });
|
11536 | const getActiveAnchor = (scrollTop, rects) => {
|
11537 | for (let i = children.length - 1; i >= 0; i--) {
|
11538 | const prevHeight = i > 0 ? rects[i - 1].height : 0;
|
11539 | const reachTop = props2.sticky ? prevHeight + props2.stickyOffsetTop : 0;
|
11540 | if (scrollTop + reachTop >= rects[i].top) {
|
11541 | return i;
|
11542 | }
|
11543 | }
|
11544 | return -1;
|
11545 | };
|
11546 | const getMatchAnchor = (index) => children.find((item) => String(item.index) === index);
|
11547 | const onScroll = () => {
|
11548 | if (isHidden(root)) {
|
11549 | return;
|
11550 | }
|
11551 | const {
|
11552 | sticky,
|
11553 | indexList
|
11554 | } = props2;
|
11555 | const scrollTop = getScrollTop(scrollParent.value);
|
11556 | const scrollParentRect = useRect(scrollParent);
|
11557 | const rects = children.map((item) => item.getRect(scrollParent.value, scrollParentRect));
|
11558 | let active = -1;
|
11559 | if (selectActiveIndex) {
|
11560 | const match = getMatchAnchor(selectActiveIndex);
|
11561 | if (match) {
|
11562 | const rect = match.getRect(scrollParent.value, scrollParentRect);
|
11563 | active = getActiveAnchor(rect.top, rects);
|
11564 | }
|
11565 | } else {
|
11566 | active = getActiveAnchor(scrollTop, rects);
|
11567 | }
|
11568 | activeAnchor.value = indexList[active];
|
11569 | if (sticky) {
|
11570 | children.forEach((item, index) => {
|
11571 | const {
|
11572 | state,
|
11573 | $el
|
11574 | } = item;
|
11575 | if (index === active || index === active - 1) {
|
11576 | const rect = $el.getBoundingClientRect();
|
11577 | state.left = rect.left;
|
11578 | state.width = rect.width;
|
11579 | } else {
|
11580 | state.left = null;
|
11581 | state.width = null;
|
11582 | }
|
11583 | if (index === active) {
|
11584 | state.active = true;
|
11585 | state.top = Math.max(props2.stickyOffsetTop, rects[index].top - scrollTop) + scrollParentRect.top;
|
11586 | } else if (index === active - 1 && selectActiveIndex === "") {
|
11587 | const activeItemTop = rects[active].top - scrollTop;
|
11588 | state.active = activeItemTop > 0;
|
11589 | state.top = activeItemTop + scrollParentRect.top - rects[index].height;
|
11590 | } else {
|
11591 | state.active = false;
|
11592 | }
|
11593 | });
|
11594 | }
|
11595 | selectActiveIndex = "";
|
11596 | };
|
11597 | const init = () => {
|
11598 | vue.nextTick(onScroll);
|
11599 | };
|
11600 | useEventListener("scroll", onScroll, {
|
11601 | target: scrollParent,
|
11602 | passive: true
|
11603 | });
|
11604 | vue.onMounted(init);
|
11605 | vue.watch(() => props2.indexList, init);
|
11606 | vue.watch(activeAnchor, (value) => {
|
11607 | if (value) {
|
11608 | emit("change", value);
|
11609 | }
|
11610 | });
|
11611 | const renderIndexes = () => props2.indexList.map((index) => {
|
11612 | const active = index === activeAnchor.value;
|
11613 | return vue.createVNode("span", {
|
11614 | "class": bem$C("index", {
|
11615 | active
|
11616 | }),
|
11617 | "style": active ? highlightStyle.value : void 0,
|
11618 | "data-index": index
|
11619 | }, [index]);
|
11620 | });
|
11621 | const scrollTo = (index) => {
|
11622 | selectActiveIndex = String(index);
|
11623 | const match = getMatchAnchor(selectActiveIndex);
|
11624 | if (match) {
|
11625 | const scrollTop = getScrollTop(scrollParent.value);
|
11626 | const scrollParentRect = useRect(scrollParent);
|
11627 | const {
|
11628 | offsetHeight
|
11629 | } = document.documentElement;
|
11630 | match.$el.scrollIntoView();
|
11631 | if (scrollTop === offsetHeight - scrollParentRect.height) {
|
11632 | onScroll();
|
11633 | return;
|
11634 | }
|
11635 | if (props2.sticky && props2.stickyOffsetTop) {
|
11636 | setRootScrollTop(getRootScrollTop() - props2.stickyOffsetTop);
|
11637 | }
|
11638 | emit("select", match.index);
|
11639 | }
|
11640 | };
|
11641 | const scrollToElement = (element) => {
|
11642 | const {
|
11643 | index
|
11644 | } = element.dataset;
|
11645 | if (index) {
|
11646 | scrollTo(index);
|
11647 | }
|
11648 | };
|
11649 | const onClickSidebar = (event) => {
|
11650 | scrollToElement(event.target);
|
11651 | };
|
11652 | let touchActiveIndex;
|
11653 | const onTouchMove = (event) => {
|
11654 | touch.move(event);
|
11655 | if (touch.isVertical()) {
|
11656 | preventDefault(event);
|
11657 | const {
|
11658 | clientX,
|
11659 | clientY
|
11660 | } = event.touches[0];
|
11661 | const target = document.elementFromPoint(clientX, clientY);
|
11662 | if (target) {
|
11663 | const {
|
11664 | index
|
11665 | } = target.dataset;
|
11666 | if (index && touchActiveIndex !== index) {
|
11667 | touchActiveIndex = index;
|
11668 | scrollToElement(target);
|
11669 | }
|
11670 | }
|
11671 | }
|
11672 | };
|
11673 | const renderSidebar = () => vue.createVNode("div", {
|
11674 | "ref": sidebar,
|
11675 | "class": bem$C("sidebar"),
|
11676 | "style": sidebarStyle.value,
|
11677 | "onClick": onClickSidebar,
|
11678 | "onTouchstartPassive": touch.start
|
11679 | }, [renderIndexes()]);
|
11680 | useExpose({
|
11681 | scrollTo
|
11682 | });
|
11683 | useEventListener("touchmove", onTouchMove, {
|
11684 | target: sidebar
|
11685 | });
|
11686 | return () => {
|
11687 | var _a;
|
11688 | return vue.createVNode("div", {
|
11689 | "ref": root,
|
11690 | "class": bem$C()
|
11691 | }, [props2.teleport ? vue.createVNode(vue.Teleport, {
|
11692 | "to": props2.teleport
|
11693 | }, {
|
11694 | default: () => [renderSidebar()]
|
11695 | }) : renderSidebar(), (_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
11696 | };
|
11697 | }
|
11698 | });
|
11699 | const [name$C, bem$B] = createNamespace("index-anchor");
|
11700 | const indexAnchorProps = {
|
11701 | index: numericProp
|
11702 | };
|
11703 | var stdin_default$K = vue.defineComponent({
|
11704 | name: name$C,
|
11705 | props: indexAnchorProps,
|
11706 | setup(props2, {
|
11707 | slots
|
11708 | }) {
|
11709 | const state = vue.reactive({
|
11710 | top: 0,
|
11711 | left: null,
|
11712 | rect: {
|
11713 | top: 0,
|
11714 | height: 0
|
11715 | },
|
11716 | width: null,
|
11717 | active: false
|
11718 | });
|
11719 | const root = vue.ref();
|
11720 | const {
|
11721 | parent
|
11722 | } = useParent(INDEX_BAR_KEY);
|
11723 | if (!parent) {
|
11724 | return;
|
11725 | }
|
11726 | const isSticky = () => state.active && parent.props.sticky;
|
11727 | const anchorStyle = vue.computed(() => {
|
11728 | const {
|
11729 | zIndex,
|
11730 | highlightColor
|
11731 | } = parent.props;
|
11732 | if (isSticky()) {
|
11733 | return extend(getZIndexStyle(zIndex), {
|
11734 | left: state.left ? `${state.left}px` : void 0,
|
11735 | width: state.width ? `${state.width}px` : void 0,
|
11736 | transform: state.top ? `translate3d(0, ${state.top}px, 0)` : void 0,
|
11737 | color: highlightColor
|
11738 | });
|
11739 | }
|
11740 | });
|
11741 | const getRect = (scrollParent, scrollParentRect) => {
|
11742 | const rootRect = useRect(root);
|
11743 | state.rect.height = rootRect.height;
|
11744 | if (scrollParent === window || scrollParent === document.body) {
|
11745 | state.rect.top = rootRect.top + getRootScrollTop();
|
11746 | } else {
|
11747 | state.rect.top = rootRect.top + getScrollTop(scrollParent) - scrollParentRect.top;
|
11748 | }
|
11749 | return state.rect;
|
11750 | };
|
11751 | useExpose({
|
11752 | state,
|
11753 | getRect
|
11754 | });
|
11755 | return () => {
|
11756 | const sticky = isSticky();
|
11757 | return vue.createVNode("div", {
|
11758 | "ref": root,
|
11759 | "style": {
|
11760 | height: sticky ? `${state.rect.height}px` : void 0
|
11761 | }
|
11762 | }, [vue.createVNode("div", {
|
11763 | "style": anchorStyle.value,
|
11764 | "class": [bem$B({
|
11765 | sticky
|
11766 | }), {
|
11767 | [BORDER_BOTTOM]: sticky
|
11768 | }]
|
11769 | }, [slots.default ? slots.default() : props2.index])]);
|
11770 | };
|
11771 | }
|
11772 | });
|
11773 | const IndexAnchor = withInstall(stdin_default$K);
|
11774 | const IndexBar = withInstall(stdin_default$L);
|
11775 | const [name$B, bem$A, t$7] = createNamespace("list");
|
11776 | const listProps = {
|
11777 | error: Boolean,
|
11778 | offset: makeNumericProp(300),
|
11779 | loading: Boolean,
|
11780 | disabled: Boolean,
|
11781 | finished: Boolean,
|
11782 | scroller: Object,
|
11783 | errorText: String,
|
11784 | direction: makeStringProp("down"),
|
11785 | loadingText: String,
|
11786 | finishedText: String,
|
11787 | immediateCheck: truthProp
|
11788 | };
|
11789 | var stdin_default$J = vue.defineComponent({
|
11790 | name: name$B,
|
11791 | props: listProps,
|
11792 | emits: ["load", "update:error", "update:loading"],
|
11793 | setup(props2, {
|
11794 | emit,
|
11795 | slots
|
11796 | }) {
|
11797 | const loading = vue.ref(props2.loading);
|
11798 | const root = vue.ref();
|
11799 | const placeholder = vue.ref();
|
11800 | const tabStatus = useTabStatus();
|
11801 | const scrollParent = useScrollParent(root);
|
11802 | const scroller = vue.computed(() => props2.scroller || scrollParent.value);
|
11803 | const check = () => {
|
11804 | vue.nextTick(() => {
|
11805 | if (loading.value || props2.finished || props2.disabled || props2.error ||
|
11806 | (tabStatus == null ? void 0 : tabStatus.value) === false) {
|
11807 | return;
|
11808 | }
|
11809 | const {
|
11810 | direction
|
11811 | } = props2;
|
11812 | const offset2 = +props2.offset;
|
11813 | const scrollParentRect = useRect(scroller);
|
11814 | if (!scrollParentRect.height || isHidden(root)) {
|
11815 | return;
|
11816 | }
|
11817 | let isReachEdge = false;
|
11818 | const placeholderRect = useRect(placeholder);
|
11819 | if (direction === "up") {
|
11820 | isReachEdge = scrollParentRect.top - placeholderRect.top <= offset2;
|
11821 | } else {
|
11822 | isReachEdge = placeholderRect.bottom - scrollParentRect.bottom <= offset2;
|
11823 | }
|
11824 | if (isReachEdge) {
|
11825 | loading.value = true;
|
11826 | emit("update:loading", true);
|
11827 | emit("load");
|
11828 | }
|
11829 | });
|
11830 | };
|
11831 | const renderFinishedText = () => {
|
11832 | if (props2.finished) {
|
11833 | const text = slots.finished ? slots.finished() : props2.finishedText;
|
11834 | if (text) {
|
11835 | return vue.createVNode("div", {
|
11836 | "class": bem$A("finished-text")
|
11837 | }, [text]);
|
11838 | }
|
11839 | }
|
11840 | };
|
11841 | const clickErrorText = () => {
|
11842 | emit("update:error", false);
|
11843 | check();
|
11844 | };
|
11845 | const renderErrorText = () => {
|
11846 | if (props2.error) {
|
11847 | const text = slots.error ? slots.error() : props2.errorText;
|
11848 | if (text) {
|
11849 | return vue.createVNode("div", {
|
11850 | "role": "button",
|
11851 | "class": bem$A("error-text"),
|
11852 | "tabindex": 0,
|
11853 | "onClick": clickErrorText
|
11854 | }, [text]);
|
11855 | }
|
11856 | }
|
11857 | };
|
11858 | const renderLoading = () => {
|
11859 | if (loading.value && !props2.finished && !props2.disabled) {
|
11860 | return vue.createVNode("div", {
|
11861 | "class": bem$A("loading")
|
11862 | }, [slots.loading ? slots.loading() : vue.createVNode(Loading, {
|
11863 | "class": bem$A("loading-icon")
|
11864 | }, {
|
11865 | default: () => [props2.loadingText || t$7("loading")]
|
11866 | })]);
|
11867 | }
|
11868 | };
|
11869 | vue.watch(() => [props2.loading, props2.finished, props2.error], check);
|
11870 | if (tabStatus) {
|
11871 | vue.watch(tabStatus, (tabActive) => {
|
11872 | if (tabActive) {
|
11873 | check();
|
11874 | }
|
11875 | });
|
11876 | }
|
11877 | vue.onUpdated(() => {
|
11878 | loading.value = props2.loading;
|
11879 | });
|
11880 | vue.onMounted(() => {
|
11881 | if (props2.immediateCheck) {
|
11882 | check();
|
11883 | }
|
11884 | });
|
11885 | useExpose({
|
11886 | check
|
11887 | });
|
11888 | useEventListener("scroll", check, {
|
11889 | target: scroller,
|
11890 | passive: true
|
11891 | });
|
11892 | return () => {
|
11893 | var _a;
|
11894 | const Content = (_a = slots.default) == null ? void 0 : _a.call(slots);
|
11895 | const Placeholder = vue.createVNode("div", {
|
11896 | "ref": placeholder,
|
11897 | "class": bem$A("placeholder")
|
11898 | }, null);
|
11899 | return vue.createVNode("div", {
|
11900 | "ref": root,
|
11901 | "role": "feed",
|
11902 | "class": bem$A(),
|
11903 | "aria-busy": loading.value
|
11904 | }, [props2.direction === "down" ? Content : Placeholder, renderLoading(), renderFinishedText(), renderErrorText(), props2.direction === "up" ? Content : Placeholder]);
|
11905 | };
|
11906 | }
|
11907 | });
|
11908 | const List = withInstall(stdin_default$J);
|
11909 | const [name$A, bem$z] = createNamespace("nav-bar");
|
11910 | const navBarProps = {
|
11911 | title: String,
|
11912 | fixed: Boolean,
|
11913 | zIndex: numericProp,
|
11914 | border: truthProp,
|
11915 | leftText: String,
|
11916 | rightText: String,
|
11917 | leftDisabled: Boolean,
|
11918 | rightDisabled: Boolean,
|
11919 | leftArrow: Boolean,
|
11920 | placeholder: Boolean,
|
11921 | safeAreaInsetTop: Boolean,
|
11922 | clickable: truthProp
|
11923 | };
|
11924 | var stdin_default$I = vue.defineComponent({
|
11925 | name: name$A,
|
11926 | props: navBarProps,
|
11927 | emits: ["clickLeft", "clickRight"],
|
11928 | setup(props2, {
|
11929 | emit,
|
11930 | slots
|
11931 | }) {
|
11932 | const navBarRef = vue.ref();
|
11933 | const renderPlaceholder = usePlaceholder(navBarRef, bem$z);
|
11934 | const onClickLeft = (event) => {
|
11935 | if (!props2.leftDisabled) {
|
11936 | emit("clickLeft", event);
|
11937 | }
|
11938 | };
|
11939 | const onClickRight = (event) => {
|
11940 | if (!props2.rightDisabled) {
|
11941 | emit("clickRight", event);
|
11942 | }
|
11943 | };
|
11944 | const renderLeft = () => {
|
11945 | if (slots.left) {
|
11946 | return slots.left();
|
11947 | }
|
11948 | return [props2.leftArrow && vue.createVNode(Icon, {
|
11949 | "class": bem$z("arrow"),
|
11950 | "name": "arrow-left"
|
11951 | }, null), props2.leftText && vue.createVNode("span", {
|
11952 | "class": bem$z("text")
|
11953 | }, [props2.leftText])];
|
11954 | };
|
11955 | const renderRight = () => {
|
11956 | if (slots.right) {
|
11957 | return slots.right();
|
11958 | }
|
11959 | return vue.createVNode("span", {
|
11960 | "class": bem$z("text")
|
11961 | }, [props2.rightText]);
|
11962 | };
|
11963 | const renderNavBar = () => {
|
11964 | const {
|
11965 | title,
|
11966 | fixed,
|
11967 | border,
|
11968 | zIndex
|
11969 | } = props2;
|
11970 | const style = getZIndexStyle(zIndex);
|
11971 | const hasLeft = props2.leftArrow || props2.leftText || slots.left;
|
11972 | const hasRight = props2.rightText || slots.right;
|
11973 | return vue.createVNode("div", {
|
11974 | "ref": navBarRef,
|
11975 | "style": style,
|
11976 | "class": [bem$z({
|
11977 | fixed
|
11978 | }), {
|
11979 | [BORDER_BOTTOM]: border,
|
11980 | "van-safe-area-top": props2.safeAreaInsetTop
|
11981 | }]
|
11982 | }, [vue.createVNode("div", {
|
11983 | "class": bem$z("content")
|
11984 | }, [hasLeft && vue.createVNode("div", {
|
11985 | "class": [bem$z("left", {
|
11986 | disabled: props2.leftDisabled
|
11987 | }), props2.clickable && !props2.leftDisabled ? HAPTICS_FEEDBACK : ""],
|
11988 | "onClick": onClickLeft
|
11989 | }, [renderLeft()]), vue.createVNode("div", {
|
11990 | "class": [bem$z("title"), "van-ellipsis"]
|
11991 | }, [slots.title ? slots.title() : title]), hasRight && vue.createVNode("div", {
|
11992 | "class": [bem$z("right", {
|
11993 | disabled: props2.rightDisabled
|
11994 | }), props2.clickable && !props2.rightDisabled ? HAPTICS_FEEDBACK : ""],
|
11995 | "onClick": onClickRight
|
11996 | }, [renderRight()])])]);
|
11997 | };
|
11998 | return () => {
|
11999 | if (props2.fixed && props2.placeholder) {
|
12000 | return renderPlaceholder(renderNavBar);
|
12001 | }
|
12002 | return renderNavBar();
|
12003 | };
|
12004 | }
|
12005 | });
|
12006 | const NavBar = withInstall(stdin_default$I);
|
12007 | const [name$z, bem$y] = createNamespace("notice-bar");
|
12008 | const noticeBarProps = {
|
12009 | text: String,
|
12010 | mode: String,
|
12011 | color: String,
|
12012 | delay: makeNumericProp(1),
|
12013 | speed: makeNumericProp(60),
|
12014 | leftIcon: String,
|
12015 | wrapable: Boolean,
|
12016 | background: String,
|
12017 | scrollable: {
|
12018 | type: Boolean,
|
12019 | default: null
|
12020 | }
|
12021 | };
|
12022 | var stdin_default$H = vue.defineComponent({
|
12023 | name: name$z,
|
12024 | props: noticeBarProps,
|
12025 | emits: ["close", "replay"],
|
12026 | setup(props2, {
|
12027 | emit,
|
12028 | slots
|
12029 | }) {
|
12030 | let wrapWidth = 0;
|
12031 | let contentWidth = 0;
|
12032 | let startTimer;
|
12033 | const wrapRef = vue.ref();
|
12034 | const contentRef = vue.ref();
|
12035 | const state = vue.reactive({
|
12036 | show: true,
|
12037 | offset: 0,
|
12038 | duration: 0
|
12039 | });
|
12040 | const renderLeftIcon = () => {
|
12041 | if (slots["left-icon"]) {
|
12042 | return slots["left-icon"]();
|
12043 | }
|
12044 | if (props2.leftIcon) {
|
12045 | return vue.createVNode(Icon, {
|
12046 | "class": bem$y("left-icon"),
|
12047 | "name": props2.leftIcon
|
12048 | }, null);
|
12049 | }
|
12050 | };
|
12051 | const getRightIconName = () => {
|
12052 | if (props2.mode === "closeable") {
|
12053 | return "cross";
|
12054 | }
|
12055 | if (props2.mode === "link") {
|
12056 | return "arrow";
|
12057 | }
|
12058 | };
|
12059 | const onClickRightIcon = (event) => {
|
12060 | if (props2.mode === "closeable") {
|
12061 | state.show = false;
|
12062 | emit("close", event);
|
12063 | }
|
12064 | };
|
12065 | const renderRightIcon = () => {
|
12066 | if (slots["right-icon"]) {
|
12067 | return slots["right-icon"]();
|
12068 | }
|
12069 | const name2 = getRightIconName();
|
12070 | if (name2) {
|
12071 | return vue.createVNode(Icon, {
|
12072 | "name": name2,
|
12073 | "class": bem$y("right-icon"),
|
12074 | "onClick": onClickRightIcon
|
12075 | }, null);
|
12076 | }
|
12077 | };
|
12078 | const onTransitionEnd = () => {
|
12079 | state.offset = wrapWidth;
|
12080 | state.duration = 0;
|
12081 | raf(() => {
|
12082 | doubleRaf(() => {
|
12083 | state.offset = -contentWidth;
|
12084 | state.duration = (contentWidth + wrapWidth) / +props2.speed;
|
12085 | emit("replay");
|
12086 | });
|
12087 | });
|
12088 | };
|
12089 | const renderMarquee = () => {
|
12090 | const ellipsis = props2.scrollable === false && !props2.wrapable;
|
12091 | const style = {
|
12092 | transform: state.offset ? `translateX(${state.offset}px)` : "",
|
12093 | transitionDuration: `${state.duration}s`
|
12094 | };
|
12095 | return vue.createVNode("div", {
|
12096 | "ref": wrapRef,
|
12097 | "role": "marquee",
|
12098 | "class": bem$y("wrap")
|
12099 | }, [vue.createVNode("div", {
|
12100 | "ref": contentRef,
|
12101 | "style": style,
|
12102 | "class": [bem$y("content"), {
|
12103 | "van-ellipsis": ellipsis
|
12104 | }],
|
12105 | "onTransitionend": onTransitionEnd
|
12106 | }, [slots.default ? slots.default() : props2.text])]);
|
12107 | };
|
12108 | const reset = () => {
|
12109 | const {
|
12110 | delay,
|
12111 | speed,
|
12112 | scrollable
|
12113 | } = props2;
|
12114 | const ms = isDef(delay) ? +delay * 1e3 : 0;
|
12115 | wrapWidth = 0;
|
12116 | contentWidth = 0;
|
12117 | state.offset = 0;
|
12118 | state.duration = 0;
|
12119 | clearTimeout(startTimer);
|
12120 | startTimer = setTimeout(() => {
|
12121 | if (!wrapRef.value || !contentRef.value || scrollable === false) {
|
12122 | return;
|
12123 | }
|
12124 | const wrapRefWidth = useRect(wrapRef).width;
|
12125 | const contentRefWidth = useRect(contentRef).width;
|
12126 | if (scrollable || contentRefWidth > wrapRefWidth) {
|
12127 | doubleRaf(() => {
|
12128 | wrapWidth = wrapRefWidth;
|
12129 | contentWidth = contentRefWidth;
|
12130 | state.offset = -contentWidth;
|
12131 | state.duration = contentWidth / +speed;
|
12132 | });
|
12133 | }
|
12134 | }, ms);
|
12135 | };
|
12136 | onPopupReopen(reset);
|
12137 | onMountedOrActivated(reset);
|
12138 | useEventListener("pageshow", reset);
|
12139 | useExpose({
|
12140 | reset
|
12141 | });
|
12142 | vue.watch(() => [props2.text, props2.scrollable], reset);
|
12143 | return () => {
|
12144 | const {
|
12145 | color,
|
12146 | wrapable,
|
12147 | background
|
12148 | } = props2;
|
12149 | return vue.withDirectives(vue.createVNode("div", {
|
12150 | "role": "alert",
|
12151 | "class": bem$y({
|
12152 | wrapable
|
12153 | }),
|
12154 | "style": {
|
12155 | color,
|
12156 | background
|
12157 | }
|
12158 | }, [renderLeftIcon(), renderMarquee(), renderRightIcon()]), [[vue.vShow, state.show]]);
|
12159 | };
|
12160 | }
|
12161 | });
|
12162 | const NoticeBar = withInstall(stdin_default$H);
|
12163 | const [name$y, bem$x] = createNamespace("notify");
|
12164 | const popupInheritProps = ["lockScroll", "position", "show", "teleport", "zIndex"];
|
12165 | const notifyProps = extend({}, popupSharedProps, {
|
12166 | type: makeStringProp("danger"),
|
12167 | color: String,
|
12168 | message: numericProp,
|
12169 | position: makeStringProp("top"),
|
12170 | className: unknownProp,
|
12171 | background: String,
|
12172 | lockScroll: Boolean
|
12173 | });
|
12174 | var stdin_default$G = vue.defineComponent({
|
12175 | name: name$y,
|
12176 | props: notifyProps,
|
12177 | emits: ["update:show"],
|
12178 | setup(props2, {
|
12179 | emit,
|
12180 | slots
|
12181 | }) {
|
12182 | const updateShow = (show) => emit("update:show", show);
|
12183 | return () => vue.createVNode(Popup, vue.mergeProps({
|
12184 | "class": [bem$x([props2.type]), props2.className],
|
12185 | "style": {
|
12186 | color: props2.color,
|
12187 | background: props2.background
|
12188 | },
|
12189 | "overlay": false,
|
12190 | "duration": 0.2,
|
12191 | "onUpdate:show": updateShow
|
12192 | }, pick(props2, popupInheritProps)), {
|
12193 | default: () => [slots.default ? slots.default() : props2.message]
|
12194 | });
|
12195 | }
|
12196 | });
|
12197 | let timer;
|
12198 | let instance;
|
12199 | const parseOptions = (message) => isObject$1(message) ? message : {
|
12200 | message
|
12201 | };
|
12202 | function initInstance() {
|
12203 | ({
|
12204 | instance
|
12205 | } = mountComponent({
|
12206 | setup() {
|
12207 | const {
|
12208 | state,
|
12209 | toggle
|
12210 | } = usePopupState();
|
12211 | return () => vue.createVNode(stdin_default$G, vue.mergeProps(state, {
|
12212 | "onUpdate:show": toggle
|
12213 | }), null);
|
12214 | }
|
12215 | }));
|
12216 | }
|
12217 | const getDefaultOptions = () => ({
|
12218 | type: "danger",
|
12219 | color: void 0,
|
12220 | message: "",
|
12221 | onClose: void 0,
|
12222 | onClick: void 0,
|
12223 | onOpened: void 0,
|
12224 | duration: 3e3,
|
12225 | position: void 0,
|
12226 | className: "",
|
12227 | lockScroll: false,
|
12228 | background: void 0
|
12229 | });
|
12230 | let currentOptions = getDefaultOptions();
|
12231 | const closeNotify = () => {
|
12232 | if (instance) {
|
12233 | instance.toggle(false);
|
12234 | }
|
12235 | };
|
12236 | function showNotify(options) {
|
12237 | if (!inBrowser$1) {
|
12238 | return;
|
12239 | }
|
12240 | if (!instance) {
|
12241 | initInstance();
|
12242 | }
|
12243 | options = extend({}, currentOptions, parseOptions(options));
|
12244 | instance.open(options);
|
12245 | clearTimeout(timer);
|
12246 | if (options.duration > 0) {
|
12247 | timer = setTimeout(closeNotify, options.duration);
|
12248 | }
|
12249 | return instance;
|
12250 | }
|
12251 | const setNotifyDefaultOptions = (options) => extend(currentOptions, options);
|
12252 | const resetNotifyDefaultOptions = () => {
|
12253 | currentOptions = getDefaultOptions();
|
12254 | };
|
12255 | const Notify = withInstall(stdin_default$G);
|
12256 | const [name$x, bem$w] = createNamespace("key");
|
12257 | const CollapseIcon = vue.createVNode("svg", {
|
12258 | "class": bem$w("collapse-icon"),
|
12259 | "viewBox": "0 0 30 24"
|
12260 | }, [vue.createVNode("path", {
|
12261 | "d": "M26 13h-2v2h2v-2zm-8-3h2V8h-2v2zm2-4h2V4h-2v2zm2 4h4V4h-2v4h-2v2zm-7 14 3-3h-6l3 3zM6 13H4v2h2v-2zm16 0H8v2h14v-2zm-12-3h2V8h-2v2zM28 0l1 1 1 1v15l-1 2H1l-1-2V2l1-1 1-1zm0 2H2v15h26V2zM6 4v2H4V4zm10 2h2V4h-2v2zM8 9v1H4V8zm8 0v1h-2V8zm-6-5v2H8V4zm4 0v2h-2V4z",
|
12262 | "fill": "currentColor"
|
12263 | }, null)]);
|
12264 | const DeleteIcon = vue.createVNode("svg", {
|
12265 | "class": bem$w("delete-icon"),
|
12266 | "viewBox": "0 0 32 22"
|
12267 | }, [vue.createVNode("path", {
|
12268 | "d": "M28 0a4 4 0 0 1 4 4v14a4 4 0 0 1-4 4H10.4a2 2 0 0 1-1.4-.6L1 13.1c-.6-.5-.9-1.3-.9-2 0-1 .3-1.7.9-2.2L9 .6a2 2 0 0 1 1.4-.6zm0 2H10.4l-8.2 8.3a1 1 0 0 0-.3.7c0 .3.1.5.3.7l8.2 8.4H28a2 2 0 0 0 2-2V4c0-1.1-.9-2-2-2zm-5 4a1 1 0 0 1 .7.3 1 1 0 0 1 0 1.4L20.4 11l3.3 3.3c.2.2.3.5.3.7 0 .3-.1.5-.3.7a1 1 0 0 1-.7.3 1 1 0 0 1-.7-.3L19 12.4l-3.4 3.3a1 1 0 0 1-.6.3 1 1 0 0 1-.7-.3 1 1 0 0 1-.3-.7c0-.2.1-.5.3-.7l3.3-3.3-3.3-3.3A1 1 0 0 1 14 7c0-.3.1-.5.3-.7A1 1 0 0 1 15 6a1 1 0 0 1 .6.3L19 9.6l3.3-3.3A1 1 0 0 1 23 6z",
|
12269 | "fill": "currentColor"
|
12270 | }, null)]);
|
12271 | var stdin_default$F = vue.defineComponent({
|
12272 | name: name$x,
|
12273 | props: {
|
12274 | type: String,
|
12275 | text: numericProp,
|
12276 | color: String,
|
12277 | wider: Boolean,
|
12278 | large: Boolean,
|
12279 | loading: Boolean
|
12280 | },
|
12281 | emits: ["press"],
|
12282 | setup(props2, {
|
12283 | emit,
|
12284 | slots
|
12285 | }) {
|
12286 | const active = vue.ref(false);
|
12287 | const touch = useTouch();
|
12288 | const onTouchStart = (event) => {
|
12289 | touch.start(event);
|
12290 | active.value = true;
|
12291 | };
|
12292 | const onTouchMove = (event) => {
|
12293 | touch.move(event);
|
12294 | if (touch.direction.value) {
|
12295 | active.value = false;
|
12296 | }
|
12297 | };
|
12298 | const onTouchEnd = (event) => {
|
12299 | if (active.value) {
|
12300 | if (!slots.default) {
|
12301 | preventDefault(event);
|
12302 | }
|
12303 | active.value = false;
|
12304 | emit("press", props2.text, props2.type);
|
12305 | }
|
12306 | };
|
12307 | const renderContent = () => {
|
12308 | if (props2.loading) {
|
12309 | return vue.createVNode(Loading, {
|
12310 | "class": bem$w("loading-icon")
|
12311 | }, null);
|
12312 | }
|
12313 | const text = slots.default ? slots.default() : props2.text;
|
12314 | switch (props2.type) {
|
12315 | case "delete":
|
12316 | return text || DeleteIcon;
|
12317 | case "extra":
|
12318 | return text || CollapseIcon;
|
12319 | default:
|
12320 | return text;
|
12321 | }
|
12322 | };
|
12323 | return () => vue.createVNode("div", {
|
12324 | "class": bem$w("wrapper", {
|
12325 | wider: props2.wider
|
12326 | }),
|
12327 | "onTouchstartPassive": onTouchStart,
|
12328 | "onTouchmovePassive": onTouchMove,
|
12329 | "onTouchend": onTouchEnd,
|
12330 | "onTouchcancel": onTouchEnd
|
12331 | }, [vue.createVNode("div", {
|
12332 | "role": "button",
|
12333 | "tabindex": 0,
|
12334 | "class": bem$w([props2.color, {
|
12335 | large: props2.large,
|
12336 | active: active.value,
|
12337 | delete: props2.type === "delete"
|
12338 | }])
|
12339 | }, [renderContent()])]);
|
12340 | }
|
12341 | });
|
12342 | const [name$w, bem$v] = createNamespace("number-keyboard");
|
12343 | const numberKeyboardProps = {
|
12344 | show: Boolean,
|
12345 | title: String,
|
12346 | theme: makeStringProp("default"),
|
12347 | zIndex: numericProp,
|
12348 | teleport: [String, Object],
|
12349 | maxlength: makeNumericProp(Infinity),
|
12350 | modelValue: makeStringProp(""),
|
12351 | transition: truthProp,
|
12352 | blurOnClose: truthProp,
|
12353 | showDeleteKey: truthProp,
|
12354 | randomKeyOrder: Boolean,
|
12355 | closeButtonText: String,
|
12356 | deleteButtonText: String,
|
12357 | closeButtonLoading: Boolean,
|
12358 | hideOnClickOutside: truthProp,
|
12359 | safeAreaInsetBottom: truthProp,
|
12360 | extraKey: {
|
12361 | type: [String, Array],
|
12362 | default: ""
|
12363 | }
|
12364 | };
|
12365 | function shuffle(array) {
|
12366 | for (let i = array.length - 1; i > 0; i--) {
|
12367 | const j = Math.floor(Math.random() * (i + 1));
|
12368 | const temp = array[i];
|
12369 | array[i] = array[j];
|
12370 | array[j] = temp;
|
12371 | }
|
12372 | return array;
|
12373 | }
|
12374 | var stdin_default$E = vue.defineComponent({
|
12375 | name: name$w,
|
12376 | inheritAttrs: false,
|
12377 | props: numberKeyboardProps,
|
12378 | emits: ["show", "hide", "blur", "input", "close", "delete", "update:modelValue"],
|
12379 | setup(props2, {
|
12380 | emit,
|
12381 | slots,
|
12382 | attrs
|
12383 | }) {
|
12384 | const root = vue.ref();
|
12385 | const genBasicKeys = () => {
|
12386 | const keys2 = Array(9).fill("").map((_, i) => ({
|
12387 | text: i + 1
|
12388 | }));
|
12389 | if (props2.randomKeyOrder) {
|
12390 | shuffle(keys2);
|
12391 | }
|
12392 | return keys2;
|
12393 | };
|
12394 | const genDefaultKeys = () => [...genBasicKeys(), {
|
12395 | text: props2.extraKey,
|
12396 | type: "extra"
|
12397 | }, {
|
12398 | text: 0
|
12399 | }, {
|
12400 | text: props2.showDeleteKey ? props2.deleteButtonText : "",
|
12401 | type: props2.showDeleteKey ? "delete" : ""
|
12402 | }];
|
12403 | const genCustomKeys = () => {
|
12404 | const keys2 = genBasicKeys();
|
12405 | const {
|
12406 | extraKey
|
12407 | } = props2;
|
12408 | const extraKeys = Array.isArray(extraKey) ? extraKey : [extraKey];
|
12409 | if (extraKeys.length === 1) {
|
12410 | keys2.push({
|
12411 | text: 0,
|
12412 | wider: true
|
12413 | }, {
|
12414 | text: extraKeys[0],
|
12415 | type: "extra"
|
12416 | });
|
12417 | } else if (extraKeys.length === 2) {
|
12418 | keys2.push({
|
12419 | text: extraKeys[0],
|
12420 | type: "extra"
|
12421 | }, {
|
12422 | text: 0
|
12423 | }, {
|
12424 | text: extraKeys[1],
|
12425 | type: "extra"
|
12426 | });
|
12427 | }
|
12428 | return keys2;
|
12429 | };
|
12430 | const keys = vue.computed(() => props2.theme === "custom" ? genCustomKeys() : genDefaultKeys());
|
12431 | const onBlur = () => {
|
12432 | if (props2.show) {
|
12433 | emit("blur");
|
12434 | }
|
12435 | };
|
12436 | const onClose = () => {
|
12437 | emit("close");
|
12438 | if (props2.blurOnClose) {
|
12439 | onBlur();
|
12440 | }
|
12441 | };
|
12442 | const onAnimationEnd = () => emit(props2.show ? "show" : "hide");
|
12443 | const onPress = (text, type) => {
|
12444 | if (text === "") {
|
12445 | if (type === "extra") {
|
12446 | onBlur();
|
12447 | }
|
12448 | return;
|
12449 | }
|
12450 | const value = props2.modelValue;
|
12451 | if (type === "delete") {
|
12452 | emit("delete");
|
12453 | emit("update:modelValue", value.slice(0, value.length - 1));
|
12454 | } else if (type === "close") {
|
12455 | onClose();
|
12456 | } else if (value.length < +props2.maxlength) {
|
12457 | emit("input", text);
|
12458 | emit("update:modelValue", value + text);
|
12459 | }
|
12460 | };
|
12461 | const renderTitle = () => {
|
12462 | const {
|
12463 | title,
|
12464 | theme,
|
12465 | closeButtonText
|
12466 | } = props2;
|
12467 | const leftSlot = slots["title-left"];
|
12468 | const showClose = closeButtonText && theme === "default";
|
12469 | const showTitle = title || showClose || leftSlot;
|
12470 | if (!showTitle) {
|
12471 | return;
|
12472 | }
|
12473 | return vue.createVNode("div", {
|
12474 | "class": bem$v("header")
|
12475 | }, [leftSlot && vue.createVNode("span", {
|
12476 | "class": bem$v("title-left")
|
12477 | }, [leftSlot()]), title && vue.createVNode("h2", {
|
12478 | "class": bem$v("title")
|
12479 | }, [title]), showClose && vue.createVNode("button", {
|
12480 | "type": "button",
|
12481 | "class": [bem$v("close"), HAPTICS_FEEDBACK],
|
12482 | "onClick": onClose
|
12483 | }, [closeButtonText])]);
|
12484 | };
|
12485 | const renderKeys = () => keys.value.map((key) => {
|
12486 | const keySlots = {};
|
12487 | if (key.type === "delete") {
|
12488 | keySlots.default = slots.delete;
|
12489 | }
|
12490 | if (key.type === "extra") {
|
12491 | keySlots.default = slots["extra-key"];
|
12492 | }
|
12493 | return vue.createVNode(stdin_default$F, {
|
12494 | "key": key.text,
|
12495 | "text": key.text,
|
12496 | "type": key.type,
|
12497 | "wider": key.wider,
|
12498 | "color": key.color,
|
12499 | "onPress": onPress
|
12500 | }, keySlots);
|
12501 | });
|
12502 | const renderSidebar = () => {
|
12503 | if (props2.theme === "custom") {
|
12504 | return vue.createVNode("div", {
|
12505 | "class": bem$v("sidebar")
|
12506 | }, [props2.showDeleteKey && vue.createVNode(stdin_default$F, {
|
12507 | "large": true,
|
12508 | "text": props2.deleteButtonText,
|
12509 | "type": "delete",
|
12510 | "onPress": onPress
|
12511 | }, {
|
12512 | default: slots.delete
|
12513 | }), vue.createVNode(stdin_default$F, {
|
12514 | "large": true,
|
12515 | "text": props2.closeButtonText,
|
12516 | "type": "close",
|
12517 | "color": "blue",
|
12518 | "loading": props2.closeButtonLoading,
|
12519 | "onPress": onPress
|
12520 | }, null)]);
|
12521 | }
|
12522 | };
|
12523 | vue.watch(() => props2.show, (value) => {
|
12524 | if (!props2.transition) {
|
12525 | emit(value ? "show" : "hide");
|
12526 | }
|
12527 | });
|
12528 | if (props2.hideOnClickOutside) {
|
12529 | useClickAway(root, onBlur, {
|
12530 | eventName: "touchstart"
|
12531 | });
|
12532 | }
|
12533 | return () => {
|
12534 | const Title = renderTitle();
|
12535 | const Content = vue.createVNode(vue.Transition, {
|
12536 | "name": props2.transition ? "van-slide-up" : ""
|
12537 | }, {
|
12538 | default: () => [vue.withDirectives(vue.createVNode("div", vue.mergeProps({
|
12539 | "ref": root,
|
12540 | "style": getZIndexStyle(props2.zIndex),
|
12541 | "class": bem$v({
|
12542 | unfit: !props2.safeAreaInsetBottom,
|
12543 | "with-title": !!Title
|
12544 | }),
|
12545 | "onAnimationend": onAnimationEnd,
|
12546 | "onTouchstartPassive": stopPropagation
|
12547 | }, attrs), [Title, vue.createVNode("div", {
|
12548 | "class": bem$v("body")
|
12549 | }, [vue.createVNode("div", {
|
12550 | "class": bem$v("keys")
|
12551 | }, [renderKeys()]), renderSidebar()])]), [[vue.vShow, props2.show]])]
|
12552 | });
|
12553 | if (props2.teleport) {
|
12554 | return vue.createVNode(vue.Teleport, {
|
12555 | "to": props2.teleport
|
12556 | }, {
|
12557 | default: () => [Content]
|
12558 | });
|
12559 | }
|
12560 | return Content;
|
12561 | };
|
12562 | }
|
12563 | });
|
12564 | const NumberKeyboard = withInstall(stdin_default$E);
|
12565 | const [name$v, bem$u, t$6] = createNamespace("pagination");
|
12566 | const makePage = (number, text, active) => ({
|
12567 | number,
|
12568 | text,
|
12569 | active
|
12570 | });
|
12571 | const paginationProps = {
|
12572 | mode: makeStringProp("multi"),
|
12573 | prevText: String,
|
12574 | nextText: String,
|
12575 | pageCount: makeNumericProp(0),
|
12576 | modelValue: makeNumberProp(0),
|
12577 | totalItems: makeNumericProp(0),
|
12578 | showPageSize: makeNumericProp(5),
|
12579 | itemsPerPage: makeNumericProp(10),
|
12580 | forceEllipses: Boolean,
|
12581 | showPrevButton: truthProp,
|
12582 | showNextButton: truthProp
|
12583 | };
|
12584 | var stdin_default$D = vue.defineComponent({
|
12585 | name: name$v,
|
12586 | props: paginationProps,
|
12587 | emits: ["change", "update:modelValue"],
|
12588 | setup(props2, {
|
12589 | emit,
|
12590 | slots
|
12591 | }) {
|
12592 | const count = vue.computed(() => {
|
12593 | const {
|
12594 | pageCount,
|
12595 | totalItems,
|
12596 | itemsPerPage
|
12597 | } = props2;
|
12598 | const count2 = +pageCount || Math.ceil(+totalItems / +itemsPerPage);
|
12599 | return Math.max(1, count2);
|
12600 | });
|
12601 | const pages = vue.computed(() => {
|
12602 | const items = [];
|
12603 | const pageCount = count.value;
|
12604 | const showPageSize = +props2.showPageSize;
|
12605 | const {
|
12606 | modelValue,
|
12607 | forceEllipses
|
12608 | } = props2;
|
12609 | let startPage = 1;
|
12610 | let endPage = pageCount;
|
12611 | const isMaxSized = showPageSize < pageCount;
|
12612 | if (isMaxSized) {
|
12613 | startPage = Math.max(modelValue - Math.floor(showPageSize / 2), 1);
|
12614 | endPage = startPage + showPageSize - 1;
|
12615 | if (endPage > pageCount) {
|
12616 | endPage = pageCount;
|
12617 | startPage = endPage - showPageSize + 1;
|
12618 | }
|
12619 | }
|
12620 | for (let number = startPage; number <= endPage; number++) {
|
12621 | const page = makePage(number, number, number === modelValue);
|
12622 | items.push(page);
|
12623 | }
|
12624 | if (isMaxSized && showPageSize > 0 && forceEllipses) {
|
12625 | if (startPage > 1) {
|
12626 | const prevPages = makePage(startPage - 1, "...");
|
12627 | items.unshift(prevPages);
|
12628 | }
|
12629 | if (endPage < pageCount) {
|
12630 | const nextPages = makePage(endPage + 1, "...");
|
12631 | items.push(nextPages);
|
12632 | }
|
12633 | }
|
12634 | return items;
|
12635 | });
|
12636 | const updateModelValue = (value, emitChange) => {
|
12637 | value = clamp(value, 1, count.value);
|
12638 | if (props2.modelValue !== value) {
|
12639 | emit("update:modelValue", value);
|
12640 | if (emitChange) {
|
12641 | emit("change", value);
|
12642 | }
|
12643 | }
|
12644 | };
|
12645 | vue.watchEffect(() => updateModelValue(props2.modelValue));
|
12646 | const renderDesc = () => vue.createVNode("li", {
|
12647 | "class": bem$u("page-desc")
|
12648 | }, [slots.pageDesc ? slots.pageDesc() : `${props2.modelValue}/${count.value}`]);
|
12649 | const renderPrevButton = () => {
|
12650 | const {
|
12651 | mode,
|
12652 | modelValue,
|
12653 | showPrevButton
|
12654 | } = props2;
|
12655 | if (!showPrevButton) {
|
12656 | return;
|
12657 | }
|
12658 | const slot = slots["prev-text"];
|
12659 | const disabled = modelValue === 1;
|
12660 | return vue.createVNode("li", {
|
12661 | "class": [bem$u("item", {
|
12662 | disabled,
|
12663 | border: mode === "simple",
|
12664 | prev: true
|
12665 | }), BORDER_SURROUND]
|
12666 | }, [vue.createVNode("button", {
|
12667 | "type": "button",
|
12668 | "disabled": disabled,
|
12669 | "onClick": () => updateModelValue(modelValue - 1, true)
|
12670 | }, [slot ? slot() : props2.prevText || t$6("prev")])]);
|
12671 | };
|
12672 | const renderNextButton = () => {
|
12673 | const {
|
12674 | mode,
|
12675 | modelValue,
|
12676 | showNextButton
|
12677 | } = props2;
|
12678 | if (!showNextButton) {
|
12679 | return;
|
12680 | }
|
12681 | const slot = slots["next-text"];
|
12682 | const disabled = modelValue === count.value;
|
12683 | return vue.createVNode("li", {
|
12684 | "class": [bem$u("item", {
|
12685 | disabled,
|
12686 | border: mode === "simple",
|
12687 | next: true
|
12688 | }), BORDER_SURROUND]
|
12689 | }, [vue.createVNode("button", {
|
12690 | "type": "button",
|
12691 | "disabled": disabled,
|
12692 | "onClick": () => updateModelValue(modelValue + 1, true)
|
12693 | }, [slot ? slot() : props2.nextText || t$6("next")])]);
|
12694 | };
|
12695 | const renderPages = () => pages.value.map((page) => vue.createVNode("li", {
|
12696 | "class": [bem$u("item", {
|
12697 | active: page.active,
|
12698 | page: true
|
12699 | }), BORDER_SURROUND]
|
12700 | }, [vue.createVNode("button", {
|
12701 | "type": "button",
|
12702 | "aria-current": page.active || void 0,
|
12703 | "onClick": () => updateModelValue(page.number, true)
|
12704 | }, [slots.page ? slots.page(page) : page.text])]));
|
12705 | return () => vue.createVNode("nav", {
|
12706 | "role": "navigation",
|
12707 | "class": bem$u()
|
12708 | }, [vue.createVNode("ul", {
|
12709 | "class": bem$u("items")
|
12710 | }, [renderPrevButton(), props2.mode === "simple" ? renderDesc() : renderPages(), renderNextButton()])]);
|
12711 | }
|
12712 | });
|
12713 | const Pagination = withInstall(stdin_default$D);
|
12714 | const [name$u, bem$t] = createNamespace("password-input");
|
12715 | const passwordInputProps = {
|
12716 | info: String,
|
12717 | mask: truthProp,
|
12718 | value: makeStringProp(""),
|
12719 | gutter: numericProp,
|
12720 | length: makeNumericProp(6),
|
12721 | focused: Boolean,
|
12722 | errorInfo: String
|
12723 | };
|
12724 | var stdin_default$C = vue.defineComponent({
|
12725 | name: name$u,
|
12726 | props: passwordInputProps,
|
12727 | emits: ["focus"],
|
12728 | setup(props2, {
|
12729 | emit
|
12730 | }) {
|
12731 | const onTouchStart = (event) => {
|
12732 | event.stopPropagation();
|
12733 | emit("focus", event);
|
12734 | };
|
12735 | const renderPoints = () => {
|
12736 | const Points = [];
|
12737 | const {
|
12738 | mask,
|
12739 | value,
|
12740 | gutter,
|
12741 | focused
|
12742 | } = props2;
|
12743 | const length = +props2.length;
|
12744 | for (let i = 0; i < length; i++) {
|
12745 | const char = value[i];
|
12746 | const showBorder = i !== 0 && !gutter;
|
12747 | const showCursor = focused && i === value.length;
|
12748 | let style;
|
12749 | if (i !== 0 && gutter) {
|
12750 | style = {
|
12751 | marginLeft: addUnit(gutter)
|
12752 | };
|
12753 | }
|
12754 | Points.push(vue.createVNode("li", {
|
12755 | "class": [{
|
12756 | [BORDER_LEFT]: showBorder
|
12757 | }, bem$t("item", {
|
12758 | focus: showCursor
|
12759 | })],
|
12760 | "style": style
|
12761 | }, [mask ? vue.createVNode("i", {
|
12762 | "style": {
|
12763 | visibility: char ? "visible" : "hidden"
|
12764 | }
|
12765 | }, null) : char, showCursor && vue.createVNode("div", {
|
12766 | "class": bem$t("cursor")
|
12767 | }, null)]));
|
12768 | }
|
12769 | return Points;
|
12770 | };
|
12771 | return () => {
|
12772 | const info = props2.errorInfo || props2.info;
|
12773 | return vue.createVNode("div", {
|
12774 | "class": bem$t()
|
12775 | }, [vue.createVNode("ul", {
|
12776 | "class": [bem$t("security"), {
|
12777 | [BORDER_SURROUND]: !props2.gutter
|
12778 | }],
|
12779 | "onTouchstartPassive": onTouchStart
|
12780 | }, [renderPoints()]), info && vue.createVNode("div", {
|
12781 | "class": bem$t(props2.errorInfo ? "error-info" : "info")
|
12782 | }, [info])]);
|
12783 | };
|
12784 | }
|
12785 | });
|
12786 | const PasswordInput = withInstall(stdin_default$C);
|
12787 | const PickerGroup = withInstall(stdin_default$1A);
|
12788 | function getWindow(node) {
|
12789 | if (node == null) {
|
12790 | return window;
|
12791 | }
|
12792 | if (node.toString() !== "[object Window]") {
|
12793 | var ownerDocument = node.ownerDocument;
|
12794 | return ownerDocument ? ownerDocument.defaultView || window : window;
|
12795 | }
|
12796 | return node;
|
12797 | }
|
12798 | function isElement(node) {
|
12799 | var OwnElement = getWindow(node).Element;
|
12800 | return node instanceof OwnElement || node instanceof Element;
|
12801 | }
|
12802 | function isHTMLElement(node) {
|
12803 | var OwnElement = getWindow(node).HTMLElement;
|
12804 | return node instanceof OwnElement || node instanceof HTMLElement;
|
12805 | }
|
12806 | function isShadowRoot(node) {
|
12807 | if (typeof ShadowRoot === "undefined") {
|
12808 | return false;
|
12809 | }
|
12810 | var OwnElement = getWindow(node).ShadowRoot;
|
12811 | return node instanceof OwnElement || node instanceof ShadowRoot;
|
12812 | }
|
12813 | var round = Math.round;
|
12814 | function getUAString() {
|
12815 | var uaData = navigator.userAgentData;
|
12816 | if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
|
12817 | return uaData.brands.map(function(item) {
|
12818 | return item.brand + "/" + item.version;
|
12819 | }).join(" ");
|
12820 | }
|
12821 | return navigator.userAgent;
|
12822 | }
|
12823 | function isLayoutViewport() {
|
12824 | return !/^((?!chrome|android).)*safari/i.test(getUAString());
|
12825 | }
|
12826 | function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
12827 | if (includeScale === void 0) {
|
12828 | includeScale = false;
|
12829 | }
|
12830 | if (isFixedStrategy === void 0) {
|
12831 | isFixedStrategy = false;
|
12832 | }
|
12833 | var clientRect = element.getBoundingClientRect();
|
12834 | var scaleX = 1;
|
12835 | var scaleY = 1;
|
12836 | if (includeScale && isHTMLElement(element)) {
|
12837 | scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
|
12838 | scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
|
12839 | }
|
12840 | var _ref = isElement(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
|
12841 | var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
12842 | var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
|
12843 | var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
|
12844 | var width2 = clientRect.width / scaleX;
|
12845 | var height2 = clientRect.height / scaleY;
|
12846 | return {
|
12847 | width: width2,
|
12848 | height: height2,
|
12849 | top: y,
|
12850 | right: x + width2,
|
12851 | bottom: y + height2,
|
12852 | left: x,
|
12853 | x,
|
12854 | y
|
12855 | };
|
12856 | }
|
12857 | function getWindowScroll(node) {
|
12858 | var win = getWindow(node);
|
12859 | var scrollLeft = win.pageXOffset;
|
12860 | var scrollTop = win.pageYOffset;
|
12861 | return {
|
12862 | scrollLeft,
|
12863 | scrollTop
|
12864 | };
|
12865 | }
|
12866 | function getHTMLElementScroll(element) {
|
12867 | return {
|
12868 | scrollLeft: element.scrollLeft,
|
12869 | scrollTop: element.scrollTop
|
12870 | };
|
12871 | }
|
12872 | function getNodeScroll(node) {
|
12873 | if (node === getWindow(node) || !isHTMLElement(node)) {
|
12874 | return getWindowScroll(node);
|
12875 | } else {
|
12876 | return getHTMLElementScroll(node);
|
12877 | }
|
12878 | }
|
12879 | function getNodeName(element) {
|
12880 | return element ? (element.nodeName || "").toLowerCase() : null;
|
12881 | }
|
12882 | function getDocumentElement(element) {
|
12883 | return ((isElement(element) ? element.ownerDocument : (
|
12884 |
|
12885 | element.document
|
12886 | )) || window.document).documentElement;
|
12887 | }
|
12888 | function getWindowScrollBarX(element) {
|
12889 | return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
|
12890 | }
|
12891 | function getComputedStyle(element) {
|
12892 | return getWindow(element).getComputedStyle(element);
|
12893 | }
|
12894 | function isScrollParent(element) {
|
12895 | var _getComputedStyle = getComputedStyle(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
|
12896 | return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
12897 | }
|
12898 | function isElementScaled(element) {
|
12899 | var rect = element.getBoundingClientRect();
|
12900 | var scaleX = round(rect.width) / element.offsetWidth || 1;
|
12901 | var scaleY = round(rect.height) / element.offsetHeight || 1;
|
12902 | return scaleX !== 1 || scaleY !== 1;
|
12903 | }
|
12904 | function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
12905 | if (isFixed === void 0) {
|
12906 | isFixed = false;
|
12907 | }
|
12908 | var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
12909 | var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
12910 | var documentElement = getDocumentElement(offsetParent);
|
12911 | var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
|
12912 | var scroll = {
|
12913 | scrollLeft: 0,
|
12914 | scrollTop: 0
|
12915 | };
|
12916 | var offsets = {
|
12917 | x: 0,
|
12918 | y: 0
|
12919 | };
|
12920 | if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
12921 | if (getNodeName(offsetParent) !== "body" ||
|
12922 | isScrollParent(documentElement)) {
|
12923 | scroll = getNodeScroll(offsetParent);
|
12924 | }
|
12925 | if (isHTMLElement(offsetParent)) {
|
12926 | offsets = getBoundingClientRect(offsetParent, true);
|
12927 | offsets.x += offsetParent.clientLeft;
|
12928 | offsets.y += offsetParent.clientTop;
|
12929 | } else if (documentElement) {
|
12930 | offsets.x = getWindowScrollBarX(documentElement);
|
12931 | }
|
12932 | }
|
12933 | return {
|
12934 | x: rect.left + scroll.scrollLeft - offsets.x,
|
12935 | y: rect.top + scroll.scrollTop - offsets.y,
|
12936 | width: rect.width,
|
12937 | height: rect.height
|
12938 | };
|
12939 | }
|
12940 | function getLayoutRect(element) {
|
12941 | var clientRect = getBoundingClientRect(element);
|
12942 | var width2 = element.offsetWidth;
|
12943 | var height2 = element.offsetHeight;
|
12944 | if (Math.abs(clientRect.width - width2) <= 1) {
|
12945 | width2 = clientRect.width;
|
12946 | }
|
12947 | if (Math.abs(clientRect.height - height2) <= 1) {
|
12948 | height2 = clientRect.height;
|
12949 | }
|
12950 | return {
|
12951 | x: element.offsetLeft,
|
12952 | y: element.offsetTop,
|
12953 | width: width2,
|
12954 | height: height2
|
12955 | };
|
12956 | }
|
12957 | function getParentNode(element) {
|
12958 | if (getNodeName(element) === "html") {
|
12959 | return element;
|
12960 | }
|
12961 | return (
|
12962 |
|
12963 |
|
12964 |
|
12965 | element.assignedSlot ||
|
12966 | element.parentNode ||
|
12967 | (isShadowRoot(element) ? element.host : null) ||
|
12968 |
|
12969 | getDocumentElement(element)
|
12970 | );
|
12971 | }
|
12972 | function getScrollParent(node) {
|
12973 | if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
|
12974 | return node.ownerDocument.body;
|
12975 | }
|
12976 | if (isHTMLElement(node) && isScrollParent(node)) {
|
12977 | return node;
|
12978 | }
|
12979 | return getScrollParent(getParentNode(node));
|
12980 | }
|
12981 | function listScrollParents(element, list) {
|
12982 | var _element$ownerDocumen;
|
12983 | if (list === void 0) {
|
12984 | list = [];
|
12985 | }
|
12986 | var scrollParent = getScrollParent(element);
|
12987 | var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
|
12988 | var win = getWindow(scrollParent);
|
12989 | var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
12990 | var updatedList = list.concat(target);
|
12991 | return isBody ? updatedList : (
|
12992 |
|
12993 | updatedList.concat(listScrollParents(getParentNode(target)))
|
12994 | );
|
12995 | }
|
12996 | function isTableElement(element) {
|
12997 | return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
|
12998 | }
|
12999 | function getTrueOffsetParent(element) {
|
13000 | if (!isHTMLElement(element) ||
|
13001 | getComputedStyle(element).position === "fixed") {
|
13002 | return null;
|
13003 | }
|
13004 | return element.offsetParent;
|
13005 | }
|
13006 | function getContainingBlock(element) {
|
13007 | var isFirefox = /firefox/i.test(getUAString());
|
13008 | var isIE = /Trident/i.test(getUAString());
|
13009 | if (isIE && isHTMLElement(element)) {
|
13010 | var elementCss = getComputedStyle(element);
|
13011 | if (elementCss.position === "fixed") {
|
13012 | return null;
|
13013 | }
|
13014 | }
|
13015 | var currentNode = getParentNode(element);
|
13016 | if (isShadowRoot(currentNode)) {
|
13017 | currentNode = currentNode.host;
|
13018 | }
|
13019 | while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
|
13020 | var css = getComputedStyle(currentNode);
|
13021 | if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
|
13022 | return currentNode;
|
13023 | } else {
|
13024 | currentNode = currentNode.parentNode;
|
13025 | }
|
13026 | }
|
13027 | return null;
|
13028 | }
|
13029 | function getOffsetParent(element) {
|
13030 | var window2 = getWindow(element);
|
13031 | var offsetParent = getTrueOffsetParent(element);
|
13032 | while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
|
13033 | offsetParent = getTrueOffsetParent(offsetParent);
|
13034 | }
|
13035 | if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static")) {
|
13036 | return window2;
|
13037 | }
|
13038 | return offsetParent || getContainingBlock(element) || window2;
|
13039 | }
|
13040 | var top = "top";
|
13041 | var bottom = "bottom";
|
13042 | var right = "right";
|
13043 | var left = "left";
|
13044 | var auto = "auto";
|
13045 | var basePlacements = [top, bottom, right, left];
|
13046 | var start = "start";
|
13047 | var end = "end";
|
13048 | var placements = [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
|
13049 | return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
|
13050 | }, []);
|
13051 | var beforeRead = "beforeRead";
|
13052 | var read = "read";
|
13053 | var afterRead = "afterRead";
|
13054 | var beforeMain = "beforeMain";
|
13055 | var main = "main";
|
13056 | var afterMain = "afterMain";
|
13057 | var beforeWrite = "beforeWrite";
|
13058 | var write = "write";
|
13059 | var afterWrite = "afterWrite";
|
13060 | var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
13061 | function order(modifiers) {
|
13062 | var map = new Map();
|
13063 | var visited = new Set();
|
13064 | var result = [];
|
13065 | modifiers.forEach(function(modifier) {
|
13066 | map.set(modifier.name, modifier);
|
13067 | });
|
13068 | function sort(modifier) {
|
13069 | visited.add(modifier.name);
|
13070 | var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
|
13071 | requires.forEach(function(dep) {
|
13072 | if (!visited.has(dep)) {
|
13073 | var depModifier = map.get(dep);
|
13074 | if (depModifier) {
|
13075 | sort(depModifier);
|
13076 | }
|
13077 | }
|
13078 | });
|
13079 | result.push(modifier);
|
13080 | }
|
13081 | modifiers.forEach(function(modifier) {
|
13082 | if (!visited.has(modifier.name)) {
|
13083 | sort(modifier);
|
13084 | }
|
13085 | });
|
13086 | return result;
|
13087 | }
|
13088 | function orderModifiers(modifiers) {
|
13089 | var orderedModifiers = order(modifiers);
|
13090 | return modifierPhases.reduce(function(acc, phase) {
|
13091 | return acc.concat(orderedModifiers.filter(function(modifier) {
|
13092 | return modifier.phase === phase;
|
13093 | }));
|
13094 | }, []);
|
13095 | }
|
13096 | function debounce(fn2) {
|
13097 | var pending;
|
13098 | return function() {
|
13099 | if (!pending) {
|
13100 | pending = new Promise(function(resolve) {
|
13101 | Promise.resolve().then(function() {
|
13102 | pending = void 0;
|
13103 | resolve(fn2());
|
13104 | });
|
13105 | });
|
13106 | }
|
13107 | return pending;
|
13108 | };
|
13109 | }
|
13110 | function mergeByName(modifiers) {
|
13111 | var merged = modifiers.reduce(function(merged2, current2) {
|
13112 | var existing = merged2[current2.name];
|
13113 | merged2[current2.name] = existing ? Object.assign({}, existing, current2, {
|
13114 | options: Object.assign({}, existing.options, current2.options),
|
13115 | data: Object.assign({}, existing.data, current2.data)
|
13116 | }) : current2;
|
13117 | return merged2;
|
13118 | }, {});
|
13119 | return Object.keys(merged).map(function(key) {
|
13120 | return merged[key];
|
13121 | });
|
13122 | }
|
13123 | function getBasePlacement(placement) {
|
13124 | return placement.split("-")[0];
|
13125 | }
|
13126 | function getVariation(placement) {
|
13127 | return placement.split("-")[1];
|
13128 | }
|
13129 | function getMainAxisFromPlacement(placement) {
|
13130 | return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
|
13131 | }
|
13132 | function computeOffsets(_ref) {
|
13133 | var reference = _ref.reference, element = _ref.element, placement = _ref.placement;
|
13134 | var basePlacement = placement ? getBasePlacement(placement) : null;
|
13135 | var variation = placement ? getVariation(placement) : null;
|
13136 | var commonX = reference.x + reference.width / 2 - element.width / 2;
|
13137 | var commonY = reference.y + reference.height / 2 - element.height / 2;
|
13138 | var offsets;
|
13139 | switch (basePlacement) {
|
13140 | case top:
|
13141 | offsets = {
|
13142 | x: commonX,
|
13143 | y: reference.y - element.height
|
13144 | };
|
13145 | break;
|
13146 | case bottom:
|
13147 | offsets = {
|
13148 | x: commonX,
|
13149 | y: reference.y + reference.height
|
13150 | };
|
13151 | break;
|
13152 | case right:
|
13153 | offsets = {
|
13154 | x: reference.x + reference.width,
|
13155 | y: commonY
|
13156 | };
|
13157 | break;
|
13158 | case left:
|
13159 | offsets = {
|
13160 | x: reference.x - element.width,
|
13161 | y: commonY
|
13162 | };
|
13163 | break;
|
13164 | default:
|
13165 | offsets = {
|
13166 | x: reference.x,
|
13167 | y: reference.y
|
13168 | };
|
13169 | }
|
13170 | var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
|
13171 | if (mainAxis != null) {
|
13172 | var len = mainAxis === "y" ? "height" : "width";
|
13173 | switch (variation) {
|
13174 | case start:
|
13175 | offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
|
13176 | break;
|
13177 | case end:
|
13178 | offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
|
13179 | break;
|
13180 | }
|
13181 | }
|
13182 | return offsets;
|
13183 | }
|
13184 | var DEFAULT_OPTIONS = {
|
13185 | placement: "bottom",
|
13186 | modifiers: [],
|
13187 | strategy: "absolute"
|
13188 | };
|
13189 | function areValidElements() {
|
13190 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
13191 | args[_key] = arguments[_key];
|
13192 | }
|
13193 | return !args.some(function(element) {
|
13194 | return !(element && typeof element.getBoundingClientRect === "function");
|
13195 | });
|
13196 | }
|
13197 | function popperGenerator(generatorOptions) {
|
13198 | if (generatorOptions === void 0) {
|
13199 | generatorOptions = {};
|
13200 | }
|
13201 | var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions2 = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
|
13202 | return function createPopper2(reference, popper, options) {
|
13203 | if (options === void 0) {
|
13204 | options = defaultOptions2;
|
13205 | }
|
13206 | var state = {
|
13207 | placement: "bottom",
|
13208 | orderedModifiers: [],
|
13209 | options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions2),
|
13210 | modifiersData: {},
|
13211 | elements: {
|
13212 | reference,
|
13213 | popper
|
13214 | },
|
13215 | attributes: {},
|
13216 | styles: {}
|
13217 | };
|
13218 | var effectCleanupFns = [];
|
13219 | var isDestroyed = false;
|
13220 | var instance2 = {
|
13221 | state,
|
13222 | setOptions: function setOptions(setOptionsAction) {
|
13223 | var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
|
13224 | cleanupModifierEffects();
|
13225 | state.options = Object.assign({}, defaultOptions2, state.options, options2);
|
13226 | state.scrollParents = {
|
13227 | reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
|
13228 | popper: listScrollParents(popper)
|
13229 | };
|
13230 | var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
|
13231 | state.orderedModifiers = orderedModifiers.filter(function(m) {
|
13232 | return m.enabled;
|
13233 | });
|
13234 | runModifierEffects();
|
13235 | return instance2.update();
|
13236 | },
|
13237 |
|
13238 |
|
13239 |
|
13240 |
|
13241 |
|
13242 | forceUpdate: function forceUpdate() {
|
13243 | if (isDestroyed) {
|
13244 | return;
|
13245 | }
|
13246 | var _state$elements = state.elements, reference2 = _state$elements.reference, popper2 = _state$elements.popper;
|
13247 | if (!areValidElements(reference2, popper2)) {
|
13248 | return;
|
13249 | }
|
13250 | state.rects = {
|
13251 | reference: getCompositeRect(reference2, getOffsetParent(popper2), state.options.strategy === "fixed"),
|
13252 | popper: getLayoutRect(popper2)
|
13253 | };
|
13254 | state.reset = false;
|
13255 | state.placement = state.options.placement;
|
13256 | state.orderedModifiers.forEach(function(modifier) {
|
13257 | return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
13258 | });
|
13259 | for (var index = 0; index < state.orderedModifiers.length; index++) {
|
13260 | if (state.reset === true) {
|
13261 | state.reset = false;
|
13262 | index = -1;
|
13263 | continue;
|
13264 | }
|
13265 | var _state$orderedModifie = state.orderedModifiers[index], fn2 = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name2 = _state$orderedModifie.name;
|
13266 | if (typeof fn2 === "function") {
|
13267 | state = fn2({
|
13268 | state,
|
13269 | options: _options,
|
13270 | name: name2,
|
13271 | instance: instance2
|
13272 | }) || state;
|
13273 | }
|
13274 | }
|
13275 | },
|
13276 |
|
13277 |
|
13278 | update: debounce(function() {
|
13279 | return new Promise(function(resolve) {
|
13280 | instance2.forceUpdate();
|
13281 | resolve(state);
|
13282 | });
|
13283 | }),
|
13284 | destroy: function destroy() {
|
13285 | cleanupModifierEffects();
|
13286 | isDestroyed = true;
|
13287 | }
|
13288 | };
|
13289 | if (!areValidElements(reference, popper)) {
|
13290 | return instance2;
|
13291 | }
|
13292 | instance2.setOptions(options).then(function(state2) {
|
13293 | if (!isDestroyed && options.onFirstUpdate) {
|
13294 | options.onFirstUpdate(state2);
|
13295 | }
|
13296 | });
|
13297 | function runModifierEffects() {
|
13298 | state.orderedModifiers.forEach(function(_ref) {
|
13299 | var name2 = _ref.name, _ref$options = _ref.options, options2 = _ref$options === void 0 ? {} : _ref$options, effect3 = _ref.effect;
|
13300 | if (typeof effect3 === "function") {
|
13301 | var cleanupFn = effect3({
|
13302 | state,
|
13303 | name: name2,
|
13304 | instance: instance2,
|
13305 | options: options2
|
13306 | });
|
13307 | var noopFn = function noopFn2() {
|
13308 | };
|
13309 | effectCleanupFns.push(cleanupFn || noopFn);
|
13310 | }
|
13311 | });
|
13312 | }
|
13313 | function cleanupModifierEffects() {
|
13314 | effectCleanupFns.forEach(function(fn2) {
|
13315 | return fn2();
|
13316 | });
|
13317 | effectCleanupFns = [];
|
13318 | }
|
13319 | return instance2;
|
13320 | };
|
13321 | }
|
13322 | var passive = {
|
13323 | passive: true
|
13324 | };
|
13325 | function effect(_ref) {
|
13326 | var state = _ref.state, instance2 = _ref.instance, options = _ref.options;
|
13327 | var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize;
|
13328 | var window2 = getWindow(state.elements.popper);
|
13329 | var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
|
13330 | if (scroll) {
|
13331 | scrollParents.forEach(function(scrollParent) {
|
13332 | scrollParent.addEventListener("scroll", instance2.update, passive);
|
13333 | });
|
13334 | }
|
13335 | if (resize) {
|
13336 | window2.addEventListener("resize", instance2.update, passive);
|
13337 | }
|
13338 | return function() {
|
13339 | if (scroll) {
|
13340 | scrollParents.forEach(function(scrollParent) {
|
13341 | scrollParent.removeEventListener("scroll", instance2.update, passive);
|
13342 | });
|
13343 | }
|
13344 | if (resize) {
|
13345 | window2.removeEventListener("resize", instance2.update, passive);
|
13346 | }
|
13347 | };
|
13348 | }
|
13349 | var eventListeners_default = {
|
13350 | name: "eventListeners",
|
13351 | enabled: true,
|
13352 | phase: "write",
|
13353 | fn: function fn() {
|
13354 | },
|
13355 | effect,
|
13356 | data: {}
|
13357 | };
|
13358 | function popperOffsets(_ref) {
|
13359 | var state = _ref.state, name2 = _ref.name;
|
13360 | state.modifiersData[name2] = computeOffsets({
|
13361 | reference: state.rects.reference,
|
13362 | element: state.rects.popper,
|
13363 | strategy: "absolute",
|
13364 | placement: state.placement
|
13365 | });
|
13366 | }
|
13367 | var popperOffsets_default = {
|
13368 | name: "popperOffsets",
|
13369 | enabled: true,
|
13370 | phase: "read",
|
13371 | fn: popperOffsets,
|
13372 | data: {}
|
13373 | };
|
13374 | var unsetSides = {
|
13375 | top: "auto",
|
13376 | right: "auto",
|
13377 | bottom: "auto",
|
13378 | left: "auto"
|
13379 | };
|
13380 | function roundOffsetsByDPR(_ref, win) {
|
13381 | var x = _ref.x, y = _ref.y;
|
13382 | var dpr = win.devicePixelRatio || 1;
|
13383 | return {
|
13384 | x: round(x * dpr) / dpr || 0,
|
13385 | y: round(y * dpr) / dpr || 0
|
13386 | };
|
13387 | }
|
13388 | function mapToStyles(_ref2) {
|
13389 | var _Object$assign2;
|
13390 | var popper = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets, isFixed = _ref2.isFixed;
|
13391 | var _offsets$x = offsets.x, x = _offsets$x === void 0 ? 0 : _offsets$x, _offsets$y = offsets.y, y = _offsets$y === void 0 ? 0 : _offsets$y;
|
13392 | var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
|
13393 | x,
|
13394 | y
|
13395 | }) : {
|
13396 | x,
|
13397 | y
|
13398 | };
|
13399 | x = _ref3.x;
|
13400 | y = _ref3.y;
|
13401 | var hasX = offsets.hasOwnProperty("x");
|
13402 | var hasY = offsets.hasOwnProperty("y");
|
13403 | var sideX = left;
|
13404 | var sideY = top;
|
13405 | var win = window;
|
13406 | if (adaptive) {
|
13407 | var offsetParent = getOffsetParent(popper);
|
13408 | var heightProp = "clientHeight";
|
13409 | var widthProp = "clientWidth";
|
13410 | if (offsetParent === getWindow(popper)) {
|
13411 | offsetParent = getDocumentElement(popper);
|
13412 | if (getComputedStyle(offsetParent).position !== "static" && position === "absolute") {
|
13413 | heightProp = "scrollHeight";
|
13414 | widthProp = "scrollWidth";
|
13415 | }
|
13416 | }
|
13417 | offsetParent = offsetParent;
|
13418 | if (placement === top || (placement === left || placement === right) && variation === end) {
|
13419 | sideY = bottom;
|
13420 | var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : (
|
13421 |
|
13422 | offsetParent[heightProp]
|
13423 | );
|
13424 | y -= offsetY - popperRect.height;
|
13425 | y *= gpuAcceleration ? 1 : -1;
|
13426 | }
|
13427 | if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
13428 | sideX = right;
|
13429 | var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : (
|
13430 |
|
13431 | offsetParent[widthProp]
|
13432 | );
|
13433 | x -= offsetX - popperRect.width;
|
13434 | x *= gpuAcceleration ? 1 : -1;
|
13435 | }
|
13436 | }
|
13437 | var commonStyles = Object.assign({
|
13438 | position
|
13439 | }, adaptive && unsetSides);
|
13440 | var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
|
13441 | x,
|
13442 | y
|
13443 | }, getWindow(popper)) : {
|
13444 | x,
|
13445 | y
|
13446 | };
|
13447 | x = _ref4.x;
|
13448 | y = _ref4.y;
|
13449 | if (gpuAcceleration) {
|
13450 | var _Object$assign;
|
13451 | return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
|
13452 | }
|
13453 | return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
|
13454 | }
|
13455 | function computeStyles(_ref5) {
|
13456 | var state = _ref5.state, options = _ref5.options;
|
13457 | var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
|
13458 | var commonStyles = {
|
13459 | placement: getBasePlacement(state.placement),
|
13460 | variation: getVariation(state.placement),
|
13461 | popper: state.elements.popper,
|
13462 | popperRect: state.rects.popper,
|
13463 | gpuAcceleration,
|
13464 | isFixed: state.options.strategy === "fixed"
|
13465 | };
|
13466 | if (state.modifiersData.popperOffsets != null) {
|
13467 | state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
|
13468 | offsets: state.modifiersData.popperOffsets,
|
13469 | position: state.options.strategy,
|
13470 | adaptive,
|
13471 | roundOffsets
|
13472 | })));
|
13473 | }
|
13474 | if (state.modifiersData.arrow != null) {
|
13475 | state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
|
13476 | offsets: state.modifiersData.arrow,
|
13477 | position: "absolute",
|
13478 | adaptive: false,
|
13479 | roundOffsets
|
13480 | })));
|
13481 | }
|
13482 | state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
13483 | "data-popper-placement": state.placement
|
13484 | });
|
13485 | }
|
13486 | var computeStyles_default = {
|
13487 | name: "computeStyles",
|
13488 | enabled: true,
|
13489 | phase: "beforeWrite",
|
13490 | fn: computeStyles,
|
13491 | data: {}
|
13492 | };
|
13493 | function applyStyles(_ref) {
|
13494 | var state = _ref.state;
|
13495 | Object.keys(state.elements).forEach(function(name2) {
|
13496 | var style = state.styles[name2] || {};
|
13497 | var attributes = state.attributes[name2] || {};
|
13498 | var element = state.elements[name2];
|
13499 | if (!isHTMLElement(element) || !getNodeName(element)) {
|
13500 | return;
|
13501 | }
|
13502 | Object.assign(element.style, style);
|
13503 | Object.keys(attributes).forEach(function(name22) {
|
13504 | var value = attributes[name22];
|
13505 | if (value === false) {
|
13506 | element.removeAttribute(name22);
|
13507 | } else {
|
13508 | element.setAttribute(name22, value === true ? "" : value);
|
13509 | }
|
13510 | });
|
13511 | });
|
13512 | }
|
13513 | function effect2(_ref2) {
|
13514 | var state = _ref2.state;
|
13515 | var initialStyles = {
|
13516 | popper: {
|
13517 | position: state.options.strategy,
|
13518 | left: "0",
|
13519 | top: "0",
|
13520 | margin: "0"
|
13521 | },
|
13522 | arrow: {
|
13523 | position: "absolute"
|
13524 | },
|
13525 | reference: {}
|
13526 | };
|
13527 | Object.assign(state.elements.popper.style, initialStyles.popper);
|
13528 | state.styles = initialStyles;
|
13529 | if (state.elements.arrow) {
|
13530 | Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
13531 | }
|
13532 | return function() {
|
13533 | Object.keys(state.elements).forEach(function(name2) {
|
13534 | var element = state.elements[name2];
|
13535 | var attributes = state.attributes[name2] || {};
|
13536 | var styleProperties = Object.keys(state.styles.hasOwnProperty(name2) ? state.styles[name2] : initialStyles[name2]);
|
13537 | var style = styleProperties.reduce(function(style2, property) {
|
13538 | style2[property] = "";
|
13539 | return style2;
|
13540 | }, {});
|
13541 | if (!isHTMLElement(element) || !getNodeName(element)) {
|
13542 | return;
|
13543 | }
|
13544 | Object.assign(element.style, style);
|
13545 | Object.keys(attributes).forEach(function(attribute) {
|
13546 | element.removeAttribute(attribute);
|
13547 | });
|
13548 | });
|
13549 | };
|
13550 | }
|
13551 | var applyStyles_default = {
|
13552 | name: "applyStyles",
|
13553 | enabled: true,
|
13554 | phase: "write",
|
13555 | fn: applyStyles,
|
13556 | effect: effect2,
|
13557 | requires: ["computeStyles"]
|
13558 | };
|
13559 | var defaultModifiers = [eventListeners_default, popperOffsets_default, computeStyles_default, applyStyles_default];
|
13560 | var createPopper = popperGenerator({
|
13561 | defaultModifiers
|
13562 | });
|
13563 | function distanceAndSkiddingToXY(placement, rects, offset2) {
|
13564 | var basePlacement = getBasePlacement(placement);
|
13565 | var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
|
13566 | var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
|
13567 | placement
|
13568 | })) : offset2, skidding = _ref[0], distance = _ref[1];
|
13569 | skidding = skidding || 0;
|
13570 | distance = (distance || 0) * invertDistance;
|
13571 | return [left, right].indexOf(basePlacement) >= 0 ? {
|
13572 | x: distance,
|
13573 | y: skidding
|
13574 | } : {
|
13575 | x: skidding,
|
13576 | y: distance
|
13577 | };
|
13578 | }
|
13579 | function offset(_ref2) {
|
13580 | var state = _ref2.state, options = _ref2.options, name2 = _ref2.name;
|
13581 | var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
|
13582 | var data = placements.reduce(function(acc, placement) {
|
13583 | acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
|
13584 | return acc;
|
13585 | }, {});
|
13586 | var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y;
|
13587 | if (state.modifiersData.popperOffsets != null) {
|
13588 | state.modifiersData.popperOffsets.x += x;
|
13589 | state.modifiersData.popperOffsets.y += y;
|
13590 | }
|
13591 | state.modifiersData[name2] = data;
|
13592 | }
|
13593 | var offset_default = {
|
13594 | name: "offset",
|
13595 | enabled: true,
|
13596 | phase: "main",
|
13597 | requires: ["popperOffsets"],
|
13598 | fn: offset
|
13599 | };
|
13600 | const [name$t, bem$s] = createNamespace("popover");
|
13601 | const popupProps = ["overlay", "duration", "teleport", "overlayStyle", "overlayClass", "closeOnClickOverlay"];
|
13602 | const popoverProps = {
|
13603 | show: Boolean,
|
13604 | theme: makeStringProp("light"),
|
13605 | overlay: Boolean,
|
13606 | actions: makeArrayProp(),
|
13607 | actionsDirection: makeStringProp("vertical"),
|
13608 | trigger: makeStringProp("click"),
|
13609 | duration: numericProp,
|
13610 | showArrow: truthProp,
|
13611 | placement: makeStringProp("bottom"),
|
13612 | iconPrefix: String,
|
13613 | overlayClass: unknownProp,
|
13614 | overlayStyle: Object,
|
13615 | closeOnClickAction: truthProp,
|
13616 | closeOnClickOverlay: truthProp,
|
13617 | closeOnClickOutside: truthProp,
|
13618 | offset: {
|
13619 | type: Array,
|
13620 | default: () => [0, 8]
|
13621 | },
|
13622 | teleport: {
|
13623 | type: [String, Object],
|
13624 | default: "body"
|
13625 | }
|
13626 | };
|
13627 | var stdin_default$B = vue.defineComponent({
|
13628 | name: name$t,
|
13629 | props: popoverProps,
|
13630 | emits: ["select", "touchstart", "update:show"],
|
13631 | setup(props2, {
|
13632 | emit,
|
13633 | slots,
|
13634 | attrs
|
13635 | }) {
|
13636 | let popper;
|
13637 | const popupRef = vue.ref();
|
13638 | const wrapperRef = vue.ref();
|
13639 | const popoverRef = vue.ref();
|
13640 | const show = useSyncPropRef(() => props2.show, (value) => emit("update:show", value));
|
13641 | const getPopoverOptions = () => ({
|
13642 | placement: props2.placement,
|
13643 | modifiers: [{
|
13644 | name: "computeStyles",
|
13645 | options: {
|
13646 | adaptive: false,
|
13647 | gpuAcceleration: false
|
13648 | }
|
13649 | }, extend({}, offset_default, {
|
13650 | options: {
|
13651 | offset: props2.offset
|
13652 | }
|
13653 | })]
|
13654 | });
|
13655 | const createPopperInstance = () => {
|
13656 | if (wrapperRef.value && popoverRef.value) {
|
13657 | return createPopper(wrapperRef.value, popoverRef.value.popupRef.value, getPopoverOptions());
|
13658 | }
|
13659 | return null;
|
13660 | };
|
13661 | const updateLocation = () => {
|
13662 | vue.nextTick(() => {
|
13663 | if (!show.value) {
|
13664 | return;
|
13665 | }
|
13666 | if (!popper) {
|
13667 | popper = createPopperInstance();
|
13668 | if (inBrowser$1) {
|
13669 | window.addEventListener("animationend", updateLocation);
|
13670 | window.addEventListener("transitionend", updateLocation);
|
13671 | }
|
13672 | } else {
|
13673 | popper.setOptions(getPopoverOptions());
|
13674 | }
|
13675 | });
|
13676 | };
|
13677 | const updateShow = (value) => {
|
13678 | show.value = value;
|
13679 | };
|
13680 | const onClickWrapper = () => {
|
13681 | if (props2.trigger === "click") {
|
13682 | show.value = !show.value;
|
13683 | }
|
13684 | };
|
13685 | const onClickAction = (action, index) => {
|
13686 | if (action.disabled) {
|
13687 | return;
|
13688 | }
|
13689 | emit("select", action, index);
|
13690 | if (props2.closeOnClickAction) {
|
13691 | show.value = false;
|
13692 | }
|
13693 | };
|
13694 | const onClickAway = () => {
|
13695 | if (show.value && props2.closeOnClickOutside && (!props2.overlay || props2.closeOnClickOverlay)) {
|
13696 | show.value = false;
|
13697 | }
|
13698 | };
|
13699 | const renderActionContent = (action, index) => {
|
13700 | if (slots.action) {
|
13701 | return slots.action({
|
13702 | action,
|
13703 | index
|
13704 | });
|
13705 | }
|
13706 | return [action.icon && vue.createVNode(Icon, {
|
13707 | "name": action.icon,
|
13708 | "classPrefix": props2.iconPrefix,
|
13709 | "class": bem$s("action-icon")
|
13710 | }, null), vue.createVNode("div", {
|
13711 | "class": [bem$s("action-text"), {
|
13712 | [BORDER_BOTTOM]: props2.actionsDirection === "vertical"
|
13713 | }]
|
13714 | }, [action.text])];
|
13715 | };
|
13716 | const renderAction = (action, index) => {
|
13717 | const {
|
13718 | icon,
|
13719 | color,
|
13720 | disabled,
|
13721 | className
|
13722 | } = action;
|
13723 | return vue.createVNode("div", {
|
13724 | "role": "menuitem",
|
13725 | "class": [bem$s("action", {
|
13726 | disabled,
|
13727 | "with-icon": icon
|
13728 | }), {
|
13729 | [BORDER_RIGHT]: props2.actionsDirection === "horizontal"
|
13730 | }, className],
|
13731 | "style": {
|
13732 | color
|
13733 | },
|
13734 | "tabindex": disabled ? void 0 : 0,
|
13735 | "aria-disabled": disabled || void 0,
|
13736 | "onClick": () => onClickAction(action, index)
|
13737 | }, [renderActionContent(action, index)]);
|
13738 | };
|
13739 | vue.onMounted(() => {
|
13740 | updateLocation();
|
13741 | vue.watchEffect(() => {
|
13742 | var _a;
|
13743 | popupRef.value = (_a = popoverRef.value) == null ? void 0 : _a.popupRef.value;
|
13744 | });
|
13745 | });
|
13746 | vue.onBeforeUnmount(() => {
|
13747 | if (popper) {
|
13748 | if (inBrowser$1) {
|
13749 | window.removeEventListener("animationend", updateLocation);
|
13750 | window.removeEventListener("transitionend", updateLocation);
|
13751 | }
|
13752 | popper.destroy();
|
13753 | popper = null;
|
13754 | }
|
13755 | });
|
13756 | vue.watch(() => [show.value, props2.offset, props2.placement], updateLocation);
|
13757 | useClickAway([wrapperRef, popupRef], onClickAway, {
|
13758 | eventName: "touchstart"
|
13759 | });
|
13760 | return () => {
|
13761 | var _a;
|
13762 | return vue.createVNode(vue.Fragment, null, [vue.createVNode("span", {
|
13763 | "ref": wrapperRef,
|
13764 | "class": bem$s("wrapper"),
|
13765 | "onClick": onClickWrapper
|
13766 | }, [(_a = slots.reference) == null ? void 0 : _a.call(slots)]), vue.createVNode(Popup, vue.mergeProps({
|
13767 | "ref": popoverRef,
|
13768 | "show": show.value,
|
13769 | "class": bem$s([props2.theme]),
|
13770 | "position": "",
|
13771 | "transition": "van-popover-zoom",
|
13772 | "lockScroll": false,
|
13773 | "onUpdate:show": updateShow
|
13774 | }, attrs, useScopeId(), pick(props2, popupProps)), {
|
13775 | default: () => [props2.showArrow && vue.createVNode("div", {
|
13776 | "class": bem$s("arrow")
|
13777 | }, null), vue.createVNode("div", {
|
13778 | "role": "menu",
|
13779 | "class": bem$s("content", props2.actionsDirection)
|
13780 | }, [slots.default ? slots.default() : props2.actions.map(renderAction)])]
|
13781 | })]);
|
13782 | };
|
13783 | }
|
13784 | });
|
13785 | const Popover = withInstall(stdin_default$B);
|
13786 | const [name$s, bem$r] = createNamespace("progress");
|
13787 | const progressProps = {
|
13788 | color: String,
|
13789 | inactive: Boolean,
|
13790 | pivotText: String,
|
13791 | textColor: String,
|
13792 | showPivot: truthProp,
|
13793 | pivotColor: String,
|
13794 | trackColor: String,
|
13795 | strokeWidth: numericProp,
|
13796 | percentage: {
|
13797 | type: numericProp,
|
13798 | default: 0,
|
13799 | validator: (value) => +value >= 0 && +value <= 100
|
13800 | }
|
13801 | };
|
13802 | var stdin_default$A = vue.defineComponent({
|
13803 | name: name$s,
|
13804 | props: progressProps,
|
13805 | setup(props2) {
|
13806 | const background = vue.computed(() => props2.inactive ? void 0 : props2.color);
|
13807 | const renderPivot = () => {
|
13808 | const {
|
13809 | textColor,
|
13810 | pivotText,
|
13811 | pivotColor,
|
13812 | percentage
|
13813 | } = props2;
|
13814 | const text = pivotText != null ? pivotText : `${percentage}%`;
|
13815 | if (props2.showPivot && text) {
|
13816 | const style = {
|
13817 | color: textColor,
|
13818 | left: `${+percentage}%`,
|
13819 | transform: `translate(-${+percentage}%,-50%)`,
|
13820 | background: pivotColor || background.value
|
13821 | };
|
13822 | return vue.createVNode("span", {
|
13823 | "style": style,
|
13824 | "class": bem$r("pivot", {
|
13825 | inactive: props2.inactive
|
13826 | })
|
13827 | }, [text]);
|
13828 | }
|
13829 | };
|
13830 | return () => {
|
13831 | const {
|
13832 | trackColor,
|
13833 | percentage,
|
13834 | strokeWidth
|
13835 | } = props2;
|
13836 | const rootStyle = {
|
13837 | background: trackColor,
|
13838 | height: addUnit(strokeWidth)
|
13839 | };
|
13840 | const portionStyle = {
|
13841 | width: `${percentage}%`,
|
13842 | background: background.value
|
13843 | };
|
13844 | return vue.createVNode("div", {
|
13845 | "class": bem$r(),
|
13846 | "style": rootStyle
|
13847 | }, [vue.createVNode("span", {
|
13848 | "class": bem$r("portion", {
|
13849 | inactive: props2.inactive
|
13850 | }),
|
13851 | "style": portionStyle
|
13852 | }, null), renderPivot()]);
|
13853 | };
|
13854 | }
|
13855 | });
|
13856 | const Progress = withInstall(stdin_default$A);
|
13857 | const [name$r, bem$q, t$5] = createNamespace("pull-refresh");
|
13858 | const DEFAULT_HEAD_HEIGHT = 50;
|
13859 | const TEXT_STATUS = ["pulling", "loosing", "success"];
|
13860 | const pullRefreshProps = {
|
13861 | disabled: Boolean,
|
13862 | modelValue: Boolean,
|
13863 | headHeight: makeNumericProp(DEFAULT_HEAD_HEIGHT),
|
13864 | successText: String,
|
13865 | pullingText: String,
|
13866 | loosingText: String,
|
13867 | loadingText: String,
|
13868 | pullDistance: numericProp,
|
13869 | successDuration: makeNumericProp(500),
|
13870 | animationDuration: makeNumericProp(300)
|
13871 | };
|
13872 | var stdin_default$z = vue.defineComponent({
|
13873 | name: name$r,
|
13874 | props: pullRefreshProps,
|
13875 | emits: ["change", "refresh", "update:modelValue"],
|
13876 | setup(props2, {
|
13877 | emit,
|
13878 | slots
|
13879 | }) {
|
13880 | let reachTop;
|
13881 | const root = vue.ref();
|
13882 | const track = vue.ref();
|
13883 | const scrollParent = useScrollParent(root);
|
13884 | const state = vue.reactive({
|
13885 | status: "normal",
|
13886 | distance: 0,
|
13887 | duration: 0
|
13888 | });
|
13889 | const touch = useTouch();
|
13890 | const getHeadStyle = () => {
|
13891 | if (props2.headHeight !== DEFAULT_HEAD_HEIGHT) {
|
13892 | return {
|
13893 | height: `${props2.headHeight}px`
|
13894 | };
|
13895 | }
|
13896 | };
|
13897 | const isTouchable = () => state.status !== "loading" && state.status !== "success" && !props2.disabled;
|
13898 | const ease = (distance) => {
|
13899 | const pullDistance = +(props2.pullDistance || props2.headHeight);
|
13900 | if (distance > pullDistance) {
|
13901 | if (distance < pullDistance * 2) {
|
13902 | distance = pullDistance + (distance - pullDistance) / 2;
|
13903 | } else {
|
13904 | distance = pullDistance * 1.5 + (distance - pullDistance * 2) / 4;
|
13905 | }
|
13906 | }
|
13907 | return Math.round(distance);
|
13908 | };
|
13909 | const setStatus = (distance, isLoading) => {
|
13910 | const pullDistance = +(props2.pullDistance || props2.headHeight);
|
13911 | state.distance = distance;
|
13912 | if (isLoading) {
|
13913 | state.status = "loading";
|
13914 | } else if (distance === 0) {
|
13915 | state.status = "normal";
|
13916 | } else if (distance < pullDistance) {
|
13917 | state.status = "pulling";
|
13918 | } else {
|
13919 | state.status = "loosing";
|
13920 | }
|
13921 | emit("change", {
|
13922 | status: state.status,
|
13923 | distance
|
13924 | });
|
13925 | };
|
13926 | const getStatusText = () => {
|
13927 | const {
|
13928 | status
|
13929 | } = state;
|
13930 | if (status === "normal") {
|
13931 | return "";
|
13932 | }
|
13933 | return props2[`${status}Text`] || t$5(status);
|
13934 | };
|
13935 | const renderStatus = () => {
|
13936 | const {
|
13937 | status,
|
13938 | distance
|
13939 | } = state;
|
13940 | if (slots[status]) {
|
13941 | return slots[status]({
|
13942 | distance
|
13943 | });
|
13944 | }
|
13945 | const nodes = [];
|
13946 | if (TEXT_STATUS.includes(status)) {
|
13947 | nodes.push(vue.createVNode("div", {
|
13948 | "class": bem$q("text")
|
13949 | }, [getStatusText()]));
|
13950 | }
|
13951 | if (status === "loading") {
|
13952 | nodes.push(vue.createVNode(Loading, {
|
13953 | "class": bem$q("loading")
|
13954 | }, {
|
13955 | default: getStatusText
|
13956 | }));
|
13957 | }
|
13958 | return nodes;
|
13959 | };
|
13960 | const showSuccessTip = () => {
|
13961 | state.status = "success";
|
13962 | setTimeout(() => {
|
13963 | setStatus(0);
|
13964 | }, +props2.successDuration);
|
13965 | };
|
13966 | const checkPosition = (event) => {
|
13967 | reachTop = getScrollTop(scrollParent.value) === 0;
|
13968 | if (reachTop) {
|
13969 | state.duration = 0;
|
13970 | touch.start(event);
|
13971 | }
|
13972 | };
|
13973 | const onTouchStart = (event) => {
|
13974 | if (isTouchable()) {
|
13975 | checkPosition(event);
|
13976 | }
|
13977 | };
|
13978 | const onTouchMove = (event) => {
|
13979 | if (isTouchable()) {
|
13980 | if (!reachTop) {
|
13981 | checkPosition(event);
|
13982 | }
|
13983 | const {
|
13984 | deltaY
|
13985 | } = touch;
|
13986 | touch.move(event);
|
13987 | if (reachTop && deltaY.value >= 0 && touch.isVertical()) {
|
13988 | preventDefault(event);
|
13989 | setStatus(ease(deltaY.value));
|
13990 | }
|
13991 | }
|
13992 | };
|
13993 | const onTouchEnd = () => {
|
13994 | if (reachTop && touch.deltaY.value && isTouchable()) {
|
13995 | state.duration = +props2.animationDuration;
|
13996 | if (state.status === "loosing") {
|
13997 | setStatus(+props2.headHeight, true);
|
13998 | emit("update:modelValue", true);
|
13999 | vue.nextTick(() => emit("refresh"));
|
14000 | } else {
|
14001 | setStatus(0);
|
14002 | }
|
14003 | }
|
14004 | };
|
14005 | vue.watch(() => props2.modelValue, (value) => {
|
14006 | state.duration = +props2.animationDuration;
|
14007 | if (value) {
|
14008 | setStatus(+props2.headHeight, true);
|
14009 | } else if (slots.success || props2.successText) {
|
14010 | showSuccessTip();
|
14011 | } else {
|
14012 | setStatus(0, false);
|
14013 | }
|
14014 | });
|
14015 | useEventListener("touchmove", onTouchMove, {
|
14016 | target: track
|
14017 | });
|
14018 | return () => {
|
14019 | var _a;
|
14020 | const trackStyle = {
|
14021 | transitionDuration: `${state.duration}ms`,
|
14022 | transform: state.distance ? `translate3d(0,${state.distance}px, 0)` : ""
|
14023 | };
|
14024 | return vue.createVNode("div", {
|
14025 | "ref": root,
|
14026 | "class": bem$q()
|
14027 | }, [vue.createVNode("div", {
|
14028 | "ref": track,
|
14029 | "class": bem$q("track"),
|
14030 | "style": trackStyle,
|
14031 | "onTouchstartPassive": onTouchStart,
|
14032 | "onTouchend": onTouchEnd,
|
14033 | "onTouchcancel": onTouchEnd
|
14034 | }, [vue.createVNode("div", {
|
14035 | "class": bem$q("head"),
|
14036 | "style": getHeadStyle()
|
14037 | }, [renderStatus()]), (_a = slots.default) == null ? void 0 : _a.call(slots)])]);
|
14038 | };
|
14039 | }
|
14040 | });
|
14041 | const PullRefresh = withInstall(stdin_default$z);
|
14042 | const [name$q, bem$p] = createNamespace("rate");
|
14043 | function getRateStatus(value, index, allowHalf, readonly) {
|
14044 | if (value >= index) {
|
14045 | return {
|
14046 | status: "full",
|
14047 | value: 1
|
14048 | };
|
14049 | }
|
14050 | if (value + 0.5 >= index && allowHalf && !readonly) {
|
14051 | return {
|
14052 | status: "half",
|
14053 | value: 0.5
|
14054 | };
|
14055 | }
|
14056 | if (value + 1 >= index && allowHalf && readonly) {
|
14057 | const cardinal = 10 ** 10;
|
14058 | return {
|
14059 | status: "half",
|
14060 | value: Math.round((value - index + 1) * cardinal) / cardinal
|
14061 | };
|
14062 | }
|
14063 | return {
|
14064 | status: "void",
|
14065 | value: 0
|
14066 | };
|
14067 | }
|
14068 | const rateProps = {
|
14069 | size: numericProp,
|
14070 | icon: makeStringProp("star"),
|
14071 | color: String,
|
14072 | count: makeNumericProp(5),
|
14073 | gutter: numericProp,
|
14074 | clearable: Boolean,
|
14075 | readonly: Boolean,
|
14076 | disabled: Boolean,
|
14077 | voidIcon: makeStringProp("star-o"),
|
14078 | allowHalf: Boolean,
|
14079 | voidColor: String,
|
14080 | touchable: truthProp,
|
14081 | iconPrefix: String,
|
14082 | modelValue: makeNumberProp(0),
|
14083 | disabledColor: String
|
14084 | };
|
14085 | var stdin_default$y = vue.defineComponent({
|
14086 | name: name$q,
|
14087 | props: rateProps,
|
14088 | emits: ["change", "update:modelValue"],
|
14089 | setup(props2, {
|
14090 | emit
|
14091 | }) {
|
14092 | const touch = useTouch();
|
14093 | const [itemRefs, setItemRefs] = useRefs();
|
14094 | const groupRef = vue.ref();
|
14095 | const unselectable = vue.computed(() => props2.readonly || props2.disabled);
|
14096 | const untouchable = vue.computed(() => unselectable.value || !props2.touchable);
|
14097 | const list = vue.computed(() => Array(+props2.count).fill("").map((_, i) => getRateStatus(props2.modelValue, i + 1, props2.allowHalf, props2.readonly)));
|
14098 | let ranges;
|
14099 | let groupRefRect;
|
14100 | let minRectTop = Number.MAX_SAFE_INTEGER;
|
14101 | let maxRectTop = Number.MIN_SAFE_INTEGER;
|
14102 | const updateRanges = () => {
|
14103 | groupRefRect = useRect(groupRef);
|
14104 | const rects = itemRefs.value.map(useRect);
|
14105 | ranges = [];
|
14106 | rects.forEach((rect, index) => {
|
14107 | minRectTop = Math.min(rect.top, minRectTop);
|
14108 | maxRectTop = Math.max(rect.top, maxRectTop);
|
14109 | if (props2.allowHalf) {
|
14110 | ranges.push({
|
14111 | score: index + 0.5,
|
14112 | left: rect.left,
|
14113 | top: rect.top,
|
14114 | height: rect.height
|
14115 | }, {
|
14116 | score: index + 1,
|
14117 | left: rect.left + rect.width / 2,
|
14118 | top: rect.top,
|
14119 | height: rect.height
|
14120 | });
|
14121 | } else {
|
14122 | ranges.push({
|
14123 | score: index + 1,
|
14124 | left: rect.left,
|
14125 | top: rect.top,
|
14126 | height: rect.height
|
14127 | });
|
14128 | }
|
14129 | });
|
14130 | };
|
14131 | const getScoreByPosition = (x, y) => {
|
14132 | for (let i = ranges.length - 1; i > 0; i--) {
|
14133 | if (y >= groupRefRect.top && y <= groupRefRect.bottom) {
|
14134 | if (x > ranges[i].left && y >= ranges[i].top && y <= ranges[i].top + ranges[i].height) {
|
14135 | return ranges[i].score;
|
14136 | }
|
14137 | } else {
|
14138 | const curTop = y < groupRefRect.top ? minRectTop : maxRectTop;
|
14139 | if (x > ranges[i].left && ranges[i].top === curTop) {
|
14140 | return ranges[i].score;
|
14141 | }
|
14142 | }
|
14143 | }
|
14144 | return props2.allowHalf ? 0.5 : 1;
|
14145 | };
|
14146 | const select = (value) => {
|
14147 | if (unselectable.value || value === props2.modelValue)
|
14148 | return;
|
14149 | emit("update:modelValue", value);
|
14150 | emit("change", value);
|
14151 | };
|
14152 | const onTouchStart = (event) => {
|
14153 | if (untouchable.value) {
|
14154 | return;
|
14155 | }
|
14156 | touch.start(event);
|
14157 | updateRanges();
|
14158 | };
|
14159 | const onTouchMove = (event) => {
|
14160 | if (untouchable.value) {
|
14161 | return;
|
14162 | }
|
14163 | touch.move(event);
|
14164 | if (touch.isHorizontal() && !touch.isTap.value) {
|
14165 | const {
|
14166 | clientX,
|
14167 | clientY
|
14168 | } = event.touches[0];
|
14169 | preventDefault(event);
|
14170 | select(getScoreByPosition(clientX, clientY));
|
14171 | }
|
14172 | };
|
14173 | const renderStar = (item, index) => {
|
14174 | const {
|
14175 | icon,
|
14176 | size,
|
14177 | color,
|
14178 | count,
|
14179 | gutter,
|
14180 | voidIcon,
|
14181 | disabled,
|
14182 | voidColor,
|
14183 | allowHalf,
|
14184 | iconPrefix,
|
14185 | disabledColor
|
14186 | } = props2;
|
14187 | const score = index + 1;
|
14188 | const isFull = item.status === "full";
|
14189 | const isVoid = item.status === "void";
|
14190 | const renderHalf = allowHalf && item.value > 0 && item.value < 1;
|
14191 | let style;
|
14192 | if (gutter && score !== +count) {
|
14193 | style = {
|
14194 | paddingRight: addUnit(gutter)
|
14195 | };
|
14196 | }
|
14197 | const onClickItem = (event) => {
|
14198 | updateRanges();
|
14199 | let value = allowHalf ? getScoreByPosition(event.clientX, event.clientY) : score;
|
14200 | if (props2.clearable && touch.isTap.value && value === props2.modelValue) {
|
14201 | value = 0;
|
14202 | }
|
14203 | select(value);
|
14204 | };
|
14205 | return vue.createVNode("div", {
|
14206 | "key": index,
|
14207 | "ref": setItemRefs(index),
|
14208 | "role": "radio",
|
14209 | "style": style,
|
14210 | "class": bem$p("item"),
|
14211 | "tabindex": disabled ? void 0 : 0,
|
14212 | "aria-setsize": count,
|
14213 | "aria-posinset": score,
|
14214 | "aria-checked": !isVoid,
|
14215 | "onClick": onClickItem
|
14216 | }, [vue.createVNode(Icon, {
|
14217 | "size": size,
|
14218 | "name": isFull ? icon : voidIcon,
|
14219 | "class": bem$p("icon", {
|
14220 | disabled,
|
14221 | full: isFull
|
14222 | }),
|
14223 | "color": disabled ? disabledColor : isFull ? color : voidColor,
|
14224 | "classPrefix": iconPrefix
|
14225 | }, null), renderHalf && vue.createVNode(Icon, {
|
14226 | "size": size,
|
14227 | "style": {
|
14228 | width: item.value + "em"
|
14229 | },
|
14230 | "name": isVoid ? voidIcon : icon,
|
14231 | "class": bem$p("icon", ["half", {
|
14232 | disabled,
|
14233 | full: !isVoid
|
14234 | }]),
|
14235 | "color": disabled ? disabledColor : isVoid ? voidColor : color,
|
14236 | "classPrefix": iconPrefix
|
14237 | }, null)]);
|
14238 | };
|
14239 | useCustomFieldValue(() => props2.modelValue);
|
14240 | useEventListener("touchmove", onTouchMove, {
|
14241 | target: groupRef
|
14242 | });
|
14243 | return () => vue.createVNode("div", {
|
14244 | "ref": groupRef,
|
14245 | "role": "radiogroup",
|
14246 | "class": bem$p({
|
14247 | readonly: props2.readonly,
|
14248 | disabled: props2.disabled
|
14249 | }),
|
14250 | "tabindex": props2.disabled ? void 0 : 0,
|
14251 | "aria-disabled": props2.disabled,
|
14252 | "aria-readonly": props2.readonly,
|
14253 | "onTouchstartPassive": onTouchStart
|
14254 | }, [list.value.map(renderStar)]);
|
14255 | }
|
14256 | });
|
14257 | const Rate = withInstall(stdin_default$y);
|
14258 | const props = {
|
14259 | figureArr: makeArrayProp(),
|
14260 | delay: Number,
|
14261 | duration: makeNumberProp(2),
|
14262 | isStart: Boolean,
|
14263 | direction: makeStringProp("down"),
|
14264 | height: makeNumberProp(40)
|
14265 | };
|
14266 | const [name$p, bem$o] = createNamespace("rolling-text-item");
|
14267 | var stdin_default$x = vue.defineComponent({
|
14268 | name: name$p,
|
14269 | props,
|
14270 | setup(props2) {
|
14271 | const newFigureArr = vue.computed(() => props2.direction === "down" ? props2.figureArr.slice().reverse() : props2.figureArr);
|
14272 | const translatePx = vue.computed(() => {
|
14273 | const totalHeight = props2.height * (props2.figureArr.length - 1);
|
14274 | return `-${totalHeight}px`;
|
14275 | });
|
14276 | const itemStyle = vue.computed(() => ({
|
14277 | lineHeight: addUnit(props2.height)
|
14278 | }));
|
14279 | const rootStyle = vue.computed(() => ({
|
14280 | height: addUnit(props2.height),
|
14281 | "--van-translate": translatePx.value,
|
14282 | "--van-duration": props2.duration + "s",
|
14283 | "--van-delay": props2.delay + "s"
|
14284 | }));
|
14285 | return () => vue.createVNode("div", {
|
14286 | "class": bem$o([props2.direction]),
|
14287 | "style": rootStyle.value
|
14288 | }, [vue.createVNode("div", {
|
14289 | "class": bem$o("box", {
|
14290 | animate: props2.isStart
|
14291 | })
|
14292 | }, [Array.isArray(newFigureArr.value) && newFigureArr.value.map((figure) => vue.createVNode("div", {
|
14293 | "class": bem$o("item"),
|
14294 | "style": itemStyle.value
|
14295 | }, [figure]))])]);
|
14296 | }
|
14297 | });
|
14298 | const [name$o, bem$n] = createNamespace("rolling-text");
|
14299 | const rollingTextProps = {
|
14300 | startNum: makeNumberProp(0),
|
14301 | targetNum: Number,
|
14302 | textList: makeArrayProp(),
|
14303 | duration: makeNumberProp(2),
|
14304 | autoStart: truthProp,
|
14305 | direction: makeStringProp("down"),
|
14306 | stopOrder: makeStringProp("ltr"),
|
14307 | height: makeNumberProp(40)
|
14308 | };
|
14309 | const CIRCLE_NUM = 2;
|
14310 | var stdin_default$w = vue.defineComponent({
|
14311 | name: name$o,
|
14312 | props: rollingTextProps,
|
14313 | setup(props2) {
|
14314 | const isCustomType = vue.computed(() => Array.isArray(props2.textList) && props2.textList.length);
|
14315 | const itemLength = vue.computed(() => {
|
14316 | if (isCustomType.value)
|
14317 | return props2.textList[0].length;
|
14318 | return `${Math.max(props2.startNum, props2.targetNum)}`.length;
|
14319 | });
|
14320 | const getTextArrByIdx = (idx) => {
|
14321 | const result = [];
|
14322 | for (let i = 0; i < props2.textList.length; i++) {
|
14323 | result.push(props2.textList[i][idx]);
|
14324 | }
|
14325 | return result;
|
14326 | };
|
14327 | const targetNumArr = vue.computed(() => {
|
14328 | if (isCustomType.value)
|
14329 | return new Array(itemLength.value).fill("");
|
14330 | return padZero(props2.targetNum, itemLength.value).split("");
|
14331 | });
|
14332 | const startNumArr = vue.computed(() => padZero(props2.startNum, itemLength.value).split(""));
|
14333 | const getFigureArr = (i) => {
|
14334 | const start22 = +startNumArr.value[i];
|
14335 | const target = +targetNumArr.value[i];
|
14336 | const result = [];
|
14337 | for (let i2 = start22; i2 <= 9; i2++) {
|
14338 | result.push(i2);
|
14339 | }
|
14340 | for (let i2 = 0; i2 <= CIRCLE_NUM; i2++) {
|
14341 | for (let j = 0; j <= 9; j++) {
|
14342 | result.push(j);
|
14343 | }
|
14344 | }
|
14345 | for (let i2 = 0; i2 <= target; i2++) {
|
14346 | result.push(i2);
|
14347 | }
|
14348 | return result;
|
14349 | };
|
14350 | const getDelay = (i, len) => {
|
14351 | if (props2.stopOrder === "ltr")
|
14352 | return 0.2 * i;
|
14353 | return 0.2 * (len - 1 - i);
|
14354 | };
|
14355 | const rolling = vue.ref(props2.autoStart);
|
14356 | const start2 = () => {
|
14357 | rolling.value = true;
|
14358 | };
|
14359 | const reset = () => {
|
14360 | rolling.value = false;
|
14361 | if (props2.autoStart) {
|
14362 | raf(() => start2());
|
14363 | }
|
14364 | };
|
14365 | vue.watch(() => props2.autoStart, (value) => {
|
14366 | if (value) {
|
14367 | start2();
|
14368 | }
|
14369 | });
|
14370 | useExpose({
|
14371 | start: start2,
|
14372 | reset
|
14373 | });
|
14374 | return () => vue.createVNode("div", {
|
14375 | "class": bem$n()
|
14376 | }, [targetNumArr.value.map((_, i) => vue.createVNode(stdin_default$x, {
|
14377 | "figureArr": isCustomType.value ? getTextArrByIdx(i) : getFigureArr(i),
|
14378 | "duration": props2.duration,
|
14379 | "direction": props2.direction,
|
14380 | "isStart": rolling.value,
|
14381 | "height": props2.height,
|
14382 | "delay": getDelay(i, itemLength.value)
|
14383 | }, null))]);
|
14384 | }
|
14385 | });
|
14386 | const RollingText = withInstall(stdin_default$w);
|
14387 | const Row = withInstall(stdin_default$17);
|
14388 | const [name$n, bem$m, t$4] = createNamespace("search");
|
14389 | const searchProps = extend({}, fieldSharedProps, {
|
14390 | label: String,
|
14391 | shape: makeStringProp("square"),
|
14392 | leftIcon: makeStringProp("search"),
|
14393 | clearable: truthProp,
|
14394 | actionText: String,
|
14395 | background: String,
|
14396 | showAction: Boolean
|
14397 | });
|
14398 | var stdin_default$v = vue.defineComponent({
|
14399 | name: name$n,
|
14400 | props: searchProps,
|
14401 | emits: ["blur", "focus", "clear", "search", "cancel", "clickInput", "clickLeftIcon", "clickRightIcon", "update:modelValue"],
|
14402 | setup(props2, {
|
14403 | emit,
|
14404 | slots,
|
14405 | attrs
|
14406 | }) {
|
14407 | const id = useId();
|
14408 | const fieldRef = vue.ref();
|
14409 | const onCancel = () => {
|
14410 | if (!slots.action) {
|
14411 | emit("update:modelValue", "");
|
14412 | emit("cancel");
|
14413 | }
|
14414 | };
|
14415 | const onKeypress = (event) => {
|
14416 | const ENTER_CODE = 13;
|
14417 | if (event.keyCode === ENTER_CODE) {
|
14418 | preventDefault(event);
|
14419 | emit("search", props2.modelValue);
|
14420 | }
|
14421 | };
|
14422 | const getInputId = () => props2.id || `${id}-input`;
|
14423 | const renderLabel = () => {
|
14424 | if (slots.label || props2.label) {
|
14425 | return vue.createVNode("label", {
|
14426 | "class": bem$m("label"),
|
14427 | "for": getInputId()
|
14428 | }, [slots.label ? slots.label() : props2.label]);
|
14429 | }
|
14430 | };
|
14431 | const renderAction = () => {
|
14432 | if (props2.showAction) {
|
14433 | const text = props2.actionText || t$4("cancel");
|
14434 | return vue.createVNode("div", {
|
14435 | "class": bem$m("action"),
|
14436 | "role": "button",
|
14437 | "tabindex": 0,
|
14438 | "onClick": onCancel
|
14439 | }, [slots.action ? slots.action() : text]);
|
14440 | }
|
14441 | };
|
14442 | const blur = () => {
|
14443 | var _a;
|
14444 | return (_a = fieldRef.value) == null ? void 0 : _a.blur();
|
14445 | };
|
14446 | const focus = () => {
|
14447 | var _a;
|
14448 | return (_a = fieldRef.value) == null ? void 0 : _a.focus();
|
14449 | };
|
14450 | const onBlur = (event) => emit("blur", event);
|
14451 | const onFocus = (event) => emit("focus", event);
|
14452 | const onClear = (event) => emit("clear", event);
|
14453 | const onClickInput = (event) => emit("clickInput", event);
|
14454 | const onClickLeftIcon = (event) => emit("clickLeftIcon", event);
|
14455 | const onClickRightIcon = (event) => emit("clickRightIcon", event);
|
14456 | const fieldPropNames = Object.keys(fieldSharedProps);
|
14457 | const renderField = () => {
|
14458 | const fieldAttrs = extend({}, attrs, pick(props2, fieldPropNames), {
|
14459 | id: getInputId()
|
14460 | });
|
14461 | const onInput = (value) => emit("update:modelValue", value);
|
14462 | return vue.createVNode(Field, vue.mergeProps({
|
14463 | "ref": fieldRef,
|
14464 | "type": "search",
|
14465 | "class": bem$m("field", {
|
14466 | "with-message": fieldAttrs.errorMessage
|
14467 | }),
|
14468 | "border": false,
|
14469 | "onBlur": onBlur,
|
14470 | "onFocus": onFocus,
|
14471 | "onClear": onClear,
|
14472 | "onKeypress": onKeypress,
|
14473 | "onClickInput": onClickInput,
|
14474 | "onClickLeftIcon": onClickLeftIcon,
|
14475 | "onClickRightIcon": onClickRightIcon,
|
14476 | "onUpdate:modelValue": onInput
|
14477 | }, fieldAttrs), pick(slots, ["left-icon", "right-icon"]));
|
14478 | };
|
14479 | useExpose({
|
14480 | focus,
|
14481 | blur
|
14482 | });
|
14483 | return () => {
|
14484 | var _a;
|
14485 | return vue.createVNode("div", {
|
14486 | "class": bem$m({
|
14487 | "show-action": props2.showAction
|
14488 | }),
|
14489 | "style": {
|
14490 | background: props2.background
|
14491 | }
|
14492 | }, [(_a = slots.left) == null ? void 0 : _a.call(slots), vue.createVNode("div", {
|
14493 | "class": bem$m("content", props2.shape)
|
14494 | }, [renderLabel(), renderField()]), renderAction()]);
|
14495 | };
|
14496 | }
|
14497 | });
|
14498 | const Search = withInstall(stdin_default$v);
|
14499 | const isImage = (name2) => name2 == null ? void 0 : name2.includes("/");
|
14500 | const popupInheritKeys = [...popupSharedPropKeys, "round", "closeOnPopstate", "safeAreaInsetBottom"];
|
14501 | const iconMap = {
|
14502 | qq: "qq",
|
14503 | link: "link-o",
|
14504 | weibo: "weibo",
|
14505 | qrcode: "qr",
|
14506 | poster: "photo-o",
|
14507 | wechat: "wechat",
|
14508 | "weapp-qrcode": "miniprogram-o",
|
14509 | "wechat-moments": "wechat-moments"
|
14510 | };
|
14511 | const [name$m, bem$l, t$3] = createNamespace("share-sheet");
|
14512 | const shareSheetProps = extend({}, popupSharedProps, {
|
14513 | title: String,
|
14514 | round: truthProp,
|
14515 | options: makeArrayProp(),
|
14516 | cancelText: String,
|
14517 | description: String,
|
14518 | closeOnPopstate: truthProp,
|
14519 | safeAreaInsetBottom: truthProp
|
14520 | });
|
14521 | var stdin_default$u = vue.defineComponent({
|
14522 | name: name$m,
|
14523 | props: shareSheetProps,
|
14524 | emits: ["cancel", "select", "update:show"],
|
14525 | setup(props2, {
|
14526 | emit,
|
14527 | slots
|
14528 | }) {
|
14529 | const updateShow = (value) => emit("update:show", value);
|
14530 | const onCancel = () => {
|
14531 | updateShow(false);
|
14532 | emit("cancel");
|
14533 | };
|
14534 | const onSelect = (option, index) => emit("select", option, index);
|
14535 | const renderHeader = () => {
|
14536 | const title = slots.title ? slots.title() : props2.title;
|
14537 | const description = slots.description ? slots.description() : props2.description;
|
14538 | if (title || description) {
|
14539 | return vue.createVNode("div", {
|
14540 | "class": bem$l("header")
|
14541 | }, [title && vue.createVNode("h2", {
|
14542 | "class": bem$l("title")
|
14543 | }, [title]), description && vue.createVNode("span", {
|
14544 | "class": bem$l("description")
|
14545 | }, [description])]);
|
14546 | }
|
14547 | };
|
14548 | const renderIcon = (icon) => {
|
14549 | if (isImage(icon)) {
|
14550 | return vue.createVNode("img", {
|
14551 | "src": icon,
|
14552 | "class": bem$l("image-icon")
|
14553 | }, null);
|
14554 | }
|
14555 | return vue.createVNode("div", {
|
14556 | "class": bem$l("icon", [icon])
|
14557 | }, [vue.createVNode(Icon, {
|
14558 | "name": iconMap[icon] || icon
|
14559 | }, null)]);
|
14560 | };
|
14561 | const renderOption = (option, index) => {
|
14562 | const {
|
14563 | name: name2,
|
14564 | icon,
|
14565 | className,
|
14566 | description
|
14567 | } = option;
|
14568 | return vue.createVNode("div", {
|
14569 | "role": "button",
|
14570 | "tabindex": 0,
|
14571 | "class": [bem$l("option"), className, HAPTICS_FEEDBACK],
|
14572 | "onClick": () => onSelect(option, index)
|
14573 | }, [renderIcon(icon), name2 && vue.createVNode("span", {
|
14574 | "class": bem$l("name")
|
14575 | }, [name2]), description && vue.createVNode("span", {
|
14576 | "class": bem$l("option-description")
|
14577 | }, [description])]);
|
14578 | };
|
14579 | const renderOptions = (options, border) => vue.createVNode("div", {
|
14580 | "class": bem$l("options", {
|
14581 | border
|
14582 | })
|
14583 | }, [options.map(renderOption)]);
|
14584 | const renderRows = () => {
|
14585 | const {
|
14586 | options
|
14587 | } = props2;
|
14588 | if (Array.isArray(options[0])) {
|
14589 | return options.map((item, index) => renderOptions(item, index !== 0));
|
14590 | }
|
14591 | return renderOptions(options);
|
14592 | };
|
14593 | const renderCancelButton = () => {
|
14594 | var _a;
|
14595 | const cancelText = (_a = props2.cancelText) != null ? _a : t$3("cancel");
|
14596 | if (slots.cancel || cancelText) {
|
14597 | return vue.createVNode("button", {
|
14598 | "type": "button",
|
14599 | "class": bem$l("cancel"),
|
14600 | "onClick": onCancel
|
14601 | }, [slots.cancel ? slots.cancel() : cancelText]);
|
14602 | }
|
14603 | };
|
14604 | return () => vue.createVNode(Popup, vue.mergeProps({
|
14605 | "class": bem$l(),
|
14606 | "position": "bottom",
|
14607 | "onUpdate:show": updateShow
|
14608 | }, pick(props2, popupInheritKeys)), {
|
14609 | default: () => [renderHeader(), renderRows(), renderCancelButton()]
|
14610 | });
|
14611 | }
|
14612 | });
|
14613 | const ShareSheet = withInstall(stdin_default$u);
|
14614 | const [name$l, bem$k] = createNamespace("sidebar");
|
14615 | const SIDEBAR_KEY = Symbol(name$l);
|
14616 | const sidebarProps = {
|
14617 | modelValue: makeNumericProp(0)
|
14618 | };
|
14619 | var stdin_default$t = vue.defineComponent({
|
14620 | name: name$l,
|
14621 | props: sidebarProps,
|
14622 | emits: ["change", "update:modelValue"],
|
14623 | setup(props2, {
|
14624 | emit,
|
14625 | slots
|
14626 | }) {
|
14627 | const {
|
14628 | linkChildren
|
14629 | } = useChildren(SIDEBAR_KEY);
|
14630 | const getActive = () => +props2.modelValue;
|
14631 | const setActive = (value) => {
|
14632 | if (value !== getActive()) {
|
14633 | emit("update:modelValue", value);
|
14634 | emit("change", value);
|
14635 | }
|
14636 | };
|
14637 | linkChildren({
|
14638 | getActive,
|
14639 | setActive
|
14640 | });
|
14641 | return () => {
|
14642 | var _a;
|
14643 | return vue.createVNode("div", {
|
14644 | "role": "tablist",
|
14645 | "class": bem$k()
|
14646 | }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
14647 | };
|
14648 | }
|
14649 | });
|
14650 | const Sidebar = withInstall(stdin_default$t);
|
14651 | const [name$k, bem$j] = createNamespace("sidebar-item");
|
14652 | const sidebarItemProps = extend({}, routeProps, {
|
14653 | dot: Boolean,
|
14654 | title: String,
|
14655 | badge: numericProp,
|
14656 | disabled: Boolean,
|
14657 | badgeProps: Object
|
14658 | });
|
14659 | var stdin_default$s = vue.defineComponent({
|
14660 | name: name$k,
|
14661 | props: sidebarItemProps,
|
14662 | emits: ["click"],
|
14663 | setup(props2, {
|
14664 | emit,
|
14665 | slots
|
14666 | }) {
|
14667 | const route2 = useRoute();
|
14668 | const {
|
14669 | parent,
|
14670 | index
|
14671 | } = useParent(SIDEBAR_KEY);
|
14672 | if (!parent) {
|
14673 | return;
|
14674 | }
|
14675 | const onClick = () => {
|
14676 | if (props2.disabled) {
|
14677 | return;
|
14678 | }
|
14679 | emit("click", index.value);
|
14680 | parent.setActive(index.value);
|
14681 | route2();
|
14682 | };
|
14683 | return () => {
|
14684 | const {
|
14685 | dot,
|
14686 | badge,
|
14687 | title,
|
14688 | disabled
|
14689 | } = props2;
|
14690 | const selected = index.value === parent.getActive();
|
14691 | return vue.createVNode("div", {
|
14692 | "role": "tab",
|
14693 | "class": bem$j({
|
14694 | select: selected,
|
14695 | disabled
|
14696 | }),
|
14697 | "tabindex": disabled ? void 0 : 0,
|
14698 | "aria-selected": selected,
|
14699 | "onClick": onClick
|
14700 | }, [vue.createVNode(Badge, vue.mergeProps({
|
14701 | "dot": dot,
|
14702 | "class": bem$j("text"),
|
14703 | "content": badge
|
14704 | }, props2.badgeProps), {
|
14705 | default: () => [slots.title ? slots.title() : title]
|
14706 | })]);
|
14707 | };
|
14708 | }
|
14709 | });
|
14710 | const SidebarItem = withInstall(stdin_default$s);
|
14711 | const [name$j, bem$i, t$2] = createNamespace("signature");
|
14712 | const signatureProps = {
|
14713 | tips: String,
|
14714 | type: makeStringProp("png"),
|
14715 | penColor: makeStringProp("#000"),
|
14716 | lineWidth: makeNumberProp(3),
|
14717 | clearButtonText: String,
|
14718 | backgroundColor: makeStringProp(""),
|
14719 | confirmButtonText: String
|
14720 | };
|
14721 | const hasCanvasSupport = () => {
|
14722 | var _a;
|
14723 | const canvas = document.createElement("canvas");
|
14724 | return !!((_a = canvas.getContext) == null ? void 0 : _a.call(canvas, "2d"));
|
14725 | };
|
14726 | var stdin_default$r = vue.defineComponent({
|
14727 | name: name$j,
|
14728 | props: signatureProps,
|
14729 | emits: ["submit", "clear", "start", "end", "signing"],
|
14730 | setup(props2, {
|
14731 | emit
|
14732 | }) {
|
14733 | const canvasRef = vue.ref();
|
14734 | const wrapRef = vue.ref();
|
14735 | const ctx = vue.computed(() => {
|
14736 | if (!canvasRef.value)
|
14737 | return null;
|
14738 | return canvasRef.value.getContext("2d");
|
14739 | });
|
14740 | const isRenderCanvas = inBrowser$1 ? hasCanvasSupport() : true;
|
14741 | let canvasWidth = 0;
|
14742 | let canvasHeight = 0;
|
14743 | let canvasRect;
|
14744 | const touchStart = () => {
|
14745 | if (!ctx.value) {
|
14746 | return false;
|
14747 | }
|
14748 | ctx.value.beginPath();
|
14749 | ctx.value.lineWidth = props2.lineWidth;
|
14750 | ctx.value.strokeStyle = props2.penColor;
|
14751 | canvasRect = useRect(canvasRef);
|
14752 | emit("start");
|
14753 | };
|
14754 | const touchMove = (event) => {
|
14755 | if (!ctx.value) {
|
14756 | return false;
|
14757 | }
|
14758 | preventDefault(event);
|
14759 | const touch = event.touches[0];
|
14760 | const mouseX = touch.clientX - ((canvasRect == null ? void 0 : canvasRect.left) || 0);
|
14761 | const mouseY = touch.clientY - ((canvasRect == null ? void 0 : canvasRect.top) || 0);
|
14762 | ctx.value.lineCap = "round";
|
14763 | ctx.value.lineJoin = "round";
|
14764 | ctx.value.lineTo(mouseX, mouseY);
|
14765 | ctx.value.stroke();
|
14766 | emit("signing", event);
|
14767 | };
|
14768 | const touchEnd = (event) => {
|
14769 | preventDefault(event);
|
14770 | emit("end");
|
14771 | };
|
14772 | const isCanvasEmpty = (canvas) => {
|
14773 | const empty = document.createElement("canvas");
|
14774 | empty.width = canvas.width;
|
14775 | empty.height = canvas.height;
|
14776 | if (props2.backgroundColor) {
|
14777 | const emptyCtx = empty.getContext("2d");
|
14778 | setCanvasBgColor(emptyCtx);
|
14779 | }
|
14780 | return canvas.toDataURL() === empty.toDataURL();
|
14781 | };
|
14782 | const setCanvasBgColor = (ctx2) => {
|
14783 | if (ctx2 && props2.backgroundColor) {
|
14784 | ctx2.fillStyle = props2.backgroundColor;
|
14785 | ctx2.fillRect(0, 0, canvasWidth, canvasHeight);
|
14786 | }
|
14787 | };
|
14788 | const submit = () => {
|
14789 | var _a, _b;
|
14790 | const canvas = canvasRef.value;
|
14791 | if (!canvas) {
|
14792 | return;
|
14793 | }
|
14794 | const isEmpty = isCanvasEmpty(canvas);
|
14795 | const image = isEmpty ? "" : ((_b = (_a = {
|
14796 | jpg: () => canvas.toDataURL("image/jpeg", 0.8),
|
14797 | jpeg: () => canvas.toDataURL("image/jpeg", 0.8)
|
14798 | })[props2.type]) == null ? void 0 : _b.call(_a)) || canvas.toDataURL(`image/${props2.type}`);
|
14799 | emit("submit", {
|
14800 | image,
|
14801 | canvas
|
14802 | });
|
14803 | };
|
14804 | const clear = () => {
|
14805 | if (ctx.value) {
|
14806 | ctx.value.clearRect(0, 0, canvasWidth, canvasHeight);
|
14807 | ctx.value.closePath();
|
14808 | setCanvasBgColor(ctx.value);
|
14809 | }
|
14810 | emit("clear");
|
14811 | };
|
14812 | const initialize = () => {
|
14813 | var _a, _b, _c;
|
14814 | if (isRenderCanvas && canvasRef.value) {
|
14815 | const canvas = canvasRef.value;
|
14816 | const dpr = inBrowser$1 ? window.devicePixelRatio : 1;
|
14817 | canvasWidth = canvas.width = (((_a = wrapRef.value) == null ? void 0 : _a.offsetWidth) || 0) * dpr;
|
14818 | canvasHeight = canvas.height = (((_b = wrapRef.value) == null ? void 0 : _b.offsetHeight) || 0) * dpr;
|
14819 | (_c = ctx.value) == null ? void 0 : _c.scale(dpr, dpr);
|
14820 | setCanvasBgColor(ctx.value);
|
14821 | }
|
14822 | };
|
14823 | const resize = () => {
|
14824 | if (ctx.value) {
|
14825 | const data = ctx.value.getImageData(0, 0, canvasWidth, canvasHeight);
|
14826 | initialize();
|
14827 | ctx.value.putImageData(data, 0, 0);
|
14828 | }
|
14829 | };
|
14830 | vue.watch(windowWidth, resize);
|
14831 | vue.onMounted(initialize);
|
14832 | useExpose({
|
14833 | resize,
|
14834 | clear,
|
14835 | submit
|
14836 | });
|
14837 | return () => vue.createVNode("div", {
|
14838 | "class": bem$i()
|
14839 | }, [vue.createVNode("div", {
|
14840 | "class": bem$i("content"),
|
14841 | "ref": wrapRef
|
14842 | }, [isRenderCanvas ? vue.createVNode("canvas", {
|
14843 | "ref": canvasRef,
|
14844 | "onTouchstartPassive": touchStart,
|
14845 | "onTouchmove": touchMove,
|
14846 | "onTouchend": touchEnd
|
14847 | }, null) : vue.createVNode("p", null, [props2.tips])]), vue.createVNode("div", {
|
14848 | "class": bem$i("footer")
|
14849 | }, [vue.createVNode(Button, {
|
14850 | "size": "small",
|
14851 | "onClick": clear
|
14852 | }, {
|
14853 | default: () => [props2.clearButtonText || t$2("clear")]
|
14854 | }), vue.createVNode(Button, {
|
14855 | "type": "primary",
|
14856 | "size": "small",
|
14857 | "onClick": submit
|
14858 | }, {
|
14859 | default: () => [props2.confirmButtonText || t$2("confirm")]
|
14860 | })])]);
|
14861 | }
|
14862 | });
|
14863 | const Signature = withInstall(stdin_default$r);
|
14864 | const [name$i, bem$h] = createNamespace("skeleton-title");
|
14865 | const skeletonTitleProps = {
|
14866 | round: Boolean,
|
14867 | titleWidth: numericProp
|
14868 | };
|
14869 | var stdin_default$q = vue.defineComponent({
|
14870 | name: name$i,
|
14871 | props: skeletonTitleProps,
|
14872 | setup(props2) {
|
14873 | return () => vue.createVNode("h3", {
|
14874 | "class": bem$h([{
|
14875 | round: props2.round
|
14876 | }]),
|
14877 | "style": {
|
14878 | width: addUnit(props2.titleWidth)
|
14879 | }
|
14880 | }, null);
|
14881 | }
|
14882 | });
|
14883 | const SkeletonTitle = withInstall(stdin_default$q);
|
14884 | var stdin_default$p = SkeletonTitle;
|
14885 | const [name$h, bem$g] = createNamespace("skeleton-avatar");
|
14886 | const skeletonAvatarProps = {
|
14887 | avatarSize: numericProp,
|
14888 | avatarShape: makeStringProp("round")
|
14889 | };
|
14890 | var stdin_default$o = vue.defineComponent({
|
14891 | name: name$h,
|
14892 | props: skeletonAvatarProps,
|
14893 | setup(props2) {
|
14894 | return () => vue.createVNode("div", {
|
14895 | "class": bem$g([props2.avatarShape]),
|
14896 | "style": getSizeStyle(props2.avatarSize)
|
14897 | }, null);
|
14898 | }
|
14899 | });
|
14900 | const SkeletonAvatar = withInstall(stdin_default$o);
|
14901 | var stdin_default$n = SkeletonAvatar;
|
14902 | const DEFAULT_ROW_WIDTH = "100%";
|
14903 | const skeletonParagraphProps = {
|
14904 | round: Boolean,
|
14905 | rowWidth: {
|
14906 | type: numericProp,
|
14907 | default: DEFAULT_ROW_WIDTH
|
14908 | }
|
14909 | };
|
14910 | const [name$g, bem$f] = createNamespace("skeleton-paragraph");
|
14911 | var stdin_default$m = vue.defineComponent({
|
14912 | name: name$g,
|
14913 | props: skeletonParagraphProps,
|
14914 | setup(props2) {
|
14915 | return () => vue.createVNode("div", {
|
14916 | "class": bem$f([{
|
14917 | round: props2.round
|
14918 | }]),
|
14919 | "style": {
|
14920 | width: props2.rowWidth
|
14921 | }
|
14922 | }, null);
|
14923 | }
|
14924 | });
|
14925 | const SkeletonParagraph = withInstall(stdin_default$m);
|
14926 | var stdin_default$l = SkeletonParagraph;
|
14927 | const [name$f, bem$e] = createNamespace("skeleton");
|
14928 | const DEFAULT_LAST_ROW_WIDTH = "60%";
|
14929 | const skeletonProps = {
|
14930 | row: makeNumericProp(0),
|
14931 | round: Boolean,
|
14932 | title: Boolean,
|
14933 | titleWidth: numericProp,
|
14934 | avatar: Boolean,
|
14935 | avatarSize: numericProp,
|
14936 | avatarShape: makeStringProp("round"),
|
14937 | loading: truthProp,
|
14938 | animate: truthProp,
|
14939 | rowWidth: {
|
14940 | type: [Number, String, Array],
|
14941 | default: DEFAULT_ROW_WIDTH
|
14942 | }
|
14943 | };
|
14944 | var stdin_default$k = vue.defineComponent({
|
14945 | name: name$f,
|
14946 | inheritAttrs: false,
|
14947 | props: skeletonProps,
|
14948 | setup(props2, {
|
14949 | slots,
|
14950 | attrs
|
14951 | }) {
|
14952 | const renderAvatar = () => {
|
14953 | if (props2.avatar) {
|
14954 | return vue.createVNode(stdin_default$n, {
|
14955 | "avatarShape": props2.avatarShape,
|
14956 | "avatarSize": props2.avatarSize
|
14957 | }, null);
|
14958 | }
|
14959 | };
|
14960 | const renderTitle = () => {
|
14961 | if (props2.title) {
|
14962 | return vue.createVNode(stdin_default$p, {
|
14963 | "round": props2.round,
|
14964 | "titleWidth": props2.titleWidth
|
14965 | }, null);
|
14966 | }
|
14967 | };
|
14968 | const getRowWidth = (index) => {
|
14969 | const {
|
14970 | rowWidth
|
14971 | } = props2;
|
14972 | if (rowWidth === DEFAULT_ROW_WIDTH && index === +props2.row - 1) {
|
14973 | return DEFAULT_LAST_ROW_WIDTH;
|
14974 | }
|
14975 | if (Array.isArray(rowWidth)) {
|
14976 | return rowWidth[index];
|
14977 | }
|
14978 | return rowWidth;
|
14979 | };
|
14980 | const renderRows = () => Array(+props2.row).fill("").map((_, i) => vue.createVNode(stdin_default$l, {
|
14981 | "key": i,
|
14982 | "round": props2.round,
|
14983 | "rowWidth": addUnit(getRowWidth(i))
|
14984 | }, null));
|
14985 | const renderContents = () => {
|
14986 | if (slots.template) {
|
14987 | return slots.template();
|
14988 | }
|
14989 | return vue.createVNode(vue.Fragment, null, [renderAvatar(), vue.createVNode("div", {
|
14990 | "class": bem$e("content")
|
14991 | }, [renderTitle(), renderRows()])]);
|
14992 | };
|
14993 | return () => {
|
14994 | var _a;
|
14995 | if (!props2.loading) {
|
14996 | return (_a = slots.default) == null ? void 0 : _a.call(slots);
|
14997 | }
|
14998 | return vue.createVNode("div", vue.mergeProps({
|
14999 | "class": bem$e({
|
15000 | animate: props2.animate,
|
15001 | round: props2.round
|
15002 | })
|
15003 | }, attrs), [renderContents()]);
|
15004 | };
|
15005 | }
|
15006 | });
|
15007 | const Skeleton = withInstall(stdin_default$k);
|
15008 | const [name$e, bem$d] = createNamespace("skeleton-image");
|
15009 | const skeletonImageProps = {
|
15010 | imageSize: numericProp,
|
15011 | imageShape: makeStringProp("square")
|
15012 | };
|
15013 | var stdin_default$j = vue.defineComponent({
|
15014 | name: name$e,
|
15015 | props: skeletonImageProps,
|
15016 | setup(props2) {
|
15017 | return () => vue.createVNode("div", {
|
15018 | "class": bem$d([props2.imageShape]),
|
15019 | "style": getSizeStyle(props2.imageSize)
|
15020 | }, [vue.createVNode(Icon, {
|
15021 | "name": "photo",
|
15022 | "class": bem$d("icon")
|
15023 | }, null)]);
|
15024 | }
|
15025 | });
|
15026 | const SkeletonImage = withInstall(stdin_default$j);
|
15027 | const [name$d, bem$c] = createNamespace("slider");
|
15028 | const sliderProps = {
|
15029 | min: makeNumericProp(0),
|
15030 | max: makeNumericProp(100),
|
15031 | step: makeNumericProp(1),
|
15032 | range: Boolean,
|
15033 | reverse: Boolean,
|
15034 | disabled: Boolean,
|
15035 | readonly: Boolean,
|
15036 | vertical: Boolean,
|
15037 | barHeight: numericProp,
|
15038 | buttonSize: numericProp,
|
15039 | activeColor: String,
|
15040 | inactiveColor: String,
|
15041 | modelValue: {
|
15042 | type: [Number, Array],
|
15043 | default: 0
|
15044 | }
|
15045 | };
|
15046 | var stdin_default$i = vue.defineComponent({
|
15047 | name: name$d,
|
15048 | props: sliderProps,
|
15049 | emits: ["change", "dragEnd", "dragStart", "update:modelValue"],
|
15050 | setup(props2, {
|
15051 | emit,
|
15052 | slots
|
15053 | }) {
|
15054 | let buttonIndex;
|
15055 | let current2;
|
15056 | let startValue;
|
15057 | const root = vue.ref();
|
15058 | const slider = [vue.ref(), vue.ref()];
|
15059 | const dragStatus = vue.ref();
|
15060 | const touch = useTouch();
|
15061 | const scope = vue.computed(() => Number(props2.max) - Number(props2.min));
|
15062 | const wrapperStyle = vue.computed(() => {
|
15063 | const crossAxis = props2.vertical ? "width" : "height";
|
15064 | return {
|
15065 | background: props2.inactiveColor,
|
15066 | [crossAxis]: addUnit(props2.barHeight)
|
15067 | };
|
15068 | });
|
15069 | const isRange = (val) => props2.range && Array.isArray(val);
|
15070 | const calcMainAxis = () => {
|
15071 | const {
|
15072 | modelValue,
|
15073 | min
|
15074 | } = props2;
|
15075 | if (isRange(modelValue)) {
|
15076 | return `${(modelValue[1] - modelValue[0]) * 100 / scope.value}%`;
|
15077 | }
|
15078 | return `${(modelValue - Number(min)) * 100 / scope.value}%`;
|
15079 | };
|
15080 | const calcOffset = () => {
|
15081 | const {
|
15082 | modelValue,
|
15083 | min
|
15084 | } = props2;
|
15085 | if (isRange(modelValue)) {
|
15086 | return `${(modelValue[0] - Number(min)) * 100 / scope.value}%`;
|
15087 | }
|
15088 | return "0%";
|
15089 | };
|
15090 | const barStyle = vue.computed(() => {
|
15091 | const mainAxis = props2.vertical ? "height" : "width";
|
15092 | const style = {
|
15093 | [mainAxis]: calcMainAxis(),
|
15094 | background: props2.activeColor
|
15095 | };
|
15096 | if (dragStatus.value) {
|
15097 | style.transition = "none";
|
15098 | }
|
15099 | const getPositionKey = () => {
|
15100 | if (props2.vertical) {
|
15101 | return props2.reverse ? "bottom" : "top";
|
15102 | }
|
15103 | return props2.reverse ? "right" : "left";
|
15104 | };
|
15105 | style[getPositionKey()] = calcOffset();
|
15106 | return style;
|
15107 | });
|
15108 | const format2 = (value) => {
|
15109 | const min = +props2.min;
|
15110 | const max = +props2.max;
|
15111 | const step = +props2.step;
|
15112 | value = clamp(value, min, max);
|
15113 | const diff = Math.round((value - min) / step) * step;
|
15114 | return addNumber(min, diff);
|
15115 | };
|
15116 | const updateStartValue = () => {
|
15117 | const current22 = props2.modelValue;
|
15118 | if (isRange(current22)) {
|
15119 | startValue = current22.map(format2);
|
15120 | } else {
|
15121 | startValue = format2(current22);
|
15122 | }
|
15123 | };
|
15124 | const handleRangeValue = (value) => {
|
15125 | var _a, _b;
|
15126 | const left2 = (_a = value[0]) != null ? _a : Number(props2.min);
|
15127 | const right2 = (_b = value[1]) != null ? _b : Number(props2.max);
|
15128 | return left2 > right2 ? [right2, left2] : [left2, right2];
|
15129 | };
|
15130 | const updateValue = (value, end2) => {
|
15131 | if (isRange(value)) {
|
15132 | value = handleRangeValue(value).map(format2);
|
15133 | } else {
|
15134 | value = format2(value);
|
15135 | }
|
15136 | if (!isSameValue(value, props2.modelValue)) {
|
15137 | emit("update:modelValue", value);
|
15138 | }
|
15139 | if (end2 && !isSameValue(value, startValue)) {
|
15140 | emit("change", value);
|
15141 | }
|
15142 | };
|
15143 | const onClick = (event) => {
|
15144 | event.stopPropagation();
|
15145 | if (props2.disabled || props2.readonly) {
|
15146 | return;
|
15147 | }
|
15148 | updateStartValue();
|
15149 | const {
|
15150 | min,
|
15151 | reverse,
|
15152 | vertical,
|
15153 | modelValue
|
15154 | } = props2;
|
15155 | const rect = useRect(root);
|
15156 | const getDelta = () => {
|
15157 | if (vertical) {
|
15158 | if (reverse) {
|
15159 | return rect.bottom - event.clientY;
|
15160 | }
|
15161 | return event.clientY - rect.top;
|
15162 | }
|
15163 | if (reverse) {
|
15164 | return rect.right - event.clientX;
|
15165 | }
|
15166 | return event.clientX - rect.left;
|
15167 | };
|
15168 | const total = vertical ? rect.height : rect.width;
|
15169 | const value = Number(min) + getDelta() / total * scope.value;
|
15170 | if (isRange(modelValue)) {
|
15171 | const [left2, right2] = modelValue;
|
15172 | const middle = (left2 + right2) / 2;
|
15173 | if (value <= middle) {
|
15174 | updateValue([value, right2], true);
|
15175 | } else {
|
15176 | updateValue([left2, value], true);
|
15177 | }
|
15178 | } else {
|
15179 | updateValue(value, true);
|
15180 | }
|
15181 | };
|
15182 | const onTouchStart = (event) => {
|
15183 | if (props2.disabled || props2.readonly) {
|
15184 | return;
|
15185 | }
|
15186 | touch.start(event);
|
15187 | current2 = props2.modelValue;
|
15188 | updateStartValue();
|
15189 | dragStatus.value = "start";
|
15190 | };
|
15191 | const onTouchMove = (event) => {
|
15192 | if (props2.disabled || props2.readonly) {
|
15193 | return;
|
15194 | }
|
15195 | if (dragStatus.value === "start") {
|
15196 | emit("dragStart", event);
|
15197 | }
|
15198 | preventDefault(event, true);
|
15199 | touch.move(event);
|
15200 | dragStatus.value = "dragging";
|
15201 | const rect = useRect(root);
|
15202 | const delta = props2.vertical ? touch.deltaY.value : touch.deltaX.value;
|
15203 | const total = props2.vertical ? rect.height : rect.width;
|
15204 | let diff = delta / total * scope.value;
|
15205 | if (props2.reverse) {
|
15206 | diff = -diff;
|
15207 | }
|
15208 | if (isRange(startValue)) {
|
15209 | const index = props2.reverse ? 1 - buttonIndex : buttonIndex;
|
15210 | current2[index] = startValue[index] + diff;
|
15211 | } else {
|
15212 | current2 = startValue + diff;
|
15213 | }
|
15214 | updateValue(current2);
|
15215 | };
|
15216 | const onTouchEnd = (event) => {
|
15217 | if (props2.disabled || props2.readonly) {
|
15218 | return;
|
15219 | }
|
15220 | if (dragStatus.value === "dragging") {
|
15221 | updateValue(current2, true);
|
15222 | emit("dragEnd", event);
|
15223 | }
|
15224 | dragStatus.value = "";
|
15225 | };
|
15226 | const getButtonClassName = (index) => {
|
15227 | if (typeof index === "number") {
|
15228 | const position = ["left", "right"];
|
15229 | return bem$c(`button-wrapper`, position[index]);
|
15230 | }
|
15231 | return bem$c("button-wrapper", props2.reverse ? "left" : "right");
|
15232 | };
|
15233 | const renderButtonContent = (value, index) => {
|
15234 | const dragging = dragStatus.value === "dragging";
|
15235 | if (typeof index === "number") {
|
15236 | const slot = slots[index === 0 ? "left-button" : "right-button"];
|
15237 | let dragIndex;
|
15238 | if (dragging && Array.isArray(current2)) {
|
15239 | dragIndex = current2[0] > current2[1] ? buttonIndex ^ 1 : buttonIndex;
|
15240 | }
|
15241 | if (slot) {
|
15242 | return slot({
|
15243 | value,
|
15244 | dragging,
|
15245 | dragIndex
|
15246 | });
|
15247 | }
|
15248 | }
|
15249 | if (slots.button) {
|
15250 | return slots.button({
|
15251 | value,
|
15252 | dragging
|
15253 | });
|
15254 | }
|
15255 | return vue.createVNode("div", {
|
15256 | "class": bem$c("button"),
|
15257 | "style": getSizeStyle(props2.buttonSize)
|
15258 | }, null);
|
15259 | };
|
15260 | const renderButton = (index) => {
|
15261 | const current22 = typeof index === "number" ? props2.modelValue[index] : props2.modelValue;
|
15262 | return vue.createVNode("div", {
|
15263 | "ref": slider[index != null ? index : 0],
|
15264 | "role": "slider",
|
15265 | "class": getButtonClassName(index),
|
15266 | "tabindex": props2.disabled ? void 0 : 0,
|
15267 | "aria-valuemin": props2.min,
|
15268 | "aria-valuenow": current22,
|
15269 | "aria-valuemax": props2.max,
|
15270 | "aria-disabled": props2.disabled || void 0,
|
15271 | "aria-readonly": props2.readonly || void 0,
|
15272 | "aria-orientation": props2.vertical ? "vertical" : "horizontal",
|
15273 | "onTouchstartPassive": (event) => {
|
15274 | if (typeof index === "number") {
|
15275 | buttonIndex = index;
|
15276 | }
|
15277 | onTouchStart(event);
|
15278 | },
|
15279 | "onTouchend": onTouchEnd,
|
15280 | "onTouchcancel": onTouchEnd,
|
15281 | "onClick": stopPropagation
|
15282 | }, [renderButtonContent(current22, index)]);
|
15283 | };
|
15284 | updateValue(props2.modelValue);
|
15285 | useCustomFieldValue(() => props2.modelValue);
|
15286 | slider.forEach((item) => {
|
15287 | useEventListener("touchmove", onTouchMove, {
|
15288 | target: item
|
15289 | });
|
15290 | });
|
15291 | return () => vue.createVNode("div", {
|
15292 | "ref": root,
|
15293 | "style": wrapperStyle.value,
|
15294 | "class": bem$c({
|
15295 | vertical: props2.vertical,
|
15296 | disabled: props2.disabled
|
15297 | }),
|
15298 | "onClick": onClick
|
15299 | }, [vue.createVNode("div", {
|
15300 | "class": bem$c("bar"),
|
15301 | "style": barStyle.value
|
15302 | }, [props2.range ? [renderButton(0), renderButton(1)] : renderButton()])]);
|
15303 | }
|
15304 | });
|
15305 | const Slider = withInstall(stdin_default$i);
|
15306 | const [name$c, bem$b] = createNamespace("space");
|
15307 | const spaceProps = {
|
15308 | align: String,
|
15309 | direction: {
|
15310 | type: String,
|
15311 | default: "horizontal"
|
15312 | },
|
15313 | size: {
|
15314 | type: [Number, String, Array],
|
15315 | default: 8
|
15316 | },
|
15317 | wrap: Boolean,
|
15318 | fill: Boolean
|
15319 | };
|
15320 | function filterEmpty(children = []) {
|
15321 | const nodes = [];
|
15322 | children.forEach((child) => {
|
15323 | if (Array.isArray(child)) {
|
15324 | nodes.push(...child);
|
15325 | } else if (child.type === vue.Fragment) {
|
15326 | nodes.push(...filterEmpty(child.children));
|
15327 | } else {
|
15328 | nodes.push(child);
|
15329 | }
|
15330 | });
|
15331 | return nodes.filter((c) => {
|
15332 | var _a;
|
15333 | return !(c && (c.type === vue.Comment || c.type === vue.Fragment && ((_a = c.children) == null ? void 0 : _a.length) === 0 || c.type === vue.Text && c.children.trim() === ""));
|
15334 | });
|
15335 | }
|
15336 | var stdin_default$h = vue.defineComponent({
|
15337 | name: name$c,
|
15338 | props: spaceProps,
|
15339 | setup(props2, {
|
15340 | slots
|
15341 | }) {
|
15342 | const mergedAlign = vue.computed(() => {
|
15343 | var _a;
|
15344 | return (_a = props2.align) != null ? _a : props2.direction === "horizontal" ? "center" : "";
|
15345 | });
|
15346 | const getMargin = (size) => {
|
15347 | if (typeof size === "number") {
|
15348 | return size + "px";
|
15349 | }
|
15350 | return size;
|
15351 | };
|
15352 | const getMarginStyle = (isLast) => {
|
15353 | const style = {};
|
15354 | const marginRight = `${getMargin(Array.isArray(props2.size) ? props2.size[0] : props2.size)}`;
|
15355 | const marginBottom = `${getMargin(Array.isArray(props2.size) ? props2.size[1] : props2.size)}`;
|
15356 | if (isLast) {
|
15357 | return props2.wrap ? {
|
15358 | marginBottom
|
15359 | } : {};
|
15360 | }
|
15361 | if (props2.direction === "horizontal") {
|
15362 | style.marginRight = marginRight;
|
15363 | }
|
15364 | if (props2.direction === "vertical" || props2.wrap) {
|
15365 | style.marginBottom = marginBottom;
|
15366 | }
|
15367 | return style;
|
15368 | };
|
15369 | return () => {
|
15370 | var _a;
|
15371 | const children = filterEmpty((_a = slots.default) == null ? void 0 : _a.call(slots));
|
15372 | return vue.createVNode("div", {
|
15373 | "class": [bem$b({
|
15374 | [props2.direction]: props2.direction,
|
15375 | [`align-${mergedAlign.value}`]: mergedAlign.value,
|
15376 | wrap: props2.wrap,
|
15377 | fill: props2.fill
|
15378 | })]
|
15379 | }, [children.map((c, i) => vue.createVNode("div", {
|
15380 | "key": `item-${i}`,
|
15381 | "class": `${name$c}-item`,
|
15382 | "style": getMarginStyle(i === children.length - 1)
|
15383 | }, [c]))]);
|
15384 | };
|
15385 | }
|
15386 | });
|
15387 | const Space = withInstall(stdin_default$h);
|
15388 | const [name$b, bem$a] = createNamespace("steps");
|
15389 | const stepsProps = {
|
15390 | active: makeNumericProp(0),
|
15391 | direction: makeStringProp("horizontal"),
|
15392 | activeIcon: makeStringProp("checked"),
|
15393 | iconPrefix: String,
|
15394 | finishIcon: String,
|
15395 | activeColor: String,
|
15396 | inactiveIcon: String,
|
15397 | inactiveColor: String
|
15398 | };
|
15399 | const STEPS_KEY = Symbol(name$b);
|
15400 | var stdin_default$g = vue.defineComponent({
|
15401 | name: name$b,
|
15402 | props: stepsProps,
|
15403 | emits: ["clickStep"],
|
15404 | setup(props2, {
|
15405 | emit,
|
15406 | slots
|
15407 | }) {
|
15408 | const {
|
15409 | linkChildren
|
15410 | } = useChildren(STEPS_KEY);
|
15411 | const onClickStep = (index) => emit("clickStep", index);
|
15412 | linkChildren({
|
15413 | props: props2,
|
15414 | onClickStep
|
15415 | });
|
15416 | return () => {
|
15417 | var _a;
|
15418 | return vue.createVNode("div", {
|
15419 | "class": bem$a([props2.direction])
|
15420 | }, [vue.createVNode("div", {
|
15421 | "class": bem$a("items")
|
15422 | }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])]);
|
15423 | };
|
15424 | }
|
15425 | });
|
15426 | const [name$a, bem$9] = createNamespace("step");
|
15427 | var stdin_default$f = vue.defineComponent({
|
15428 | name: name$a,
|
15429 | setup(props2, {
|
15430 | slots
|
15431 | }) {
|
15432 | const {
|
15433 | parent,
|
15434 | index
|
15435 | } = useParent(STEPS_KEY);
|
15436 | if (!parent) {
|
15437 | return;
|
15438 | }
|
15439 | const parentProps = parent.props;
|
15440 | const getStatus = () => {
|
15441 | const active = +parentProps.active;
|
15442 | if (index.value < active) {
|
15443 | return "finish";
|
15444 | }
|
15445 | return index.value === active ? "process" : "waiting";
|
15446 | };
|
15447 | const isActive = () => getStatus() === "process";
|
15448 | const lineStyle = vue.computed(() => ({
|
15449 | background: getStatus() === "finish" ? parentProps.activeColor : parentProps.inactiveColor
|
15450 | }));
|
15451 | const titleStyle = vue.computed(() => {
|
15452 | if (isActive()) {
|
15453 | return {
|
15454 | color: parentProps.activeColor
|
15455 | };
|
15456 | }
|
15457 | if (getStatus() === "waiting") {
|
15458 | return {
|
15459 | color: parentProps.inactiveColor
|
15460 | };
|
15461 | }
|
15462 | });
|
15463 | const onClickStep = () => parent.onClickStep(index.value);
|
15464 | const renderCircle = () => {
|
15465 | const {
|
15466 | iconPrefix,
|
15467 | finishIcon,
|
15468 | activeIcon,
|
15469 | activeColor,
|
15470 | inactiveIcon
|
15471 | } = parentProps;
|
15472 | if (isActive()) {
|
15473 | if (slots["active-icon"]) {
|
15474 | return slots["active-icon"]();
|
15475 | }
|
15476 | return vue.createVNode(Icon, {
|
15477 | "class": bem$9("icon", "active"),
|
15478 | "name": activeIcon,
|
15479 | "color": activeColor,
|
15480 | "classPrefix": iconPrefix
|
15481 | }, null);
|
15482 | }
|
15483 | if (getStatus() === "finish" && (finishIcon || slots["finish-icon"])) {
|
15484 | if (slots["finish-icon"]) {
|
15485 | return slots["finish-icon"]();
|
15486 | }
|
15487 | return vue.createVNode(Icon, {
|
15488 | "class": bem$9("icon", "finish"),
|
15489 | "name": finishIcon,
|
15490 | "color": activeColor,
|
15491 | "classPrefix": iconPrefix
|
15492 | }, null);
|
15493 | }
|
15494 | if (slots["inactive-icon"]) {
|
15495 | return slots["inactive-icon"]();
|
15496 | }
|
15497 | if (inactiveIcon) {
|
15498 | return vue.createVNode(Icon, {
|
15499 | "class": bem$9("icon"),
|
15500 | "name": inactiveIcon,
|
15501 | "classPrefix": iconPrefix
|
15502 | }, null);
|
15503 | }
|
15504 | return vue.createVNode("i", {
|
15505 | "class": bem$9("circle"),
|
15506 | "style": lineStyle.value
|
15507 | }, null);
|
15508 | };
|
15509 | return () => {
|
15510 | var _a;
|
15511 | const status = getStatus();
|
15512 | return vue.createVNode("div", {
|
15513 | "class": [BORDER, bem$9([parentProps.direction, {
|
15514 | [status]: status
|
15515 | }])]
|
15516 | }, [vue.createVNode("div", {
|
15517 | "class": bem$9("title", {
|
15518 | active: isActive()
|
15519 | }),
|
15520 | "style": titleStyle.value,
|
15521 | "onClick": onClickStep
|
15522 | }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]), vue.createVNode("div", {
|
15523 | "class": bem$9("circle-container"),
|
15524 | "onClick": onClickStep
|
15525 | }, [renderCircle()]), vue.createVNode("div", {
|
15526 | "class": bem$9("line"),
|
15527 | "style": lineStyle.value
|
15528 | }, null)]);
|
15529 | };
|
15530 | }
|
15531 | });
|
15532 | const Step = withInstall(stdin_default$f);
|
15533 | const [name$9, bem$8] = createNamespace("stepper");
|
15534 | const LONG_PRESS_INTERVAL = 200;
|
15535 | const isEqual = (value1, value2) => String(value1) === String(value2);
|
15536 | const stepperProps = {
|
15537 | min: makeNumericProp(1),
|
15538 | max: makeNumericProp(Infinity),
|
15539 | name: makeNumericProp(""),
|
15540 | step: makeNumericProp(1),
|
15541 | theme: String,
|
15542 | integer: Boolean,
|
15543 | disabled: Boolean,
|
15544 | showPlus: truthProp,
|
15545 | showMinus: truthProp,
|
15546 | showInput: truthProp,
|
15547 | longPress: truthProp,
|
15548 | autoFixed: truthProp,
|
15549 | allowEmpty: Boolean,
|
15550 | modelValue: numericProp,
|
15551 | inputWidth: numericProp,
|
15552 | buttonSize: numericProp,
|
15553 | placeholder: String,
|
15554 | disablePlus: Boolean,
|
15555 | disableMinus: Boolean,
|
15556 | disableInput: Boolean,
|
15557 | beforeChange: Function,
|
15558 | defaultValue: makeNumericProp(1),
|
15559 | decimalLength: numericProp
|
15560 | };
|
15561 | var stdin_default$e = vue.defineComponent({
|
15562 | name: name$9,
|
15563 | props: stepperProps,
|
15564 | emits: ["plus", "blur", "minus", "focus", "change", "overlimit", "update:modelValue"],
|
15565 | setup(props2, {
|
15566 | emit
|
15567 | }) {
|
15568 | const format2 = (value, autoFixed = true) => {
|
15569 | const {
|
15570 | min,
|
15571 | max,
|
15572 | allowEmpty,
|
15573 | decimalLength
|
15574 | } = props2;
|
15575 | if (allowEmpty && value === "") {
|
15576 | return value;
|
15577 | }
|
15578 | value = formatNumber(String(value), !props2.integer);
|
15579 | value = value === "" ? 0 : +value;
|
15580 | value = Number.isNaN(value) ? +min : value;
|
15581 | value = autoFixed ? Math.max(Math.min(+max, value), +min) : value;
|
15582 | if (isDef(decimalLength)) {
|
15583 | value = value.toFixed(+decimalLength);
|
15584 | }
|
15585 | return value;
|
15586 | };
|
15587 | const getInitialValue = () => {
|
15588 | var _a;
|
15589 | const defaultValue = (_a = props2.modelValue) != null ? _a : props2.defaultValue;
|
15590 | const value = format2(defaultValue);
|
15591 | if (!isEqual(value, props2.modelValue)) {
|
15592 | emit("update:modelValue", value);
|
15593 | }
|
15594 | return value;
|
15595 | };
|
15596 | let actionType;
|
15597 | const inputRef = vue.ref();
|
15598 | const current2 = vue.ref(getInitialValue());
|
15599 | const minusDisabled = vue.computed(() => props2.disabled || props2.disableMinus || +current2.value <= +props2.min);
|
15600 | const plusDisabled = vue.computed(() => props2.disabled || props2.disablePlus || +current2.value >= +props2.max);
|
15601 | const inputStyle = vue.computed(() => ({
|
15602 | width: addUnit(props2.inputWidth),
|
15603 | height: addUnit(props2.buttonSize)
|
15604 | }));
|
15605 | const buttonStyle = vue.computed(() => getSizeStyle(props2.buttonSize));
|
15606 | const check = () => {
|
15607 | const value = format2(current2.value);
|
15608 | if (!isEqual(value, current2.value)) {
|
15609 | current2.value = value;
|
15610 | }
|
15611 | };
|
15612 | const setValue = (value) => {
|
15613 | if (props2.beforeChange) {
|
15614 | callInterceptor(props2.beforeChange, {
|
15615 | args: [value],
|
15616 | done() {
|
15617 | current2.value = value;
|
15618 | }
|
15619 | });
|
15620 | } else {
|
15621 | current2.value = value;
|
15622 | }
|
15623 | };
|
15624 | const onChange = () => {
|
15625 | if (actionType === "plus" && plusDisabled.value || actionType === "minus" && minusDisabled.value) {
|
15626 | emit("overlimit", actionType);
|
15627 | return;
|
15628 | }
|
15629 | const diff = actionType === "minus" ? -props2.step : +props2.step;
|
15630 | const value = format2(addNumber(+current2.value, diff));
|
15631 | setValue(value);
|
15632 | emit(actionType);
|
15633 | };
|
15634 | const onInput = (event) => {
|
15635 | const input = event.target;
|
15636 | const {
|
15637 | value
|
15638 | } = input;
|
15639 | const {
|
15640 | decimalLength
|
15641 | } = props2;
|
15642 | let formatted = formatNumber(String(value), !props2.integer);
|
15643 | if (isDef(decimalLength) && formatted.includes(".")) {
|
15644 | const pair = formatted.split(".");
|
15645 | formatted = `${pair[0]}.${pair[1].slice(0, +decimalLength)}`;
|
15646 | }
|
15647 | if (props2.beforeChange) {
|
15648 | input.value = String(current2.value);
|
15649 | } else if (!isEqual(value, formatted)) {
|
15650 | input.value = formatted;
|
15651 | }
|
15652 | const isNumeric2 = formatted === String(+formatted);
|
15653 | setValue(isNumeric2 ? +formatted : formatted);
|
15654 | };
|
15655 | const onFocus = (event) => {
|
15656 | var _a;
|
15657 | if (props2.disableInput) {
|
15658 | (_a = inputRef.value) == null ? void 0 : _a.blur();
|
15659 | } else {
|
15660 | emit("focus", event);
|
15661 | }
|
15662 | };
|
15663 | const onBlur = (event) => {
|
15664 | const input = event.target;
|
15665 | const value = format2(input.value, props2.autoFixed);
|
15666 | input.value = String(value);
|
15667 | current2.value = value;
|
15668 | vue.nextTick(() => {
|
15669 | emit("blur", event);
|
15670 | resetScroll();
|
15671 | });
|
15672 | };
|
15673 | let isLongPress;
|
15674 | let longPressTimer;
|
15675 | const longPressStep = () => {
|
15676 | longPressTimer = setTimeout(() => {
|
15677 | onChange();
|
15678 | longPressStep();
|
15679 | }, LONG_PRESS_INTERVAL);
|
15680 | };
|
15681 | const onTouchStart = () => {
|
15682 | if (props2.longPress) {
|
15683 | isLongPress = false;
|
15684 | clearTimeout(longPressTimer);
|
15685 | longPressTimer = setTimeout(() => {
|
15686 | isLongPress = true;
|
15687 | onChange();
|
15688 | longPressStep();
|
15689 | }, LONG_PRESS_START_TIME);
|
15690 | }
|
15691 | };
|
15692 | const onTouchEnd = (event) => {
|
15693 | if (props2.longPress) {
|
15694 | clearTimeout(longPressTimer);
|
15695 | if (isLongPress) {
|
15696 | preventDefault(event);
|
15697 | }
|
15698 | }
|
15699 | };
|
15700 | const onMousedown = (event) => {
|
15701 | if (props2.disableInput) {
|
15702 | preventDefault(event);
|
15703 | }
|
15704 | };
|
15705 | const createListeners = (type) => ({
|
15706 | onClick: (event) => {
|
15707 | preventDefault(event);
|
15708 | actionType = type;
|
15709 | onChange();
|
15710 | },
|
15711 | onTouchstartPassive: () => {
|
15712 | actionType = type;
|
15713 | onTouchStart();
|
15714 | },
|
15715 | onTouchend: onTouchEnd,
|
15716 | onTouchcancel: onTouchEnd
|
15717 | });
|
15718 | vue.watch(() => [props2.max, props2.min, props2.integer, props2.decimalLength], check);
|
15719 | vue.watch(() => props2.modelValue, (value) => {
|
15720 | if (!isEqual(value, current2.value)) {
|
15721 | current2.value = format2(value);
|
15722 | }
|
15723 | });
|
15724 | vue.watch(current2, (value) => {
|
15725 | emit("update:modelValue", value);
|
15726 | emit("change", value, {
|
15727 | name: props2.name
|
15728 | });
|
15729 | });
|
15730 | useCustomFieldValue(() => props2.modelValue);
|
15731 | return () => vue.createVNode("div", {
|
15732 | "role": "group",
|
15733 | "class": bem$8([props2.theme])
|
15734 | }, [vue.withDirectives(vue.createVNode("button", vue.mergeProps({
|
15735 | "type": "button",
|
15736 | "style": buttonStyle.value,
|
15737 | "class": [bem$8("minus", {
|
15738 | disabled: minusDisabled.value
|
15739 | }), {
|
15740 | [HAPTICS_FEEDBACK]: !minusDisabled.value
|
15741 | }],
|
15742 | "aria-disabled": minusDisabled.value || void 0
|
15743 | }, createListeners("minus")), null), [[vue.vShow, props2.showMinus]]), vue.withDirectives(vue.createVNode("input", {
|
15744 | "ref": inputRef,
|
15745 | "type": props2.integer ? "tel" : "text",
|
15746 | "role": "spinbutton",
|
15747 | "class": bem$8("input"),
|
15748 | "value": current2.value,
|
15749 | "style": inputStyle.value,
|
15750 | "disabled": props2.disabled,
|
15751 | "readonly": props2.disableInput,
|
15752 | "inputmode": props2.integer ? "numeric" : "decimal",
|
15753 | "placeholder": props2.placeholder,
|
15754 | "aria-valuemax": props2.max,
|
15755 | "aria-valuemin": props2.min,
|
15756 | "aria-valuenow": current2.value,
|
15757 | "onBlur": onBlur,
|
15758 | "onInput": onInput,
|
15759 | "onFocus": onFocus,
|
15760 | "onMousedown": onMousedown
|
15761 | }, null), [[vue.vShow, props2.showInput]]), vue.withDirectives(vue.createVNode("button", vue.mergeProps({
|
15762 | "type": "button",
|
15763 | "style": buttonStyle.value,
|
15764 | "class": [bem$8("plus", {
|
15765 | disabled: plusDisabled.value
|
15766 | }), {
|
15767 | [HAPTICS_FEEDBACK]: !plusDisabled.value
|
15768 | }],
|
15769 | "aria-disabled": plusDisabled.value || void 0
|
15770 | }, createListeners("plus")), null), [[vue.vShow, props2.showPlus]])]);
|
15771 | }
|
15772 | });
|
15773 | const Stepper = withInstall(stdin_default$e);
|
15774 | const Steps = withInstall(stdin_default$g);
|
15775 | const [name$8, bem$7, t$1] = createNamespace("submit-bar");
|
15776 | const submitBarProps = {
|
15777 | tip: String,
|
15778 | label: String,
|
15779 | price: Number,
|
15780 | tipIcon: String,
|
15781 | loading: Boolean,
|
15782 | currency: makeStringProp("¥"),
|
15783 | disabled: Boolean,
|
15784 | textAlign: String,
|
15785 | buttonText: String,
|
15786 | buttonType: makeStringProp("danger"),
|
15787 | buttonColor: String,
|
15788 | suffixLabel: String,
|
15789 | placeholder: Boolean,
|
15790 | decimalLength: makeNumericProp(2),
|
15791 | safeAreaInsetBottom: truthProp
|
15792 | };
|
15793 | var stdin_default$d = vue.defineComponent({
|
15794 | name: name$8,
|
15795 | props: submitBarProps,
|
15796 | emits: ["submit"],
|
15797 | setup(props2, {
|
15798 | emit,
|
15799 | slots
|
15800 | }) {
|
15801 | const root = vue.ref();
|
15802 | const renderPlaceholder = usePlaceholder(root, bem$7);
|
15803 | const renderText = () => {
|
15804 | const {
|
15805 | price,
|
15806 | label,
|
15807 | currency,
|
15808 | textAlign,
|
15809 | suffixLabel,
|
15810 | decimalLength
|
15811 | } = props2;
|
15812 | if (typeof price === "number") {
|
15813 | const pricePair = (price / 100).toFixed(+decimalLength).split(".");
|
15814 | const decimal = decimalLength ? `.${pricePair[1]}` : "";
|
15815 | return vue.createVNode("div", {
|
15816 | "class": bem$7("text"),
|
15817 | "style": {
|
15818 | textAlign
|
15819 | }
|
15820 | }, [vue.createVNode("span", null, [label || t$1("label")]), vue.createVNode("span", {
|
15821 | "class": bem$7("price")
|
15822 | }, [currency, vue.createVNode("span", {
|
15823 | "class": bem$7("price-integer")
|
15824 | }, [pricePair[0]]), decimal]), suffixLabel && vue.createVNode("span", {
|
15825 | "class": bem$7("suffix-label")
|
15826 | }, [suffixLabel])]);
|
15827 | }
|
15828 | };
|
15829 | const renderTip = () => {
|
15830 | var _a;
|
15831 | const {
|
15832 | tip,
|
15833 | tipIcon
|
15834 | } = props2;
|
15835 | if (slots.tip || tip) {
|
15836 | return vue.createVNode("div", {
|
15837 | "class": bem$7("tip")
|
15838 | }, [tipIcon && vue.createVNode(Icon, {
|
15839 | "class": bem$7("tip-icon"),
|
15840 | "name": tipIcon
|
15841 | }, null), tip && vue.createVNode("span", {
|
15842 | "class": bem$7("tip-text")
|
15843 | }, [tip]), (_a = slots.tip) == null ? void 0 : _a.call(slots)]);
|
15844 | }
|
15845 | };
|
15846 | const onClickButton = () => emit("submit");
|
15847 | const renderButton = () => {
|
15848 | if (slots.button) {
|
15849 | return slots.button();
|
15850 | }
|
15851 | return vue.createVNode(Button, {
|
15852 | "round": true,
|
15853 | "type": props2.buttonType,
|
15854 | "text": props2.buttonText,
|
15855 | "class": bem$7("button", props2.buttonType),
|
15856 | "color": props2.buttonColor,
|
15857 | "loading": props2.loading,
|
15858 | "disabled": props2.disabled,
|
15859 | "onClick": onClickButton
|
15860 | }, null);
|
15861 | };
|
15862 | const renderSubmitBar = () => {
|
15863 | var _a, _b;
|
15864 | return vue.createVNode("div", {
|
15865 | "ref": root,
|
15866 | "class": [bem$7(), {
|
15867 | "van-safe-area-bottom": props2.safeAreaInsetBottom
|
15868 | }]
|
15869 | }, [(_a = slots.top) == null ? void 0 : _a.call(slots), renderTip(), vue.createVNode("div", {
|
15870 | "class": bem$7("bar")
|
15871 | }, [(_b = slots.default) == null ? void 0 : _b.call(slots), renderText(), renderButton()])]);
|
15872 | };
|
15873 | return () => {
|
15874 | if (props2.placeholder) {
|
15875 | return renderPlaceholder(renderSubmitBar);
|
15876 | }
|
15877 | return renderSubmitBar();
|
15878 | };
|
15879 | }
|
15880 | });
|
15881 | const SubmitBar = withInstall(stdin_default$d);
|
15882 | const [name$7, bem$6] = createNamespace("swipe-cell");
|
15883 | const swipeCellProps = {
|
15884 | name: makeNumericProp(""),
|
15885 | disabled: Boolean,
|
15886 | leftWidth: numericProp,
|
15887 | rightWidth: numericProp,
|
15888 | beforeClose: Function,
|
15889 | stopPropagation: Boolean
|
15890 | };
|
15891 | var stdin_default$c = vue.defineComponent({
|
15892 | name: name$7,
|
15893 | props: swipeCellProps,
|
15894 | emits: ["open", "close", "click"],
|
15895 | setup(props2, {
|
15896 | emit,
|
15897 | slots
|
15898 | }) {
|
15899 | let opened;
|
15900 | let lockClick2;
|
15901 | let startOffset;
|
15902 | let isInBeforeClosing;
|
15903 | const root = vue.ref();
|
15904 | const leftRef = vue.ref();
|
15905 | const rightRef = vue.ref();
|
15906 | const state = vue.reactive({
|
15907 | offset: 0,
|
15908 | dragging: false
|
15909 | });
|
15910 | const touch = useTouch();
|
15911 | const getWidthByRef = (ref2) => ref2.value ? useRect(ref2).width : 0;
|
15912 | const leftWidth = vue.computed(() => isDef(props2.leftWidth) ? +props2.leftWidth : getWidthByRef(leftRef));
|
15913 | const rightWidth = vue.computed(() => isDef(props2.rightWidth) ? +props2.rightWidth : getWidthByRef(rightRef));
|
15914 | const open = (side) => {
|
15915 | state.offset = side === "left" ? leftWidth.value : -rightWidth.value;
|
15916 | if (!opened) {
|
15917 | opened = true;
|
15918 | emit("open", {
|
15919 | name: props2.name,
|
15920 | position: side
|
15921 | });
|
15922 | }
|
15923 | };
|
15924 | const close = (position) => {
|
15925 | state.offset = 0;
|
15926 | if (opened) {
|
15927 | opened = false;
|
15928 | emit("close", {
|
15929 | name: props2.name,
|
15930 | position
|
15931 | });
|
15932 | }
|
15933 | };
|
15934 | const toggle = (side) => {
|
15935 | const offset2 = Math.abs(state.offset);
|
15936 | const THRESHOLD = 0.15;
|
15937 | const threshold = opened ? 1 - THRESHOLD : THRESHOLD;
|
15938 | const width2 = side === "left" ? leftWidth.value : rightWidth.value;
|
15939 | if (width2 && offset2 > width2 * threshold) {
|
15940 | open(side);
|
15941 | } else {
|
15942 | close(side);
|
15943 | }
|
15944 | };
|
15945 | const onTouchStart = (event) => {
|
15946 | if (!props2.disabled) {
|
15947 | startOffset = state.offset;
|
15948 | touch.start(event);
|
15949 | }
|
15950 | };
|
15951 | const onTouchMove = (event) => {
|
15952 | if (props2.disabled) {
|
15953 | return;
|
15954 | }
|
15955 | const {
|
15956 | deltaX
|
15957 | } = touch;
|
15958 | touch.move(event);
|
15959 | if (touch.isHorizontal()) {
|
15960 | lockClick2 = true;
|
15961 | state.dragging = true;
|
15962 | const isEdge = !opened || deltaX.value * startOffset < 0;
|
15963 | if (isEdge) {
|
15964 | preventDefault(event, props2.stopPropagation);
|
15965 | }
|
15966 | state.offset = clamp(deltaX.value + startOffset, -rightWidth.value, leftWidth.value);
|
15967 | }
|
15968 | };
|
15969 | const onTouchEnd = () => {
|
15970 | if (state.dragging) {
|
15971 | state.dragging = false;
|
15972 | toggle(state.offset > 0 ? "left" : "right");
|
15973 | setTimeout(() => {
|
15974 | lockClick2 = false;
|
15975 | }, 0);
|
15976 | }
|
15977 | };
|
15978 | const onClick = (position = "outside") => {
|
15979 | if (isInBeforeClosing)
|
15980 | return;
|
15981 | emit("click", position);
|
15982 | if (opened && !lockClick2) {
|
15983 | isInBeforeClosing = true;
|
15984 | callInterceptor(props2.beforeClose, {
|
15985 | args: [{
|
15986 | name: props2.name,
|
15987 | position
|
15988 | }],
|
15989 | done: () => {
|
15990 | isInBeforeClosing = false;
|
15991 | close(position);
|
15992 | },
|
15993 | canceled: () => isInBeforeClosing = false,
|
15994 | error: () => isInBeforeClosing = false
|
15995 | });
|
15996 | }
|
15997 | };
|
15998 | const getClickHandler = (position, stop) => (event) => {
|
15999 | if (stop) {
|
16000 | event.stopPropagation();
|
16001 | }
|
16002 | onClick(position);
|
16003 | };
|
16004 | const renderSideContent = (side, ref2) => {
|
16005 | const contentSlot = slots[side];
|
16006 | if (contentSlot) {
|
16007 | return vue.createVNode("div", {
|
16008 | "ref": ref2,
|
16009 | "class": bem$6(side),
|
16010 | "onClick": getClickHandler(side, true)
|
16011 | }, [contentSlot()]);
|
16012 | }
|
16013 | };
|
16014 | useExpose({
|
16015 | open,
|
16016 | close
|
16017 | });
|
16018 | useClickAway(root, () => onClick("outside"), {
|
16019 | eventName: "touchstart"
|
16020 | });
|
16021 | useEventListener("touchmove", onTouchMove, {
|
16022 | target: root
|
16023 | });
|
16024 | return () => {
|
16025 | var _a;
|
16026 | const wrapperStyle = {
|
16027 | transform: `translate3d(${state.offset}px, 0, 0)`,
|
16028 | transitionDuration: state.dragging ? "0s" : ".6s"
|
16029 | };
|
16030 | return vue.createVNode("div", {
|
16031 | "ref": root,
|
16032 | "class": bem$6(),
|
16033 | "onClick": getClickHandler("cell", lockClick2),
|
16034 | "onTouchstartPassive": onTouchStart,
|
16035 | "onTouchend": onTouchEnd,
|
16036 | "onTouchcancel": onTouchEnd
|
16037 | }, [vue.createVNode("div", {
|
16038 | "class": bem$6("wrapper"),
|
16039 | "style": wrapperStyle
|
16040 | }, [renderSideContent("left", leftRef), (_a = slots.default) == null ? void 0 : _a.call(slots), renderSideContent("right", rightRef)])]);
|
16041 | };
|
16042 | }
|
16043 | });
|
16044 | const SwipeCell = withInstall(stdin_default$c);
|
16045 | const [name$6, bem$5] = createNamespace("tabbar");
|
16046 | const tabbarProps = {
|
16047 | route: Boolean,
|
16048 | fixed: truthProp,
|
16049 | border: truthProp,
|
16050 | zIndex: numericProp,
|
16051 | placeholder: Boolean,
|
16052 | activeColor: String,
|
16053 | beforeChange: Function,
|
16054 | inactiveColor: String,
|
16055 | modelValue: makeNumericProp(0),
|
16056 | safeAreaInsetBottom: {
|
16057 | type: Boolean,
|
16058 | default: null
|
16059 | }
|
16060 | };
|
16061 | const TABBAR_KEY = Symbol(name$6);
|
16062 | var stdin_default$b = vue.defineComponent({
|
16063 | name: name$6,
|
16064 | props: tabbarProps,
|
16065 | emits: ["change", "update:modelValue"],
|
16066 | setup(props2, {
|
16067 | emit,
|
16068 | slots
|
16069 | }) {
|
16070 | const root = vue.ref();
|
16071 | const {
|
16072 | linkChildren
|
16073 | } = useChildren(TABBAR_KEY);
|
16074 | const renderPlaceholder = usePlaceholder(root, bem$5);
|
16075 | const enableSafeArea = () => {
|
16076 | var _a;
|
16077 | return (_a = props2.safeAreaInsetBottom) != null ? _a : props2.fixed;
|
16078 | };
|
16079 | const renderTabbar = () => {
|
16080 | var _a;
|
16081 | const {
|
16082 | fixed,
|
16083 | zIndex,
|
16084 | border
|
16085 | } = props2;
|
16086 | return vue.createVNode("div", {
|
16087 | "ref": root,
|
16088 | "role": "tablist",
|
16089 | "style": getZIndexStyle(zIndex),
|
16090 | "class": [bem$5({
|
16091 | fixed
|
16092 | }), {
|
16093 | [BORDER_TOP_BOTTOM]: border,
|
16094 | "van-safe-area-bottom": enableSafeArea()
|
16095 | }]
|
16096 | }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
16097 | };
|
16098 | const setActive = (active, afterChange) => {
|
16099 | callInterceptor(props2.beforeChange, {
|
16100 | args: [active],
|
16101 | done() {
|
16102 | emit("update:modelValue", active);
|
16103 | emit("change", active);
|
16104 | afterChange();
|
16105 | }
|
16106 | });
|
16107 | };
|
16108 | linkChildren({
|
16109 | props: props2,
|
16110 | setActive
|
16111 | });
|
16112 | return () => {
|
16113 | if (props2.fixed && props2.placeholder) {
|
16114 | return renderPlaceholder(renderTabbar);
|
16115 | }
|
16116 | return renderTabbar();
|
16117 | };
|
16118 | }
|
16119 | });
|
16120 | const Tabbar = withInstall(stdin_default$b);
|
16121 | const [name$5, bem$4] = createNamespace("tabbar-item");
|
16122 | const tabbarItemProps = extend({}, routeProps, {
|
16123 | dot: Boolean,
|
16124 | icon: String,
|
16125 | name: numericProp,
|
16126 | badge: numericProp,
|
16127 | badgeProps: Object,
|
16128 | iconPrefix: String
|
16129 | });
|
16130 | var stdin_default$a = vue.defineComponent({
|
16131 | name: name$5,
|
16132 | props: tabbarItemProps,
|
16133 | emits: ["click"],
|
16134 | setup(props2, {
|
16135 | emit,
|
16136 | slots
|
16137 | }) {
|
16138 | const route2 = useRoute();
|
16139 | const vm = vue.getCurrentInstance().proxy;
|
16140 | const {
|
16141 | parent,
|
16142 | index
|
16143 | } = useParent(TABBAR_KEY);
|
16144 | if (!parent) {
|
16145 | return;
|
16146 | }
|
16147 | const active = vue.computed(() => {
|
16148 | var _a;
|
16149 | const {
|
16150 | route: route22,
|
16151 | modelValue
|
16152 | } = parent.props;
|
16153 | if (route22 && "$route" in vm) {
|
16154 | const {
|
16155 | $route
|
16156 | } = vm;
|
16157 | const {
|
16158 | to
|
16159 | } = props2;
|
16160 | const config = isObject$1(to) ? to : {
|
16161 | path: to
|
16162 | };
|
16163 | return !!$route.matched.find((val) => {
|
16164 | const pathMatched = "path" in config && config.path === val.path;
|
16165 | const nameMatched = "name" in config && config.name === val.name;
|
16166 | return pathMatched || nameMatched;
|
16167 | });
|
16168 | }
|
16169 | return ((_a = props2.name) != null ? _a : index.value) === modelValue;
|
16170 | });
|
16171 | const onClick = (event) => {
|
16172 | var _a;
|
16173 | if (!active.value) {
|
16174 | parent.setActive((_a = props2.name) != null ? _a : index.value, route2);
|
16175 | }
|
16176 | emit("click", event);
|
16177 | };
|
16178 | const renderIcon = () => {
|
16179 | if (slots.icon) {
|
16180 | return slots.icon({
|
16181 | active: active.value
|
16182 | });
|
16183 | }
|
16184 | if (props2.icon) {
|
16185 | return vue.createVNode(Icon, {
|
16186 | "name": props2.icon,
|
16187 | "classPrefix": props2.iconPrefix
|
16188 | }, null);
|
16189 | }
|
16190 | };
|
16191 | return () => {
|
16192 | var _a;
|
16193 | const {
|
16194 | dot,
|
16195 | badge
|
16196 | } = props2;
|
16197 | const {
|
16198 | activeColor,
|
16199 | inactiveColor
|
16200 | } = parent.props;
|
16201 | const color = active.value ? activeColor : inactiveColor;
|
16202 | return vue.createVNode("div", {
|
16203 | "role": "tab",
|
16204 | "class": bem$4({
|
16205 | active: active.value
|
16206 | }),
|
16207 | "style": {
|
16208 | color
|
16209 | },
|
16210 | "tabindex": 0,
|
16211 | "aria-selected": active.value,
|
16212 | "onClick": onClick
|
16213 | }, [vue.createVNode(Badge, vue.mergeProps({
|
16214 | "dot": dot,
|
16215 | "class": bem$4("icon"),
|
16216 | "content": badge
|
16217 | }, props2.badgeProps), {
|
16218 | default: renderIcon
|
16219 | }), vue.createVNode("div", {
|
16220 | "class": bem$4("text")
|
16221 | }, [(_a = slots.default) == null ? void 0 : _a.call(slots, {
|
16222 | active: active.value
|
16223 | })])]);
|
16224 | };
|
16225 | }
|
16226 | });
|
16227 | const TabbarItem = withInstall(stdin_default$a);
|
16228 | const [name$4, bem$3] = createNamespace("text-ellipsis");
|
16229 | const textEllipsisProps = {
|
16230 | rows: makeNumericProp(1),
|
16231 | dots: makeStringProp("..."),
|
16232 | content: makeStringProp(""),
|
16233 | expandText: makeStringProp(""),
|
16234 | collapseText: makeStringProp(""),
|
16235 | position: makeStringProp("end")
|
16236 | };
|
16237 | var stdin_default$9 = vue.defineComponent({
|
16238 | name: name$4,
|
16239 | props: textEllipsisProps,
|
16240 | emits: ["clickAction"],
|
16241 | setup(props2, {
|
16242 | emit,
|
16243 | slots
|
16244 | }) {
|
16245 | const text = vue.ref("");
|
16246 | const expanded = vue.ref(false);
|
16247 | const hasAction = vue.ref(false);
|
16248 | const root = vue.ref();
|
16249 | const actionText = vue.computed(() => expanded.value ? props2.collapseText : props2.expandText);
|
16250 | const pxToNum = (value) => {
|
16251 | if (!value)
|
16252 | return 0;
|
16253 | const match = value.match(/^\d*(\.\d*)?/);
|
16254 | return match ? Number(match[0]) : 0;
|
16255 | };
|
16256 | const calcEllipsised = () => {
|
16257 | const cloneContainer = () => {
|
16258 | if (!root.value)
|
16259 | return;
|
16260 | const originStyle = window.getComputedStyle(root.value);
|
16261 | const container2 = document.createElement("div");
|
16262 | const styleNames = Array.prototype.slice.apply(originStyle);
|
16263 | styleNames.forEach((name2) => {
|
16264 | container2.style.setProperty(name2, originStyle.getPropertyValue(name2));
|
16265 | });
|
16266 | container2.style.position = "fixed";
|
16267 | container2.style.zIndex = "-9999";
|
16268 | container2.style.top = "-9999px";
|
16269 | container2.style.height = "auto";
|
16270 | container2.style.minHeight = "auto";
|
16271 | container2.style.maxHeight = "auto";
|
16272 | container2.innerText = props2.content;
|
16273 | document.body.appendChild(container2);
|
16274 | return container2;
|
16275 | };
|
16276 | const calcEllipsisText = (container2, maxHeight2) => {
|
16277 | const {
|
16278 | content,
|
16279 | position,
|
16280 | dots
|
16281 | } = props2;
|
16282 | const end2 = content.length;
|
16283 | const calcEllipse = () => {
|
16284 | const tail = (left2, right2) => {
|
16285 | if (right2 - left2 <= 1) {
|
16286 | if (position === "end") {
|
16287 | return content.slice(0, left2) + dots;
|
16288 | }
|
16289 | return dots + content.slice(right2, end2);
|
16290 | }
|
16291 | const middle2 = Math.round((left2 + right2) / 2);
|
16292 | if (position === "end") {
|
16293 | container2.innerText = content.slice(0, middle2) + dots + actionText.value;
|
16294 | } else {
|
16295 | container2.innerText = dots + content.slice(middle2, end2) + actionText.value;
|
16296 | }
|
16297 | if (container2.offsetHeight > maxHeight2) {
|
16298 | if (position === "end") {
|
16299 | return tail(left2, middle2);
|
16300 | }
|
16301 | return tail(middle2, right2);
|
16302 | }
|
16303 | if (position === "end") {
|
16304 | return tail(middle2, right2);
|
16305 | }
|
16306 | return tail(left2, middle2);
|
16307 | };
|
16308 | container2.innerText = tail(0, end2);
|
16309 | };
|
16310 | const middleTail = (leftPart, rightPart) => {
|
16311 | if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
|
16312 | return content.slice(0, leftPart[0]) + dots + content.slice(rightPart[1], end2);
|
16313 | }
|
16314 | const leftMiddle = Math.floor((leftPart[0] + leftPart[1]) / 2);
|
16315 | const rightMiddle = Math.ceil((rightPart[0] + rightPart[1]) / 2);
|
16316 | container2.innerText = props2.content.slice(0, leftMiddle) + props2.dots + props2.content.slice(rightMiddle, end2) + props2.expandText;
|
16317 | if (container2.offsetHeight >= maxHeight2) {
|
16318 | return middleTail([leftPart[0], leftMiddle], [rightMiddle, rightPart[1]]);
|
16319 | }
|
16320 | return middleTail([leftMiddle, leftPart[1]], [rightPart[0], rightMiddle]);
|
16321 | };
|
16322 | const middle = 0 + end2 >> 1;
|
16323 | props2.position === "middle" ? container2.innerText = middleTail([0, middle], [middle, end2]) : calcEllipse();
|
16324 | return container2.innerText;
|
16325 | };
|
16326 | const container = cloneContainer();
|
16327 | if (!container)
|
16328 | return;
|
16329 | const {
|
16330 | paddingBottom,
|
16331 | paddingTop,
|
16332 | lineHeight
|
16333 | } = container.style;
|
16334 | const maxHeight = Math.ceil((Number(props2.rows) + 0.5) * pxToNum(lineHeight) + pxToNum(paddingTop) + pxToNum(paddingBottom));
|
16335 | if (maxHeight < container.offsetHeight) {
|
16336 | hasAction.value = true;
|
16337 | text.value = calcEllipsisText(container, maxHeight);
|
16338 | } else {
|
16339 | hasAction.value = false;
|
16340 | text.value = props2.content;
|
16341 | }
|
16342 | document.body.removeChild(container);
|
16343 | };
|
16344 | const toggle = (isExpanded = !expanded.value) => {
|
16345 | expanded.value = isExpanded;
|
16346 | };
|
16347 | const onClickAction = (event) => {
|
16348 | toggle();
|
16349 | emit("clickAction", event);
|
16350 | };
|
16351 | const renderAction = () => {
|
16352 | const action = slots.action ? slots.action({
|
16353 | expanded: expanded.value
|
16354 | }) : actionText.value;
|
16355 | return vue.createVNode("span", {
|
16356 | "class": bem$3("action"),
|
16357 | "onClick": onClickAction
|
16358 | }, [action]);
|
16359 | };
|
16360 | vue.onMounted(calcEllipsised);
|
16361 | vue.watch([windowWidth, () => [props2.content, props2.rows, props2.position]], calcEllipsised);
|
16362 | useExpose({
|
16363 | toggle
|
16364 | });
|
16365 | return () => vue.createVNode("div", {
|
16366 | "ref": root,
|
16367 | "class": bem$3()
|
16368 | }, [expanded.value ? props2.content : text.value, hasAction.value ? renderAction() : null]);
|
16369 | }
|
16370 | });
|
16371 | const TextEllipsis = withInstall(stdin_default$9);
|
16372 | const [name$3] = createNamespace("time-picker");
|
16373 | const validateTime = (val) => /^([01]\d|2[0-3]):([0-5]\d):([0-5]\d)$/.test(val);
|
16374 | const fullColumns = ["hour", "minute", "second"];
|
16375 | const timePickerProps = extend({}, sharedProps, {
|
16376 | minHour: makeNumericProp(0),
|
16377 | maxHour: makeNumericProp(23),
|
16378 | minMinute: makeNumericProp(0),
|
16379 | maxMinute: makeNumericProp(59),
|
16380 | minSecond: makeNumericProp(0),
|
16381 | maxSecond: makeNumericProp(59),
|
16382 | minTime: {
|
16383 | type: String,
|
16384 | validator: validateTime
|
16385 | },
|
16386 | maxTime: {
|
16387 | type: String,
|
16388 | validator: validateTime
|
16389 | },
|
16390 | columnsType: {
|
16391 | type: Array,
|
16392 | default: () => ["hour", "minute"]
|
16393 | },
|
16394 | filter: Function
|
16395 | });
|
16396 | var stdin_default$8 = vue.defineComponent({
|
16397 | name: name$3,
|
16398 | props: timePickerProps,
|
16399 | emits: ["confirm", "cancel", "change", "update:modelValue"],
|
16400 | setup(props2, {
|
16401 | emit,
|
16402 | slots
|
16403 | }) {
|
16404 | const currentValues = vue.ref(props2.modelValue);
|
16405 | const getValidTime = (time) => {
|
16406 | const timeLimitArr = time.split(":");
|
16407 | return fullColumns.map((col, i) => props2.columnsType.includes(col) ? timeLimitArr[i] : "00");
|
16408 | };
|
16409 | const columns = vue.computed(() => {
|
16410 | let {
|
16411 | minHour,
|
16412 | maxHour,
|
16413 | minMinute,
|
16414 | maxMinute,
|
16415 | minSecond,
|
16416 | maxSecond
|
16417 | } = props2;
|
16418 | if (props2.minTime || props2.maxTime) {
|
16419 | const fullTime = {
|
16420 | hour: 0,
|
16421 | minute: 0,
|
16422 | second: 0
|
16423 | };
|
16424 | props2.columnsType.forEach((col, i) => {
|
16425 | var _a;
|
16426 | fullTime[col] = (_a = currentValues.value[i]) != null ? _a : 0;
|
16427 | });
|
16428 | const {
|
16429 | hour,
|
16430 | minute
|
16431 | } = fullTime;
|
16432 | if (props2.minTime) {
|
16433 | const [minH, minM, minS] = getValidTime(props2.minTime);
|
16434 | minHour = minH;
|
16435 | minMinute = +hour <= +minHour ? minM : "00";
|
16436 | minSecond = +hour <= +minHour && +minute <= +minMinute ? minS : "00";
|
16437 | }
|
16438 | if (props2.maxTime) {
|
16439 | const [maxH, maxM, maxS] = getValidTime(props2.maxTime);
|
16440 | maxHour = maxH;
|
16441 | maxMinute = +hour >= +maxHour ? maxM : "59";
|
16442 | maxSecond = +hour >= +maxHour && +minute >= +maxMinute ? maxS : "59";
|
16443 | }
|
16444 | }
|
16445 | return props2.columnsType.map((type) => {
|
16446 | const {
|
16447 | filter,
|
16448 | formatter
|
16449 | } = props2;
|
16450 | switch (type) {
|
16451 | case "hour":
|
16452 | return genOptions(+minHour, +maxHour, type, formatter, filter, currentValues.value);
|
16453 | case "minute":
|
16454 | return genOptions(+minMinute, +maxMinute, type, formatter, filter, currentValues.value);
|
16455 | case "second":
|
16456 | return genOptions(+minSecond, +maxSecond, type, formatter, filter, currentValues.value);
|
16457 | default:
|
16458 | return [];
|
16459 | }
|
16460 | });
|
16461 | });
|
16462 | vue.watch(currentValues, (newValues) => {
|
16463 | if (!isSameValue(newValues, props2.modelValue)) {
|
16464 | emit("update:modelValue", newValues);
|
16465 | }
|
16466 | });
|
16467 | vue.watch(() => props2.modelValue, (newValues) => {
|
16468 | newValues = formatValueRange(newValues, columns.value);
|
16469 | if (!isSameValue(newValues, currentValues.value)) {
|
16470 | currentValues.value = newValues;
|
16471 | }
|
16472 | }, {
|
16473 | immediate: true
|
16474 | });
|
16475 | const onChange = (...args) => emit("change", ...args);
|
16476 | const onCancel = (...args) => emit("cancel", ...args);
|
16477 | const onConfirm = (...args) => emit("confirm", ...args);
|
16478 | return () => vue.createVNode(Picker, vue.mergeProps({
|
16479 | "modelValue": currentValues.value,
|
16480 | "onUpdate:modelValue": ($event) => currentValues.value = $event,
|
16481 | "columns": columns.value,
|
16482 | "onChange": onChange,
|
16483 | "onCancel": onCancel,
|
16484 | "onConfirm": onConfirm
|
16485 | }, pick(props2, pickerInheritKeys)), slots);
|
16486 | }
|
16487 | });
|
16488 | const TimePicker = withInstall(stdin_default$8);
|
16489 | const [name$2, bem$2] = createNamespace("tree-select");
|
16490 | const treeSelectProps = {
|
16491 | max: makeNumericProp(Infinity),
|
16492 | items: makeArrayProp(),
|
16493 | height: makeNumericProp(300),
|
16494 | selectedIcon: makeStringProp("success"),
|
16495 | mainActiveIndex: makeNumericProp(0),
|
16496 | activeId: {
|
16497 | type: [Number, String, Array],
|
16498 | default: 0
|
16499 | }
|
16500 | };
|
16501 | var stdin_default$7 = vue.defineComponent({
|
16502 | name: name$2,
|
16503 | props: treeSelectProps,
|
16504 | emits: ["clickNav", "clickItem", "update:activeId", "update:mainActiveIndex"],
|
16505 | setup(props2, {
|
16506 | emit,
|
16507 | slots
|
16508 | }) {
|
16509 | const isActiveItem = (id) => Array.isArray(props2.activeId) ? props2.activeId.includes(id) : props2.activeId === id;
|
16510 | const renderSubItem = (item) => {
|
16511 | const onClick = () => {
|
16512 | if (item.disabled) {
|
16513 | return;
|
16514 | }
|
16515 | let activeId;
|
16516 | if (Array.isArray(props2.activeId)) {
|
16517 | activeId = props2.activeId.slice();
|
16518 | const index = activeId.indexOf(item.id);
|
16519 | if (index !== -1) {
|
16520 | activeId.splice(index, 1);
|
16521 | } else if (activeId.length < +props2.max) {
|
16522 | activeId.push(item.id);
|
16523 | }
|
16524 | } else {
|
16525 | activeId = item.id;
|
16526 | }
|
16527 | emit("update:activeId", activeId);
|
16528 | emit("clickItem", item);
|
16529 | };
|
16530 | return vue.createVNode("div", {
|
16531 | "key": item.id,
|
16532 | "class": ["van-ellipsis", bem$2("item", {
|
16533 | active: isActiveItem(item.id),
|
16534 | disabled: item.disabled
|
16535 | })],
|
16536 | "onClick": onClick
|
16537 | }, [item.text, isActiveItem(item.id) && vue.createVNode(Icon, {
|
16538 | "name": props2.selectedIcon,
|
16539 | "class": bem$2("selected")
|
16540 | }, null)]);
|
16541 | };
|
16542 | const onSidebarChange = (index) => {
|
16543 | emit("update:mainActiveIndex", index);
|
16544 | };
|
16545 | const onClickSidebarItem = (index) => emit("clickNav", index);
|
16546 | const renderSidebar = () => {
|
16547 | const Items = props2.items.map((item) => vue.createVNode(SidebarItem, {
|
16548 | "dot": item.dot,
|
16549 | "badge": item.badge,
|
16550 | "class": [bem$2("nav-item"), item.className],
|
16551 | "disabled": item.disabled,
|
16552 | "onClick": onClickSidebarItem
|
16553 | }, {
|
16554 | title: () => slots["nav-text"] ? slots["nav-text"](item) : item.text
|
16555 | }));
|
16556 | return vue.createVNode(Sidebar, {
|
16557 | "class": bem$2("nav"),
|
16558 | "modelValue": props2.mainActiveIndex,
|
16559 | "onChange": onSidebarChange
|
16560 | }, {
|
16561 | default: () => [Items]
|
16562 | });
|
16563 | };
|
16564 | const renderContent = () => {
|
16565 | if (slots.content) {
|
16566 | return slots.content();
|
16567 | }
|
16568 | const selected = props2.items[+props2.mainActiveIndex] || {};
|
16569 | if (selected.children) {
|
16570 | return selected.children.map(renderSubItem);
|
16571 | }
|
16572 | };
|
16573 | return () => vue.createVNode("div", {
|
16574 | "class": bem$2(),
|
16575 | "style": {
|
16576 | height: addUnit(props2.height)
|
16577 | }
|
16578 | }, [renderSidebar(), vue.createVNode("div", {
|
16579 | "class": bem$2("content")
|
16580 | }, [renderContent()])]);
|
16581 | }
|
16582 | });
|
16583 | const TreeSelect = withInstall(stdin_default$7);
|
16584 | const [name$1, bem$1, t] = createNamespace("uploader");
|
16585 | function readFileContent(file, resultType) {
|
16586 | return new Promise((resolve) => {
|
16587 | if (resultType === "file") {
|
16588 | resolve();
|
16589 | return;
|
16590 | }
|
16591 | const reader = new FileReader();
|
16592 | reader.onload = (event) => {
|
16593 | resolve(event.target.result);
|
16594 | };
|
16595 | if (resultType === "dataUrl") {
|
16596 | reader.readAsDataURL(file);
|
16597 | } else if (resultType === "text") {
|
16598 | reader.readAsText(file);
|
16599 | }
|
16600 | });
|
16601 | }
|
16602 | function isOversize(items, maxSize) {
|
16603 | return toArray(items).some((item) => {
|
16604 | if (item.file) {
|
16605 | if (isFunction(maxSize)) {
|
16606 | return maxSize(item.file);
|
16607 | }
|
16608 | return item.file.size > +maxSize;
|
16609 | }
|
16610 | return false;
|
16611 | });
|
16612 | }
|
16613 | function filterFiles(items, maxSize) {
|
16614 | const valid = [];
|
16615 | const invalid = [];
|
16616 | items.forEach((item) => {
|
16617 | if (isOversize(item, maxSize)) {
|
16618 | invalid.push(item);
|
16619 | } else {
|
16620 | valid.push(item);
|
16621 | }
|
16622 | });
|
16623 | return { valid, invalid };
|
16624 | }
|
16625 | const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg|avif)/i;
|
16626 | const isImageUrl = (url) => IMAGE_REGEXP.test(url);
|
16627 | function isImageFile(item) {
|
16628 | if (item.isImage) {
|
16629 | return true;
|
16630 | }
|
16631 | if (item.file && item.file.type) {
|
16632 | return item.file.type.indexOf("image") === 0;
|
16633 | }
|
16634 | if (item.url) {
|
16635 | return isImageUrl(item.url);
|
16636 | }
|
16637 | if (typeof item.content === "string") {
|
16638 | return item.content.indexOf("data:image") === 0;
|
16639 | }
|
16640 | return false;
|
16641 | }
|
16642 | var stdin_default$6 = vue.defineComponent({
|
16643 | props: {
|
16644 | name: numericProp,
|
16645 | item: makeRequiredProp(Object),
|
16646 | index: Number,
|
16647 | imageFit: String,
|
16648 | lazyLoad: Boolean,
|
16649 | deletable: Boolean,
|
16650 | reupload: Boolean,
|
16651 | previewSize: [Number, String, Array],
|
16652 | beforeDelete: Function
|
16653 | },
|
16654 | emits: ["delete", "preview", "reupload"],
|
16655 | setup(props2, {
|
16656 | emit,
|
16657 | slots
|
16658 | }) {
|
16659 | const renderMask = () => {
|
16660 | const {
|
16661 | status,
|
16662 | message
|
16663 | } = props2.item;
|
16664 | if (status === "uploading" || status === "failed") {
|
16665 | const MaskIcon = status === "failed" ? vue.createVNode(Icon, {
|
16666 | "name": "close",
|
16667 | "class": bem$1("mask-icon")
|
16668 | }, null) : vue.createVNode(Loading, {
|
16669 | "class": bem$1("loading")
|
16670 | }, null);
|
16671 | const showMessage = isDef(message) && message !== "";
|
16672 | return vue.createVNode("div", {
|
16673 | "class": bem$1("mask")
|
16674 | }, [MaskIcon, showMessage && vue.createVNode("div", {
|
16675 | "class": bem$1("mask-message")
|
16676 | }, [message])]);
|
16677 | }
|
16678 | };
|
16679 | const onDelete = (event) => {
|
16680 | const {
|
16681 | name: name2,
|
16682 | item,
|
16683 | index,
|
16684 | beforeDelete
|
16685 | } = props2;
|
16686 | event.stopPropagation();
|
16687 | callInterceptor(beforeDelete, {
|
16688 | args: [item, {
|
16689 | name: name2,
|
16690 | index
|
16691 | }],
|
16692 | done: () => emit("delete")
|
16693 | });
|
16694 | };
|
16695 | const onPreview = () => emit("preview");
|
16696 | const onReupload = () => emit("reupload");
|
16697 | const renderDeleteIcon = () => {
|
16698 | if (props2.deletable && props2.item.status !== "uploading") {
|
16699 | const slot = slots["preview-delete"];
|
16700 | return vue.createVNode("div", {
|
16701 | "role": "button",
|
16702 | "class": bem$1("preview-delete", {
|
16703 | shadow: !slot
|
16704 | }),
|
16705 | "tabindex": 0,
|
16706 | "aria-label": t("delete"),
|
16707 | "onClick": onDelete
|
16708 | }, [slot ? slot() : vue.createVNode(Icon, {
|
16709 | "name": "cross",
|
16710 | "class": bem$1("preview-delete-icon")
|
16711 | }, null)]);
|
16712 | }
|
16713 | };
|
16714 | const renderCover = () => {
|
16715 | if (slots["preview-cover"]) {
|
16716 | const {
|
16717 | index,
|
16718 | item
|
16719 | } = props2;
|
16720 | return vue.createVNode("div", {
|
16721 | "class": bem$1("preview-cover")
|
16722 | }, [slots["preview-cover"](extend({
|
16723 | index
|
16724 | }, item))]);
|
16725 | }
|
16726 | };
|
16727 | const renderPreview = () => {
|
16728 | const {
|
16729 | item,
|
16730 | lazyLoad,
|
16731 | imageFit,
|
16732 | previewSize,
|
16733 | reupload
|
16734 | } = props2;
|
16735 | if (isImageFile(item)) {
|
16736 | return vue.createVNode(Image$1, {
|
16737 | "fit": imageFit,
|
16738 | "src": item.objectUrl || item.content || item.url,
|
16739 | "class": bem$1("preview-image"),
|
16740 | "width": Array.isArray(previewSize) ? previewSize[0] : previewSize,
|
16741 | "height": Array.isArray(previewSize) ? previewSize[1] : previewSize,
|
16742 | "lazyLoad": lazyLoad,
|
16743 | "onClick": reupload ? onReupload : onPreview
|
16744 | }, {
|
16745 | default: renderCover
|
16746 | });
|
16747 | }
|
16748 | return vue.createVNode("div", {
|
16749 | "class": bem$1("file"),
|
16750 | "style": getSizeStyle(props2.previewSize)
|
16751 | }, [vue.createVNode(Icon, {
|
16752 | "class": bem$1("file-icon"),
|
16753 | "name": "description"
|
16754 | }, null), vue.createVNode("div", {
|
16755 | "class": [bem$1("file-name"), "van-ellipsis"]
|
16756 | }, [item.file ? item.file.name : item.url]), renderCover()]);
|
16757 | };
|
16758 | return () => vue.createVNode("div", {
|
16759 | "class": bem$1("preview")
|
16760 | }, [renderPreview(), renderMask(), renderDeleteIcon()]);
|
16761 | }
|
16762 | });
|
16763 | const uploaderProps = {
|
16764 | name: makeNumericProp(""),
|
16765 | accept: makeStringProp("image/*"),
|
16766 | capture: String,
|
16767 | multiple: Boolean,
|
16768 | disabled: Boolean,
|
16769 | readonly: Boolean,
|
16770 | lazyLoad: Boolean,
|
16771 | maxCount: makeNumericProp(Infinity),
|
16772 | imageFit: makeStringProp("cover"),
|
16773 | resultType: makeStringProp("dataUrl"),
|
16774 | uploadIcon: makeStringProp("photograph"),
|
16775 | uploadText: String,
|
16776 | deletable: truthProp,
|
16777 | reupload: Boolean,
|
16778 | afterRead: Function,
|
16779 | showUpload: truthProp,
|
16780 | modelValue: makeArrayProp(),
|
16781 | beforeRead: Function,
|
16782 | beforeDelete: Function,
|
16783 | previewSize: [Number, String, Array],
|
16784 | previewImage: truthProp,
|
16785 | previewOptions: Object,
|
16786 | previewFullImage: truthProp,
|
16787 | maxSize: {
|
16788 | type: [Number, String, Function],
|
16789 | default: Infinity
|
16790 | }
|
16791 | };
|
16792 | var stdin_default$5 = vue.defineComponent({
|
16793 | name: name$1,
|
16794 | props: uploaderProps,
|
16795 | emits: ["delete", "oversize", "clickUpload", "closePreview", "clickPreview", "clickReupload", "update:modelValue"],
|
16796 | setup(props2, {
|
16797 | emit,
|
16798 | slots
|
16799 | }) {
|
16800 | const inputRef = vue.ref();
|
16801 | const urls = [];
|
16802 | const reuploadIndex = vue.ref(-1);
|
16803 | const isReuploading = vue.ref(false);
|
16804 | const getDetail = (index = props2.modelValue.length) => ({
|
16805 | name: props2.name,
|
16806 | index
|
16807 | });
|
16808 | const resetInput = () => {
|
16809 | if (inputRef.value) {
|
16810 | inputRef.value.value = "";
|
16811 | }
|
16812 | };
|
16813 | const onAfterRead = (items) => {
|
16814 | resetInput();
|
16815 | if (isOversize(items, props2.maxSize)) {
|
16816 | if (Array.isArray(items)) {
|
16817 | const result = filterFiles(items, props2.maxSize);
|
16818 | items = result.valid;
|
16819 | emit("oversize", result.invalid, getDetail());
|
16820 | if (!items.length) {
|
16821 | return;
|
16822 | }
|
16823 | } else {
|
16824 | emit("oversize", items, getDetail());
|
16825 | return;
|
16826 | }
|
16827 | }
|
16828 | items = vue.reactive(items);
|
16829 | if (reuploadIndex.value > -1) {
|
16830 | const arr = [...props2.modelValue];
|
16831 | arr.splice(reuploadIndex.value, 1, items);
|
16832 | emit("update:modelValue", arr);
|
16833 | reuploadIndex.value = -1;
|
16834 | } else {
|
16835 | emit("update:modelValue", [...props2.modelValue, ...toArray(items)]);
|
16836 | }
|
16837 | if (props2.afterRead) {
|
16838 | props2.afterRead(items, getDetail());
|
16839 | }
|
16840 | };
|
16841 | const readFile = (files) => {
|
16842 | const {
|
16843 | maxCount,
|
16844 | modelValue,
|
16845 | resultType
|
16846 | } = props2;
|
16847 | if (Array.isArray(files)) {
|
16848 | const remainCount = +maxCount - modelValue.length;
|
16849 | if (files.length > remainCount) {
|
16850 | files = files.slice(0, remainCount);
|
16851 | }
|
16852 | Promise.all(files.map((file) => readFileContent(file, resultType))).then((contents) => {
|
16853 | const fileList = files.map((file, index) => {
|
16854 | const result = {
|
16855 | file,
|
16856 | status: "",
|
16857 | message: "",
|
16858 | objectUrl: URL.createObjectURL(file)
|
16859 | };
|
16860 | if (contents[index]) {
|
16861 | result.content = contents[index];
|
16862 | }
|
16863 | return result;
|
16864 | });
|
16865 | onAfterRead(fileList);
|
16866 | });
|
16867 | } else {
|
16868 | readFileContent(files, resultType).then((content) => {
|
16869 | const result = {
|
16870 | file: files,
|
16871 | status: "",
|
16872 | message: "",
|
16873 | objectUrl: URL.createObjectURL(files)
|
16874 | };
|
16875 | if (content) {
|
16876 | result.content = content;
|
16877 | }
|
16878 | onAfterRead(result);
|
16879 | });
|
16880 | }
|
16881 | };
|
16882 | const onChange = (event) => {
|
16883 | const {
|
16884 | files
|
16885 | } = event.target;
|
16886 | if (props2.disabled || !files || !files.length) {
|
16887 | return;
|
16888 | }
|
16889 | const file = files.length === 1 ? files[0] : [].slice.call(files);
|
16890 | if (props2.beforeRead) {
|
16891 | const response = props2.beforeRead(file, getDetail());
|
16892 | if (!response) {
|
16893 | resetInput();
|
16894 | return;
|
16895 | }
|
16896 | if (isPromise(response)) {
|
16897 | response.then((data) => {
|
16898 | if (data) {
|
16899 | readFile(data);
|
16900 | } else {
|
16901 | readFile(file);
|
16902 | }
|
16903 | }).catch(resetInput);
|
16904 | return;
|
16905 | }
|
16906 | }
|
16907 | readFile(file);
|
16908 | };
|
16909 | let imagePreview;
|
16910 | const onClosePreview = () => emit("closePreview");
|
16911 | const previewImage = (item) => {
|
16912 | if (props2.previewFullImage) {
|
16913 | const imageFiles = props2.modelValue.filter(isImageFile);
|
16914 | const images = imageFiles.map((item2) => {
|
16915 | if (item2.objectUrl && !item2.url && item2.status !== "failed") {
|
16916 | item2.url = item2.objectUrl;
|
16917 | urls.push(item2.url);
|
16918 | }
|
16919 | return item2.url;
|
16920 | }).filter(Boolean);
|
16921 | imagePreview = showImagePreview(extend({
|
16922 | images,
|
16923 | startPosition: imageFiles.indexOf(item),
|
16924 | onClose: onClosePreview
|
16925 | }, props2.previewOptions));
|
16926 | }
|
16927 | };
|
16928 | const closeImagePreview = () => {
|
16929 | if (imagePreview) {
|
16930 | imagePreview.close();
|
16931 | }
|
16932 | };
|
16933 | const deleteFile = (item, index) => {
|
16934 | const fileList = props2.modelValue.slice(0);
|
16935 | fileList.splice(index, 1);
|
16936 | emit("update:modelValue", fileList);
|
16937 | emit("delete", item, getDetail(index));
|
16938 | };
|
16939 | const reuploadImage = (index) => {
|
16940 | isReuploading.value = true;
|
16941 | reuploadIndex.value = index;
|
16942 | vue.nextTick(() => chooseFile());
|
16943 | };
|
16944 | const onInputClick = () => {
|
16945 | if (!isReuploading.value) {
|
16946 | reuploadIndex.value = -1;
|
16947 | }
|
16948 | isReuploading.value = false;
|
16949 | };
|
16950 | const renderPreviewItem = (item, index) => {
|
16951 | const needPickData = ["imageFit", "deletable", "reupload", "previewSize", "beforeDelete"];
|
16952 | const previewData = extend(pick(props2, needPickData), pick(item, needPickData, true));
|
16953 | return vue.createVNode(stdin_default$6, vue.mergeProps({
|
16954 | "item": item,
|
16955 | "index": index,
|
16956 | "onClick": () => emit(props2.reupload ? "clickReupload" : "clickPreview", item, getDetail(index)),
|
16957 | "onDelete": () => deleteFile(item, index),
|
16958 | "onPreview": () => previewImage(item),
|
16959 | "onReupload": () => reuploadImage(index)
|
16960 | }, pick(props2, ["name", "lazyLoad"]), previewData), pick(slots, ["preview-cover", "preview-delete"]));
|
16961 | };
|
16962 | const renderPreviewList = () => {
|
16963 | if (props2.previewImage) {
|
16964 | return props2.modelValue.map(renderPreviewItem);
|
16965 | }
|
16966 | };
|
16967 | const onClickUpload = (event) => emit("clickUpload", event);
|
16968 | const renderUpload = () => {
|
16969 | if (props2.modelValue.length >= +props2.maxCount && !props2.reupload) {
|
16970 | return;
|
16971 | }
|
16972 | const hideUploader = props2.modelValue.length >= +props2.maxCount && props2.reupload;
|
16973 | const Input = props2.readonly ? null : vue.createVNode("input", {
|
16974 | "ref": inputRef,
|
16975 | "type": "file",
|
16976 | "class": bem$1("input"),
|
16977 | "accept": props2.accept,
|
16978 | "capture": props2.capture,
|
16979 | "multiple": props2.multiple && reuploadIndex.value === -1,
|
16980 | "disabled": props2.disabled,
|
16981 | "onChange": onChange,
|
16982 | "onClick": onInputClick
|
16983 | }, null);
|
16984 | if (slots.default) {
|
16985 | return vue.withDirectives(vue.createVNode("div", {
|
16986 | "class": bem$1("input-wrapper"),
|
16987 | "onClick": onClickUpload
|
16988 | }, [slots.default(), Input]), [[vue.vShow, !hideUploader]]);
|
16989 | }
|
16990 | return vue.withDirectives(vue.createVNode("div", {
|
16991 | "class": bem$1("upload", {
|
16992 | readonly: props2.readonly
|
16993 | }),
|
16994 | "style": getSizeStyle(props2.previewSize),
|
16995 | "onClick": onClickUpload
|
16996 | }, [vue.createVNode(Icon, {
|
16997 | "name": props2.uploadIcon,
|
16998 | "class": bem$1("upload-icon")
|
16999 | }, null), props2.uploadText && vue.createVNode("span", {
|
17000 | "class": bem$1("upload-text")
|
17001 | }, [props2.uploadText]), Input]), [[vue.vShow, props2.showUpload && !hideUploader]]);
|
17002 | };
|
17003 | const chooseFile = () => {
|
17004 | if (inputRef.value && !props2.disabled) {
|
17005 | inputRef.value.click();
|
17006 | }
|
17007 | };
|
17008 | vue.onBeforeUnmount(() => {
|
17009 | urls.forEach((url) => URL.revokeObjectURL(url));
|
17010 | });
|
17011 | useExpose({
|
17012 | chooseFile,
|
17013 | closeImagePreview
|
17014 | });
|
17015 | useCustomFieldValue(() => props2.modelValue);
|
17016 | return () => vue.createVNode("div", {
|
17017 | "class": bem$1()
|
17018 | }, [vue.createVNode("div", {
|
17019 | "class": bem$1("wrapper", {
|
17020 | disabled: props2.disabled
|
17021 | })
|
17022 | }, [renderPreviewList(), renderUpload()])]);
|
17023 | }
|
17024 | });
|
17025 | const Uploader = withInstall(stdin_default$5);
|
17026 | const [name, bem] = createNamespace("watermark");
|
17027 | const watermarkProps = {
|
17028 | gapX: makeNumberProp(0),
|
17029 | gapY: makeNumberProp(0),
|
17030 | image: String,
|
17031 | width: makeNumberProp(100),
|
17032 | height: makeNumberProp(100),
|
17033 | rotate: makeNumericProp(-22),
|
17034 | zIndex: numericProp,
|
17035 | content: String,
|
17036 | opacity: numericProp,
|
17037 | fullPage: truthProp,
|
17038 | textColor: makeStringProp("#dcdee0")
|
17039 | };
|
17040 | var stdin_default$4 = vue.defineComponent({
|
17041 | name,
|
17042 | props: watermarkProps,
|
17043 | setup(props2, {
|
17044 | slots
|
17045 | }) {
|
17046 | const svgElRef = vue.ref();
|
17047 | const watermarkUrl = vue.ref("");
|
17048 | const imageBase64 = vue.ref("");
|
17049 | const renderWatermark = () => {
|
17050 | const rotateStyle = {
|
17051 | transformOrigin: "center",
|
17052 | transform: `rotate(${props2.rotate}deg)`
|
17053 | };
|
17054 | const svgInner = () => {
|
17055 | if (props2.image && !slots.content) {
|
17056 | return vue.createVNode("image", {
|
17057 | "href": imageBase64.value,
|
17058 | "xlink:href": imageBase64.value,
|
17059 | "x": "0",
|
17060 | "y": "0",
|
17061 | "width": props2.width,
|
17062 | "height": props2.height,
|
17063 | "style": rotateStyle
|
17064 | }, null);
|
17065 | }
|
17066 | return vue.createVNode("foreignObject", {
|
17067 | "x": "0",
|
17068 | "y": "0",
|
17069 | "width": props2.width,
|
17070 | "height": props2.height
|
17071 | }, [vue.createVNode("div", {
|
17072 | "xmlns": "http://www.w3.org/1999/xhtml",
|
17073 | "style": rotateStyle
|
17074 | }, [slots.content ? slots.content() : vue.createVNode("span", {
|
17075 | "style": {
|
17076 | color: props2.textColor
|
17077 | }
|
17078 | }, [props2.content])])]);
|
17079 | };
|
17080 | const svgWidth = props2.width + props2.gapX;
|
17081 | const svgHeight = props2.height + props2.gapY;
|
17082 | return vue.createVNode("svg", {
|
17083 | "viewBox": `0 0 ${svgWidth} ${svgHeight}`,
|
17084 | "width": svgWidth,
|
17085 | "height": svgHeight,
|
17086 | "xmlns": "http://www.w3.org/2000/svg",
|
17087 | "xmlns:xlink": "http://www.w3.org/1999/xlink",
|
17088 | "style": {
|
17089 | padding: `0 ${props2.gapX}px ${props2.gapY}px 0`,
|
17090 | opacity: props2.opacity
|
17091 | }
|
17092 | }, [svgInner()]);
|
17093 | };
|
17094 | const makeImageToBase64 = (url) => {
|
17095 | const canvas = document.createElement("canvas");
|
17096 | const image = new Image();
|
17097 | image.crossOrigin = "anonymous";
|
17098 | image.referrerPolicy = "no-referrer";
|
17099 | image.onload = () => {
|
17100 | canvas.width = image.naturalWidth;
|
17101 | canvas.height = image.naturalHeight;
|
17102 | const ctx = canvas.getContext("2d");
|
17103 | ctx == null ? void 0 : ctx.drawImage(image, 0, 0);
|
17104 | imageBase64.value = canvas.toDataURL();
|
17105 | };
|
17106 | image.src = url;
|
17107 | };
|
17108 | const makeSvgToBlobUrl = (svgStr) => {
|
17109 | const svgBlob = new Blob([svgStr], {
|
17110 | type: "image/svg+xml"
|
17111 | });
|
17112 | return URL.createObjectURL(svgBlob);
|
17113 | };
|
17114 | vue.watchEffect(() => {
|
17115 | if (props2.image) {
|
17116 | makeImageToBase64(props2.image);
|
17117 | }
|
17118 | });
|
17119 | vue.watch(() => [imageBase64.value, props2.content, props2.textColor, props2.height, props2.width, props2.rotate, props2.gapX, props2.gapY], () => {
|
17120 | vue.nextTick(() => {
|
17121 | if (svgElRef.value) {
|
17122 | if (watermarkUrl.value) {
|
17123 | URL.revokeObjectURL(watermarkUrl.value);
|
17124 | }
|
17125 | watermarkUrl.value = makeSvgToBlobUrl(svgElRef.value.innerHTML);
|
17126 | }
|
17127 | });
|
17128 | }, {
|
17129 | immediate: true
|
17130 | });
|
17131 | vue.onUnmounted(() => {
|
17132 | if (watermarkUrl.value) {
|
17133 | URL.revokeObjectURL(watermarkUrl.value);
|
17134 | }
|
17135 | });
|
17136 | return () => {
|
17137 | const style = extend({
|
17138 | backgroundImage: `url(${watermarkUrl.value})`
|
17139 | }, getZIndexStyle(props2.zIndex));
|
17140 | return vue.createVNode("div", {
|
17141 | "class": bem({
|
17142 | full: props2.fullPage
|
17143 | }),
|
17144 | "style": style
|
17145 | }, [vue.createVNode("div", {
|
17146 | "class": bem("wrapper"),
|
17147 | "ref": svgElRef
|
17148 | }, [renderWatermark()])]);
|
17149 | };
|
17150 | }
|
17151 | });
|
17152 | const Watermark = withInstall(stdin_default$4);
|
17153 | class ReactiveListener {
|
17154 | constructor({
|
17155 | el,
|
17156 | src,
|
17157 | error,
|
17158 | loading,
|
17159 | bindType,
|
17160 | $parent,
|
17161 | options,
|
17162 | cors,
|
17163 | elRenderer,
|
17164 | imageCache
|
17165 | }) {
|
17166 | this.el = el;
|
17167 | this.src = src;
|
17168 | this.error = error;
|
17169 | this.loading = loading;
|
17170 | this.bindType = bindType;
|
17171 | this.attempt = 0;
|
17172 | this.cors = cors;
|
17173 | this.naturalHeight = 0;
|
17174 | this.naturalWidth = 0;
|
17175 | this.options = options;
|
17176 | this.$parent = $parent;
|
17177 | this.elRenderer = elRenderer;
|
17178 | this.imageCache = imageCache;
|
17179 | this.performanceData = {
|
17180 | loadStart: 0,
|
17181 | loadEnd: 0
|
17182 | };
|
17183 | this.filter();
|
17184 | this.initState();
|
17185 | this.render("loading", false);
|
17186 | }
|
17187 | |
17188 |
|
17189 |
|
17190 |
|
17191 | initState() {
|
17192 | if ("dataset" in this.el) {
|
17193 | this.el.dataset.src = this.src;
|
17194 | } else {
|
17195 | this.el.setAttribute("data-src", this.src);
|
17196 | }
|
17197 | this.state = {
|
17198 | loading: false,
|
17199 | error: false,
|
17200 | loaded: false,
|
17201 | rendered: false
|
17202 | };
|
17203 | }
|
17204 | |
17205 |
|
17206 |
|
17207 |
|
17208 | record(event) {
|
17209 | this.performanceData[event] = Date.now();
|
17210 | }
|
17211 | |
17212 |
|
17213 |
|
17214 |
|
17215 |
|
17216 |
|
17217 |
|
17218 | update({ src, loading, error }) {
|
17219 | const oldSrc = this.src;
|
17220 | this.src = src;
|
17221 | this.loading = loading;
|
17222 | this.error = error;
|
17223 | this.filter();
|
17224 | if (oldSrc !== this.src) {
|
17225 | this.attempt = 0;
|
17226 | this.initState();
|
17227 | }
|
17228 | }
|
17229 | |
17230 |
|
17231 |
|
17232 |
|
17233 | checkInView() {
|
17234 | const rect = useRect(this.el);
|
17235 | return rect.top < window.innerHeight * this.options.preLoad && rect.bottom > this.options.preLoadTop && rect.left < window.innerWidth * this.options.preLoad && rect.right > 0;
|
17236 | }
|
17237 | |
17238 |
|
17239 |
|
17240 | filter() {
|
17241 | Object.keys(this.options.filter).forEach((key) => {
|
17242 | this.options.filter[key](this, this.options);
|
17243 | });
|
17244 | }
|
17245 | |
17246 |
|
17247 |
|
17248 |
|
17249 |
|
17250 | renderLoading(cb) {
|
17251 | this.state.loading = true;
|
17252 | loadImageAsync(
|
17253 | {
|
17254 | src: this.loading,
|
17255 | cors: this.cors
|
17256 | },
|
17257 | () => {
|
17258 | this.render("loading", false);
|
17259 | this.state.loading = false;
|
17260 | cb();
|
17261 | },
|
17262 | () => {
|
17263 | cb();
|
17264 | this.state.loading = false;
|
17265 | }
|
17266 | );
|
17267 | }
|
17268 | |
17269 |
|
17270 |
|
17271 |
|
17272 | load(onFinish = noop) {
|
17273 | if (this.attempt > this.options.attempt - 1 && this.state.error) {
|
17274 | onFinish();
|
17275 | return;
|
17276 | }
|
17277 | if (this.state.rendered && this.state.loaded)
|
17278 | return;
|
17279 | if (this.imageCache.has(this.src)) {
|
17280 | this.state.loaded = true;
|
17281 | this.render("loaded", true);
|
17282 | this.state.rendered = true;
|
17283 | return onFinish();
|
17284 | }
|
17285 | this.renderLoading(() => {
|
17286 | var _a, _b;
|
17287 | this.attempt++;
|
17288 | (_b = (_a = this.options.adapter).beforeLoad) == null ? void 0 : _b.call(_a, this, this.options);
|
17289 | this.record("loadStart");
|
17290 | loadImageAsync(
|
17291 | {
|
17292 | src: this.src,
|
17293 | cors: this.cors
|
17294 | },
|
17295 | (data) => {
|
17296 | this.naturalHeight = data.naturalHeight;
|
17297 | this.naturalWidth = data.naturalWidth;
|
17298 | this.state.loaded = true;
|
17299 | this.state.error = false;
|
17300 | this.record("loadEnd");
|
17301 | this.render("loaded", false);
|
17302 | this.state.rendered = true;
|
17303 | this.imageCache.add(this.src);
|
17304 | onFinish();
|
17305 | },
|
17306 | (err) => {
|
17307 | !this.options.silent && console.error(err);
|
17308 | this.state.error = true;
|
17309 | this.state.loaded = false;
|
17310 | this.render("error", false);
|
17311 | }
|
17312 | );
|
17313 | });
|
17314 | }
|
17315 | |
17316 |
|
17317 |
|
17318 |
|
17319 |
|
17320 |
|
17321 | render(state, cache) {
|
17322 | this.elRenderer(this, state, cache);
|
17323 | }
|
17324 | |
17325 |
|
17326 |
|
17327 |
|
17328 | performance() {
|
17329 | let state = "loading";
|
17330 | let time = 0;
|
17331 | if (this.state.loaded) {
|
17332 | state = "loaded";
|
17333 | time = (this.performanceData.loadEnd - this.performanceData.loadStart) / 1e3;
|
17334 | }
|
17335 | if (this.state.error)
|
17336 | state = "error";
|
17337 | return {
|
17338 | src: this.src,
|
17339 | state,
|
17340 | time
|
17341 | };
|
17342 | }
|
17343 | |
17344 |
|
17345 |
|
17346 |
|
17347 | $destroy() {
|
17348 | this.el = null;
|
17349 | this.src = null;
|
17350 | this.error = null;
|
17351 | this.loading = null;
|
17352 | this.bindType = null;
|
17353 | this.attempt = 0;
|
17354 | }
|
17355 | }
|
17356 | const DEFAULT_URL = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
17357 | const DEFAULT_EVENTS = [
|
17358 | "scroll",
|
17359 | "wheel",
|
17360 | "mousewheel",
|
17361 | "resize",
|
17362 | "animationend",
|
17363 | "transitionend",
|
17364 | "touchmove"
|
17365 | ];
|
17366 | const DEFAULT_OBSERVER_OPTIONS = {
|
17367 | rootMargin: "0px",
|
17368 | threshold: 0
|
17369 | };
|
17370 | function stdin_default$3() {
|
17371 | return class Lazy {
|
17372 | constructor({
|
17373 | preLoad,
|
17374 | error,
|
17375 | throttleWait,
|
17376 | preLoadTop,
|
17377 | dispatchEvent,
|
17378 | loading,
|
17379 | attempt,
|
17380 | silent = true,
|
17381 | scale,
|
17382 | listenEvents,
|
17383 | filter,
|
17384 | adapter,
|
17385 | observer,
|
17386 | observerOptions
|
17387 | }) {
|
17388 | this.mode = modeType.event;
|
17389 | this.listeners = [];
|
17390 | this.targetIndex = 0;
|
17391 | this.targets = [];
|
17392 | this.options = {
|
17393 | silent,
|
17394 | dispatchEvent: !!dispatchEvent,
|
17395 | throttleWait: throttleWait || 200,
|
17396 | preLoad: preLoad || 1.3,
|
17397 | preLoadTop: preLoadTop || 0,
|
17398 | error: error || DEFAULT_URL,
|
17399 | loading: loading || DEFAULT_URL,
|
17400 | attempt: attempt || 3,
|
17401 | scale: scale || getDPR(scale),
|
17402 | ListenEvents: listenEvents || DEFAULT_EVENTS,
|
17403 | supportWebp: supportWebp(),
|
17404 | filter: filter || {},
|
17405 | adapter: adapter || {},
|
17406 | observer: !!observer,
|
17407 | observerOptions: observerOptions || DEFAULT_OBSERVER_OPTIONS
|
17408 | };
|
17409 | this.initEvent();
|
17410 | this.imageCache = new ImageCache({ max: 200 });
|
17411 | this.lazyLoadHandler = throttle(
|
17412 | this.lazyLoadHandler.bind(this),
|
17413 | this.options.throttleWait
|
17414 | );
|
17415 | this.setMode(this.options.observer ? modeType.observer : modeType.event);
|
17416 | }
|
17417 | |
17418 |
|
17419 |
|
17420 |
|
17421 |
|
17422 | config(options = {}) {
|
17423 | Object.assign(this.options, options);
|
17424 | }
|
17425 | |
17426 |
|
17427 |
|
17428 |
|
17429 | performance() {
|
17430 | return this.listeners.map((item) => item.performance());
|
17431 | }
|
17432 | |
17433 |
|
17434 |
|
17435 |
|
17436 |
|
17437 | addLazyBox(vm) {
|
17438 | this.listeners.push(vm);
|
17439 | if (inBrowser) {
|
17440 | this.addListenerTarget(window);
|
17441 | this.observer && this.observer.observe(vm.el);
|
17442 | if (vm.$el && vm.$el.parentNode) {
|
17443 | this.addListenerTarget(vm.$el.parentNode);
|
17444 | }
|
17445 | }
|
17446 | }
|
17447 | |
17448 |
|
17449 |
|
17450 |
|
17451 |
|
17452 |
|
17453 |
|
17454 | add(el, binding, vnode) {
|
17455 | if (this.listeners.some((item) => item.el === el)) {
|
17456 | this.update(el, binding);
|
17457 | return vue.nextTick(this.lazyLoadHandler);
|
17458 | }
|
17459 | const value = this.valueFormatter(binding.value);
|
17460 | let { src } = value;
|
17461 | vue.nextTick(() => {
|
17462 | src = getBestSelectionFromSrcset(el, this.options.scale) || src;
|
17463 | this.observer && this.observer.observe(el);
|
17464 | const container = Object.keys(binding.modifiers)[0];
|
17465 | let $parent;
|
17466 | if (container) {
|
17467 | $parent = vnode.context.$refs[container];
|
17468 | $parent = $parent ? $parent.$el || $parent : document.getElementById(container);
|
17469 | }
|
17470 | if (!$parent) {
|
17471 | $parent = getScrollParent$1(el);
|
17472 | }
|
17473 | const newListener = new ReactiveListener({
|
17474 | bindType: binding.arg,
|
17475 | $parent,
|
17476 | el,
|
17477 | src,
|
17478 | loading: value.loading,
|
17479 | error: value.error,
|
17480 | cors: value.cors,
|
17481 | elRenderer: this.elRenderer.bind(this),
|
17482 | options: this.options,
|
17483 | imageCache: this.imageCache
|
17484 | });
|
17485 | this.listeners.push(newListener);
|
17486 | if (inBrowser) {
|
17487 | this.addListenerTarget(window);
|
17488 | this.addListenerTarget($parent);
|
17489 | }
|
17490 | this.lazyLoadHandler();
|
17491 | vue.nextTick(() => this.lazyLoadHandler());
|
17492 | });
|
17493 | }
|
17494 | |
17495 |
|
17496 |
|
17497 |
|
17498 |
|
17499 |
|
17500 | update(el, binding, vnode) {
|
17501 | const value = this.valueFormatter(binding.value);
|
17502 | let { src } = value;
|
17503 | src = getBestSelectionFromSrcset(el, this.options.scale) || src;
|
17504 | const exist = this.listeners.find((item) => item.el === el);
|
17505 | if (!exist) {
|
17506 | this.add(el, binding, vnode);
|
17507 | } else {
|
17508 | exist.update({
|
17509 | src,
|
17510 | error: value.error,
|
17511 | loading: value.loading
|
17512 | });
|
17513 | }
|
17514 | if (this.observer) {
|
17515 | this.observer.unobserve(el);
|
17516 | this.observer.observe(el);
|
17517 | }
|
17518 | this.lazyLoadHandler();
|
17519 | vue.nextTick(() => this.lazyLoadHandler());
|
17520 | }
|
17521 | |
17522 |
|
17523 |
|
17524 |
|
17525 |
|
17526 | remove(el) {
|
17527 | if (!el)
|
17528 | return;
|
17529 | this.observer && this.observer.unobserve(el);
|
17530 | const existItem = this.listeners.find((item) => item.el === el);
|
17531 | if (existItem) {
|
17532 | this.removeListenerTarget(existItem.$parent);
|
17533 | this.removeListenerTarget(window);
|
17534 | remove(this.listeners, existItem);
|
17535 | existItem.$destroy();
|
17536 | }
|
17537 | }
|
17538 | |
17539 |
|
17540 |
|
17541 |
|
17542 |
|
17543 | removeComponent(vm) {
|
17544 | if (!vm)
|
17545 | return;
|
17546 | remove(this.listeners, vm);
|
17547 | this.observer && this.observer.unobserve(vm.el);
|
17548 | if (vm.$parent && vm.$el.parentNode) {
|
17549 | this.removeListenerTarget(vm.$el.parentNode);
|
17550 | }
|
17551 | this.removeListenerTarget(window);
|
17552 | }
|
17553 | setMode(mode) {
|
17554 | if (!hasIntersectionObserver && mode === modeType.observer) {
|
17555 | mode = modeType.event;
|
17556 | }
|
17557 | this.mode = mode;
|
17558 | if (mode === modeType.event) {
|
17559 | if (this.observer) {
|
17560 | this.listeners.forEach((listener) => {
|
17561 | this.observer.unobserve(listener.el);
|
17562 | });
|
17563 | this.observer = null;
|
17564 | }
|
17565 | this.targets.forEach((target) => {
|
17566 | this.initListen(target.el, true);
|
17567 | });
|
17568 | } else {
|
17569 | this.targets.forEach((target) => {
|
17570 | this.initListen(target.el, false);
|
17571 | });
|
17572 | this.initIntersectionObserver();
|
17573 | }
|
17574 | }
|
17575 | |
17576 |
|
17577 |
|
17578 | |
17579 |
|
17580 |
|
17581 |
|
17582 |
|
17583 | addListenerTarget(el) {
|
17584 | if (!el)
|
17585 | return;
|
17586 | let target = this.targets.find((target2) => target2.el === el);
|
17587 | if (!target) {
|
17588 | target = {
|
17589 | el,
|
17590 | id: ++this.targetIndex,
|
17591 | childrenCount: 1,
|
17592 | listened: true
|
17593 | };
|
17594 | this.mode === modeType.event && this.initListen(target.el, true);
|
17595 | this.targets.push(target);
|
17596 | } else {
|
17597 | target.childrenCount++;
|
17598 | }
|
17599 | return this.targetIndex;
|
17600 | }
|
17601 | |
17602 |
|
17603 |
|
17604 |
|
17605 |
|
17606 | removeListenerTarget(el) {
|
17607 | this.targets.forEach((target, index) => {
|
17608 | if (target.el === el) {
|
17609 | target.childrenCount--;
|
17610 | if (!target.childrenCount) {
|
17611 | this.initListen(target.el, false);
|
17612 | this.targets.splice(index, 1);
|
17613 | target = null;
|
17614 | }
|
17615 | }
|
17616 | });
|
17617 | }
|
17618 | |
17619 |
|
17620 |
|
17621 |
|
17622 |
|
17623 |
|
17624 | initListen(el, start2) {
|
17625 | this.options.ListenEvents.forEach(
|
17626 | (evt) => (start2 ? on : off)(el, evt, this.lazyLoadHandler)
|
17627 | );
|
17628 | }
|
17629 | initEvent() {
|
17630 | this.Event = {
|
17631 | listeners: {
|
17632 | loading: [],
|
17633 | loaded: [],
|
17634 | error: []
|
17635 | }
|
17636 | };
|
17637 | this.$on = (event, func) => {
|
17638 | if (!this.Event.listeners[event])
|
17639 | this.Event.listeners[event] = [];
|
17640 | this.Event.listeners[event].push(func);
|
17641 | };
|
17642 | this.$once = (event, func) => {
|
17643 | const on2 = (...args) => {
|
17644 | this.$off(event, on2);
|
17645 | func.apply(this, args);
|
17646 | };
|
17647 | this.$on(event, on2);
|
17648 | };
|
17649 | this.$off = (event, func) => {
|
17650 | if (!func) {
|
17651 | if (!this.Event.listeners[event])
|
17652 | return;
|
17653 | this.Event.listeners[event].length = 0;
|
17654 | return;
|
17655 | }
|
17656 | remove(this.Event.listeners[event], func);
|
17657 | };
|
17658 | this.$emit = (event, context, inCache) => {
|
17659 | if (!this.Event.listeners[event])
|
17660 | return;
|
17661 | this.Event.listeners[event].forEach((func) => func(context, inCache));
|
17662 | };
|
17663 | }
|
17664 | |
17665 |
|
17666 |
|
17667 |
|
17668 | lazyLoadHandler() {
|
17669 | const freeList = [];
|
17670 | this.listeners.forEach((listener) => {
|
17671 | if (!listener.el || !listener.el.parentNode) {
|
17672 | freeList.push(listener);
|
17673 | }
|
17674 | const catIn = listener.checkInView();
|
17675 | if (!catIn)
|
17676 | return;
|
17677 | listener.load();
|
17678 | });
|
17679 | freeList.forEach((item) => {
|
17680 | remove(this.listeners, item);
|
17681 | item.$destroy();
|
17682 | });
|
17683 | }
|
17684 | |
17685 |
|
17686 |
|
17687 |
|
17688 |
|
17689 | initIntersectionObserver() {
|
17690 | if (!hasIntersectionObserver) {
|
17691 | return;
|
17692 | }
|
17693 | this.observer = new IntersectionObserver(
|
17694 | this.observerHandler.bind(this),
|
17695 | this.options.observerOptions
|
17696 | );
|
17697 | if (this.listeners.length) {
|
17698 | this.listeners.forEach((listener) => {
|
17699 | this.observer.observe(listener.el);
|
17700 | });
|
17701 | }
|
17702 | }
|
17703 | |
17704 |
|
17705 |
|
17706 |
|
17707 | observerHandler(entries) {
|
17708 | entries.forEach((entry) => {
|
17709 | if (entry.isIntersecting) {
|
17710 | this.listeners.forEach((listener) => {
|
17711 | if (listener.el === entry.target) {
|
17712 | if (listener.state.loaded)
|
17713 | return this.observer.unobserve(listener.el);
|
17714 | listener.load();
|
17715 | }
|
17716 | });
|
17717 | }
|
17718 | });
|
17719 | }
|
17720 | |
17721 |
|
17722 |
|
17723 |
|
17724 |
|
17725 |
|
17726 |
|
17727 | elRenderer(listener, state, cache) {
|
17728 | if (!listener.el)
|
17729 | return;
|
17730 | const { el, bindType } = listener;
|
17731 | let src;
|
17732 | switch (state) {
|
17733 | case "loading":
|
17734 | src = listener.loading;
|
17735 | break;
|
17736 | case "error":
|
17737 | src = listener.error;
|
17738 | break;
|
17739 | default:
|
17740 | ({ src } = listener);
|
17741 | break;
|
17742 | }
|
17743 | if (bindType) {
|
17744 | el.style[bindType] = 'url("' + src + '")';
|
17745 | } else if (el.getAttribute("src") !== src) {
|
17746 | el.setAttribute("src", src);
|
17747 | }
|
17748 | el.setAttribute("lazy", state);
|
17749 | this.$emit(state, listener, cache);
|
17750 | this.options.adapter[state] && this.options.adapter[state](listener, this.options);
|
17751 | if (this.options.dispatchEvent) {
|
17752 | const event = new CustomEvent(state, {
|
17753 | detail: listener
|
17754 | });
|
17755 | el.dispatchEvent(event);
|
17756 | }
|
17757 | }
|
17758 | |
17759 |
|
17760 |
|
17761 |
|
17762 |
|
17763 | valueFormatter(value) {
|
17764 | let src = value;
|
17765 | let { loading, error } = this.options;
|
17766 | if (isObject$1(value)) {
|
17767 | ({ src } = value);
|
17768 | loading = value.loading || this.options.loading;
|
17769 | error = value.error || this.options.error;
|
17770 | }
|
17771 | return {
|
17772 | src,
|
17773 | loading,
|
17774 | error
|
17775 | };
|
17776 | }
|
17777 | };
|
17778 | }
|
17779 | var stdin_default$2 = (lazy) => ({
|
17780 | props: {
|
17781 | tag: {
|
17782 | type: String,
|
17783 | default: "div"
|
17784 | }
|
17785 | },
|
17786 | emits: ["show"],
|
17787 | render() {
|
17788 | return vue.h(
|
17789 | this.tag,
|
17790 | this.show && this.$slots.default ? this.$slots.default() : null
|
17791 | );
|
17792 | },
|
17793 | data() {
|
17794 | return {
|
17795 | el: null,
|
17796 | state: {
|
17797 | loaded: false
|
17798 | },
|
17799 | show: false
|
17800 | };
|
17801 | },
|
17802 | mounted() {
|
17803 | this.el = this.$el;
|
17804 | lazy.addLazyBox(this);
|
17805 | lazy.lazyLoadHandler();
|
17806 | },
|
17807 | beforeUnmount() {
|
17808 | lazy.removeComponent(this);
|
17809 | },
|
17810 | methods: {
|
17811 | checkInView() {
|
17812 | const rect = useRect(this.$el);
|
17813 | return inBrowser && rect.top < window.innerHeight * lazy.options.preLoad && rect.bottom > 0 && rect.left < window.innerWidth * lazy.options.preLoad && rect.right > 0;
|
17814 | },
|
17815 | load() {
|
17816 | this.show = true;
|
17817 | this.state.loaded = true;
|
17818 | this.$emit("show", this);
|
17819 | },
|
17820 | destroy() {
|
17821 | return this.$destroy;
|
17822 | }
|
17823 | }
|
17824 | });
|
17825 | const defaultOptions = {
|
17826 | selector: "img"
|
17827 | };
|
17828 | class LazyContainer {
|
17829 | constructor({ el, binding, vnode, lazy }) {
|
17830 | this.el = null;
|
17831 | this.vnode = vnode;
|
17832 | this.binding = binding;
|
17833 | this.options = {};
|
17834 | this.lazy = lazy;
|
17835 | this.queue = [];
|
17836 | this.update({ el, binding });
|
17837 | }
|
17838 | update({ el, binding }) {
|
17839 | this.el = el;
|
17840 | this.options = Object.assign({}, defaultOptions, binding.value);
|
17841 | const imgs = this.getImgs();
|
17842 | imgs.forEach((el2) => {
|
17843 | this.lazy.add(
|
17844 | el2,
|
17845 | Object.assign({}, this.binding, {
|
17846 | value: {
|
17847 | src: "dataset" in el2 ? el2.dataset.src : el2.getAttribute("data-src"),
|
17848 | error: ("dataset" in el2 ? el2.dataset.error : el2.getAttribute("data-error")) || this.options.error,
|
17849 | loading: ("dataset" in el2 ? el2.dataset.loading : el2.getAttribute("data-loading")) || this.options.loading
|
17850 | }
|
17851 | }),
|
17852 | this.vnode
|
17853 | );
|
17854 | });
|
17855 | }
|
17856 | getImgs() {
|
17857 | return Array.from(this.el.querySelectorAll(this.options.selector));
|
17858 | }
|
17859 | clear() {
|
17860 | const imgs = this.getImgs();
|
17861 | imgs.forEach((el) => this.lazy.remove(el));
|
17862 | this.vnode = null;
|
17863 | this.binding = null;
|
17864 | this.lazy = null;
|
17865 | }
|
17866 | }
|
17867 | class LazyContainerManager {
|
17868 | constructor({ lazy }) {
|
17869 | this.lazy = lazy;
|
17870 | this.queue = [];
|
17871 | }
|
17872 | bind(el, binding, vnode) {
|
17873 | const container = new LazyContainer({
|
17874 | el,
|
17875 | binding,
|
17876 | vnode,
|
17877 | lazy: this.lazy
|
17878 | });
|
17879 | this.queue.push(container);
|
17880 | }
|
17881 | update(el, binding, vnode) {
|
17882 | const container = this.queue.find((item) => item.el === el);
|
17883 | if (!container)
|
17884 | return;
|
17885 | container.update({ el, binding, vnode });
|
17886 | }
|
17887 | unbind(el) {
|
17888 | const container = this.queue.find((item) => item.el === el);
|
17889 | if (!container)
|
17890 | return;
|
17891 | container.clear();
|
17892 | remove(this.queue, container);
|
17893 | }
|
17894 | }
|
17895 | var stdin_default$1 = (lazyManager) => ({
|
17896 | props: {
|
17897 | src: [String, Object],
|
17898 | tag: {
|
17899 | type: String,
|
17900 | default: "img"
|
17901 | }
|
17902 | },
|
17903 | render() {
|
17904 | var _a, _b;
|
17905 | return vue.h(
|
17906 | this.tag,
|
17907 | {
|
17908 | src: this.renderSrc
|
17909 | },
|
17910 | (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)
|
17911 | );
|
17912 | },
|
17913 | data() {
|
17914 | return {
|
17915 | el: null,
|
17916 | options: {
|
17917 | src: "",
|
17918 | error: "",
|
17919 | loading: "",
|
17920 | attempt: lazyManager.options.attempt
|
17921 | },
|
17922 | state: {
|
17923 | loaded: false,
|
17924 | error: false,
|
17925 | attempt: 0
|
17926 | },
|
17927 | renderSrc: ""
|
17928 | };
|
17929 | },
|
17930 | watch: {
|
17931 | src() {
|
17932 | this.init();
|
17933 | lazyManager.addLazyBox(this);
|
17934 | lazyManager.lazyLoadHandler();
|
17935 | }
|
17936 | },
|
17937 | created() {
|
17938 | this.init();
|
17939 | },
|
17940 | mounted() {
|
17941 | this.el = this.$el;
|
17942 | lazyManager.addLazyBox(this);
|
17943 | lazyManager.lazyLoadHandler();
|
17944 | },
|
17945 | beforeUnmount() {
|
17946 | lazyManager.removeComponent(this);
|
17947 | },
|
17948 | methods: {
|
17949 | init() {
|
17950 | const { src, loading, error } = lazyManager.valueFormatter(this.src);
|
17951 | this.state.loaded = false;
|
17952 | this.options.src = src;
|
17953 | this.options.error = error;
|
17954 | this.options.loading = loading;
|
17955 | this.renderSrc = this.options.loading;
|
17956 | },
|
17957 | checkInView() {
|
17958 | const rect = useRect(this.$el);
|
17959 | return rect.top < window.innerHeight * lazyManager.options.preLoad && rect.bottom > 0 && rect.left < window.innerWidth * lazyManager.options.preLoad && rect.right > 0;
|
17960 | },
|
17961 | load(onFinish = noop) {
|
17962 | if (this.state.attempt > this.options.attempt - 1 && this.state.error) {
|
17963 | onFinish();
|
17964 | return;
|
17965 | }
|
17966 | const { src } = this.options;
|
17967 | loadImageAsync(
|
17968 | { src },
|
17969 | ({ src: src2 }) => {
|
17970 | this.renderSrc = src2;
|
17971 | this.state.loaded = true;
|
17972 | },
|
17973 | () => {
|
17974 | this.state.attempt++;
|
17975 | this.renderSrc = this.options.error;
|
17976 | this.state.error = true;
|
17977 | }
|
17978 | );
|
17979 | }
|
17980 | }
|
17981 | });
|
17982 | const Lazyload = {
|
17983 | |
17984 |
|
17985 |
|
17986 |
|
17987 |
|
17988 | install(app, options = {}) {
|
17989 | const LazyClass = stdin_default$3();
|
17990 | const lazy = new LazyClass(options);
|
17991 | const lazyContainer = new LazyContainerManager({ lazy });
|
17992 | app.config.globalProperties.$Lazyload = lazy;
|
17993 | if (options.lazyComponent) {
|
17994 | app.component("LazyComponent", stdin_default$2(lazy));
|
17995 | }
|
17996 | if (options.lazyImage) {
|
17997 | app.component("LazyImage", stdin_default$1(lazy));
|
17998 | }
|
17999 | app.directive("lazy", {
|
18000 | beforeMount: lazy.add.bind(lazy),
|
18001 | updated: lazy.update.bind(lazy),
|
18002 | unmounted: lazy.remove.bind(lazy)
|
18003 | });
|
18004 | app.directive("lazy-container", {
|
18005 | beforeMount: lazyContainer.bind.bind(lazyContainer),
|
18006 | updated: lazyContainer.update.bind(lazyContainer),
|
18007 | unmounted: lazyContainer.unbind.bind(lazyContainer)
|
18008 | });
|
18009 | }
|
18010 | };
|
18011 | const version = "4.8.7";
|
18012 | function install(app) {
|
18013 | const components = [
|
18014 | ActionBar,
|
18015 | ActionBarButton,
|
18016 | ActionBarIcon,
|
18017 | ActionSheet,
|
18018 | AddressEdit,
|
18019 | AddressList,
|
18020 | Area,
|
18021 | BackTop,
|
18022 | Badge,
|
18023 | Barrage,
|
18024 | Button,
|
18025 | Calendar,
|
18026 | Card,
|
18027 | Cascader,
|
18028 | Cell,
|
18029 | CellGroup,
|
18030 | Checkbox,
|
18031 | CheckboxGroup,
|
18032 | Circle,
|
18033 | Col,
|
18034 | Collapse,
|
18035 | CollapseItem,
|
18036 | ConfigProvider,
|
18037 | ContactCard,
|
18038 | ContactEdit,
|
18039 | ContactList,
|
18040 | CountDown,
|
18041 | Coupon,
|
18042 | CouponCell,
|
18043 | CouponList,
|
18044 | DatePicker,
|
18045 | Dialog,
|
18046 | Divider,
|
18047 | DropdownItem,
|
18048 | DropdownMenu,
|
18049 | Empty,
|
18050 | Field,
|
18051 | FloatingBubble,
|
18052 | FloatingPanel,
|
18053 | Form,
|
18054 | Grid,
|
18055 | GridItem,
|
18056 | Highlight,
|
18057 | Icon,
|
18058 | Image$1,
|
18059 | ImagePreview,
|
18060 | IndexAnchor,
|
18061 | IndexBar,
|
18062 | List,
|
18063 | Loading,
|
18064 | Locale,
|
18065 | NavBar,
|
18066 | NoticeBar,
|
18067 | Notify,
|
18068 | NumberKeyboard,
|
18069 | Overlay,
|
18070 | Pagination,
|
18071 | PasswordInput,
|
18072 | Picker,
|
18073 | PickerGroup,
|
18074 | Popover,
|
18075 | Popup,
|
18076 | Progress,
|
18077 | PullRefresh,
|
18078 | Radio,
|
18079 | RadioGroup,
|
18080 | Rate,
|
18081 | RollingText,
|
18082 | Row,
|
18083 | Search,
|
18084 | ShareSheet,
|
18085 | Sidebar,
|
18086 | SidebarItem,
|
18087 | Signature,
|
18088 | Skeleton,
|
18089 | SkeletonAvatar,
|
18090 | SkeletonImage,
|
18091 | SkeletonParagraph,
|
18092 | SkeletonTitle,
|
18093 | Slider,
|
18094 | Space,
|
18095 | Step,
|
18096 | Stepper,
|
18097 | Steps,
|
18098 | Sticky,
|
18099 | SubmitBar,
|
18100 | Swipe,
|
18101 | SwipeCell,
|
18102 | SwipeItem,
|
18103 | Switch,
|
18104 | Tab,
|
18105 | Tabbar,
|
18106 | TabbarItem,
|
18107 | Tabs,
|
18108 | Tag,
|
18109 | TextEllipsis,
|
18110 | TimePicker,
|
18111 | Toast,
|
18112 | TreeSelect,
|
18113 | Uploader,
|
18114 | Watermark
|
18115 | ];
|
18116 | components.forEach((item) => {
|
18117 | if (item.install) {
|
18118 | app.use(item);
|
18119 | } else if (item.name) {
|
18120 | app.component(item.name, item);
|
18121 | }
|
18122 | });
|
18123 | }
|
18124 | var stdin_default = {
|
18125 | install,
|
18126 | version
|
18127 | };
|
18128 | exports2.ActionBar = ActionBar;
|
18129 | exports2.ActionBarButton = ActionBarButton;
|
18130 | exports2.ActionBarIcon = ActionBarIcon;
|
18131 | exports2.ActionSheet = ActionSheet;
|
18132 | exports2.AddressEdit = AddressEdit;
|
18133 | exports2.AddressList = AddressList;
|
18134 | exports2.Area = Area;
|
18135 | exports2.BackTop = BackTop;
|
18136 | exports2.Badge = Badge;
|
18137 | exports2.Barrage = Barrage;
|
18138 | exports2.Button = Button;
|
18139 | exports2.Calendar = Calendar;
|
18140 | exports2.Card = Card;
|
18141 | exports2.Cascader = Cascader;
|
18142 | exports2.Cell = Cell;
|
18143 | exports2.CellGroup = CellGroup;
|
18144 | exports2.Checkbox = Checkbox;
|
18145 | exports2.CheckboxGroup = CheckboxGroup;
|
18146 | exports2.Circle = Circle;
|
18147 | exports2.Col = Col;
|
18148 | exports2.Collapse = Collapse;
|
18149 | exports2.CollapseItem = CollapseItem;
|
18150 | exports2.ConfigProvider = ConfigProvider;
|
18151 | exports2.ContactCard = ContactCard;
|
18152 | exports2.ContactEdit = ContactEdit;
|
18153 | exports2.ContactList = ContactList;
|
18154 | exports2.CountDown = CountDown;
|
18155 | exports2.Coupon = Coupon;
|
18156 | exports2.CouponCell = CouponCell;
|
18157 | exports2.CouponList = CouponList;
|
18158 | exports2.DEFAULT_ROW_WIDTH = DEFAULT_ROW_WIDTH;
|
18159 | exports2.DatePicker = DatePicker;
|
18160 | exports2.Dialog = Dialog;
|
18161 | exports2.Divider = Divider;
|
18162 | exports2.DropdownItem = DropdownItem;
|
18163 | exports2.DropdownMenu = DropdownMenu;
|
18164 | exports2.Empty = Empty;
|
18165 | exports2.Field = Field;
|
18166 | exports2.FloatingBubble = FloatingBubble;
|
18167 | exports2.FloatingPanel = FloatingPanel;
|
18168 | exports2.Form = Form;
|
18169 | exports2.Grid = Grid;
|
18170 | exports2.GridItem = GridItem;
|
18171 | exports2.Highlight = Highlight;
|
18172 | exports2.Icon = Icon;
|
18173 | exports2.Image = Image$1;
|
18174 | exports2.ImagePreview = ImagePreview;
|
18175 | exports2.IndexAnchor = IndexAnchor;
|
18176 | exports2.IndexBar = IndexBar;
|
18177 | exports2.Lazyload = Lazyload;
|
18178 | exports2.List = List;
|
18179 | exports2.Loading = Loading;
|
18180 | exports2.Locale = Locale;
|
18181 | exports2.NavBar = NavBar;
|
18182 | exports2.NoticeBar = NoticeBar;
|
18183 | exports2.Notify = Notify;
|
18184 | exports2.NumberKeyboard = NumberKeyboard;
|
18185 | exports2.Overlay = Overlay;
|
18186 | exports2.Pagination = Pagination;
|
18187 | exports2.PasswordInput = PasswordInput;
|
18188 | exports2.Picker = Picker;
|
18189 | exports2.PickerGroup = PickerGroup;
|
18190 | exports2.Popover = Popover;
|
18191 | exports2.Popup = Popup;
|
18192 | exports2.Progress = Progress;
|
18193 | exports2.PullRefresh = PullRefresh;
|
18194 | exports2.Radio = Radio;
|
18195 | exports2.RadioGroup = RadioGroup;
|
18196 | exports2.Rate = Rate;
|
18197 | exports2.RollingText = RollingText;
|
18198 | exports2.Row = Row;
|
18199 | exports2.Search = Search;
|
18200 | exports2.ShareSheet = ShareSheet;
|
18201 | exports2.Sidebar = Sidebar;
|
18202 | exports2.SidebarItem = SidebarItem;
|
18203 | exports2.Signature = Signature;
|
18204 | exports2.Skeleton = Skeleton;
|
18205 | exports2.SkeletonAvatar = SkeletonAvatar;
|
18206 | exports2.SkeletonImage = SkeletonImage;
|
18207 | exports2.SkeletonParagraph = SkeletonParagraph;
|
18208 | exports2.SkeletonTitle = SkeletonTitle;
|
18209 | exports2.Slider = Slider;
|
18210 | exports2.Space = Space;
|
18211 | exports2.Step = Step;
|
18212 | exports2.Stepper = Stepper;
|
18213 | exports2.Steps = Steps;
|
18214 | exports2.Sticky = Sticky;
|
18215 | exports2.SubmitBar = SubmitBar;
|
18216 | exports2.Swipe = Swipe;
|
18217 | exports2.SwipeCell = SwipeCell;
|
18218 | exports2.SwipeItem = SwipeItem;
|
18219 | exports2.Switch = Switch;
|
18220 | exports2.Tab = Tab;
|
18221 | exports2.Tabbar = Tabbar;
|
18222 | exports2.TabbarItem = TabbarItem;
|
18223 | exports2.Tabs = Tabs;
|
18224 | exports2.Tag = Tag;
|
18225 | exports2.TextEllipsis = TextEllipsis;
|
18226 | exports2.TimePicker = TimePicker;
|
18227 | exports2.Toast = Toast;
|
18228 | exports2.TreeSelect = TreeSelect;
|
18229 | exports2.Uploader = Uploader;
|
18230 | exports2.Watermark = Watermark;
|
18231 | exports2.actionBarButtonProps = actionBarButtonProps;
|
18232 | exports2.actionBarIconProps = actionBarIconProps;
|
18233 | exports2.actionBarProps = actionBarProps;
|
18234 | exports2.actionSheetProps = actionSheetProps;
|
18235 | exports2.addressEditProps = addressEditProps;
|
18236 | exports2.addressListProps = addressListProps;
|
18237 | exports2.allowMultipleToast = allowMultipleToast;
|
18238 | exports2.areaProps = areaProps;
|
18239 | exports2.backTopProps = backTopProps;
|
18240 | exports2.badgeProps = badgeProps;
|
18241 | exports2.barrageProps = barrageProps;
|
18242 | exports2.buttonProps = buttonProps;
|
18243 | exports2.calendarProps = calendarProps;
|
18244 | exports2.cardProps = cardProps;
|
18245 | exports2.cascaderProps = cascaderProps;
|
18246 | exports2.cellGroupProps = cellGroupProps;
|
18247 | exports2.cellProps = cellProps;
|
18248 | exports2.checkboxGroupProps = checkboxGroupProps;
|
18249 | exports2.checkboxProps = checkboxProps;
|
18250 | exports2.circleProps = circleProps;
|
18251 | exports2.closeDialog = closeDialog;
|
18252 | exports2.closeNotify = closeNotify;
|
18253 | exports2.closeToast = closeToast;
|
18254 | exports2.colProps = colProps;
|
18255 | exports2.collapseItemProps = collapseItemProps;
|
18256 | exports2.collapseProps = collapseProps;
|
18257 | exports2.configProviderProps = configProviderProps;
|
18258 | exports2.contactCardProps = contactCardProps;
|
18259 | exports2.contactEditProps = contactEditProps;
|
18260 | exports2.contactListProps = contactListProps;
|
18261 | exports2.countDownProps = countDownProps;
|
18262 | exports2.couponCellProps = couponCellProps;
|
18263 | exports2.couponListProps = couponListProps;
|
18264 | exports2.datePickerProps = datePickerProps;
|
18265 | exports2.default = stdin_default;
|
18266 | exports2.dialogProps = dialogProps;
|
18267 | exports2.dividerProps = dividerProps;
|
18268 | exports2.dropdownItemProps = dropdownItemProps;
|
18269 | exports2.dropdownMenuProps = dropdownMenuProps;
|
18270 | exports2.emptyProps = emptyProps;
|
18271 | exports2.fieldProps = fieldProps;
|
18272 | exports2.floatingBubbleProps = floatingBubbleProps;
|
18273 | exports2.floatingPanelProps = floatingPanelProps;
|
18274 | exports2.formProps = formProps;
|
18275 | exports2.gridItemProps = gridItemProps;
|
18276 | exports2.gridProps = gridProps;
|
18277 | exports2.highlightProps = highlightProps;
|
18278 | exports2.iconProps = iconProps;
|
18279 | exports2.imagePreviewProps = imagePreviewProps;
|
18280 | exports2.imageProps = imageProps;
|
18281 | exports2.indexAnchorProps = indexAnchorProps;
|
18282 | exports2.indexBarProps = indexBarProps;
|
18283 | exports2.install = install;
|
18284 | exports2.listProps = listProps;
|
18285 | exports2.loadingProps = loadingProps;
|
18286 | exports2.navBarProps = navBarProps;
|
18287 | exports2.noticeBarProps = noticeBarProps;
|
18288 | exports2.notifyProps = notifyProps;
|
18289 | exports2.numberKeyboardProps = numberKeyboardProps;
|
18290 | exports2.overlayProps = overlayProps;
|
18291 | exports2.paginationProps = paginationProps;
|
18292 | exports2.passwordInputProps = passwordInputProps;
|
18293 | exports2.pickerGroupProps = pickerGroupProps;
|
18294 | exports2.pickerProps = pickerProps;
|
18295 | exports2.popoverProps = popoverProps;
|
18296 | exports2.popupProps = popupProps$2;
|
18297 | exports2.progressProps = progressProps;
|
18298 | exports2.pullRefreshProps = pullRefreshProps;
|
18299 | exports2.radioGroupProps = radioGroupProps;
|
18300 | exports2.radioProps = radioProps;
|
18301 | exports2.rateProps = rateProps;
|
18302 | exports2.resetDialogDefaultOptions = resetDialogDefaultOptions;
|
18303 | exports2.resetNotifyDefaultOptions = resetNotifyDefaultOptions;
|
18304 | exports2.resetToastDefaultOptions = resetToastDefaultOptions;
|
18305 | exports2.rollingTextProps = rollingTextProps;
|
18306 | exports2.rowProps = rowProps;
|
18307 | exports2.searchProps = searchProps;
|
18308 | exports2.setDialogDefaultOptions = setDialogDefaultOptions;
|
18309 | exports2.setNotifyDefaultOptions = setNotifyDefaultOptions;
|
18310 | exports2.setToastDefaultOptions = setToastDefaultOptions;
|
18311 | exports2.shareSheetProps = shareSheetProps;
|
18312 | exports2.showConfirmDialog = showConfirmDialog;
|
18313 | exports2.showDialog = showDialog;
|
18314 | exports2.showFailToast = showFailToast;
|
18315 | exports2.showImagePreview = showImagePreview;
|
18316 | exports2.showLoadingToast = showLoadingToast;
|
18317 | exports2.showNotify = showNotify;
|
18318 | exports2.showSuccessToast = showSuccessToast;
|
18319 | exports2.showToast = showToast;
|
18320 | exports2.sidebarItemProps = sidebarItemProps;
|
18321 | exports2.sidebarProps = sidebarProps;
|
18322 | exports2.skeletonAvatarProps = skeletonAvatarProps;
|
18323 | exports2.skeletonImageProps = skeletonImageProps;
|
18324 | exports2.skeletonParagraphProps = skeletonParagraphProps;
|
18325 | exports2.skeletonProps = skeletonProps;
|
18326 | exports2.skeletonTitleProps = skeletonTitleProps;
|
18327 | exports2.sliderProps = sliderProps;
|
18328 | exports2.spaceProps = spaceProps;
|
18329 | exports2.stepperProps = stepperProps;
|
18330 | exports2.stepsProps = stepsProps;
|
18331 | exports2.stickyProps = stickyProps;
|
18332 | exports2.submitBarProps = submitBarProps;
|
18333 | exports2.swipeCellProps = swipeCellProps;
|
18334 | exports2.swipeProps = swipeProps;
|
18335 | exports2.switchProps = switchProps;
|
18336 | exports2.tabProps = tabProps;
|
18337 | exports2.tabbarItemProps = tabbarItemProps;
|
18338 | exports2.tabbarProps = tabbarProps;
|
18339 | exports2.tabsProps = tabsProps;
|
18340 | exports2.tagProps = tagProps;
|
18341 | exports2.textEllipsisProps = textEllipsisProps;
|
18342 | exports2.timePickerProps = timePickerProps;
|
18343 | exports2.toastProps = toastProps;
|
18344 | exports2.treeSelectProps = treeSelectProps;
|
18345 | exports2.uploaderProps = uploaderProps;
|
18346 | exports2.useCurrentLang = useCurrentLang;
|
18347 | exports2.version = version;
|
18348 | exports2.watermarkProps = watermarkProps;
|
18349 | Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
18350 | });
|