1/*! Element Plus v2.3.5 */ 2 3(function (global, factory) { 4 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) : 5 typeof define === 'function' && define.amd ? define(['exports', 'vue'], factory) : 6 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ElementPlus = {}, global.Vue)); 7 })(this, (function (exports, vue) { 'use strict'; 8 9 const FOCUSABLE_ELEMENT_SELECTORS = `a[href],button:not([disabled]),button:not([hidden]),:not([tabindex="-1"]),input:not([disabled]),input:not([type="hidden"]),select:not([disabled]),textarea:not([disabled])`; 10 const isVisible = (element) => { 11 const computed = getComputedStyle(element); 12 return computed.position === "fixed" ? false : element.offsetParent !== null; 13 }; 14 const obtainAllFocusableElements$1 = (element) => { 15 return Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter((item) => isFocusable(item) && isVisible(item)); 16 }; 17 const isFocusable = (element) => { 18 if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null) { 19 return true; 20 } 21 if (element.disabled) { 22 return false; 23 } 24 switch (element.nodeName) { 25 case "A": { 26 return !!element.href && element.rel !== "ignore"; 27 } 28 case "INPUT": { 29 return !(element.type === "hidden" || element.type === "file"); 30 } 31 case "BUTTON": 32 case "SELECT": 33 case "TEXTAREA": { 34 return true; 35 } 36 default: { 37 return false; 38 } 39 } 40 }; 41 const triggerEvent = function(elm, name, ...opts) { 42 let eventName; 43 if (name.includes("mouse") || name.includes("click")) { 44 eventName = "MouseEvents"; 45 } else if (name.includes("key")) { 46 eventName = "KeyboardEvent"; 47 } else { 48 eventName = "HTMLEvents"; 49 } 50 const evt = document.createEvent(eventName); 51 evt.initEvent(name, ...opts); 52 elm.dispatchEvent(evt); 53 return elm; 54 }; 55 const isLeaf = (el) => !el.getAttribute("aria-owns"); 56 const getSibling = (el, distance, elClass) => { 57 const { parentNode } = el; 58 if (!parentNode) 59 return null; 60 const siblings = parentNode.querySelectorAll(elClass); 61 const index = Array.prototype.indexOf.call(siblings, el); 62 return siblings[index + distance] || null; 63 }; 64 const focusNode = (el) => { 65 if (!el) 66 return; 67 el.focus(); 68 !isLeaf(el) && el.click(); 69 }; 70 71 const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => { 72 const handleEvent = (event) => { 73 const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event); 74 if (checkForDefaultPrevented === false || !shouldPrevent) { 75 return oursHandler == null ? void 0 : oursHandler(event); 76 } 77 }; 78 return handleEvent; 79 }; 80 const whenMouse = (handler) => { 81 return (e) => e.pointerType === "mouse" ? handler(e) : void 0; 82 }; 83 84 var __defProp$9 = Object.defineProperty; 85 var __defProps$6 = Object.defineProperties; 86 var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors; 87 var __getOwnPropSymbols$b = Object.getOwnPropertySymbols; 88 var __hasOwnProp$b = Object.prototype.hasOwnProperty; 89 var __propIsEnum$b = Object.prototype.propertyIsEnumerable; 90 var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 91 var __spreadValues$9 = (a, b) => { 92 for (var prop in b || (b = {})) 93 if (__hasOwnProp$b.call(b, prop)) 94 __defNormalProp$9(a, prop, b[prop]); 95 if (__getOwnPropSymbols$b) 96 for (var prop of __getOwnPropSymbols$b(b)) { 97 if (__propIsEnum$b.call(b, prop)) 98 __defNormalProp$9(a, prop, b[prop]); 99 } 100 return a; 101 }; 102 var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b)); 103 function computedEager(fn, options) { 104 var _a; 105 const result = vue.shallowRef(); 106 vue.watchEffect(() => { 107 result.value = fn(); 108 }, __spreadProps$6(__spreadValues$9({}, options), { 109 flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync" 110 })); 111 return vue.readonly(result); 112 } 113 114 var _a; 115 const isClient = typeof window !== "undefined"; 116 const isDef = (val) => typeof val !== "undefined"; 117 const isString$2 = (val) => typeof val === "string"; 118 const noop$1 = () => { 119 }; 120 const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent); 121 122 function resolveUnref(r) { 123 return typeof r === "function" ? r() : vue.unref(r); 124 } 125 126 function createFilterWrapper(filter, fn) { 127 function wrapper(...args) { 128 filter(() => fn.apply(this, args), { fn, thisArg: this, args }); 129 } 130 return wrapper; 131 } 132 function debounceFilter(ms, options = {}) { 133 let timer; 134 let maxTimer; 135 const filter = (invoke) => { 136 const duration = resolveUnref(ms); 137 const maxDuration = resolveUnref(options.maxWait); 138 if (timer) 139 clearTimeout(timer); 140 if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) { 141 if (maxTimer) { 142 clearTimeout(maxTimer); 143 maxTimer = null; 144 } 145 return invoke(); 146 } 147 if (maxDuration && !maxTimer) { 148 maxTimer = setTimeout(() => { 149 if (timer) 150 clearTimeout(timer); 151 maxTimer = null; 152 invoke(); 153 }, maxDuration); 154 } 155 timer = setTimeout(() => { 156 if (maxTimer) 157 clearTimeout(maxTimer); 158 maxTimer = null; 159 invoke(); 160 }, duration); 161 }; 162 return filter; 163 } 164 function throttleFilter(ms, trailing = true, leading = true) { 165 let lastExec = 0; 166 let timer; 167 let isLeading = true; 168 const clear = () => { 169 if (timer) { 170 clearTimeout(timer); 171 timer = void 0; 172 } 173 }; 174 const filter = (invoke) => { 175 const duration = resolveUnref(ms);
176 const elapsed = Date.now() - lastExec; 177 clear(); 178 if (duration <= 0) { 179 lastExec = Date.now(); 180 return invoke(); 181 } 182 if (elapsed > duration && (leading || !isLeading)) { 183 lastExec = Date.now(); 184 invoke(); 185 } else if (trailing) { 186 timer = setTimeout(() => { 187 lastExec = Date.now(); 188 isLeading = true; 189 clear(); 190 invoke(); 191 }, duration); 192 } 193 if (!leading && !timer) 194 timer = setTimeout(() => isLeading = true, duration); 195 isLeading = false; 196 }; 197 return filter; 198 } 199 function identity$1(arg) { 200 return arg; 201 } 202 203 function tryOnScopeDispose(fn) { 204 if (vue.getCurrentScope()) { 205 vue.onScopeDispose(fn); 206 return true; 207 } 208 return false; 209 } 210 211 function useDebounceFn(fn, ms = 200, options = {}) { 212 return createFilterWrapper(debounceFilter(ms, options), fn); 213 } 214 215 function refDebounced(value, ms = 200, options = {}) { 216 if (ms <= 0) 217 return value; 218 const debounced = vue.ref(value.value); 219 const updater = useDebounceFn(() => { 220 debounced.value = value.value; 221 }, ms, options); 222 vue.watch(value, () => updater()); 223 return debounced; 224 } 225 226 function useThrottleFn(fn, ms = 200, trailing = false, leading = true) { 227 return createFilterWrapper(throttleFilter(ms, trailing, leading), fn); 228 } 229 230 function tryOnMounted(fn, sync = true) { 231 if (vue.getCurrentInstance()) 232 vue.onMounted(fn); 233 else if (sync) 234 fn(); 235 else 236 vue.nextTick(fn); 237 } 238 239 function useTimeoutFn(cb, interval, options = {}) { 240 const { 241 immediate = true 242 } = options; 243 const isPending = vue.ref(false); 244 let timer = null; 245 function clear() { 246 if (timer) { 247 clearTimeout(timer); 248 timer = null; 249 } 250 } 251 function stop() { 252 isPending.value = false; 253 clear(); 254 } 255 function start(...args) { 256 clear(); 257 isPending.value = true; 258 timer = setTimeout(() => { 259 isPending.value = false; 260 timer = null; 261 cb(...args); 262 }, resolveUnref(interval)); 263 } 264 if (immediate) { 265 isPending.value = true; 266 if (isClient) 267 start(); 268 } 269 tryOnScopeDispose(stop); 270 return { 271 isPending, 272 start, 273 stop 274 }; 275 } 276 277 function unrefElement(elRef) { 278 var _a; 279 const plain = resolveUnref(elRef); 280 return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain; 281 } 282 283 const defaultWindow = isClient ? window : void 0; 284 const defaultDocument = isClient ? window.document : void 0; 285 286 function useEventListener(...args) { 287 let target; 288 let event; 289 let listener; 290 let options; 291 if (isString$2(args[0])) { 292 [event, listener, options] = args; 293 target = defaultWindow; 294 } else { 295 [target, event, listener, options] = args; 296 } 297 if (!target) 298 return noop$1; 299 let cleanup = noop$1; 300 const stopWatch = vue.watch(() => unrefElement(target), (el) => { 301 cleanup(); 302 if (!el) 303 return; 304 el.addEventListener(event, listener, options); 305 cleanup = () => { 306 el.removeEventListener(event, listener, options); 307 cleanup = noop$1; 308 }; 309 }, { immediate: true, flush: "post" }); 310 const stop = () => { 311 stopWatch(); 312 cleanup(); 313 }; 314 tryOnScopeDispose(stop); 315 return stop; 316 } 317 318 function onClickOutside(target, handler, options = {}) { 319 const { window = defaultWindow, ignore, capture = true, detectIframe = false } = options; 320 if (!window) 321 return; 322 const shouldListen = vue.ref(true); 323 let fallback; 324 const listener = (event) => { 325 window.clearTimeout(fallback); 326 const el = unrefElement(target); 327 const composedPath = event.composedPath(); 328 if (!el || el === event.target || composedPath.includes(el) || !shouldListen.value) 329 return; 330 if (ignore && ignore.length > 0) { 331 if (ignore.some((target2) => { 332 const el2 = unrefElement(target2); 333 return el2 && (event.target === el2 || composedPath.includes(el2)); 334 })) 335 return; 336 } 337 handler(event); 338 }; 339 const cleanup = [ 340 useEventListener(window, "click", listener, { passive: true, capture }), 341 useEventListener(window, "pointerdown", (e) => { 342 const el = unrefElement(target); 343 shouldListen.value = !!el && !e.composedPath().includes(el); 344 }, { passive: true }), 345 useEventListener(window, "pointerup", (e) => { 346 if (e.button === 0) { 347 const path = e.composedPath(); 348 e.composedPath = () => path; 349 fallback = window.setTimeout(() => listener(e), 50); 350 } 351 }, { passive: true }), 352 detectIframe && useEventListener(window, "blur", (event) => { 353 var _a; 354 const el = unrefElement(target); 355 if (((_a = document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(document.activeElement))) 356 handler(event); 357 })
358 ].filter(Boolean); 359 const stop = () => cleanup.forEach((fn) => fn()); 360 return stop; 361 } 362 363 function useSupported(callback, sync = false) { 364 const isSupported = vue.ref(); 365 const update = () => isSupported.value = Boolean(callback()); 366 update(); 367 tryOnMounted(update, sync); 368 return isSupported; 369 } 370 371 const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; 372 const globalKey = "__vueuse_ssr_handlers__"; 373 _global[globalKey] = _global[globalKey] || {}; 374 _global[globalKey]; 375 376 function useCssVar(prop, target, { window = defaultWindow, initialValue = "" } = {}) { 377 const variable = vue.ref(initialValue); 378 const elRef = vue.computed(() => { 379 var _a; 380 return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement); 381 }); 382 vue.watch([elRef, () => resolveUnref(prop)], ([el, prop2]) => { 383 var _a; 384 if (el && window) { 385 const value = (_a = window.getComputedStyle(el).getPropertyValue(prop2)) == null ? void 0 : _a.trim(); 386 variable.value = value || initialValue; 387 } 388 }, { immediate: true }); 389 vue.watch(variable, (val) => { 390 var _a; 391 if ((_a = elRef.value) == null ? void 0 : _a.style) 392 elRef.value.style.setProperty(resolveUnref(prop), val); 393 }); 394 return variable; 395 } 396 397 function useDocumentVisibility({ document = defaultDocument } = {}) { 398 if (!document) 399 return vue.ref("visible"); 400 const visibility = vue.ref(document.visibilityState); 401 useEventListener(document, "visibilitychange", () => { 402 visibility.value = document.visibilityState; 403 }); 404 return visibility; 405 } 406 407 var __getOwnPropSymbols$f = Object.getOwnPropertySymbols; 408 var __hasOwnProp$f = Object.prototype.hasOwnProperty; 409 var __propIsEnum$f = Object.prototype.propertyIsEnumerable; 410 var __objRest$2 = (source, exclude) => { 411 var target = {}; 412 for (var prop in source) 413 if (__hasOwnProp$f.call(source, prop) && exclude.indexOf(prop) < 0) 414 target[prop] = source[prop]; 415 if (source != null && __getOwnPropSymbols$f) 416 for (var prop of __getOwnPropSymbols$f(source)) { 417 if (exclude.indexOf(prop) < 0 && __propIsEnum$f.call(source, prop)) 418 target[prop] = source[prop]; 419 } 420 return target; 421 }; 422 function useResizeObserver(target, callback, options = {}) { 423 const _a = options, { window = defaultWindow } = _a, observerOptions = __objRest$2(_a, ["window"]); 424 let observer; 425 const isSupported = useSupported(() => window && "ResizeObserver" in window); 426 const cleanup = () => { 427 if (observer) { 428 observer.disconnect(); 429 observer = void 0; 430 } 431 }; 432 const stopWatch = vue.watch(() => unrefElement(target), (el) => { 433 cleanup(); 434 if (isSupported.value && window && el) { 435 observer = new ResizeObserver(callback); 436 observer.observe(el, observerOptions); 437 } 438 }, { immediate: true, flush: "post" }); 439 const stop = () => { 440 cleanup(); 441 stopWatch(); 442 }; 443 tryOnScopeDispose(stop); 444 return { 445 isSupported, 446 stop 447 }; 448 } 449 450 function useElementBounding(target, options = {}) { 451 const { 452 reset = true, 453 windowResize = true, 454 windowScroll = true, 455 immediate = true 456 } = options; 457 const height = vue.ref(0);
458 const bottom = vue.ref(0); 459 const left = vue.ref(0); 460 const right = vue.ref(0); 461 const top = vue.ref(0); 462 const width = vue.ref(0); 463 const x = vue.ref(0); 464 const y = vue.ref(0); 465 function update() { 466 const el = unrefElement(target); 467 if (!el) { 468 if (reset) { 469 height.value = 0; 470 bottom.value = 0; 471 left.value = 0; 472 right.value = 0; 473 top.value = 0; 474 width.value = 0; 475 x.value = 0; 476 y.value = 0; 477 } 478 return; 479 } 480 const rect = el.getBoundingClientRect(); 481 height.value = rect.height; 482 bottom.value = rect.bottom; 483 left.value = rect.left; 484 right.value = rect.right; 485 top.value = rect.top; 486 width.value = rect.width; 487 x.value = rect.x; 488 y.value = rect.y; 489 } 490 useResizeObserver(target, update); 491 vue.watch(() => unrefElement(target), (ele) => !ele && update()); 492 if (windowScroll) 493 useEventListener("scroll", update, { passive: true }); 494 if (windowResize) 495 useEventListener("resize", update, { passive: true }); 496 tryOnMounted(() => { 497 if (immediate) 498 update(); 499 }); 500 return { 501 height, 502 bottom, 503 left, 504 right, 505 top, 506 width, 507 x, 508 y, 509 update 510 }; 511 } 512 513 var SwipeDirection; 514 (function(SwipeDirection2) { 515 SwipeDirection2["UP"] = "UP"; 516 SwipeDirection2["RIGHT"] = "RIGHT"; 517 SwipeDirection2["DOWN"] = "DOWN"; 518 SwipeDirection2["LEFT"] = "LEFT"; 519 SwipeDirection2["NONE"] = "NONE"; 520 })(SwipeDirection || (SwipeDirection = {})); 521 522 var __defProp = Object.defineProperty; 523 var __getOwnPropSymbols = Object.getOwnPropertySymbols; 524 var __hasOwnProp = Object.prototype.hasOwnProperty; 525 var __propIsEnum = Object.prototype.propertyIsEnumerable; 526 var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 527 var __spreadValues = (a, b) => { 528 for (var prop in b || (b = {})) 529 if (__hasOwnProp.call(b, prop)) 530 __defNormalProp(a, prop, b[prop]); 531 if (__getOwnPropSymbols) 532 for (var prop of __getOwnPropSymbols(b)) { 533 if (__propIsEnum.call(b, prop)) 534 __defNormalProp(a, prop, b[prop]); 535 } 536 return a; 537 }; 538 const _TransitionPresets = { 539 easeInSine: [0.12, 0, 0.39, 0], 540 easeOutSine: [0.61, 1, 0.88, 1], 541 easeInOutSine: [0.37, 0, 0.63, 1], 542 easeInQuad: [0.11, 0, 0.5, 0], 543 easeOutQuad: [0.5, 1, 0.89, 1], 544 easeInOutQuad: [0.45, 0, 0.55, 1], 545 easeInCubic: [0.32, 0, 0.67, 0], 546 easeOutCubic: [0.33, 1, 0.68, 1], 547 easeInOutCubic: [0.65, 0, 0.35, 1], 548 easeInQuart: [0.5, 0, 0.75, 0], 549 easeOutQuart: [0.25, 1, 0.5, 1], 550 easeInOutQuart: [0.76, 0, 0.24, 1], 551 easeInQuint: [0.64, 0, 0.78, 0], 552 easeOutQuint: [0.22, 1, 0.36, 1], 553 easeInOutQuint: [0.83, 0, 0.17, 1], 554 easeInExpo: [0.7, 0, 0.84, 0], 555 easeOutExpo: [0.16, 1, 0.3, 1], 556 easeInOutExpo: [0.87, 0, 0.13, 1], 557 easeInCirc: [0.55, 0, 1, 0.45], 558 easeOutCirc: [0, 0.55, 0.45, 1], 559 easeInOutCirc: [0.85, 0, 0.15, 1], 560 easeInBack: [0.36, 0, 0.66, -0.56], 561 easeOutBack: [0.34, 1.56, 0.64, 1], 562 easeInOutBack: [0.68, -0.6, 0.32, 1.6] 563 }; 564 __spreadValues({ 565 linear: identity$1 566 }, _TransitionPresets); 567 568 function useVModel(props, key, emit, options = {}) { 569 var _a, _b, _c; 570 const { 571 passive = false, 572 eventName, 573 deep = false, 574 defaultValue 575 } = options; 576 const vm = vue.getCurrentInstance(); 577 const _emit = emit || (vm == null ? void 0 : vm.emit) || ((_a = vm == null ? void 0 : vm.$emit) == null ? void 0 : _a.bind(vm)) || ((_c = (_b = vm == null ? void 0 : vm.proxy) == null ? void 0 : _b.$emit) == null ? void 0 : _c.bind(vm == null ? void 0 : vm.proxy)); 578 let event = eventName; 579 if (!key) { 580 { 581 key = "modelValue"; 582 } 583 } 584 event = eventName || event || `update:${key.toString()}`; 585 const getValue = () => isDef(props[key]) ? props[key] : defaultValue; 586 if (passive) { 587 const proxy = vue.ref(getValue()); 588 vue.watch(() => props[key], (v) => proxy.value = v); 589 vue.watch(proxy, (v) => { 590 if (v !== props[key] || deep) 591 _emit(event, v); 592 }, { 593 deep 594 }); 595 return proxy; 596 } else { 597 return vue.computed({ 598 get() { 599 return getValue(); 600 }, 601 set(value) { 602 _emit(event, value); 603 } 604 }); 605 } 606 } 607 608 function useWindowFocus({ window = defaultWindow } = {}) { 609 if (!window) 610 return vue.ref(false); 611 const focused = vue.ref(window.document.hasFocus()); 612 useEventListener(window, "blur", () => { 613 focused.value = false; 614 }); 615 useEventListener(window, "focus", () => { 616 focused.value = true; 617 }); 618 return focused; 619 } 620 621 function useWindowSize(options = {}) { 622 const { 623 window = defaultWindow, 624 initialWidth = Infinity, 625 initialHeight = Infinity, 626 listenOrientation = true 627 } = options; 628 const width = vue.ref(initialWidth);
629 const height = vue.ref(initialHeight); 630 const update = () => { 631 if (window) { 632 width.value = window.innerWidth; 633 height.value = window.innerHeight; 634 } 635 }; 636 update(); 637 tryOnMounted(update); 638 useEventListener("resize", update, { passive: true }); 639 if (listenOrientation) 640 useEventListener("orientationchange", update, { passive: true }); 641 return { width, height }; 642 } 643 644 const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent); 645 646 const isInContainer = (el, container) => { 647 if (!isClient || !el || !container) 648 return false; 649 const elRect = el.getBoundingClientRect(); 650 let containerRect; 651 if (container instanceof Element) { 652 containerRect = container.getBoundingClientRect(); 653 } else { 654 containerRect = { 655 top: 0, 656 right: window.innerWidth, 657 bottom: window.innerHeight, 658 left: 0 659 }; 660 } 661 return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right; 662 }; 663 const getOffsetTop = (el) => { 664 let offset = 0; 665 let parent = el; 666 while (parent) { 667 offset += parent.offsetTop; 668 parent = parent.offsetParent; 669 } 670 return offset; 671 }; 672 const getOffsetTopDistance = (el, containerEl) => { 673 return Math.abs(getOffsetTop(el) - getOffsetTop(containerEl)); 674 }; 675 const getClientXY = (event) => { 676 let clientX; 677 let clientY; 678 if (event.type === "touchend") { 679 clientY = event.changedTouches[0].clientY; 680 clientX = event.changedTouches[0].clientX; 681 } else if (event.type.startsWith("touch")) { 682 clientY = event.touches[0].clientY; 683 clientX = event.touches[0].clientX; 684 } else { 685 clientY = event.clientY; 686 clientX = event.clientX; 687 } 688 return { 689 clientX, 690 clientY 691 }; 692 }; 693 694 const NOOP = () => { 695 }; 696 const hasOwnProperty$p = Object.prototype.hasOwnProperty; 697 const hasOwn = (val, key) => hasOwnProperty$p.call(val, key); 698 const isArray$1 = Array.isArray; 699 const isDate$1 = (val) => toTypeString(val) === "[object Date]"; 700 const isFunction$1 = (val) => typeof val === "function"; 701 const isString$1 = (val) => typeof val === "string"; 702 const isObject$1 = (val) => val !== null && typeof val === "object"; 703 const isPromise = (val) => { 704 return isObject$1(val) && isFunction$1(val.then) && isFunction$1(val.catch); 705 }; 706 const objectToString$1 = Object.prototype.toString; 707 const toTypeString = (value) => objectToString$1.call(value); 708 const toRawType = (value) => { 709 return toTypeString(value).slice(8, -1); 710 }; 711 const cacheStringFunction = (fn) => { 712 const cache = /* @__PURE__ */ Object.create(null); 713 return (str) => { 714 const hit = cache[str]; 715 return hit || (cache[str] = fn(str)); 716 }; 717 }; 718 const camelizeRE = /-(\w)/g; 719 const camelize = cacheStringFunction((str) => { 720 return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : ""); 721 }); 722 const hyphenateRE = /\B([A-Z])/g; 723 const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase()); 724 const capitalize$2 = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1)); 725 726 var freeGlobal = typeof global == "object" && global && global.Object === Object && global; 727 728 var freeSelf = typeof self == "object" && self && self.Object === Object && self; 729 var root = freeGlobal || freeSelf || Function("return this")(); 730 731 var Symbol$1 = root.Symbol; 732 733 var objectProto$s = Object.prototype; 734 var hasOwnProperty$o = objectProto$s.hasOwnProperty; 735 var nativeObjectToString$3 = objectProto$s.toString; 736 var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0; 737 function getRawTag(value) { 738 var isOwn = hasOwnProperty$o.call(value, symToStringTag$1), tag = value[symToStringTag$1];
739 try { 740 value[symToStringTag$1] = void 0; 741 var unmasked = true; 742 } catch (e) { 743 } 744 var result = nativeObjectToString$3.call(value); 745 if (unmasked) { 746 if (isOwn) { 747 value[symToStringTag$1] = tag; 748 } else { 749 delete value[symToStringTag$1]; 750 } 751 } 752 return result; 753 } 754 755 var objectProto$r = Object.prototype; 756 var nativeObjectToString$2 = objectProto$r.toString; 757 function objectToString(value) { 758 return nativeObjectToString$2.call(value); 759 } 760 761 var nullTag = "[object Null]"; 762 var undefinedTag = "[object Undefined]"; 763 var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0; 764 function baseGetTag(value) { 765 if (value == null) { 766 return value === void 0 ? undefinedTag : nullTag; 767 } 768 return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value); 769 } 770 771 function isObjectLike(value) { 772 return value != null && typeof value == "object"; 773 } 774 775 var symbolTag$3 = "[object Symbol]"; 776 function isSymbol(value) { 777 return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3; 778 } 779 780 var NAN$2 = 0 / 0; 781 function baseToNumber(value) { 782 if (typeof value == "number") { 783 return value; 784 } 785 if (isSymbol(value)) { 786 return NAN$2; 787 } 788 return +value; 789 } 790 791 function arrayMap(array, iteratee) { 792 var index = -1, length = array == null ? 0 : array.length, result = Array(length); 793 while (++index < length) { 794 result[index] = iteratee(array[index], index, array); 795 } 796 return result; 797 } 798 799 var isArray = Array.isArray; 800 801 var INFINITY$5 = 1 / 0; 802 var symbolProto$2 = Symbol$1 ? Symbol$1.prototype : void 0; 803 var symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0; 804 function baseToString(value) { 805 if (typeof value == "string") { 806 return value; 807 } 808 if (isArray(value)) { 809 return arrayMap(value, baseToString) + ""; 810 } 811 if (isSymbol(value)) { 812 return symbolToString ? symbolToString.call(value) : ""; 813 } 814 var result = value + ""; 815 return result == "0" && 1 / value == -INFINITY$5 ? "-0" : result; 816 } 817 818 function createMathOperation(operator, defaultValue) { 819 return function(value, other) { 820 var result; 821 if (value === void 0 && other === void 0) { 822 return defaultValue; 823 } 824 if (value !== void 0) { 825 result = value; 826 } 827 if (other !== void 0) { 828 if (result === void 0) { 829 return other; 830 } 831 if (typeof value == "string" || typeof other == "string") { 832 value = baseToString(value); 833 other = baseToString(other); 834 } else { 835 value = baseToNumber(value); 836 other = baseToNumber(other); 837 } 838 result = operator(value, other); 839 } 840 return result; 841 }; 842 } 843 844 var add = createMathOperation(function(augend, addend) { 845 return augend + addend; 846 }, 0); 847 848 var reWhitespace = /\s/; 849 function trimmedEndIndex(string) { 850 var index = string.length; 851 while (index-- && reWhitespace.test(string.charAt(index))) { 852 } 853 return index; 854 } 855 856 var reTrimStart$2 = /^\s+/; 857 function baseTrim(string) { 858 return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart$2, "") : string; 859 } 860 861 function isObject(value) { 862 var type = typeof value; 863 return value != null && (type == "object" || type == "function"); 864 } 865 866 var NAN$1 = 0 / 0; 867 var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; 868 var reIsBinary = /^0b[01]+$/i; 869 var reIsOctal = /^0o[0-7]+$/i; 870 var freeParseInt = parseInt; 871 function toNumber(value) { 872 if (typeof value == "number") { 873 return value; 874 } 875 if (isSymbol(value)) { 876 return NAN$1; 877 } 878 if (isObject(value)) { 879 var other = typeof value.valueOf == "function" ? value.valueOf() : value; 880 value = isObject(other) ? other + "" : other; 881 } 882 if (typeof value != "string") { 883 return value === 0 ? value : +value; 884 } 885 value = baseTrim(value); 886 var isBinary = reIsBinary.test(value); 887 return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN$1 : +value; 888 } 889 890 var INFINITY$4 = 1 / 0; 891 var MAX_INTEGER = 17976931348623157e292; 892 function toFinite(value) { 893 if (!value) { 894 return value === 0 ? value : 0; 895 } 896 value = toNumber(value); 897 if (value === INFINITY$4 || value === -INFINITY$4) { 898 var sign = value < 0 ? -1 : 1; 899 return sign * MAX_INTEGER; 900 } 901 return value === value ? value : 0; 902 } 903 904 function toInteger(value) { 905 var result = toFinite(value), remainder = result % 1; 906 return result === result ? remainder ? result - remainder : result : 0; 907 } 908
vendor: 18,692 bytes, lines 909-1458
909 var FUNC_ERROR_TEXT$b = "Expected a function"; 910 function after(n, func) { 911 if (typeof func != "function") { 912 throw new TypeError(FUNC_ERROR_TEXT$b); 913 } 914 n = toInteger(n); 915 return function() { 916 if (--n < 1) { 917 return func.apply(this, arguments); 918 } 919 }; 920 } 921 922 function identity(value) { 923 return value; 924 } 925 926 var asyncTag = "[object AsyncFunction]"; 927 var funcTag$2 = "[object Function]"; 928 var genTag$1 = "[object GeneratorFunction]"; 929 var proxyTag = "[object Proxy]"; 930 function isFunction(value) { 931 if (!isObject(value)) { 932 return false; 933 } 934 var tag = baseGetTag(value); 935 return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag; 936 } 937 938 var coreJsData = root["__core-js_shared__"]; 939 940 var maskSrcKey = function() { 941 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ""); 942 return uid ? "Symbol(src)_1." + uid : ""; 943 }(); 944 function isMasked(func) { 945 return !!maskSrcKey && maskSrcKey in func; 946 } 947 948 var funcProto$2 = Function.prototype; 949 var funcToString$2 = funcProto$2.toString; 950 function toSource(func) { 951 if (func != null) { 952 try { 953 return funcToString$2.call(func); 954 } catch (e) { 955 } 956 try { 957 return func + ""; 958 } catch (e) { 959 } 960 } 961 return ""; 962 } 963 964 var reRegExpChar$1 = /[\\^$.*+?()[\]{}|]/g; 965 var reIsHostCtor = /^\[object .+?Constructor\]$/; 966 var funcProto$1 = Function.prototype; 967 var objectProto$q = Object.prototype; 968 var funcToString$1 = funcProto$1.toString; 969 var hasOwnProperty$n = objectProto$q.hasOwnProperty; 970 var reIsNative = RegExp("^" + funcToString$1.call(hasOwnProperty$n).replace(reRegExpChar$1, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"); 971 function baseIsNative(value) { 972 if (!isObject(value) || isMasked(value)) { 973 return false; 974 } 975 var pattern = isFunction(value) ? reIsNative : reIsHostCtor; 976 return pattern.test(toSource(value)); 977 } 978 979 function getValue$1(object, key) { 980 return object == null ? void 0 : object[key]; 981 } 982 983 function getNative(object, key) { 984 var value = getValue$1(object, key); 985 return baseIsNative(value) ? value : void 0; 986 } 987 988 var WeakMap = getNative(root, "WeakMap"); 989 990 var metaMap = WeakMap && new WeakMap(); 991 992 var baseSetData = !metaMap ? identity : function(func, data) { 993 metaMap.set(func, data); 994 return func; 995 }; 996 997 var objectCreate = Object.create; 998 var baseCreate = function() { 999 function object() { 1000 } 1001 return function(proto) { 1002 if (!isObject(proto)) { 1003 return {}; 1004 } 1005 if (objectCreate) { 1006 return objectCreate(proto); 1007 } 1008 object.prototype = proto; 1009 var result = new object(); 1010 object.prototype = void 0; 1011 return result; 1012 }; 1013 }(); 1014 1015 function createCtor(Ctor) { 1016 return function() { 1017 var args = arguments; 1018 switch (args.length) { 1019 case 0: 1020 return new Ctor(); 1021 case 1: 1022 return new Ctor(args[0]); 1023 case 2: 1024 return new Ctor(args[0], args[1]); 1025 case 3: 1026 return new Ctor(args[0], args[1], args[2]); 1027 case 4: 1028 return new Ctor(args[0], args[1], args[2], args[3]); 1029 case 5: 1030 return new Ctor(args[0], args[1], args[2], args[3], args[4]); 1031 case 6: 1032 return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); 1033 case 7: 1034 return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); 1035 } 1036 var thisBinding = baseCreate(Ctor.prototype), result = Ctor.apply(thisBinding, args); 1037 return isObject(result) ? result : thisBinding; 1038 }; 1039 } 1040 1041 var WRAP_BIND_FLAG$8 = 1; 1042 function createBind(func, bitmask, thisArg) { 1043 var isBind = bitmask & WRAP_BIND_FLAG$8, Ctor = createCtor(func); 1044 function wrapper() { 1045 var fn = this && this !== root && this instanceof wrapper ? Ctor : func; 1046 return fn.apply(isBind ? thisArg : this, arguments); 1047 } 1048 return wrapper; 1049 } 1050 1051 function apply(func, thisArg, args) { 1052 switch (args.length) { 1053 case 0: 1054 return func.call(thisArg); 1055 case 1: 1056 return func.call(thisArg, args[0]); 1057 case 2: 1058 return func.call(thisArg, args[0], args[1]); 1059 case 3: 1060 return func.call(thisArg, args[0], args[1], args[2]); 1061 } 1062 return func.apply(thisArg, args); 1063 } 1064 1065 var nativeMax$g = Math.max; 1066 function composeArgs(args, partials, holders, isCurried) { 1067 var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax$g(argsLength - holdersLength, 0), result = Array(leftLength + rangeLength), isUncurried = !isCurried; 1068 while (++leftIndex < leftLength) { 1069 result[leftIndex] = partials[leftIndex]; 1070 } 1071 while (++argsIndex < holdersLength) { 1072 if (isUncurried || argsIndex < argsLength) { 1073 result[holders[argsIndex]] = args[argsIndex]; 1074 } 1075 } 1076 while (rangeLength--) { 1077 result[leftIndex++] = args[argsIndex++]; 1078 } 1079 return result; 1080 } 1081 1082 var nativeMax$f = Math.max; 1083 function composeArgsRight(args, partials, holders, isCurried) { 1084 var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax$f(argsLength - holdersLength, 0), result = Array(rangeLength + rightLength), isUncurried = !isCurried; 1085 while (++argsIndex < rangeLength) { 1086 result[argsIndex] = args[argsIndex]; 1087 } 1088 var offset = argsIndex; 1089 while (++rightIndex < rightLength) { 1090 result[offset + rightIndex] = partials[rightIndex]; 1091 } 1092 while (++holdersIndex < holdersLength) { 1093 if (isUncurried || argsIndex < argsLength) { 1094 result[offset + holders[holdersIndex]] = args[argsIndex++]; 1095 } 1096 } 1097 return result; 1098 } 1099 1100 function countHolders(array, placeholder) { 1101 var length = array.length, result = 0; 1102 while (length--) { 1103 if (array[length] === placeholder) { 1104 ++result; 1105 } 1106 } 1107 return result; 1108 } 1109 1110 function baseLodash() { 1111 } 1112 1113 var MAX_ARRAY_LENGTH$6 = 4294967295; 1114 function LazyWrapper(value) { 1115 this.__wrapped__ = value; 1116 this.__actions__ = []; 1117 this.__dir__ = 1; 1118 this.__filtered__ = false; 1119 this.__iteratees__ = []; 1120 this.__takeCount__ = MAX_ARRAY_LENGTH$6; 1121 this.__views__ = []; 1122 } 1123 LazyWrapper.prototype = baseCreate(baseLodash.prototype); 1124 LazyWrapper.prototype.constructor = LazyWrapper; 1125 1126 function noop() { 1127 } 1128 1129 var getData = !metaMap ? noop : function(func) { 1130 return metaMap.get(func); 1131 }; 1132 1133 var realNames = {}; 1134 1135 var objectProto$p = Object.prototype; 1136 var hasOwnProperty$m = objectProto$p.hasOwnProperty; 1137 function getFuncName(func) { 1138 var result = func.name + "", array = realNames[result], length = hasOwnProperty$m.call(realNames, result) ? array.length : 0; 1139 while (length--) { 1140 var data = array[length], otherFunc = data.func; 1141 if (otherFunc == null || otherFunc == func) { 1142 return data.name; 1143 } 1144 } 1145 return result; 1146 } 1147 1148 function LodashWrapper(value, chainAll) { 1149 this.__wrapped__ = value; 1150 this.__actions__ = []; 1151 this.__chain__ = !!chainAll; 1152 this.__index__ = 0; 1153 this.__values__ = void 0; 1154 } 1155 LodashWrapper.prototype = baseCreate(baseLodash.prototype); 1156 LodashWrapper.prototype.constructor = LodashWrapper; 1157 1158 function copyArray(source, array) { 1159 var index = -1, length = source.length; 1160 array || (array = Array(length)); 1161 while (++index < length) { 1162 array[index] = source[index]; 1163 } 1164 return array; 1165 } 1166 1167 function wrapperClone(wrapper) { 1168 if (wrapper instanceof LazyWrapper) { 1169 return wrapper.clone(); 1170 } 1171 var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); 1172 result.__actions__ = copyArray(wrapper.__actions__); 1173 result.__index__ = wrapper.__index__; 1174 result.__values__ = wrapper.__values__; 1175 return result; 1176 } 1177 1178 var objectProto$o = Object.prototype; 1179 var hasOwnProperty$l = objectProto$o.hasOwnProperty; 1180 function lodash(value) { 1181 if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { 1182 if (value instanceof LodashWrapper) { 1183 return value; 1184 } 1185 if (hasOwnProperty$l.call(value, "__wrapped__")) { 1186 return wrapperClone(value); 1187 } 1188 } 1189 return new LodashWrapper(value); 1190 } 1191 lodash.prototype = baseLodash.prototype; 1192 lodash.prototype.constructor = lodash; 1193 1194 function isLaziable(func) { 1195 var funcName = getFuncName(func), other = lodash[funcName]; 1196 if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) { 1197 return false; 1198 } 1199 if (func === other) { 1200 return true; 1201 } 1202 var data = getData(other); 1203 return !!data && func === data[0]; 1204 } 1205 1206 var HOT_COUNT = 800; 1207 var HOT_SPAN = 16; 1208 var nativeNow = Date.now; 1209 function shortOut(func) { 1210 var count = 0, lastCalled = 0; 1211 return function() { 1212 var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled); 1213 lastCalled = stamp; 1214 if (remaining > 0) { 1215 if (++count >= HOT_COUNT) { 1216 return arguments[0]; 1217 } 1218 } else { 1219 count = 0; 1220 } 1221 return func.apply(void 0, arguments); 1222 }; 1223 } 1224 1225 var setData = shortOut(baseSetData); 1226 1227 var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/; 1228 var reSplitDetails = /,? & /; 1229 function getWrapDetails(source) { 1230 var match = source.match(reWrapDetails); 1231 return match ? match[1].split(reSplitDetails) : []; 1232 } 1233 1234 var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/; 1235 function insertWrapDetails(source, details) { 1236 var length = details.length; 1237 if (!length) { 1238 return source; 1239 } 1240 var lastIndex = length - 1; 1241 details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex]; 1242 details = details.join(length > 2 ? ", " : " "); 1243 return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n"); 1244 } 1245 1246 function constant(value) { 1247 return function() { 1248 return value; 1249 }; 1250 } 1251 1252 var defineProperty = function() { 1253 try { 1254 var func = getNative(Object, "defineProperty"); 1255 func({}, "", {}); 1256 return func; 1257 } catch (e) { 1258 } 1259 }(); 1260 1261 var baseSetToString = !defineProperty ? identity : function(func, string) { 1262 return defineProperty(func, "toString", { 1263 "configurable": true, 1264 "enumerable": false, 1265 "value": constant(string), 1266 "writable": true 1267 }); 1268 }; 1269 1270 var setToString = shortOut(baseSetToString); 1271 1272 function arrayEach(array, iteratee) { 1273 var index = -1, length = array == null ? 0 : array.length; 1274 while (++index < length) { 1275 if (iteratee(array[index], index, array) === false) { 1276 break; 1277 } 1278 } 1279 return array; 1280 } 1281 1282 function baseFindIndex(array, predicate, fromIndex, fromRight) { 1283 var length = array.length, index = fromIndex + (fromRight ? 1 : -1); 1284 while (fromRight ? index-- : ++index < length) { 1285 if (predicate(array[index], index, array)) { 1286 return index; 1287 } 1288 } 1289 return -1; 1290 } 1291 1292 function baseIsNaN(value) { 1293 return value !== value; 1294 } 1295 1296 function strictIndexOf(array, value, fromIndex) { 1297 var index = fromIndex - 1, length = array.length; 1298 while (++index < length) { 1299 if (array[index] === value) { 1300 return index; 1301 } 1302 } 1303 return -1; 1304 } 1305 1306 function baseIndexOf(array, value, fromIndex) { 1307 return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex); 1308 } 1309 1310 function arrayIncludes(array, value) { 1311 var length = array == null ? 0 : array.length; 1312 return !!length && baseIndexOf(array, value, 0) > -1; 1313 } 1314 1315 var WRAP_BIND_FLAG$7 = 1; 1316 var WRAP_BIND_KEY_FLAG$6 = 2; 1317 var WRAP_CURRY_FLAG$6 = 8; 1318 var WRAP_CURRY_RIGHT_FLAG$3 = 16; 1319 var WRAP_PARTIAL_FLAG$6 = 32; 1320 var WRAP_PARTIAL_RIGHT_FLAG$3 = 64; 1321 var WRAP_ARY_FLAG$4 = 128; 1322 var WRAP_REARG_FLAG$3 = 256; 1323 var WRAP_FLIP_FLAG$2 = 512; 1324 var wrapFlags = [ 1325 ["ary", WRAP_ARY_FLAG$4], 1326 ["bind", WRAP_BIND_FLAG$7], 1327 ["bindKey", WRAP_BIND_KEY_FLAG$6], 1328 ["curry", WRAP_CURRY_FLAG$6], 1329 ["curryRight", WRAP_CURRY_RIGHT_FLAG$3], 1330 ["flip", WRAP_FLIP_FLAG$2], 1331 ["partial", WRAP_PARTIAL_FLAG$6], 1332 ["partialRight", WRAP_PARTIAL_RIGHT_FLAG$3], 1333 ["rearg", WRAP_REARG_FLAG$3] 1334 ]; 1335 function updateWrapDetails(details, bitmask) { 1336 arrayEach(wrapFlags, function(pair) { 1337 var value = "_." + pair[0]; 1338 if (bitmask & pair[1] && !arrayIncludes(details, value)) { 1339 details.push(value); 1340 } 1341 }); 1342 return details.sort(); 1343 } 1344 1345 function setWrapToString(wrapper, reference, bitmask) { 1346 var source = reference + ""; 1347 return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); 1348 } 1349 1350 var WRAP_BIND_FLAG$6 = 1; 1351 var WRAP_BIND_KEY_FLAG$5 = 2; 1352 var WRAP_CURRY_BOUND_FLAG$1 = 4; 1353 var WRAP_CURRY_FLAG$5 = 8; 1354 var WRAP_PARTIAL_FLAG$5 = 32; 1355 var WRAP_PARTIAL_RIGHT_FLAG$2 = 64; 1356 function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { 1357 var isCurry = bitmask & WRAP_CURRY_FLAG$5, newHolders = isCurry ? holders : void 0, newHoldersRight = isCurry ? void 0 : holders, newPartials = isCurry ? partials : void 0, newPartialsRight = isCurry ? void 0 : partials; 1358 bitmask |= isCurry ? WRAP_PARTIAL_FLAG$5 : WRAP_PARTIAL_RIGHT_FLAG$2; 1359 bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG$2 : WRAP_PARTIAL_FLAG$5); 1360 if (!(bitmask & WRAP_CURRY_BOUND_FLAG$1)) { 1361 bitmask &= ~(WRAP_BIND_FLAG$6 | WRAP_BIND_KEY_FLAG$5); 1362 } 1363 var newData = [ 1364 func, 1365 bitmask, 1366 thisArg, 1367 newPartials, 1368 newHolders, 1369 newPartialsRight, 1370 newHoldersRight, 1371 argPos, 1372 ary, 1373 arity 1374 ]; 1375 var result = wrapFunc.apply(void 0, newData); 1376 if (isLaziable(func)) { 1377 setData(result, newData); 1378 } 1379 result.placeholder = placeholder; 1380 return setWrapToString(result, func, bitmask); 1381 } 1382 1383 function getHolder(func) { 1384 var object = func; 1385 return object.placeholder; 1386 } 1387 1388 var MAX_SAFE_INTEGER$5 = 9007199254740991; 1389 var reIsUint = /^(?:0|[1-9]\d*)$/; 1390 function isIndex(value, length) { 1391 var type = typeof value; 1392 length = length == null ? MAX_SAFE_INTEGER$5 : length; 1393 return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); 1394 } 1395 1396 var nativeMin$e = Math.min; 1397 function reorder(array, indexes) { 1398 var arrLength = array.length, length = nativeMin$e(indexes.length, arrLength), oldArray = copyArray(array); 1399 while (length--) { 1400 var index = indexes[length]; 1401 array[length] = isIndex(index, arrLength) ? oldArray[index] : void 0; 1402 } 1403 return array; 1404 } 1405 1406 var PLACEHOLDER$1 = "__lodash_placeholder__"; 1407 function replaceHolders(array, placeholder) { 1408 var index = -1, length = array.length, resIndex = 0, result = []; 1409 while (++index < length) { 1410 var value = array[index]; 1411 if (value === placeholder || value === PLACEHOLDER$1) { 1412 array[index] = PLACEHOLDER$1; 1413 result[resIndex++] = index; 1414 } 1415 } 1416 return result; 1417 } 1418 1419 var WRAP_BIND_FLAG$5 = 1; 1420 var WRAP_BIND_KEY_FLAG$4 = 2; 1421 var WRAP_CURRY_FLAG$4 = 8; 1422 var WRAP_CURRY_RIGHT_FLAG$2 = 16; 1423 var WRAP_ARY_FLAG$3 = 128; 1424 var WRAP_FLIP_FLAG$1 = 512; 1425 function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { 1426 var isAry = bitmask & WRAP_ARY_FLAG$3, isBind = bitmask & WRAP_BIND_FLAG$5, isBindKey = bitmask & WRAP_BIND_KEY_FLAG$4, isCurried = bitmask & (WRAP_CURRY_FLAG$4 | WRAP_CURRY_RIGHT_FLAG$2), isFlip = bitmask & WRAP_FLIP_FLAG$1, Ctor = isBindKey ? void 0 : createCtor(func); 1427 function wrapper() { 1428 var length = arguments.length, args = Array(length), index = length; 1429 while (index--) { 1430 args[index] = arguments[index]; 1431 } 1432 if (isCurried) { 1433 var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder); 1434 } 1435 if (partials) { 1436 args = composeArgs(args, partials, holders, isCurried); 1437 } 1438 if (partialsRight) { 1439 args = composeArgsRight(args, partialsRight, holdersRight, isCurried); 1440 } 1441 length -= holdersCount; 1442 if (isCurried && length < arity) { 1443 var newHolders = replaceHolders(args, placeholder); 1444 return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, thisArg, args, newHolders, argPos, ary, arity - length); 1445 } 1446 var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func; 1447 length = args.length; 1448 if (argPos) { 1449 args = reorder(args, argPos); 1450 } else if (isFlip && length > 1) { 1451 args.reverse(); 1452 } 1453 if (isAry && ary < length) { 1454 args.length = ary; 1455 } 1456 if (this && this !== root && this instanceof wrapper) { 1457 fn = Ctor || createCtor(fn); 1458 }
vendor: 5,738 bytes, lines 1459-1597
1459 return fn.apply(thisBinding, args); 1460 } 1461 return wrapper; 1462 } 1463 1464 function createCurry(func, bitmask, arity) { 1465 var Ctor = createCtor(func); 1466 function wrapper() { 1467 var length = arguments.length, args = Array(length), index = length, placeholder = getHolder(wrapper); 1468 while (index--) { 1469 args[index] = arguments[index]; 1470 } 1471 var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder); 1472 length -= holders.length; 1473 if (length < arity) { 1474 return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, void 0, args, holders, void 0, void 0, arity - length); 1475 } 1476 var fn = this && this !== root && this instanceof wrapper ? Ctor : func; 1477 return apply(fn, this, args); 1478 } 1479 return wrapper; 1480 } 1481 1482 var WRAP_BIND_FLAG$4 = 1; 1483 function createPartial(func, bitmask, thisArg, partials) { 1484 var isBind = bitmask & WRAP_BIND_FLAG$4, Ctor = createCtor(func); 1485 function wrapper() { 1486 var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func; 1487 while (++leftIndex < leftLength) { 1488 args[leftIndex] = partials[leftIndex]; 1489 } 1490 while (argsLength--) { 1491 args[leftIndex++] = arguments[++argsIndex]; 1492 } 1493 return apply(fn, isBind ? thisArg : this, args); 1494 } 1495 return wrapper; 1496 } 1497 1498 var PLACEHOLDER = "__lodash_placeholder__"; 1499 var WRAP_BIND_FLAG$3 = 1; 1500 var WRAP_BIND_KEY_FLAG$3 = 2; 1501 var WRAP_CURRY_BOUND_FLAG = 4; 1502 var WRAP_CURRY_FLAG$3 = 8; 1503 var WRAP_ARY_FLAG$2 = 128; 1504 var WRAP_REARG_FLAG$2 = 256; 1505 var nativeMin$d = Math.min; 1506 function mergeData(data, source) { 1507 var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG$3 | WRAP_BIND_KEY_FLAG$3 | WRAP_ARY_FLAG$2); 1508 var isCombo = srcBitmask == WRAP_ARY_FLAG$2 && bitmask == WRAP_CURRY_FLAG$3 || srcBitmask == WRAP_ARY_FLAG$2 && bitmask == WRAP_REARG_FLAG$2 && data[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG$2 | WRAP_REARG_FLAG$2) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG$3; 1509 if (!(isCommon || isCombo)) { 1510 return data; 1511 } 1512 if (srcBitmask & WRAP_BIND_FLAG$3) { 1513 data[2] = source[2]; 1514 newBitmask |= bitmask & WRAP_BIND_FLAG$3 ? 0 : WRAP_CURRY_BOUND_FLAG; 1515 } 1516 var value = source[3]; 1517 if (value) { 1518 var partials = data[3]; 1519 data[3] = partials ? composeArgs(partials, value, source[4]) : value; 1520 data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; 1521 } 1522 value = source[5]; 1523 if (value) { 1524 partials = data[5]; 1525 data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; 1526 data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; 1527 } 1528 value = source[7]; 1529 if (value) { 1530 data[7] = value; 1531 } 1532 if (srcBitmask & WRAP_ARY_FLAG$2) { 1533 data[8] = data[8] == null ? source[8] : nativeMin$d(data[8], source[8]); 1534 } 1535 if (data[9] == null) { 1536 data[9] = source[9]; 1537 } 1538 data[0] = source[0]; 1539 data[1] = newBitmask; 1540 return data; 1541 } 1542 1543 var FUNC_ERROR_TEXT$a = "Expected a function"; 1544 var WRAP_BIND_FLAG$2 = 1; 1545 var WRAP_BIND_KEY_FLAG$2 = 2; 1546 var WRAP_CURRY_FLAG$2 = 8; 1547 var WRAP_CURRY_RIGHT_FLAG$1 = 16; 1548 var WRAP_PARTIAL_FLAG$4 = 32; 1549 var WRAP_PARTIAL_RIGHT_FLAG$1 = 64; 1550 var nativeMax$e = Math.max; 1551 function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) { 1552 var isBindKey = bitmask & WRAP_BIND_KEY_FLAG$2; 1553 if (!isBindKey && typeof func != "function") { 1554 throw new TypeError(FUNC_ERROR_TEXT$a); 1555 } 1556 var length = partials ? partials.length : 0; 1557 if (!length) { 1558 bitmask &= ~(WRAP_PARTIAL_FLAG$4 | WRAP_PARTIAL_RIGHT_FLAG$1); 1559 partials = holders = void 0; 1560 } 1561 ary = ary === void 0 ? ary : nativeMax$e(toInteger(ary), 0); 1562 arity = arity === void 0 ? arity : toInteger(arity); 1563 length -= holders ? holders.length : 0; 1564 if (bitmask & WRAP_PARTIAL_RIGHT_FLAG$1) { 1565 var partialsRight = partials, holdersRight = holders; 1566 partials = holders = void 0; 1567 } 1568 var data = isBindKey ? void 0 : getData(func); 1569 var newData = [ 1570 func, 1571 bitmask, 1572 thisArg, 1573 partials, 1574 holders, 1575 partialsRight, 1576 holdersRight, 1577 argPos, 1578 ary, 1579 arity 1580 ]; 1581 if (data) { 1582 mergeData(newData, data); 1583 } 1584 func = newData[0]; 1585 bitmask = newData[1]; 1586 thisArg = newData[2]; 1587 partials = newData[3]; 1588 holders = newData[4]; 1589 arity = newData[9] = newData[9] === void 0 ? isBindKey ? 0 : func.length : nativeMax$e(newData[9] - length, 0); 1590 if (!arity && bitmask & (WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1)) { 1591 bitmask &= ~(WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1); 1592 } 1593 if (!bitmask || bitmask == WRAP_BIND_FLAG$2) { 1594 var result = createBind(func, bitmask, thisArg); 1595 } else if (bitmask == WRAP_CURRY_FLAG$2 || bitmask == WRAP_CURRY_RIGHT_FLAG$1) { 1596 result = createCurry(func, bitmask, arity); 1597 } else if ((bitmask == WRAP_PARTIAL_FLAG$4 || bitmask == (WRAP_BIND_FLAG$2 | WRAP_PARTIAL_FLAG$4)) && !holders.length) {
vendor: 4,496 bytes, lines 1598-1726
1598 result = createPartial(func, bitmask, thisArg, partials); 1599 } else { 1600 result = createHybrid.apply(void 0, newData); 1601 } 1602 var setter = data ? baseSetData : setData; 1603 return setWrapToString(setter(result, newData), func, bitmask); 1604 } 1605 1606 var WRAP_ARY_FLAG$1 = 128; 1607 function ary(func, n, guard) { 1608 n = guard ? void 0 : n; 1609 n = func && n == null ? func.length : n; 1610 return createWrap(func, WRAP_ARY_FLAG$1, void 0, void 0, void 0, void 0, n); 1611 } 1612 1613 function baseAssignValue(object, key, value) { 1614 if (key == "__proto__" && defineProperty) { 1615 defineProperty(object, key, { 1616 "configurable": true, 1617 "enumerable": true, 1618 "value": value, 1619 "writable": true 1620 }); 1621 } else { 1622 object[key] = value; 1623 } 1624 } 1625 1626 function eq(value, other) { 1627 return value === other || value !== value && other !== other; 1628 } 1629 1630 var objectProto$n = Object.prototype; 1631 var hasOwnProperty$k = objectProto$n.hasOwnProperty; 1632 function assignValue(object, key, value) { 1633 var objValue = object[key]; 1634 if (!(hasOwnProperty$k.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) { 1635 baseAssignValue(object, key, value); 1636 } 1637 } 1638 1639 function copyObject(source, props, object, customizer) { 1640 var isNew = !object; 1641 object || (object = {}); 1642 var index = -1, length = props.length; 1643 while (++index < length) { 1644 var key = props[index]; 1645 var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0; 1646 if (newValue === void 0) { 1647 newValue = source[key]; 1648 } 1649 if (isNew) { 1650 baseAssignValue(object, key, newValue); 1651 } else { 1652 assignValue(object, key, newValue); 1653 } 1654 } 1655 return object; 1656 } 1657 1658 var nativeMax$d = Math.max; 1659 function overRest(func, start, transform) { 1660 start = nativeMax$d(start === void 0 ? func.length - 1 : start, 0); 1661 return function() { 1662 var args = arguments, index = -1, length = nativeMax$d(args.length - start, 0), array = Array(length); 1663 while (++index < length) { 1664 array[index] = args[start + index]; 1665 } 1666 index = -1; 1667 var otherArgs = Array(start + 1); 1668 while (++index < start) { 1669 otherArgs[index] = args[index]; 1670 } 1671 otherArgs[start] = transform(array); 1672 return apply(func, this, otherArgs); 1673 }; 1674 } 1675 1676 function baseRest(func, start) { 1677 return setToString(overRest(func, start, identity), func + ""); 1678 } 1679 1680 var MAX_SAFE_INTEGER$4 = 9007199254740991; 1681 function isLength(value) { 1682 return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$4; 1683 } 1684 1685 function isArrayLike(value) { 1686 return value != null && isLength(value.length) && !isFunction(value); 1687 } 1688 1689 function isIterateeCall(value, index, object) { 1690 if (!isObject(object)) { 1691 return false; 1692 } 1693 var type = typeof index; 1694 if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) { 1695 return eq(object[index], value); 1696 } 1697 return false; 1698 } 1699 1700 function createAssigner(assigner) { 1701 return baseRest(function(object, sources) { 1702 var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0; 1703 customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0; 1704 if (guard && isIterateeCall(sources[0], sources[1], guard)) { 1705 customizer = length < 3 ? void 0 : customizer; 1706 length = 1; 1707 } 1708 object = Object(object); 1709 while (++index < length) { 1710 var source = sources[index]; 1711 if (source) { 1712 assigner(object, source, index, customizer); 1713 } 1714 } 1715 return object; 1716 }); 1717 } 1718 1719 var objectProto$m = Object.prototype; 1720 function isPrototype(value) { 1721 var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$m; 1722 return value === proto; 1723 } 1724 1725 function baseTimes(n, iteratee) { 1726 var index = -1, result = Array(n);
vendor: 4,857 bytes, lines 1727-1818
1727 while (++index < n) { 1728 result[index] = iteratee(index); 1729 } 1730 return result; 1731 } 1732 1733 var argsTag$3 = "[object Arguments]"; 1734 function baseIsArguments(value) { 1735 return isObjectLike(value) && baseGetTag(value) == argsTag$3; 1736 } 1737 1738 var objectProto$l = Object.prototype; 1739 var hasOwnProperty$j = objectProto$l.hasOwnProperty; 1740 var propertyIsEnumerable$1 = objectProto$l.propertyIsEnumerable; 1741 var isArguments = baseIsArguments(function() { 1742 return arguments; 1743 }()) ? baseIsArguments : function(value) { 1744 return isObjectLike(value) && hasOwnProperty$j.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee"); 1745 }; 1746 1747 function stubFalse() { 1748 return false; 1749 } 1750 1751 var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports; 1752 var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module; 1753 var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2; 1754 var Buffer$1 = moduleExports$2 ? root.Buffer : void 0; 1755 var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0; 1756 var isBuffer = nativeIsBuffer || stubFalse; 1757 1758 var argsTag$2 = "[object Arguments]"; 1759 var arrayTag$2 = "[object Array]"; 1760 var boolTag$4 = "[object Boolean]"; 1761 var dateTag$4 = "[object Date]"; 1762 var errorTag$3 = "[object Error]"; 1763 var funcTag$1 = "[object Function]"; 1764 var mapTag$9 = "[object Map]"; 1765 var numberTag$4 = "[object Number]"; 1766 var objectTag$4 = "[object Object]"; 1767 var regexpTag$4 = "[object RegExp]"; 1768 var setTag$9 = "[object Set]"; 1769 var stringTag$4 = "[object String]"; 1770 var weakMapTag$3 = "[object WeakMap]"; 1771 var arrayBufferTag$4 = "[object ArrayBuffer]"; 1772 var dataViewTag$4 = "[object DataView]"; 1773 var float32Tag$2 = "[object Float32Array]"; 1774 var float64Tag$2 = "[object Float64Array]"; 1775 var int8Tag$2 = "[object Int8Array]"; 1776 var int16Tag$2 = "[object Int16Array]"; 1777 var int32Tag$2 = "[object Int32Array]"; 1778 var uint8Tag$2 = "[object Uint8Array]"; 1779 var uint8ClampedTag$2 = "[object Uint8ClampedArray]"; 1780 var uint16Tag$2 = "[object Uint16Array]"; 1781 var uint32Tag$2 = "[object Uint32Array]"; 1782 var typedArrayTags = {}; 1783 typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true; 1784 typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] = typedArrayTags[arrayBufferTag$4] = typedArrayTags[boolTag$4] = typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$4] = typedArrayTags[errorTag$3] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$9] = typedArrayTags[numberTag$4] = typedArrayTags[objectTag$4] = typedArrayTags[regexpTag$4] = typedArrayTags[setTag$9] = typedArrayTags[stringTag$4] = typedArrayTags[weakMapTag$3] = false; 1785 function baseIsTypedArray(value) { 1786 return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; 1787 } 1788 1789 function baseUnary(func) { 1790 return function(value) { 1791 return func(value); 1792 }; 1793 } 1794 1795 var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports; 1796 var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module; 1797 var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1; 1798 var freeProcess = moduleExports$1 && freeGlobal.process; 1799 var nodeUtil = function() { 1800 try { 1801 var types = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types; 1802 if (types) { 1803 return types; 1804 } 1805 return freeProcess && freeProcess.binding && freeProcess.binding("util"); 1806 } catch (e) { 1807 } 1808 }(); 1809 1810 var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; 1811 var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; 1812 1813 var objectProto$k = Object.prototype; 1814 var hasOwnProperty$i = objectProto$k.hasOwnProperty; 1815 function arrayLikeKeys(value, inherited) { 1816 var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length; 1817 for (var key in value) { 1818 if ((inherited || hasOwnProperty$i.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" ||
vendor: 4,124 bytes, lines 1818-1949
1818key == "byteOffset") || isIndex(key, length)))) { 1819 result.push(key); 1820 } 1821 } 1822 return result; 1823 } 1824 1825 function overArg(func, transform) { 1826 return function(arg) { 1827 return func(transform(arg)); 1828 }; 1829 } 1830 1831 var nativeKeys = overArg(Object.keys, Object); 1832 1833 var objectProto$j = Object.prototype; 1834 var hasOwnProperty$h = objectProto$j.hasOwnProperty; 1835 function baseKeys(object) { 1836 if (!isPrototype(object)) { 1837 return nativeKeys(object); 1838 } 1839 var result = []; 1840 for (var key in Object(object)) { 1841 if (hasOwnProperty$h.call(object, key) && key != "constructor") { 1842 result.push(key); 1843 } 1844 } 1845 return result; 1846 } 1847 1848 function keys(object) { 1849 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); 1850 } 1851 1852 var objectProto$i = Object.prototype; 1853 var hasOwnProperty$g = objectProto$i.hasOwnProperty; 1854 var assign = createAssigner(function(object, source) { 1855 if (isPrototype(source) || isArrayLike(source)) { 1856 copyObject(source, keys(source), object); 1857 return; 1858 } 1859 for (var key in source) { 1860 if (hasOwnProperty$g.call(source, key)) { 1861 assignValue(object, key, source[key]); 1862 } 1863 } 1864 }); 1865 1866 function nativeKeysIn(object) { 1867 var result = []; 1868 if (object != null) { 1869 for (var key in Object(object)) { 1870 result.push(key); 1871 } 1872 } 1873 return result; 1874 } 1875 1876 var objectProto$h = Object.prototype; 1877 var hasOwnProperty$f = objectProto$h.hasOwnProperty; 1878 function baseKeysIn(object) { 1879 if (!isObject(object)) { 1880 return nativeKeysIn(object); 1881 } 1882 var isProto = isPrototype(object), result = []; 1883 for (var key in object) { 1884 if (!(key == "constructor" && (isProto || !hasOwnProperty$f.call(object, key)))) { 1885 result.push(key); 1886 } 1887 } 1888 return result; 1889 } 1890 1891 function keysIn(object) { 1892 return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); 1893 } 1894 1895 var assignIn = createAssigner(function(object, source) { 1896 copyObject(source, keysIn(source), object); 1897 }); 1898 1899 var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { 1900 copyObject(source, keysIn(source), object, customizer); 1901 }); 1902 1903 var assignWith = createAssigner(function(object, source, srcIndex, customizer) { 1904 copyObject(source, keys(source), object, customizer); 1905 }); 1906 1907 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/; 1908 var reIsPlainProp = /^\w*$/; 1909 function isKey(value, object) { 1910 if (isArray(value)) { 1911 return false; 1912 } 1913 var type = typeof value; 1914 if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) { 1915 return true; 1916 } 1917 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object); 1918 } 1919 1920 var nativeCreate = getNative(Object, "create"); 1921 1922 function hashClear() { 1923 this.__data__ = nativeCreate ? nativeCreate(null) : {}; 1924 this.size = 0; 1925 } 1926 1927 function hashDelete(key) { 1928 var result = this.has(key) && delete this.__data__[key]; 1929 this.size -= result ? 1 : 0; 1930 return result; 1931 } 1932 1933 var HASH_UNDEFINED$2 = "__lodash_hash_undefined__"; 1934 var objectProto$g = Object.prototype; 1935 var hasOwnProperty$e = objectProto$g.hasOwnProperty; 1936 function hashGet(key) { 1937 var data = this.__data__; 1938 if (nativeCreate) { 1939 var result = data[key]; 1940 return result === HASH_UNDEFINED$2 ? void 0 : result; 1941 } 1942 return hasOwnProperty$e.call(data, key) ? data[key] : void 0; 1943 } 1944 1945 var objectProto$f = Object.prototype; 1946 var hasOwnProperty$d = objectProto$f.hasOwnProperty; 1947 function hashHas(key) { 1948 var data = this.__data__; 1949 return nativeCreate ? data[key] !== void 0 : hasOwnProperty$d.call(
vendor: 4,197 bytes, lines 1949-2095
1949data, key); 1950 } 1951 1952 var HASH_UNDEFINED$1 = "__lodash_hash_undefined__"; 1953 function hashSet(key, value) { 1954 var data = this.__data__; 1955 this.size += this.has(key) ? 0 : 1; 1956 data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED$1 : value; 1957 return this; 1958 } 1959 1960 function Hash(entries) { 1961 var index = -1, length = entries == null ? 0 : entries.length; 1962 this.clear(); 1963 while (++index < length) { 1964 var entry = entries[index]; 1965 this.set(entry[0], entry[1]); 1966 } 1967 } 1968 Hash.prototype.clear = hashClear; 1969 Hash.prototype["delete"] = hashDelete; 1970 Hash.prototype.get = hashGet; 1971 Hash.prototype.has = hashHas; 1972 Hash.prototype.set = hashSet; 1973 1974 function listCacheClear() { 1975 this.__data__ = []; 1976 this.size = 0; 1977 } 1978 1979 function assocIndexOf(array, key) { 1980 var length = array.length; 1981 while (length--) { 1982 if (eq(array[length][0], key)) { 1983 return length; 1984 } 1985 } 1986 return -1; 1987 } 1988 1989 var arrayProto$5 = Array.prototype; 1990 var splice$2 = arrayProto$5.splice; 1991 function listCacheDelete(key) { 1992 var data = this.__data__, index = assocIndexOf(data, key); 1993 if (index < 0) { 1994 return false; 1995 } 1996 var lastIndex = data.length - 1; 1997 if (index == lastIndex) { 1998 data.pop(); 1999 } else { 2000 splice$2.call(data, index, 1); 2001 } 2002 --this.size; 2003 return true; 2004 } 2005 2006 function listCacheGet(key) { 2007 var data = this.__data__, index = assocIndexOf(data, key); 2008 return index < 0 ? void 0 : data[index][1]; 2009 } 2010 2011 function listCacheHas(key) { 2012 return assocIndexOf(this.__data__, key) > -1; 2013 } 2014 2015 function listCacheSet(key, value) { 2016 var data = this.__data__, index = assocIndexOf(data, key); 2017 if (index < 0) { 2018 ++this.size; 2019 data.push([key, value]); 2020 } else { 2021 data[index][1] = value; 2022 } 2023 return this; 2024 } 2025 2026 function ListCache(entries) { 2027 var index = -1, length = entries == null ? 0 : entries.length; 2028 this.clear(); 2029 while (++index < length) { 2030 var entry = entries[index]; 2031 this.set(entry[0], entry[1]); 2032 } 2033 } 2034 ListCache.prototype.clear = listCacheClear; 2035 ListCache.prototype["delete"] = listCacheDelete; 2036 ListCache.prototype.get = listCacheGet; 2037 ListCache.prototype.has = listCacheHas; 2038 ListCache.prototype.set = listCacheSet; 2039 2040 var Map$1 = getNative(root, "Map"); 2041 2042 function mapCacheClear() { 2043 this.size = 0; 2044 this.__data__ = { 2045 "hash": new Hash(), 2046 "map": new (Map$1 || ListCache)(), 2047 "string": new Hash() 2048 }; 2049 } 2050 2051 function isKeyable(value) { 2052 var type = typeof value; 2053 return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null; 2054 } 2055 2056 function getMapData(map, key) { 2057 var data = map.__data__; 2058 return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; 2059 } 2060 2061 function mapCacheDelete(key) { 2062 var result = getMapData(this, key)["delete"](key); 2063 this.size -= result ? 1 : 0; 2064 return result; 2065 } 2066 2067 function mapCacheGet(key) { 2068 return getMapData(this, key).get(key); 2069 } 2070 2071 function mapCacheHas(key) { 2072 return getMapData(this, key).has(key); 2073 } 2074 2075 function mapCacheSet(key, value) { 2076 var data = getMapData(this, key), size = data.size; 2077 data.set(key, value); 2078 this.size += data.size == size ? 0 : 1; 2079 return this; 2080 } 2081 2082 function MapCache(entries) { 2083 var index = -1, length = entries == null ? 0 : entries.length; 2084 this.clear(); 2085 while (++index < length) { 2086 var entry = entries[index]; 2087 this.set(entry[0], entry[1]); 2088 } 2089 } 2090 MapCache.prototype.clear = mapCacheClear; 2091 MapCache.prototype["delete"] = mapCacheDelete; 2092 MapCache.prototype.get = mapCacheGet; 2093 MapCache.prototype.has = mapCacheHas; 2094 MapCache.prototype.set = mapCacheSet; 2095
vendor: 4,545 bytes, lines 2096-2231
2096 var FUNC_ERROR_TEXT$9 = "Expected a function"; 2097 function memoize(func, resolver) { 2098 if (typeof func != "function" || resolver != null && typeof resolver != "function") { 2099 throw new TypeError(FUNC_ERROR_TEXT$9); 2100 } 2101 var memoized = function() { 2102 var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; 2103 if (cache.has(key)) { 2104 return cache.get(key); 2105 } 2106 var result = func.apply(this, args); 2107 memoized.cache = cache.set(key, result) || cache; 2108 return result; 2109 }; 2110 memoized.cache = new (memoize.Cache || MapCache)(); 2111 return memoized; 2112 } 2113 memoize.Cache = MapCache; 2114 2115 var MAX_MEMOIZE_SIZE = 500; 2116 function memoizeCapped(func) { 2117 var result = memoize(func, function(key) { 2118 if (cache.size === MAX_MEMOIZE_SIZE) { 2119 cache.clear(); 2120 } 2121 return key; 2122 }); 2123 var cache = result.cache; 2124 return result; 2125 } 2126 2127 var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; 2128 var reEscapeChar = /\\(\\)?/g; 2129 var stringToPath = memoizeCapped(function(string) { 2130 var result = []; 2131 if (string.charCodeAt(0) === 46) { 2132 result.push(""); 2133 } 2134 string.replace(rePropName, function(match, number, quote, subString) { 2135 result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match); 2136 }); 2137 return result; 2138 }); 2139 2140 function toString(value) { 2141 return value == null ? "" : baseToString(value); 2142 } 2143 2144 function castPath(value, object) { 2145 if (isArray(value)) { 2146 return value; 2147 } 2148 return isKey(value, object) ? [value] : stringToPath(toString(value)); 2149 } 2150 2151 var INFINITY$3 = 1 / 0; 2152 function toKey(value) { 2153 if (typeof value == "string" || isSymbol(value)) { 2154 return value; 2155 } 2156 var result = value + ""; 2157 return result == "0" && 1 / value == -INFINITY$3 ? "-0" : result; 2158 } 2159 2160 function baseGet(object, path) { 2161 path = castPath(path, object); 2162 var index = 0, length = path.length; 2163 while (object != null && index < length) { 2164 object = object[toKey(path[index++])]; 2165 } 2166 return index && index == length ? object : void 0; 2167 } 2168 2169 function get(object, path, defaultValue) { 2170 var result = object == null ? void 0 : baseGet(object, path); 2171 return result === void 0 ? defaultValue : result; 2172 } 2173 2174 function baseAt(object, paths) { 2175 var index = -1, length = paths.length, result = Array(length), skip = object == null; 2176 while (++index < length) { 2177 result[index] = skip ? void 0 : get(object, paths[index]); 2178 } 2179 return result; 2180 } 2181 2182 function arrayPush(array, values) { 2183 var index = -1, length = values.length, offset = array.length; 2184 while (++index < length) { 2185 array[offset + index] = values[index]; 2186 } 2187 return array; 2188 } 2189 2190 var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : void 0; 2191 function isFlattenable(value) { 2192 return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]); 2193 } 2194 2195 function baseFlatten(array, depth, predicate, isStrict, result) { 2196 var index = -1, length = array.length; 2197 predicate || (predicate = isFlattenable); 2198 result || (result = []); 2199 while (++index < length) { 2200 var value = array[index]; 2201 if (depth > 0 && predicate(value)) { 2202 if (depth > 1) { 2203 baseFlatten(value, depth - 1, predicate, isStrict, result); 2204 } else { 2205 arrayPush(result, value); 2206 } 2207 } else if (!isStrict) { 2208 result[result.length] = value; 2209 } 2210 } 2211 return result; 2212 } 2213 2214 function flatten(array) { 2215 var length = array == null ? 0 : array.length; 2216 return length ? baseFlatten(array, 1) : []; 2217 } 2218 2219 function flatRest(func) { 2220 return setToString(overRest(func, void 0, flatten), func + ""); 2221 } 2222 2223 var at$1 = flatRest(baseAt); 2224 2225 var getPrototype = overArg(Object.getPrototypeOf, Object); 2226 2227 var objectTag$3 = "[object Object]"; 2228 var funcProto = Function.prototype; 2229 var objectProto$e = Object.prototype; 2230 var funcToString = funcProto.toString; 2231 var hasOwnProperty$c = objectProto$e.hasOwnProperty;
2232 var objectCtorString = funcToString.call(Object); 2233 function isPlainObject(value) { 2234 if (!isObjectLike(value) || baseGetTag(value) != objectTag$3) { 2235 return false; 2236 } 2237 var proto = getPrototype(value); 2238 if (proto === null) { 2239 return true; 2240 } 2241 var Ctor = hasOwnProperty$c.call(proto, "constructor") && proto.constructor; 2242 return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; 2243 } 2244 2245 var domExcTag = "[object DOMException]"; 2246 var errorTag$2 = "[object Error]"; 2247 function isError(value) { 2248 if (!isObjectLike(value)) { 2249 return false; 2250 } 2251 var tag = baseGetTag(value); 2252 return tag == errorTag$2 || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value); 2253 } 2254 2255 var attempt = baseRest(function(func, args) { 2256 try { 2257 return apply(func, void 0, args); 2258 } catch (e) { 2259 return isError(e) ? e : new Error(e); 2260 } 2261 }); 2262 2263 var FUNC_ERROR_TEXT$8 = "Expected a function"; 2264 function before(n, func) { 2265 var result; 2266 if (typeof func != "function") { 2267 throw new TypeError(FUNC_ERROR_TEXT$8); 2268 } 2269 n = toInteger(n); 2270 return function() { 2271 if (--n > 0) { 2272 result = func.apply(this, arguments); 2273 } 2274 if (n <= 1) { 2275 func = void 0; 2276 } 2277 return result; 2278 }; 2279 } 2280 2281 var WRAP_BIND_FLAG$1 = 1; 2282 var WRAP_PARTIAL_FLAG$3 = 32; 2283 var bind = baseRest(function(func, thisArg, partials) { 2284 var bitmask = WRAP_BIND_FLAG$1; 2285 if (partials.length) { 2286 var holders = replaceHolders(partials, getHolder(bind)); 2287 bitmask |= WRAP_PARTIAL_FLAG$3; 2288 } 2289 return createWrap(func, bitmask, thisArg, partials, holders); 2290 }); 2291 bind.placeholder = {}; 2292 2293 var bindAll = flatRest(function(object, methodNames) { 2294 arrayEach(methodNames, function(key) { 2295 key = toKey(key); 2296 baseAssignValue(object, key, bind(object[key], object)); 2297 }); 2298 return object; 2299 }); 2300 2301 var WRAP_BIND_FLAG = 1; 2302 var WRAP_BIND_KEY_FLAG$1 = 2; 2303 var WRAP_PARTIAL_FLAG$2 = 32; 2304 var bindKey = baseRest(function(object, key, partials) { 2305 var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG$1; 2306 if (partials.length) { 2307 var holders = replaceHolders(partials, getHolder(bindKey)); 2308 bitmask |= WRAP_PARTIAL_FLAG$2; 2309 } 2310 return createWrap(key, bitmask, object, partials, holders); 2311 }); 2312 bindKey.placeholder = {}; 2313 2314 function baseSlice(array, start, end) { 2315 var index = -1, length = array.length; 2316 if (start < 0) { 2317 start = -start > length ? 0 : length + start; 2318 } 2319 end = end > length ? length : end; 2320 if (end < 0) { 2321 end += length; 2322 } 2323 length = start > end ? 0 : end - start >>> 0; 2324 start >>>= 0; 2325 var result = Array(length); 2326 while (++index < length) { 2327 result[index] = array[index + start]; 2328 } 2329 return result; 2330 } 2331 2332 function castSlice(array, start, end) { 2333 var length = array.length; 2334 end = end === void 0 ? length : end; 2335 return !start && end >= length ? array : baseSlice(array, start, end); 2336 } 2337 2338 var rsAstralRange$3 = "\\ud800-\\udfff"; 2339 var rsComboMarksRange$4 = "\\u0300-\\u036f"; 2340 var reComboHalfMarksRange$4 = "\\ufe20-\\ufe2f"; 2341 var rsComboSymbolsRange$4 = "\\u20d0-\\u20ff"; 2342 var rsComboRange$4 = rsComboMarksRange$4 + reComboHalfMarksRange$4 + rsComboSymbolsRange$4; 2343 var rsVarRange$3 = "\\ufe0e\\ufe0f"; 2344 var rsZWJ$3 = "\\u200d"; 2345 var reHasUnicode = RegExp("[" + rsZWJ$3 + rsAstralRange$3 + rsComboRange$4 + rsVarRange$3 + "]"); 2346 function hasUnicode(string) { 2347 return reHasUnicode.test(string); 2348 } 2349 2350 function asciiToArray(string) { 2351 return string.split(""); 2352 } 2353 2354 var rsAstralRange$2 = "\\ud800-\\udfff"; 2355 var rsComboMarksRange$3 = "\\u0300-\\u036f"; 2356 var reComboHalfMarksRange$3 = "\\ufe20-\\ufe2f";
vendor: 1,616 bytes, lines 2357-2386
2357 var rsComboSymbolsRange$3 = "\\u20d0-\\u20ff"; 2358 var rsComboRange$3 = rsComboMarksRange$3 + reComboHalfMarksRange$3 + rsComboSymbolsRange$3; 2359 var rsVarRange$2 = "\\ufe0e\\ufe0f"; 2360 var rsAstral$1 = "[" + rsAstralRange$2 + "]"; 2361 var rsCombo$3 = "[" + rsComboRange$3 + "]"; 2362 var rsFitz$2 = "\\ud83c[\\udffb-\\udfff]"; 2363 var rsModifier$2 = "(?:" + rsCombo$3 + "|" + rsFitz$2 + ")"; 2364 var rsNonAstral$2 = "[^" + rsAstralRange$2 + "]"; 2365 var rsRegional$2 = "(?:\\ud83c[\\udde6-\\uddff]){2}"; 2366 var rsSurrPair$2 = "[\\ud800-\\udbff][\\udc00-\\udfff]"; 2367 var rsZWJ$2 = "\\u200d"; 2368 var reOptMod$2 = rsModifier$2 + "?"; 2369 var rsOptVar$2 = "[" + rsVarRange$2 + "]?"; 2370 var rsOptJoin$2 = "(?:" + rsZWJ$2 + "(?:" + [rsNonAstral$2, rsRegional$2, rsSurrPair$2].join("|") + ")" + rsOptVar$2 + reOptMod$2 + ")*"; 2371 var rsSeq$2 = rsOptVar$2 + reOptMod$2 + rsOptJoin$2; 2372 var rsSymbol$1 = "(?:" + [rsNonAstral$2 + rsCombo$3 + "?", rsCombo$3, rsRegional$2, rsSurrPair$2, rsAstral$1].join("|") + ")"; 2373 var reUnicode$1 = RegExp(rsFitz$2 + "(?=" + rsFitz$2 + ")|" + rsSymbol$1 + rsSeq$2, "g"); 2374 function unicodeToArray(string) { 2375 return string.match(reUnicode$1) || []; 2376 } 2377 2378 function stringToArray(string) { 2379 return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string); 2380 } 2381 2382 function createCaseFirst(methodName) { 2383 return function(string) { 2384 string = toString(string); 2385 var strSymbols = hasUnicode(string) ? stringToArray(string) : void 0; 2386 var chr = strSymbols ? strSymbols[0] : string.charAt(0);
vendor: 1,927 bytes, lines 2387-2468
2387 var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1); 2388 return chr[methodName]() + trailing; 2389 }; 2390 } 2391 2392 var upperFirst = createCaseFirst("toUpperCase"); 2393 2394 function capitalize$1(string) { 2395 return upperFirst(toString(string).toLowerCase()); 2396 } 2397 2398 function arrayReduce(array, iteratee, accumulator, initAccum) { 2399 var index = -1, length = array == null ? 0 : array.length; 2400 if (initAccum && length) { 2401 accumulator = array[++index]; 2402 } 2403 while (++index < length) { 2404 accumulator = iteratee(accumulator, array[index], index, array); 2405 } 2406 return accumulator; 2407 } 2408 2409 function basePropertyOf(object) { 2410 return function(key) { 2411 return object == null ? void 0 : object[key]; 2412 }; 2413 } 2414 2415 var deburredLetters = { 2416 "\xC0": "A", 2417 "\xC1": "A", 2418 "\xC2": "A", 2419 "\xC3": "A", 2420 "\xC4": "A", 2421 "\xC5": "A", 2422 "\xE0": "a", 2423 "\xE1": "a", 2424 "\xE2": "a", 2425 "\xE3": "a", 2426 "\xE4": "a", 2427 "\xE5": "a", 2428 "\xC7": "C", 2429 "\xE7": "c", 2430 "\xD0": "D", 2431 "\xF0": "d", 2432 "\xC8": "E", 2433 "\xC9": "E", 2434 "\xCA": "E", 2435 "\xCB": "E", 2436 "\xE8": "e", 2437 "\xE9": "e", 2438 "\xEA": "e", 2439 "\xEB": "e", 2440 "\xCC": "I", 2441 "\xCD": "I", 2442 "\xCE": "I", 2443 "\xCF": "I", 2444 "\xEC": "i", 2445 "\xED": "i", 2446 "\xEE": "i", 2447 "\xEF": "i", 2448 "\xD1": "N", 2449 "\xF1": "n", 2450 "\xD2": "O", 2451 "\xD3": "O", 2452 "\xD4": "O", 2453 "\xD5": "O", 2454 "\xD6": "O", 2455 "\xD8": "O", 2456 "\xF2": "o", 2457 "\xF3": "o", 2458 "\xF4": "o", 2459 "\xF5": "o", 2460 "\xF6": "o", 2461 "\xF8": "o", 2462 "\xD9": "U", 2463 "\xDA": "U", 2464 "\xDB": "U", 2465 "\xDC": "U", 2466 "\xF9": "u", 2467 "\xFA": "u", 2468 "\xFB": "u",
2469 "\xFC": "u", 2470 "\xDD": "Y", 2471 "\xFD": "y", 2472 "\xFF": "y", 2473 "\xC6": "Ae", 2474 "\xE6": "ae", 2475 "\xDE": "Th", 2476 "\xFE": "th", 2477 "\xDF": "ss", 2478 "\u0100": "A", 2479 "\u0102": "A", 2480 "\u0104": "A", 2481 "\u0101": "a", 2482 "\u0103": "a", 2483 "\u0105": "a", 2484 "\u0106": "C", 2485 "\u0108": "C", 2486 "\u010A": "C", 2487 "\u010C": "C", 2488 "\u0107": "c", 2489 "\u0109": "c", 2490 "\u010B": "c", 2491 "\u010D": "c", 2492 "\u010E": "D", 2493 "\u0110": "D", 2494 "\u010F": "d", 2495 "\u0111": "d", 2496 "\u0112": "E", 2497 "\u0114": "E", 2498 "\u0116": "E", 2499 "\u0118": "E", 2500 "\u011A": "E", 2501 "\u0113": "e", 2502 "\u0115": "e", 2503 "\u0117": "e", 2504 "\u0119": "e", 2505 "\u011B": "e", 2506 "\u011C": "G", 2507 "\u011E": "G", 2508 "\u0120": "G", 2509 "\u0122": "G", 2510 "\u011D": "g", 2511 "\u011F": "g", 2512 "\u0121": "g", 2513 "\u0123": "g", 2514 "\u0124": "H", 2515 "\u0126": "H", 2516 "\u0125": "h", 2517 "\u0127": "h", 2518 "\u0128": "I", 2519 "\u012A": "I", 2520 "\u012C": "I", 2521 "\u012E": "I", 2522 "\u0130": "I", 2523 "\u0129": "i", 2524 "\u012B": "i", 2525 "\u012D": "i", 2526 "\u012F": "i", 2527 "\u0131": "i", 2528 "\u0134": "J", 2529 "\u0135": "j", 2530 "\u0136": "K", 2531 "\u0137": "k", 2532 "\u0138": "k", 2533 "\u0139": "L", 2534 "\u013B": "L", 2535 "\u013D": "L", 2536 "\u013F": "L", 2537 "\u0141": "L", 2538 "\u013A": "l", 2539 "\u013C": "l", 2540 "\u013E": "l", 2541 "\u0140": "l", 2542 "\u0142": "l", 2543 "\u0143": "N", 2544 "\u0145": "N", 2545 "\u0147": "N", 2546 "\u014A": "N", 2547 "\u0144": "n", 2548 "\u0146": "n", 2549 "\u0148": "n", 2550 "\u014B": "n", 2551 "\u014C": "O", 2552 "\u014E": "O", 2553 "\u0150": "O", 2554 "\u014D": "o", 2555 "\u014F": "o", 2556 "\u0151": "o", 2557 "\u0154": "R", 2558 "\u0156": "R", 2559 "\u0158": "R", 2560 "\u0155": "r", 2561 "\u0157": "r", 2562 "\u0159": "r", 2563 "\u015A": "S", 2564 "\u015C": "S", 2565 "\u015E": "S", 2566 "\u0160": "S", 2567 "\u015B": "s", 2568 "\u015D": "s", 2569 "\u015F": "s", 2570 "\u0161": "s", 2571 "\u0162": "T", 2572 "\u0164": "T", 2573 "\u0166": "T", 2574 "\u0163": "t", 2575 "\u0165": "t", 2576 "\u0167": "t", 2577 "\u0168": "U", 2578 "\u016A": "U", 2579 "\u016C": "U", 2580 "\u016E": "U", 2581 "\u0170": "U", 2582 "\u0172": "U", 2583 "\u0169": "u", 2584 "\u016B": "u", 2585 "\u016D": "u", 2586 "\u016F": "u", 2587 "\u0171": "u", 2588 "\u0173": "u", 2589 "\u0174": "W", 2590 "\u0175": "w", 2591 "\u0176": "Y", 2592 "\u0177": "y", 2593 "\u0178": "Y", 2594 "\u0179": "Z", 2595 "\u017B": "Z", 2596 "\u017D": "Z", 2597 "\u017A": "z", 2598 "\u017C": "z", 2599 "\u017E": "z", 2600 "\u0132": "IJ", 2601 "\u0133": "ij", 2602 "\u0152": "Oe", 2603 "\u0153": "oe", 2604 "\u0149": "'n", 2605 "\u017F": "s" 2606 }; 2607 var deburrLetter = basePropertyOf(deburredLetters); 2608
vendor: 4,503 bytes, lines 2609-2700
2609 var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; 2610 var rsComboMarksRange$2 = "\\u0300-\\u036f"; 2611 var reComboHalfMarksRange$2 = "\\ufe20-\\ufe2f"; 2612 var rsComboSymbolsRange$2 = "\\u20d0-\\u20ff"; 2613 var rsComboRange$2 = rsComboMarksRange$2 + reComboHalfMarksRange$2 + rsComboSymbolsRange$2; 2614 var rsCombo$2 = "[" + rsComboRange$2 + "]"; 2615 var reComboMark = RegExp(rsCombo$2, "g"); 2616 function deburr(string) { 2617 string = toString(string); 2618 return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ""); 2619 } 2620 2621 var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; 2622 function asciiWords(string) { 2623 return string.match(reAsciiWord) || []; 2624 } 2625 2626 var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; 2627 function hasUnicodeWord(string) { 2628 return reHasUnicodeWord.test(string); 2629 } 2630 2631 var rsAstralRange$1 = "\\ud800-\\udfff"; 2632 var rsComboMarksRange$1 = "\\u0300-\\u036f"; 2633 var reComboHalfMarksRange$1 = "\\ufe20-\\ufe2f"; 2634 var rsComboSymbolsRange$1 = "\\u20d0-\\u20ff"; 2635 var rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1; 2636 var rsDingbatRange = "\\u2700-\\u27bf"; 2637 var rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff"; 2638 var rsMathOpRange = "\\xac\\xb1\\xd7\\xf7"; 2639 var rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf"; 2640 var rsPunctuationRange = "\\u2000-\\u206f"; 2641 var rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000"; 2642 var rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde"; 2643 var rsVarRange$1 = "\\ufe0e\\ufe0f"; 2644 var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; 2645 var rsApos$1 = "['\u2019]"; 2646 var rsBreak = "[" + rsBreakRange + "]"; 2647 var rsCombo$1 = "[" + rsComboRange$1 + "]"; 2648 var rsDigits = "\\d+"; 2649 var rsDingbat = "[" + rsDingbatRange + "]"; 2650 var rsLower = "[" + rsLowerRange + "]"; 2651 var rsMisc = "[^" + rsAstralRange$1 + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]"; 2652 var rsFitz$1 = "\\ud83c[\\udffb-\\udfff]"; 2653 var rsModifier$1 = "(?:" + rsCombo$1 + "|" + rsFitz$1 + ")"; 2654 var rsNonAstral$1 = "[^" + rsAstralRange$1 + "]"; 2655 var rsRegional$1 = "(?:\\ud83c[\\udde6-\\uddff]){2}"; 2656 var rsSurrPair$1 = "[\\ud800-\\udbff][\\udc00-\\udfff]"; 2657 var rsUpper = "[" + rsUpperRange + "]"; 2658 var rsZWJ$1 = "\\u200d"; 2659 var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")"; 2660 var rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")"; 2661 var rsOptContrLower = "(?:" + rsApos$1 + "(?:d|ll|m|re|s|t|ve))?"; 2662 var rsOptContrUpper = "(?:" + rsApos$1 + "(?:D|LL|M|RE|S|T|VE))?"; 2663 var reOptMod$1 = rsModifier$1 + "?"; 2664 var rsOptVar$1 = "[" + rsVarRange$1 + "]?"; 2665 var rsOptJoin$1 = "(?:" + rsZWJ$1 + "(?:" + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsOptVar$1 + reOptMod$1 + ")*"; 2666 var rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])"; 2667 var rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])"; 2668 var rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1; 2669 var rsEmoji = "(?:" + [rsDingbat, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsSeq$1; 2670 var reUnicodeWord = RegExp([ 2671 rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")", 2672 rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")", 2673 rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower, 2674 rsUpper + "+" + rsOptContrUpper, 2675 rsOrdUpper, 2676 rsOrdLower, 2677 rsDigits, 2678 rsEmoji 2679 ].join("|"), "g"); 2680 function unicodeWords(string) { 2681 return string.match(reUnicodeWord) || []; 2682 } 2683 2684 function words(string, pattern, guard) { 2685 string = toString(string); 2686 pattern = guard ? void 0 : pattern; 2687 if (pattern === void 0) { 2688 return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); 2689 } 2690 return string.match(pattern) || []; 2691 } 2692 2693 var rsApos = "['\u2019]"; 2694 var reApos = RegExp(rsApos, "g"); 2695 function createCompounder(callback) { 2696 return function(string) { 2697 return arrayReduce(words(deburr(string).replace(reApos, "")), callback, ""); 2698 }; 2699 } 2700
vendor: 5,250 bytes, lines 2701-2869
2701 var camelCase = createCompounder(function(result, word, index) { 2702 word = word.toLowerCase(); 2703 return result + (index ? capitalize$1(word) : word); 2704 }); 2705 2706 function castArray$1() { 2707 if (!arguments.length) { 2708 return []; 2709 } 2710 var value = arguments[0]; 2711 return isArray(value) ? value : [value]; 2712 } 2713 2714 var nativeIsFinite$1 = root.isFinite; 2715 var nativeMin$c = Math.min; 2716 function createRound(methodName) { 2717 var func = Math[methodName]; 2718 return function(number, precision) { 2719 number = toNumber(number); 2720 precision = precision == null ? 0 : nativeMin$c(toInteger(precision), 292); 2721 if (precision && nativeIsFinite$1(number)) { 2722 var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision)); 2723 pair = (toString(value) + "e").split("e"); 2724 return +(pair[0] + "e" + (+pair[1] - precision)); 2725 } 2726 return func(number); 2727 }; 2728 } 2729 2730 var ceil = createRound("ceil"); 2731 2732 function chain(value) { 2733 var result = lodash(value); 2734 result.__chain__ = true; 2735 return result; 2736 } 2737 2738 var nativeCeil$3 = Math.ceil; 2739 var nativeMax$c = Math.max; 2740 function chunk(array, size, guard) { 2741 if (guard ? isIterateeCall(array, size, guard) : size === void 0) { 2742 size = 1; 2743 } else { 2744 size = nativeMax$c(toInteger(size), 0); 2745 } 2746 var length = array == null ? 0 : array.length; 2747 if (!length || size < 1) { 2748 return []; 2749 } 2750 var index = 0, resIndex = 0, result = Array(nativeCeil$3(length / size)); 2751 while (index < length) { 2752 result[resIndex++] = baseSlice(array, index, index += size); 2753 } 2754 return result; 2755 } 2756 2757 function baseClamp(number, lower, upper) { 2758 if (number === number) { 2759 if (upper !== void 0) { 2760 number = number <= upper ? number : upper; 2761 } 2762 if (lower !== void 0) { 2763 number = number >= lower ? number : lower; 2764 } 2765 } 2766 return number; 2767 } 2768 2769 function clamp(number, lower, upper) { 2770 if (upper === void 0) { 2771 upper = lower; 2772 lower = void 0; 2773 } 2774 if (upper !== void 0) { 2775 upper = toNumber(upper); 2776 upper = upper === upper ? upper : 0; 2777 } 2778 if (lower !== void 0) { 2779 lower = toNumber(lower); 2780 lower = lower === lower ? lower : 0; 2781 } 2782 return baseClamp(toNumber(number), lower, upper); 2783 } 2784 2785 function stackClear() { 2786 this.__data__ = new ListCache(); 2787 this.size = 0; 2788 } 2789 2790 function stackDelete(key) { 2791 var data = this.__data__, result = data["delete"](key); 2792 this.size = data.size; 2793 return result; 2794 } 2795 2796 function stackGet(key) { 2797 return this.__data__.get(key); 2798 } 2799 2800 function stackHas(key) { 2801 return this.__data__.has(key); 2802 } 2803 2804 var LARGE_ARRAY_SIZE$2 = 200; 2805 function stackSet(key, value) { 2806 var data = this.__data__; 2807 if (data instanceof ListCache) { 2808 var pairs = data.__data__; 2809 if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE$2 - 1) { 2810 pairs.push([key, value]); 2811 this.size = ++data.size; 2812 return this; 2813 } 2814 data = this.__data__ = new MapCache(pairs); 2815 } 2816 data.set(key, value); 2817 this.size = data.size; 2818 return this; 2819 } 2820 2821 function Stack(entries) { 2822 var data = this.__data__ = new ListCache(entries); 2823 this.size = data.size; 2824 } 2825 Stack.prototype.clear = stackClear; 2826 Stack.prototype["delete"] = stackDelete; 2827 Stack.prototype.get = stackGet; 2828 Stack.prototype.has = stackHas; 2829 Stack.prototype.set = stackSet; 2830 2831 function baseAssign(object, source) { 2832 return object && copyObject(source, keys(source), object); 2833 } 2834 2835 function baseAssignIn(object, source) { 2836 return object && copyObject(source, keysIn(source), object); 2837 } 2838 2839 var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports; 2840 var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module; 2841 var moduleExports = freeModule && freeModule.exports === freeExports; 2842 var Buffer = moduleExports ? root.Buffer : void 0; 2843 var allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0; 2844 function cloneBuffer(buffer, isDeep) { 2845 if (isDeep) { 2846 return buffer.slice(); 2847 } 2848 var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); 2849 buffer.copy(result); 2850 return result; 2851 } 2852 2853 function arrayFilter(array, predicate) { 2854 var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; 2855 while (++index < length) { 2856 var value = array[index]; 2857 if (predicate(value, index, array)) { 2858 result[resIndex++] = value; 2859 } 2860 } 2861 return result; 2862 } 2863 2864 function stubArray() { 2865 return []; 2866 } 2867 2868 var objectProto$d = Object.prototype; 2869 var propertyIsEnumerable = objectProto$d.propertyIsEnumerable;
vendor: 5,058 bytes, lines 2870-3004
2870 var nativeGetSymbols$1 = Object.getOwnPropertySymbols; 2871 var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object) { 2872 if (object == null) { 2873 return []; 2874 } 2875 object = Object(object); 2876 return arrayFilter(nativeGetSymbols$1(object), function(symbol) { 2877 return propertyIsEnumerable.call(object, symbol); 2878 }); 2879 }; 2880 2881 function copySymbols(source, object) { 2882 return copyObject(source, getSymbols(source), object); 2883 } 2884 2885 var nativeGetSymbols = Object.getOwnPropertySymbols; 2886 var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { 2887 var result = []; 2888 while (object) { 2889 arrayPush(result, getSymbols(object)); 2890 object = getPrototype(object); 2891 } 2892 return result; 2893 }; 2894 2895 function copySymbolsIn(source, object) { 2896 return copyObject(source, getSymbolsIn(source), object); 2897 } 2898 2899 function baseGetAllKeys(object, keysFunc, symbolsFunc) { 2900 var result = keysFunc(object); 2901 return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); 2902 } 2903 2904 function getAllKeys(object) { 2905 return baseGetAllKeys(object, keys, getSymbols); 2906 } 2907 2908 function getAllKeysIn(object) { 2909 return baseGetAllKeys(object, keysIn, getSymbolsIn); 2910 } 2911 2912 var DataView = getNative(root, "DataView"); 2913 2914 var Promise$1 = getNative(root, "Promise"); 2915 2916 var Set$1 = getNative(root, "Set"); 2917 2918 var mapTag$8 = "[object Map]"; 2919 var objectTag$2 = "[object Object]"; 2920 var promiseTag = "[object Promise]"; 2921 var setTag$8 = "[object Set]"; 2922 var weakMapTag$2 = "[object WeakMap]"; 2923 var dataViewTag$3 = "[object DataView]"; 2924 var dataViewCtorString = toSource(DataView); 2925 var mapCtorString = toSource(Map$1); 2926 var promiseCtorString = toSource(Promise$1); 2927 var setCtorString = toSource(Set$1); 2928 var weakMapCtorString = toSource(WeakMap); 2929 var getTag = baseGetTag; 2930 if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$3 || Map$1 && getTag(new Map$1()) != mapTag$8 || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag$8 || WeakMap && getTag(new WeakMap()) != weakMapTag$2) { 2931 getTag = function(value) { 2932 var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : ""; 2933 if (ctorString) { 2934 switch (ctorString) { 2935 case dataViewCtorString: 2936 return dataViewTag$3; 2937 case mapCtorString: 2938 return mapTag$8; 2939 case promiseCtorString: 2940 return promiseTag; 2941 case setCtorString: 2942 return setTag$8; 2943 case weakMapCtorString: 2944 return weakMapTag$2; 2945 } 2946 } 2947 return result; 2948 }; 2949 } 2950 var getTag$1 = getTag; 2951 2952 var objectProto$c = Object.prototype; 2953 var hasOwnProperty$b = objectProto$c.hasOwnProperty; 2954 function initCloneArray(array) { 2955 var length = array.length, result = new array.constructor(length); 2956 if (length && typeof array[0] == "string" && hasOwnProperty$b.call(array, "index")) { 2957 result.index = array.index; 2958 result.input = array.input; 2959 } 2960 return result; 2961 } 2962 2963 var Uint8Array = root.Uint8Array; 2964 2965 function cloneArrayBuffer(arrayBuffer) { 2966 var result = new arrayBuffer.constructor(arrayBuffer.byteLength); 2967 new Uint8Array(result).set(new Uint8Array(arrayBuffer)); 2968 return result; 2969 } 2970 2971 function cloneDataView(dataView, isDeep) { 2972 var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; 2973 return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); 2974 } 2975 2976 var reFlags$1 = /\w*$/; 2977 function cloneRegExp(regexp) { 2978 var result = new regexp.constructor(regexp.source, reFlags$1.exec(regexp)); 2979 result.lastIndex = regexp.lastIndex; 2980 return result; 2981 } 2982 2983 var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : void 0; 2984 var symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0; 2985 function cloneSymbol(symbol) { 2986 return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {}; 2987 } 2988 2989 function cloneTypedArray(typedArray, isDeep) { 2990 var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; 2991 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); 2992 } 2993 2994 var boolTag$3 = "[object Boolean]"; 2995 var dateTag$3 = "[object Date]"; 2996 var mapTag$7 = "[object Map]"; 2997 var numberTag$3 = "[object Number]"; 2998 var regexpTag$3 = "[object RegExp]"; 2999 var setTag$7 = "[object Set]"; 3000 var stringTag$3 = "[object String]"; 3001 var symbolTag$2 = "[object Symbol]"; 3002 var arrayBufferTag$3 = "[object ArrayBuffer]"; 3003 var dataViewTag$2 = "[object DataView]"; 3004 var float32Tag$1 = "[object Float32Array]";
vendor: 5,900 bytes, lines 3005-3147
3005 var float64Tag$1 = "[object Float64Array]"; 3006 var int8Tag$1 = "[object Int8Array]"; 3007 var int16Tag$1 = "[object Int16Array]"; 3008 var int32Tag$1 = "[object Int32Array]"; 3009 var uint8Tag$1 = "[object Uint8Array]"; 3010 var uint8ClampedTag$1 = "[object Uint8ClampedArray]"; 3011 var uint16Tag$1 = "[object Uint16Array]"; 3012 var uint32Tag$1 = "[object Uint32Array]"; 3013 function initCloneByTag(object, tag, isDeep) { 3014 var Ctor = object.constructor; 3015 switch (tag) { 3016 case arrayBufferTag$3: 3017 return cloneArrayBuffer(object); 3018 case boolTag$3: 3019 case dateTag$3: 3020 return new Ctor(+object); 3021 case dataViewTag$2: 3022 return cloneDataView(object, isDeep); 3023 case float32Tag$1: 3024 case float64Tag$1: 3025 case int8Tag$1: 3026 case int16Tag$1: 3027 case int32Tag$1: 3028 case uint8Tag$1: 3029 case uint8ClampedTag$1: 3030 case uint16Tag$1: 3031 case uint32Tag$1: 3032 return cloneTypedArray(object, isDeep); 3033 case mapTag$7: 3034 return new Ctor(); 3035 case numberTag$3: 3036 case stringTag$3: 3037 return new Ctor(object); 3038 case regexpTag$3: 3039 return cloneRegExp(object); 3040 case setTag$7: 3041 return new Ctor(); 3042 case symbolTag$2: 3043 return cloneSymbol(object); 3044 } 3045 } 3046 3047 function initCloneObject(object) { 3048 return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {}; 3049 } 3050 3051 var mapTag$6 = "[object Map]"; 3052 function baseIsMap(value) { 3053 return isObjectLike(value) && getTag$1(value) == mapTag$6; 3054 } 3055 3056 var nodeIsMap = nodeUtil && nodeUtil.isMap; 3057 var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; 3058 3059 var setTag$6 = "[object Set]"; 3060 function baseIsSet(value) { 3061 return isObjectLike(value) && getTag$1(value) == setTag$6; 3062 } 3063 3064 var nodeIsSet = nodeUtil && nodeUtil.isSet; 3065 var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; 3066 3067 var CLONE_DEEP_FLAG$7 = 1; 3068 var CLONE_FLAT_FLAG$1 = 2; 3069 var CLONE_SYMBOLS_FLAG$5 = 4; 3070 var argsTag$1 = "[object Arguments]"; 3071 var arrayTag$1 = "[object Array]"; 3072 var boolTag$2 = "[object Boolean]"; 3073 var dateTag$2 = "[object Date]"; 3074 var errorTag$1 = "[object Error]"; 3075 var funcTag = "[object Function]"; 3076 var genTag = "[object GeneratorFunction]"; 3077 var mapTag$5 = "[object Map]"; 3078 var numberTag$2 = "[object Number]"; 3079 var objectTag$1 = "[object Object]"; 3080 var regexpTag$2 = "[object RegExp]"; 3081 var setTag$5 = "[object Set]"; 3082 var stringTag$2 = "[object String]"; 3083 var symbolTag$1 = "[object Symbol]"; 3084 var weakMapTag$1 = "[object WeakMap]"; 3085 var arrayBufferTag$2 = "[object ArrayBuffer]"; 3086 var dataViewTag$1 = "[object DataView]"; 3087 var float32Tag = "[object Float32Array]"; 3088 var float64Tag = "[object Float64Array]"; 3089 var int8Tag = "[object Int8Array]"; 3090 var int16Tag = "[object Int16Array]"; 3091 var int32Tag = "[object Int32Array]"; 3092 var uint8Tag = "[object Uint8Array]"; 3093 var uint8ClampedTag = "[object Uint8ClampedArray]"; 3094 var uint16Tag = "[object Uint16Array]"; 3095 var uint32Tag = "[object Uint32Array]"; 3096 var cloneableTags = {}; 3097 cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$2] = cloneableTags[dataViewTag$1] = cloneableTags[boolTag$2] = cloneableTags[dateTag$2] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag$5] = cloneableTags[numberTag$2] = cloneableTags[objectTag$1] = cloneableTags[regexpTag$2] = cloneableTags[setTag$5] = cloneableTags[stringTag$2] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; 3098 cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag$1] = false; 3099 function baseClone(value, bitmask, customizer, key, object, stack) { 3100 var result, isDeep = bitmask & CLONE_DEEP_FLAG$7, isFlat = bitmask & CLONE_FLAT_FLAG$1, isFull = bitmask & CLONE_SYMBOLS_FLAG$5; 3101 if (customizer) { 3102 result = object ? customizer(value, key, object, stack) : customizer(value); 3103 } 3104 if (result !== void 0) { 3105 return result; 3106 } 3107 if (!isObject(value)) { 3108 return value; 3109 } 3110 var isArr = isArray(value); 3111 if (isArr) { 3112 result = initCloneArray(value); 3113 if (!isDeep) { 3114 return copyArray(value, result); 3115 } 3116 } else { 3117 var tag = getTag$1(value), isFunc = tag == funcTag || tag == genTag; 3118 if (isBuffer(value)) { 3119 return cloneBuffer(value, isDeep); 3120 } 3121 if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object) { 3122 result = isFlat || isFunc ? {} : initCloneObject(value); 3123 if (!isDeep) { 3124 return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value)); 3125 } 3126 } else { 3127 if (!cloneableTags[tag]) { 3128 return object ? value : {}; 3129 } 3130 result = initCloneByTag(value, tag, isDeep); 3131 } 3132 } 3133 stack || (stack = new Stack()); 3134 var stacked = stack.get(value); 3135 if (stacked) { 3136 return stacked; 3137 } 3138 stack.set(value, result); 3139 if (isSet(value)) { 3140 value.forEach(function(subValue) { 3141 result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); 3142 }); 3143 } else if (isMap(value)) { 3144 value.forEach(function(subValue, key2) { 3145 result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack)); 3146 }); 3147 }
vendor: 4,909 bytes, lines 3148-3292
3148 var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys; 3149 var props = isArr ? void 0 : keysFunc(value); 3150 arrayEach(props || value, function(subValue, key2) { 3151 if (props) { 3152 key2 = subValue; 3153 subValue = value[key2]; 3154 } 3155 assignValue(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack)); 3156 }); 3157 return result; 3158 } 3159 3160 var CLONE_SYMBOLS_FLAG$4 = 4; 3161 function clone(value) { 3162 return baseClone(value, CLONE_SYMBOLS_FLAG$4); 3163 } 3164 3165 var CLONE_DEEP_FLAG$6 = 1; 3166 var CLONE_SYMBOLS_FLAG$3 = 4; 3167 function cloneDeep(value) { 3168 return baseClone(value, CLONE_DEEP_FLAG$6 | CLONE_SYMBOLS_FLAG$3); 3169 } 3170 3171 var CLONE_DEEP_FLAG$5 = 1; 3172 var CLONE_SYMBOLS_FLAG$2 = 4; 3173 function cloneDeepWith(value, customizer) { 3174 customizer = typeof customizer == "function" ? customizer : void 0; 3175 return baseClone(value, CLONE_DEEP_FLAG$5 | CLONE_SYMBOLS_FLAG$2, customizer); 3176 } 3177 3178 var CLONE_SYMBOLS_FLAG$1 = 4; 3179 function cloneWith(value, customizer) { 3180 customizer = typeof customizer == "function" ? customizer : void 0; 3181 return baseClone(value, CLONE_SYMBOLS_FLAG$1, customizer); 3182 } 3183 3184 function wrapperCommit() { 3185 return new LodashWrapper(this.value(), this.__chain__); 3186 } 3187 3188 function compact(array) { 3189 var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; 3190 while (++index < length) { 3191 var value = array[index]; 3192 if (value) { 3193 result[resIndex++] = value; 3194 } 3195 } 3196 return result; 3197 } 3198 3199 function concat() { 3200 var length = arguments.length; 3201 if (!length) { 3202 return []; 3203 } 3204 var args = Array(length - 1), array = arguments[0], index = length; 3205 while (index--) { 3206 args[index - 1] = arguments[index]; 3207 } 3208 return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1)); 3209 } 3210 3211 var HASH_UNDEFINED = "__lodash_hash_undefined__"; 3212 function setCacheAdd(value) { 3213 this.__data__.set(value, HASH_UNDEFINED); 3214 return this; 3215 } 3216 3217 function setCacheHas(value) { 3218 return this.__data__.has(value); 3219 } 3220 3221 function SetCache(values) { 3222 var index = -1, length = values == null ? 0 : values.length; 3223 this.__data__ = new MapCache(); 3224 while (++index < length) { 3225 this.add(values[index]); 3226 } 3227 } 3228 SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; 3229 SetCache.prototype.has = setCacheHas; 3230 3231 function arraySome(array, predicate) { 3232 var index = -1, length = array == null ? 0 : array.length; 3233 while (++index < length) { 3234 if (predicate(array[index], index, array)) { 3235 return true; 3236 } 3237 } 3238 return false; 3239 } 3240 3241 function cacheHas(cache, key) { 3242 return cache.has(key); 3243 } 3244 3245 var COMPARE_PARTIAL_FLAG$5 = 1; 3246 var COMPARE_UNORDERED_FLAG$3 = 2; 3247 function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { 3248 var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array.length, othLength = other.length; 3249 if (arrLength != othLength && !(isPartial && othLength > arrLength)) { 3250 return false; 3251 } 3252 var arrStacked = stack.get(array); 3253 var othStacked = stack.get(other); 3254 if (arrStacked && othStacked) { 3255 return arrStacked == other && othStacked == array; 3256 } 3257 var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0; 3258 stack.set(array, other); 3259 stack.set(other, array); 3260 while (++index < arrLength) { 3261 var arrValue = array[index], othValue = other[index]; 3262 if (customizer) { 3263 var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); 3264 } 3265 if (compared !== void 0) { 3266 if (compared) { 3267 continue; 3268 } 3269 result = false; 3270 break; 3271 } 3272 if (seen) { 3273 if (!arraySome(other, function(othValue2, othIndex) { 3274 if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) { 3275 return seen.push(othIndex); 3276 } 3277 })) { 3278 result = false; 3279 break; 3280 } 3281 } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { 3282 result = false; 3283 break; 3284 } 3285 } 3286 stack["delete"](array); 3287 stack["delete"](other); 3288 return result; 3289 } 3290 3291 function mapToArray(map) { 3292 var index = -1, result = Array(map.size);
vendor: 10,996 bytes, lines 3293-3579
3293 map.forEach(function(value, key) { 3294 result[++index] = [key, value]; 3295 }); 3296 return result; 3297 } 3298 3299 function setToArray(set) { 3300 var index = -1, result = Array(set.size); 3301 set.forEach(function(value) { 3302 result[++index] = value; 3303 }); 3304 return result; 3305 } 3306 3307 var COMPARE_PARTIAL_FLAG$4 = 1; 3308 var COMPARE_UNORDERED_FLAG$2 = 2; 3309 var boolTag$1 = "[object Boolean]"; 3310 var dateTag$1 = "[object Date]"; 3311 var errorTag = "[object Error]"; 3312 var mapTag$4 = "[object Map]"; 3313 var numberTag$1 = "[object Number]"; 3314 var regexpTag$1 = "[object RegExp]"; 3315 var setTag$4 = "[object Set]"; 3316 var stringTag$1 = "[object String]"; 3317 var symbolTag = "[object Symbol]"; 3318 var arrayBufferTag$1 = "[object ArrayBuffer]"; 3319 var dataViewTag = "[object DataView]"; 3320 var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0; 3321 var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0; 3322 function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { 3323 switch (tag) { 3324 case dataViewTag: 3325 if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) { 3326 return false; 3327 } 3328 object = object.buffer; 3329 other = other.buffer; 3330 case arrayBufferTag$1: 3331 if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) { 3332 return false; 3333 } 3334 return true; 3335 case boolTag$1: 3336 case dateTag$1: 3337 case numberTag$1: 3338 return eq(+object, +other); 3339 case errorTag: 3340 return object.name == other.name && object.message == other.message; 3341 case regexpTag$1: 3342 case stringTag$1: 3343 return object == other + ""; 3344 case mapTag$4: 3345 var convert = mapToArray; 3346 case setTag$4: 3347 var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4; 3348 convert || (convert = setToArray); 3349 if (object.size != other.size && !isPartial) { 3350 return false; 3351 } 3352 var stacked = stack.get(object); 3353 if (stacked) { 3354 return stacked == other; 3355 } 3356 bitmask |= COMPARE_UNORDERED_FLAG$2; 3357 stack.set(object, other); 3358 var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); 3359 stack["delete"](object); 3360 return result; 3361 case symbolTag: 3362 if (symbolValueOf) { 3363 return symbolValueOf.call(object) == symbolValueOf.call(other); 3364 } 3365 } 3366 return false; 3367 } 3368 3369 var COMPARE_PARTIAL_FLAG$3 = 1; 3370 var objectProto$b = Object.prototype; 3371 var hasOwnProperty$a = objectProto$b.hasOwnProperty; 3372 function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { 3373 var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length; 3374 if (objLength != othLength && !isPartial) { 3375 return false; 3376 } 3377 var index = objLength; 3378 while (index--) { 3379 var key = objProps[index]; 3380 if (!(isPartial ? key in other : hasOwnProperty$a.call(other, key))) { 3381 return false; 3382 } 3383 } 3384 var objStacked = stack.get(object); 3385 var othStacked = stack.get(other); 3386 if (objStacked && othStacked) { 3387 return objStacked == other && othStacked == object; 3388 } 3389 var result = true; 3390 stack.set(object, other); 3391 stack.set(other, object); 3392 var skipCtor = isPartial; 3393 while (++index < objLength) { 3394 key = objProps[index]; 3395 var objValue = object[key], othValue = other[key]; 3396 if (customizer) { 3397 var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); 3398 } 3399 if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) { 3400 result = false; 3401 break; 3402 } 3403 skipCtor || (skipCtor = key == "constructor"); 3404 } 3405 if (result && !skipCtor) { 3406 var objCtor = object.constructor, othCtor = other.constructor; 3407 if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) { 3408 result = false; 3409 } 3410 } 3411 stack["delete"](object); 3412 stack["delete"](other); 3413 return result; 3414 } 3415 3416 var COMPARE_PARTIAL_FLAG$2 = 1; 3417 var argsTag = "[object Arguments]"; 3418 var arrayTag = "[object Array]"; 3419 var objectTag = "[object Object]"; 3420 var objectProto$a = Object.prototype; 3421 var hasOwnProperty$9 = objectProto$a.hasOwnProperty; 3422 function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { 3423 var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other); 3424 objTag = objTag == argsTag ? objectTag : objTag; 3425 othTag = othTag == argsTag ? objectTag : othTag; 3426 var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; 3427 if (isSameTag && isBuffer(object)) { 3428 if (!isBuffer(other)) { 3429 return false; 3430 } 3431 objIsArr = true; 3432 objIsObj = false; 3433 } 3434 if (isSameTag && !objIsObj) { 3435 stack || (stack = new Stack()); 3436 return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); 3437 } 3438 if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) { 3439 var objIsWrapped = objIsObj && hasOwnProperty$9.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$9.call(other, "__wrapped__"); 3440 if (objIsWrapped || othIsWrapped) { 3441 var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; 3442 stack || (stack = new Stack()); 3443 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); 3444 } 3445 } 3446 if (!isSameTag) { 3447 return false; 3448 } 3449 stack || (stack = new Stack()); 3450 return equalObjects(object, other, bitmask, customizer, equalFunc, stack); 3451 } 3452 3453 function baseIsEqual(value, other, bitmask, customizer, stack) { 3454 if (value === other) { 3455 return true; 3456 } 3457 if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) { 3458 return value !== value && other !== other; 3459 } 3460 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); 3461 } 3462 3463 var COMPARE_PARTIAL_FLAG$1 = 1; 3464 var COMPARE_UNORDERED_FLAG$1 = 2; 3465 function baseIsMatch(object, source, matchData, customizer) { 3466 var index = matchData.length, length = index, noCustomizer = !customizer; 3467 if (object == null) { 3468 return !length; 3469 } 3470 object = Object(object); 3471 while (index--) { 3472 var data = matchData[index]; 3473 if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) { 3474 return false; 3475 } 3476 } 3477 while (++index < length) { 3478 data = matchData[index]; 3479 var key = data[0], objValue = object[key], srcValue = data[1]; 3480 if (noCustomizer && data[2]) { 3481 if (objValue === void 0 && !(key in object)) { 3482 return false; 3483 } 3484 } else { 3485 var stack = new Stack(); 3486 if (customizer) { 3487 var result = customizer(objValue, srcValue, key, object, source, stack); 3488 } 3489 if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) { 3490 return false; 3491 } 3492 } 3493 } 3494 return true; 3495 } 3496 3497 function isStrictComparable(value) { 3498 return value === value && !isObject(value); 3499 } 3500 3501 function getMatchData(object) { 3502 var result = keys(object), length = result.length; 3503 while (length--) { 3504 var key = result[length], value = object[key]; 3505 result[length] = [key, value, isStrictComparable(value)]; 3506 } 3507 return result; 3508 } 3509 3510 function matchesStrictComparable(key, srcValue) { 3511 return function(object) { 3512 if (object == null) { 3513 return false; 3514 } 3515 return object[key] === srcValue && (srcValue !== void 0 || key in Object(object)); 3516 }; 3517 } 3518 3519 function baseMatches(source) { 3520 var matchData = getMatchData(source); 3521 if (matchData.length == 1 && matchData[0][2]) { 3522 return matchesStrictComparable(matchData[0][0], matchData[0][1]); 3523 } 3524 return function(object) { 3525 return object === source || baseIsMatch(object, source, matchData); 3526 }; 3527 } 3528 3529 function baseHasIn(object, key) { 3530 return object != null && key in Object(object); 3531 } 3532 3533 function hasPath(object, path, hasFunc) { 3534 path = castPath(path, object); 3535 var index = -1, length = path.length, result = false; 3536 while (++index < length) { 3537 var key = toKey(path[index]); 3538 if (!(result = object != null && hasFunc(object, key))) { 3539 break; 3540 } 3541 object = object[key]; 3542 } 3543 if (result || ++index != length) { 3544 return result; 3545 } 3546 length = object == null ? 0 : object.length; 3547 return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); 3548 } 3549 3550 function hasIn(object, path) { 3551 return object != null && hasPath(object, path, baseHasIn); 3552 } 3553 3554 var COMPARE_PARTIAL_FLAG = 1; 3555 var COMPARE_UNORDERED_FLAG = 2; 3556 function baseMatchesProperty(path, srcValue) { 3557 if (isKey(path) && isStrictComparable(srcValue)) { 3558 return matchesStrictComparable(toKey(path), srcValue); 3559 } 3560 return function(object) { 3561 var objValue = get(object, path); 3562 return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); 3563 }; 3564 } 3565 3566 function baseProperty(key) { 3567 return function(object) { 3568 return object == null ? void 0 : object[key]; 3569 }; 3570 } 3571 3572 function basePropertyDeep(path) { 3573 return function(object) { 3574 return baseGet(object, path); 3575 }; 3576 } 3577 3578 function property(path) { 3579 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
vendor: 4,381 bytes, lines 3580-3716
3580 } 3581 3582 function baseIteratee(value) { 3583 if (typeof value == "function") { 3584 return value; 3585 } 3586 if (value == null) { 3587 return identity; 3588 } 3589 if (typeof value == "object") { 3590 return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); 3591 } 3592 return property(value); 3593 } 3594 3595 var FUNC_ERROR_TEXT$7 = "Expected a function"; 3596 function cond(pairs) { 3597 var length = pairs == null ? 0 : pairs.length, toIteratee = baseIteratee; 3598 pairs = !length ? [] : arrayMap(pairs, function(pair) { 3599 if (typeof pair[1] != "function") { 3600 throw new TypeError(FUNC_ERROR_TEXT$7); 3601 } 3602 return [toIteratee(pair[0]), pair[1]]; 3603 }); 3604 return baseRest(function(args) { 3605 var index = -1; 3606 while (++index < length) { 3607 var pair = pairs[index]; 3608 if (apply(pair[0], this, args)) { 3609 return apply(pair[1], this, args); 3610 } 3611 } 3612 }); 3613 } 3614 3615 function baseConformsTo(object, source, props) { 3616 var length = props.length; 3617 if (object == null) { 3618 return !length; 3619 } 3620 object = Object(object); 3621 while (length--) { 3622 var key = props[length], predicate = source[key], value = object[key]; 3623 if (value === void 0 && !(key in object) || !predicate(value)) { 3624 return false; 3625 } 3626 } 3627 return true; 3628 } 3629 3630 function baseConforms(source) { 3631 var props = keys(source); 3632 return function(object) { 3633 return baseConformsTo(object, source, props); 3634 }; 3635 } 3636 3637 var CLONE_DEEP_FLAG$4 = 1; 3638 function conforms(source) { 3639 return baseConforms(baseClone(source, CLONE_DEEP_FLAG$4)); 3640 } 3641 3642 function conformsTo(object, source) { 3643 return source == null || baseConformsTo(object, source, keys(source)); 3644 } 3645 3646 function arrayAggregator(array, setter, iteratee, accumulator) { 3647 var index = -1, length = array == null ? 0 : array.length; 3648 while (++index < length) { 3649 var value = array[index]; 3650 setter(accumulator, value, iteratee(value), array); 3651 } 3652 return accumulator; 3653 } 3654 3655 function createBaseFor(fromRight) { 3656 return function(object, iteratee, keysFunc) { 3657 var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length; 3658 while (length--) { 3659 var key = props[fromRight ? length : ++index]; 3660 if (iteratee(iterable[key], key, iterable) === false) { 3661 break; 3662 } 3663 } 3664 return object; 3665 }; 3666 } 3667 3668 var baseFor = createBaseFor(); 3669 3670 function baseForOwn(object, iteratee) { 3671 return object && baseFor(object, iteratee, keys); 3672 } 3673 3674 function createBaseEach(eachFunc, fromRight) { 3675 return function(collection, iteratee) { 3676 if (collection == null) { 3677 return collection; 3678 } 3679 if (!isArrayLike(collection)) { 3680 return eachFunc(collection, iteratee); 3681 } 3682 var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection); 3683 while (fromRight ? index-- : ++index < length) { 3684 if (iteratee(iterable[index], index, iterable) === false) { 3685 break; 3686 } 3687 } 3688 return collection; 3689 }; 3690 } 3691 3692 var baseEach = createBaseEach(baseForOwn); 3693 3694 function baseAggregator(collection, setter, iteratee, accumulator) { 3695 baseEach(collection, function(value, key, collection2) { 3696 setter(accumulator, value, iteratee(value), collection2); 3697 }); 3698 return accumulator; 3699 } 3700 3701 function createAggregator(setter, initializer) { 3702 return function(collection, iteratee) { 3703 var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {}; 3704 return func(collection, setter, baseIteratee(iteratee), accumulator); 3705 }; 3706 } 3707 3708 var objectProto$9 = Object.prototype; 3709 var hasOwnProperty$8 = objectProto$9.hasOwnProperty; 3710 var countBy = createAggregator(function(result, value, key) { 3711 if (hasOwnProperty$8.call(result, key)) { 3712 ++result[key]; 3713 } else { 3714 baseAssignValue(result, key, 1); 3715 } 3716 });
3717 3718 function create(prototype, properties) { 3719 var result = baseCreate(prototype); 3720 return properties == null ? result : baseAssign(result, properties); 3721 } 3722 3723 var WRAP_CURRY_FLAG$1 = 8; 3724 function curry(func, arity, guard) { 3725 arity = guard ? void 0 : arity; 3726 var result = createWrap(func, WRAP_CURRY_FLAG$1, void 0, void 0, void 0, void 0, void 0, arity); 3727 result.placeholder = curry.placeholder; 3728 return result; 3729 } 3730 curry.placeholder = {}; 3731 3732 var WRAP_CURRY_RIGHT_FLAG = 16; 3733 function curryRight(func, arity, guard) { 3734 arity = guard ? void 0 : arity; 3735 var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, void 0, void 0, void 0, void 0, void 0, arity); 3736 result.placeholder = curryRight.placeholder; 3737 return result; 3738 } 3739 curryRight.placeholder = {}; 3740 3741 var now = function() { 3742 return root.Date.now(); 3743 }; 3744 3745 var FUNC_ERROR_TEXT$6 = "Expected a function"; 3746 var nativeMax$b = Math.max; 3747 var nativeMin$b = Math.min; 3748 function debounce(func, wait, options) { 3749 var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; 3750 if (typeof func != "function") { 3751 throw new TypeError(FUNC_ERROR_TEXT$6); 3752 } 3753 wait = toNumber(wait) || 0; 3754 if (isObject(options)) { 3755 leading = !!options.leading; 3756 maxing = "maxWait" in options; 3757 maxWait = maxing ? nativeMax$b(toNumber(options.maxWait) || 0, wait) : maxWait; 3758 trailing = "trailing" in options ? !!options.trailing : trailing; 3759 } 3760 function invokeFunc(time) { 3761 var args = lastArgs, thisArg = lastThis; 3762 lastArgs = lastThis = void 0; 3763 lastInvokeTime = time; 3764 result = func.apply(thisArg, args); 3765 return result; 3766 } 3767 function leadingEdge(time) { 3768 lastInvokeTime = time; 3769 timerId = setTimeout(timerExpired, wait); 3770 return leading ? invokeFunc(time) : result; 3771 } 3772 function remainingWait(time) { 3773 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall; 3774 return maxing ? nativeMin$b(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; 3775 } 3776 function shouldInvoke(time) { 3777 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime; 3778 return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; 3779 } 3780 function timerExpired() { 3781 var time = now(); 3782 if (shouldInvoke(time)) { 3783 return trailingEdge(time); 3784 } 3785 timerId = setTimeout(timerExpired, remainingWait(time)); 3786 } 3787 function trailingEdge(time) { 3788 timerId = void 0; 3789 if (trailing && lastArgs) { 3790 return invokeFunc(time); 3791 } 3792 lastArgs = lastThis = void 0; 3793 return result; 3794 } 3795 function cancel() { 3796 if (timerId !== void 0) { 3797 clearTimeout(timerId); 3798 } 3799 lastInvokeTime = 0; 3800 lastArgs = lastCallTime = lastThis = timerId = void 0; 3801 } 3802 function flush() { 3803 return timerId === void 0 ? result : trailingEdge(now()); 3804 } 3805 function debounced() { 3806 var time = now(), isInvoking = shouldInvoke(time); 3807 lastArgs = arguments; 3808 lastThis = this; 3809 lastCallTime = time; 3810 if (isInvoking) { 3811 if (timerId === void 0) { 3812 return leadingEdge(lastCallTime); 3813 } 3814 if (maxing) { 3815 clearTimeout(timerId); 3816 timerId = setTimeout(timerExpired, wait); 3817 return invokeFunc(lastCallTime); 3818 } 3819 } 3820 if (timerId === void 0) { 3821 timerId = setTimeout(timerExpired, wait); 3822 } 3823 return result; 3824 } 3825 debounced.cancel = cancel; 3826 debounced.flush = flush; 3827 return debounced; 3828 } 3829 3830 function defaultTo(value, defaultValue) { 3831 return value == null || value !== value ? defaultValue : value; 3832 } 3833 3834 var objectProto$8 = Object.prototype; 3835 var hasOwnProperty$7 = objectProto$8.hasOwnProperty; 3836 var defaults = baseRest(function(object, sources) { 3837 object = Object(object); 3838 var index = -1; 3839 var length = sources.length; 3840 var guard = length > 2 ? sources[2] : void 0; 3841 if (guard && isIterateeCall(sources[0], sources[1], guard)) { 3842 length = 1; 3843 } 3844 while (++index < length) { 3845 var source = sources[index]; 3846 var props = keysIn(source); 3847 var propsIndex = -1; 3848 var propsLength = props.length; 3849 while (++propsIndex < propsLength) { 3850 var key = props[propsIndex]; 3851 var value = object[key]; 3852 if (value === void 0 || eq(value, objectProto$8[key]) && !hasOwnProperty$7.call(object, key)) { 3853 object[key] = source[key]; 3854 } 3855 } 3856 } 3857 return object; 3858 });
vendor: 3,791 bytes, lines 3859-3964
3859 3860 function assignMergeValue(object, key, value) { 3861 if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) { 3862 baseAssignValue(object, key, value); 3863 } 3864 } 3865 3866 function isArrayLikeObject(value) { 3867 return isObjectLike(value) && isArrayLike(value); 3868 } 3869 3870 function safeGet(object, key) { 3871 if (key === "constructor" && typeof object[key] === "function") { 3872 return; 3873 } 3874 if (key == "__proto__") { 3875 return; 3876 } 3877 return object[key]; 3878 } 3879 3880 function toPlainObject(value) { 3881 return copyObject(value, keysIn(value)); 3882 } 3883 3884 function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { 3885 var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue); 3886 if (stacked) { 3887 assignMergeValue(object, key, stacked); 3888 return; 3889 } 3890 var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0; 3891 var isCommon = newValue === void 0; 3892 if (isCommon) { 3893 var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue); 3894 newValue = srcValue; 3895 if (isArr || isBuff || isTyped) { 3896 if (isArray(objValue)) { 3897 newValue = objValue; 3898 } else if (isArrayLikeObject(objValue)) { 3899 newValue = copyArray(objValue); 3900 } else if (isBuff) { 3901 isCommon = false; 3902 newValue = cloneBuffer(srcValue, true); 3903 } else if (isTyped) { 3904 isCommon = false; 3905 newValue = cloneTypedArray(srcValue, true); 3906 } else { 3907 newValue = []; 3908 } 3909 } else if (isPlainObject(srcValue) || isArguments(srcValue)) { 3910 newValue = objValue; 3911 if (isArguments(objValue)) { 3912 newValue = toPlainObject(objValue); 3913 } else if (!isObject(objValue) || isFunction(objValue)) { 3914 newValue = initCloneObject(srcValue); 3915 } 3916 } else { 3917 isCommon = false; 3918 } 3919 } 3920 if (isCommon) { 3921 stack.set(srcValue, newValue); 3922 mergeFunc(newValue, srcValue, srcIndex, customizer, stack); 3923 stack["delete"](srcValue); 3924 } 3925 assignMergeValue(object, key, newValue); 3926 } 3927 3928 function baseMerge(object, source, srcIndex, customizer, stack) { 3929 if (object === source) { 3930 return; 3931 } 3932 baseFor(source, function(srcValue, key) { 3933 stack || (stack = new Stack()); 3934 if (isObject(srcValue)) { 3935 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); 3936 } else { 3937 var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0; 3938 if (newValue === void 0) { 3939 newValue = srcValue; 3940 } 3941 assignMergeValue(object, key, newValue); 3942 } 3943 }, keysIn); 3944 } 3945 3946 function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { 3947 if (isObject(objValue) && isObject(srcValue)) { 3948 stack.set(srcValue, objValue); 3949 baseMerge(objValue, srcValue, void 0, customDefaultsMerge, stack); 3950 stack["delete"](srcValue); 3951 } 3952 return objValue; 3953 } 3954 3955 var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { 3956 baseMerge(object, source, srcIndex, customizer); 3957 }); 3958 3959 var defaultsDeep = baseRest(function(args) { 3960 args.push(void 0, customDefaultsMerge); 3961 return apply(mergeWith, void 0, args); 3962 }); 3963 3964 var FUNC_ERROR_TEXT$5 = "Expected a function";
vendor: 17,483 bytes, lines 3965-4499
3965 function baseDelay(func, wait, args) { 3966 if (typeof func != "function") { 3967 throw new TypeError(FUNC_ERROR_TEXT$5); 3968 } 3969 return setTimeout(function() { 3970 func.apply(void 0, args); 3971 }, wait); 3972 } 3973 3974 var defer = baseRest(function(func, args) { 3975 return baseDelay(func, 1, args); 3976 }); 3977 3978 var delay = baseRest(function(func, wait, args) { 3979 return baseDelay(func, toNumber(wait) || 0, args); 3980 }); 3981 3982 function arrayIncludesWith(array, value, comparator) { 3983 var index = -1, length = array == null ? 0 : array.length; 3984 while (++index < length) { 3985 if (comparator(value, array[index])) { 3986 return true; 3987 } 3988 } 3989 return false; 3990 } 3991 3992 var LARGE_ARRAY_SIZE$1 = 200; 3993 function baseDifference(array, values, iteratee, comparator) { 3994 var index = -1, includes = arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length; 3995 if (!length) { 3996 return result; 3997 } 3998 if (iteratee) { 3999 values = arrayMap(values, baseUnary(iteratee)); 4000 } 4001 if (comparator) { 4002 includes = arrayIncludesWith; 4003 isCommon = false; 4004 } else if (values.length >= LARGE_ARRAY_SIZE$1) { 4005 includes = cacheHas; 4006 isCommon = false; 4007 values = new SetCache(values); 4008 } 4009 outer: 4010 while (++index < length) { 4011 var value = array[index], computed = iteratee == null ? value : iteratee(value); 4012 value = comparator || value !== 0 ? value : 0; 4013 if (isCommon && computed === computed) { 4014 var valuesIndex = valuesLength; 4015 while (valuesIndex--) { 4016 if (values[valuesIndex] === computed) { 4017 continue outer; 4018 } 4019 } 4020 result.push(value); 4021 } else if (!includes(values, computed, comparator)) { 4022 result.push(value); 4023 } 4024 } 4025 return result; 4026 } 4027 4028 var difference = baseRest(function(array, values) { 4029 return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : []; 4030 }); 4031 4032 function last(array) { 4033 var length = array == null ? 0 : array.length; 4034 return length ? array[length - 1] : void 0; 4035 } 4036 4037 var differenceBy = baseRest(function(array, values) { 4038 var iteratee = last(values); 4039 if (isArrayLikeObject(iteratee)) { 4040 iteratee = void 0; 4041 } 4042 return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), baseIteratee(iteratee)) : []; 4043 }); 4044 4045 var differenceWith = baseRest(function(array, values) { 4046 var comparator = last(values); 4047 if (isArrayLikeObject(comparator)) { 4048 comparator = void 0; 4049 } 4050 return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), void 0, comparator) : []; 4051 }); 4052 4053 var divide = createMathOperation(function(dividend, divisor) { 4054 return dividend / divisor; 4055 }, 1); 4056 4057 function drop(array, n, guard) { 4058 var length = array == null ? 0 : array.length; 4059 if (!length) { 4060 return []; 4061 } 4062 n = guard || n === void 0 ? 1 : toInteger(n); 4063 return baseSlice(array, n < 0 ? 0 : n, length); 4064 } 4065 4066 function dropRight(array, n, guard) { 4067 var length = array == null ? 0 : array.length; 4068 if (!length) { 4069 return []; 4070 } 4071 n = guard || n === void 0 ? 1 : toInteger(n); 4072 n = length - n; 4073 return baseSlice(array, 0, n < 0 ? 0 : n); 4074 } 4075 4076 function baseWhile(array, predicate, isDrop, fromRight) { 4077 var length = array.length, index = fromRight ? length : -1; 4078 while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) { 4079 } 4080 return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index); 4081 } 4082 4083 function dropRightWhile(array, predicate) { 4084 return array && array.length ? baseWhile(array, baseIteratee(predicate), true, true) : []; 4085 } 4086 4087 function dropWhile(array, predicate) { 4088 return array && array.length ? baseWhile(array, baseIteratee(predicate), true) : []; 4089 } 4090 4091 function castFunction(value) { 4092 return typeof value == "function" ? value : identity; 4093 } 4094 4095 function forEach(collection, iteratee) { 4096 var func = isArray(collection) ? arrayEach : baseEach; 4097 return func(collection, castFunction(iteratee)); 4098 } 4099 4100 function arrayEachRight(array, iteratee) { 4101 var length = array == null ? 0 : array.length; 4102 while (length--) { 4103 if (iteratee(array[length], length, array) === false) { 4104 break; 4105 } 4106 } 4107 return array; 4108 } 4109 4110 var baseForRight = createBaseFor(true); 4111 4112 function baseForOwnRight(object, iteratee) { 4113 return object && baseForRight(object, iteratee, keys); 4114 } 4115 4116 var baseEachRight = createBaseEach(baseForOwnRight, true); 4117 4118 function forEachRight(collection, iteratee) { 4119 var func = isArray(collection) ? arrayEachRight : baseEachRight; 4120 return func(collection, castFunction(iteratee)); 4121 } 4122 4123 function endsWith(string, target, position) { 4124 string = toString(string); 4125 target = baseToString(target); 4126 var length = string.length; 4127 position = position === void 0 ? length : baseClamp(toInteger(position), 0, length); 4128 var end = position; 4129 position -= target.length; 4130 return position >= 0 && string.slice(position, end) == target; 4131 } 4132 4133 function baseToPairs(object, props) { 4134 return arrayMap(props, function(key) { 4135 return [key, object[key]]; 4136 }); 4137 } 4138 4139 function setToPairs(set) { 4140 var index = -1, result = Array(set.size); 4141 set.forEach(function(value) { 4142 result[++index] = [value, value]; 4143 }); 4144 return result; 4145 } 4146 4147 var mapTag$3 = "[object Map]"; 4148 var setTag$3 = "[object Set]"; 4149 function createToPairs(keysFunc) { 4150 return function(object) { 4151 var tag = getTag$1(object); 4152 if (tag == mapTag$3) { 4153 return mapToArray(object); 4154 } 4155 if (tag == setTag$3) { 4156 return setToPairs(object); 4157 } 4158 return baseToPairs(object, keysFunc(object)); 4159 }; 4160 } 4161 4162 var toPairs = createToPairs(keys); 4163 4164 var toPairsIn = createToPairs(keysIn); 4165 4166 var htmlEscapes = { 4167 "&": "&", 4168 "<": "<", 4169 ">": ">", 4170 '"': """, 4171 "'": "'" 4172 }; 4173 var escapeHtmlChar = basePropertyOf(htmlEscapes); 4174 4175 var reUnescapedHtml = /[&<>"']/g; 4176 var reHasUnescapedHtml = RegExp(reUnescapedHtml.source); 4177 function escape(string) { 4178 string = toString(string); 4179 return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string; 4180 } 4181 4182 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; 4183 var reHasRegExpChar = RegExp(reRegExpChar.source); 4184 function escapeRegExp(string) { 4185 string = toString(string); 4186 return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string; 4187 } 4188 4189 function arrayEvery(array, predicate) { 4190 var index = -1, length = array == null ? 0 : array.length; 4191 while (++index < length) { 4192 if (!predicate(array[index], index, array)) { 4193 return false; 4194 } 4195 } 4196 return true; 4197 } 4198 4199 function baseEvery(collection, predicate) { 4200 var result = true; 4201 baseEach(collection, function(value, index, collection2) { 4202 result = !!predicate(value, index, collection2); 4203 return result; 4204 }); 4205 return result; 4206 } 4207 4208 function every(collection, predicate, guard) { 4209 var func = isArray(collection) ? arrayEvery : baseEvery; 4210 if (guard && isIterateeCall(collection, predicate, guard)) { 4211 predicate = void 0; 4212 } 4213 return func(collection, baseIteratee(predicate)); 4214 } 4215 4216 var MAX_ARRAY_LENGTH$5 = 4294967295; 4217 function toLength(value) { 4218 return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH$5) : 0; 4219 } 4220 4221 function baseFill(array, value, start, end) { 4222 var length = array.length; 4223 start = toInteger(start); 4224 if (start < 0) { 4225 start = -start > length ? 0 : length + start; 4226 } 4227 end = end === void 0 || end > length ? length : toInteger(end); 4228 if (end < 0) { 4229 end += length; 4230 } 4231 end = start > end ? 0 : toLength(end); 4232 while (start < end) { 4233 array[start++] = value; 4234 } 4235 return array; 4236 } 4237 4238 function fill(array, value, start, end) { 4239 var length = array == null ? 0 : array.length; 4240 if (!length) { 4241 return []; 4242 } 4243 if (start && typeof start != "number" && isIterateeCall(array, value, start)) { 4244 start = 0; 4245 end = length; 4246 } 4247 return baseFill(array, value, start, end); 4248 } 4249 4250 function baseFilter(collection, predicate) { 4251 var result = []; 4252 baseEach(collection, function(value, index, collection2) { 4253 if (predicate(value, index, collection2)) { 4254 result.push(value); 4255 } 4256 }); 4257 return result; 4258 } 4259 4260 function filter(collection, predicate) { 4261 var func = isArray(collection) ? arrayFilter : baseFilter; 4262 return func(collection, baseIteratee(predicate)); 4263 } 4264 4265 function createFind(findIndexFunc) { 4266 return function(collection, predicate, fromIndex) { 4267 var iterable = Object(collection); 4268 if (!isArrayLike(collection)) { 4269 var iteratee = baseIteratee(predicate); 4270 collection = keys(collection); 4271 predicate = function(key) { 4272 return iteratee(iterable[key], key, iterable); 4273 }; 4274 } 4275 var index = findIndexFunc(collection, predicate, fromIndex); 4276 return index > -1 ? iterable[iteratee ? collection[index] : index] : void 0; 4277 }; 4278 } 4279 4280 var nativeMax$a = Math.max; 4281 function findIndex(array, predicate, fromIndex) { 4282 var length = array == null ? 0 : array.length; 4283 if (!length) { 4284 return -1; 4285 } 4286 var index = fromIndex == null ? 0 : toInteger(fromIndex); 4287 if (index < 0) { 4288 index = nativeMax$a(length + index, 0); 4289 } 4290 return baseFindIndex(array, baseIteratee(predicate), index); 4291 } 4292 4293 var find = createFind(findIndex); 4294 4295 function baseFindKey(collection, predicate, eachFunc) { 4296 var result; 4297 eachFunc(collection, function(value, key, collection2) { 4298 if (predicate(value, key, collection2)) { 4299 result = key; 4300 return false; 4301 } 4302 }); 4303 return result; 4304 } 4305 4306 function findKey(object, predicate) { 4307 return baseFindKey(object, baseIteratee(predicate), baseForOwn); 4308 } 4309 4310 var nativeMax$9 = Math.max; 4311 var nativeMin$a = Math.min; 4312 function findLastIndex(array, predicate, fromIndex) { 4313 var length = array == null ? 0 : array.length; 4314 if (!length) { 4315 return -1; 4316 } 4317 var index = length - 1; 4318 if (fromIndex !== void 0) { 4319 index = toInteger(fromIndex); 4320 index = fromIndex < 0 ? nativeMax$9(length + index, 0) : nativeMin$a(index, length - 1); 4321 } 4322 return baseFindIndex(array, baseIteratee(predicate), index, true); 4323 } 4324 4325 var findLast = createFind(findLastIndex); 4326 4327 function findLastKey(object, predicate) { 4328 return baseFindKey(object, baseIteratee(predicate), baseForOwnRight); 4329 } 4330 4331 function head(array) { 4332 return array && array.length ? array[0] : void 0; 4333 } 4334 4335 function baseMap(collection, iteratee) { 4336 var index = -1, result = isArrayLike(collection) ? Array(collection.length) : []; 4337 baseEach(collection, function(value, key, collection2) { 4338 result[++index] = iteratee(value, key, collection2); 4339 }); 4340 return result; 4341 } 4342 4343 function map(collection, iteratee) { 4344 var func = isArray(collection) ? arrayMap : baseMap; 4345 return func(collection, baseIteratee(iteratee)); 4346 } 4347 4348 function flatMap(collection, iteratee) { 4349 return baseFlatten(map(collection, iteratee), 1); 4350 } 4351 4352 var INFINITY$2 = 1 / 0; 4353 function flatMapDeep(collection, iteratee) { 4354 return baseFlatten(map(collection, iteratee), INFINITY$2); 4355 } 4356 4357 function flatMapDepth(collection, iteratee, depth) { 4358 depth = depth === void 0 ? 1 : toInteger(depth); 4359 return baseFlatten(map(collection, iteratee), depth); 4360 } 4361 4362 var INFINITY$1 = 1 / 0; 4363 function flattenDeep(array) { 4364 var length = array == null ? 0 : array.length; 4365 return length ? baseFlatten(array, INFINITY$1) : []; 4366 } 4367 4368 function flattenDepth(array, depth) { 4369 var length = array == null ? 0 : array.length; 4370 if (!length) { 4371 return []; 4372 } 4373 depth = depth === void 0 ? 1 : toInteger(depth); 4374 return baseFlatten(array, depth); 4375 } 4376 4377 var WRAP_FLIP_FLAG = 512; 4378 function flip(func) { 4379 return createWrap(func, WRAP_FLIP_FLAG); 4380 } 4381 4382 var floor$1 = createRound("floor"); 4383 4384 var FUNC_ERROR_TEXT$4 = "Expected a function"; 4385 var WRAP_CURRY_FLAG = 8; 4386 var WRAP_PARTIAL_FLAG$1 = 32; 4387 var WRAP_ARY_FLAG = 128; 4388 var WRAP_REARG_FLAG$1 = 256; 4389 function createFlow(fromRight) { 4390 return flatRest(function(funcs) { 4391 var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru; 4392 if (fromRight) { 4393 funcs.reverse(); 4394 } 4395 while (index--) { 4396 var func = funcs[index]; 4397 if (typeof func != "function") { 4398 throw new TypeError(FUNC_ERROR_TEXT$4); 4399 } 4400 if (prereq && !wrapper && getFuncName(func) == "wrapper") { 4401 var wrapper = new LodashWrapper([], true); 4402 } 4403 } 4404 index = wrapper ? index : length; 4405 while (++index < length) { 4406 func = funcs[index]; 4407 var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : void 0; 4408 if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG$1 | WRAP_REARG_FLAG$1) && !data[4].length && data[9] == 1) { 4409 wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); 4410 } else { 4411 wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func); 4412 } 4413 } 4414 return function() { 4415 var args = arguments, value = args[0]; 4416 if (wrapper && args.length == 1 && isArray(value)) { 4417 return wrapper.plant(value).value(); 4418 } 4419 var index2 = 0, result = length ? funcs[index2].apply(this, args) : value; 4420 while (++index2 < length) { 4421 result = funcs[index2].call(this, result); 4422 } 4423 return result; 4424 }; 4425 }); 4426 } 4427 4428 var flow = createFlow(); 4429 4430 var flowRight = createFlow(true); 4431 4432 function forIn(object, iteratee) { 4433 return object == null ? object : baseFor(object, castFunction(iteratee), keysIn); 4434 } 4435 4436 function forInRight(object, iteratee) { 4437 return object == null ? object : baseForRight(object, castFunction(iteratee), keysIn); 4438 } 4439 4440 function forOwn(object, iteratee) { 4441 return object && baseForOwn(object, castFunction(iteratee)); 4442 } 4443 4444 function forOwnRight(object, iteratee) { 4445 return object && baseForOwnRight(object, castFunction(iteratee)); 4446 } 4447 4448 function fromPairs(pairs) { 4449 var index = -1, length = pairs == null ? 0 : pairs.length, result = {}; 4450 while (++index < length) { 4451 var pair = pairs[index]; 4452 result[pair[0]] = pair[1]; 4453 } 4454 return result; 4455 } 4456 4457 function baseFunctions(object, props) { 4458 return arrayFilter(props, function(key) { 4459 return isFunction(object[key]); 4460 }); 4461 } 4462 4463 function functions(object) { 4464 return object == null ? [] : baseFunctions(object, keys(object)); 4465 } 4466 4467 function functionsIn(object) { 4468 return object == null ? [] : baseFunctions(object, keysIn(object)); 4469 } 4470 4471 var objectProto$7 = Object.prototype; 4472 var hasOwnProperty$6 = objectProto$7.hasOwnProperty; 4473 var groupBy = createAggregator(function(result, value, key) { 4474 if (hasOwnProperty$6.call(result, key)) { 4475 result[key].push(value); 4476 } else { 4477 baseAssignValue(result, key, [value]); 4478 } 4479 }); 4480 4481 function baseGt(value, other) { 4482 return value > other; 4483 } 4484 4485 function createRelationalOperation(operator) { 4486 return function(value, other) { 4487 if (!(typeof value == "string" && typeof other == "string")) { 4488 value = toNumber(value); 4489 other = toNumber(other); 4490 } 4491 return operator(value, other); 4492 }; 4493 } 4494 4495 var gt$1 = createRelationalOperation(baseGt); 4496 4497 var gte = createRelationalOperation(function(value, other) { 4498 return value >= other; 4499 });
vendor: 4,209 bytes, lines 4500-4614
4500 4501 var objectProto$6 = Object.prototype; 4502 var hasOwnProperty$5 = objectProto$6.hasOwnProperty; 4503 function baseHas(object, key) { 4504 return object != null && hasOwnProperty$5.call(object, key); 4505 } 4506 4507 function has(object, path) { 4508 return object != null && hasPath(object, path, baseHas); 4509 } 4510 4511 var nativeMax$8 = Math.max; 4512 var nativeMin$9 = Math.min; 4513 function baseInRange(number, start, end) { 4514 return number >= nativeMin$9(start, end) && number < nativeMax$8(start, end); 4515 } 4516 4517 function inRange(number, start, end) { 4518 start = toFinite(start); 4519 if (end === void 0) { 4520 end = start; 4521 start = 0; 4522 } else { 4523 end = toFinite(end); 4524 } 4525 number = toNumber(number); 4526 return baseInRange(number, start, end); 4527 } 4528 4529 var stringTag = "[object String]"; 4530 function isString(value) { 4531 return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag; 4532 } 4533 4534 function baseValues(object, props) { 4535 return arrayMap(props, function(key) { 4536 return object[key]; 4537 }); 4538 } 4539 4540 function values(object) { 4541 return object == null ? [] : baseValues(object, keys(object)); 4542 } 4543 4544 var nativeMax$7 = Math.max; 4545 function includes(collection, value, fromIndex, guard) { 4546 collection = isArrayLike(collection) ? collection : values(collection); 4547 fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0; 4548 var length = collection.length; 4549 if (fromIndex < 0) { 4550 fromIndex = nativeMax$7(length + fromIndex, 0); 4551 } 4552 return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1; 4553 } 4554 4555 var nativeMax$6 = Math.max; 4556 function indexOf(array, value, fromIndex) { 4557 var length = array == null ? 0 : array.length; 4558 if (!length) { 4559 return -1; 4560 } 4561 var index = fromIndex == null ? 0 : toInteger(fromIndex); 4562 if (index < 0) { 4563 index = nativeMax$6(length + index, 0); 4564 } 4565 return baseIndexOf(array, value, index); 4566 } 4567 4568 function initial(array) { 4569 var length = array == null ? 0 : array.length; 4570 return length ? baseSlice(array, 0, -1) : []; 4571 } 4572 4573 var nativeMin$8 = Math.min; 4574 function baseIntersection(arrays, iteratee, comparator) { 4575 var includes = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array(othLength), maxLength = Infinity, result = []; 4576 while (othIndex--) { 4577 var array = arrays[othIndex]; 4578 if (othIndex && iteratee) { 4579 array = arrayMap(array, baseUnary(iteratee)); 4580 } 4581 maxLength = nativeMin$8(array.length, maxLength); 4582 caches[othIndex] = !comparator && (iteratee || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : void 0; 4583 } 4584 array = arrays[0]; 4585 var index = -1, seen = caches[0]; 4586 outer: 4587 while (++index < length && result.length < maxLength) { 4588 var value = array[index], computed = iteratee ? iteratee(value) : value; 4589 value = comparator || value !== 0 ? value : 0; 4590 if (!(seen ? cacheHas(seen, computed) : includes(result, computed, comparator))) { 4591 othIndex = othLength; 4592 while (--othIndex) { 4593 var cache = caches[othIndex]; 4594 if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator))) { 4595 continue outer; 4596 } 4597 } 4598 if (seen) { 4599 seen.push(computed); 4600 } 4601 result.push(value); 4602 } 4603 } 4604 return result; 4605 } 4606 4607 function castArrayLikeObject(value) { 4608 return isArrayLikeObject(value) ? value : []; 4609 } 4610 4611 var intersection = baseRest(function(arrays) { 4612 var mapped = arrayMap(arrays, castArrayLikeObject); 4613 return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : []; 4614 });
vendor: 13,278 bytes, lines 4615-5006
4615 4616 var intersectionBy = baseRest(function(arrays) { 4617 var iteratee = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject); 4618 if (iteratee === last(mapped)) { 4619 iteratee = void 0; 4620 } else { 4621 mapped.pop(); 4622 } 4623 return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, baseIteratee(iteratee)) : []; 4624 }); 4625 4626 var intersectionWith = baseRest(function(arrays) { 4627 var comparator = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject); 4628 comparator = typeof comparator == "function" ? comparator : void 0; 4629 if (comparator) { 4630 mapped.pop(); 4631 } 4632 return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, void 0, comparator) : []; 4633 }); 4634 4635 function baseInverter(object, setter, iteratee, accumulator) { 4636 baseForOwn(object, function(value, key, object2) { 4637 setter(accumulator, iteratee(value), key, object2); 4638 }); 4639 return accumulator; 4640 } 4641 4642 function createInverter(setter, toIteratee) { 4643 return function(object, iteratee) { 4644 return baseInverter(object, setter, toIteratee(iteratee), {}); 4645 }; 4646 } 4647 4648 var objectProto$5 = Object.prototype; 4649 var nativeObjectToString$1 = objectProto$5.toString; 4650 var invert = createInverter(function(result, value, key) { 4651 if (value != null && typeof value.toString != "function") { 4652 value = nativeObjectToString$1.call(value); 4653 } 4654 result[value] = key; 4655 }, constant(identity)); 4656 4657 var objectProto$4 = Object.prototype; 4658 var hasOwnProperty$4 = objectProto$4.hasOwnProperty; 4659 var nativeObjectToString = objectProto$4.toString; 4660 var invertBy = createInverter(function(result, value, key) { 4661 if (value != null && typeof value.toString != "function") { 4662 value = nativeObjectToString.call(value); 4663 } 4664 if (hasOwnProperty$4.call(result, value)) { 4665 result[value].push(key); 4666 } else { 4667 result[value] = [key]; 4668 } 4669 }, baseIteratee); 4670 4671 function parent(object, path) { 4672 return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); 4673 } 4674 4675 function baseInvoke(object, path, args) { 4676 path = castPath(path, object); 4677 object = parent(object, path); 4678 var func = object == null ? object : object[toKey(last(path))]; 4679 return func == null ? void 0 : apply(func, object, args); 4680 } 4681 4682 var invoke = baseRest(baseInvoke); 4683 4684 var invokeMap = baseRest(function(collection, path, args) { 4685 var index = -1, isFunc = typeof path == "function", result = isArrayLike(collection) ? Array(collection.length) : []; 4686 baseEach(collection, function(value) { 4687 result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); 4688 }); 4689 return result; 4690 }); 4691 4692 var arrayBufferTag = "[object ArrayBuffer]"; 4693 function baseIsArrayBuffer(value) { 4694 return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; 4695 } 4696 4697 var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer; 4698 var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; 4699 4700 var boolTag = "[object Boolean]"; 4701 function isBoolean$1(value) { 4702 return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag; 4703 } 4704 4705 var dateTag = "[object Date]"; 4706 function baseIsDate(value) { 4707 return isObjectLike(value) && baseGetTag(value) == dateTag; 4708 } 4709 4710 var nodeIsDate = nodeUtil && nodeUtil.isDate; 4711 var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; 4712 4713 function isElement$2(value) { 4714 return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value); 4715 } 4716 4717 var mapTag$2 = "[object Map]"; 4718 var setTag$2 = "[object Set]"; 4719 var objectProto$3 = Object.prototype; 4720 var hasOwnProperty$3 = objectProto$3.hasOwnProperty; 4721 function isEmpty$1(value) { 4722 if (value == null) { 4723 return true; 4724 } 4725 if (isArrayLike(value) && (isArray(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) { 4726 return !value.length; 4727 } 4728 var tag = getTag$1(value); 4729 if (tag == mapTag$2 || tag == setTag$2) { 4730 return !value.size; 4731 } 4732 if (isPrototype(value)) { 4733 return !baseKeys(value).length; 4734 } 4735 for (var key in value) { 4736 if (hasOwnProperty$3.call(value, key)) { 4737 return false; 4738 } 4739 } 4740 return true; 4741 } 4742 4743 function isEqual$1(value, other) { 4744 return baseIsEqual(value, other); 4745 } 4746 4747 function isEqualWith(value, other, customizer) { 4748 customizer = typeof customizer == "function" ? customizer : void 0; 4749 var result = customizer ? customizer(value, other) : void 0; 4750 return result === void 0 ? baseIsEqual(value, other, void 0, customizer) : !!result; 4751 } 4752 4753 var nativeIsFinite = root.isFinite; 4754 function isFinite(value) { 4755 return typeof value == "number" && nativeIsFinite(value); 4756 } 4757 4758 function isInteger(value) { 4759 return typeof value == "number" && value == toInteger(value); 4760 } 4761 4762 function isMatch(object, source) { 4763 return object === source || baseIsMatch(object, source, getMatchData(source)); 4764 } 4765 4766 function isMatchWith(object, source, customizer) { 4767 customizer = typeof customizer == "function" ? customizer : void 0; 4768 return baseIsMatch(object, source, getMatchData(source), customizer); 4769 } 4770 4771 var numberTag = "[object Number]"; 4772 function isNumber$1(value) { 4773 return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag; 4774 } 4775 4776 function isNaN$1(value) { 4777 return isNumber$1(value) && value != +value; 4778 } 4779 4780 var isMaskable = coreJsData ? isFunction : stubFalse; 4781 4782 var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill."; 4783 function isNative(value) { 4784 if (isMaskable(value)) { 4785 throw new Error(CORE_ERROR_TEXT); 4786 } 4787 return baseIsNative(value); 4788 } 4789 4790 function isNil(value) { 4791 return value == null; 4792 } 4793 4794 function isNull(value) { 4795 return value === null; 4796 } 4797 4798 var regexpTag = "[object RegExp]"; 4799 function baseIsRegExp(value) { 4800 return isObjectLike(value) && baseGetTag(value) == regexpTag; 4801 } 4802 4803 var nodeIsRegExp = nodeUtil && nodeUtil.isRegExp; 4804 var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; 4805 4806 var MAX_SAFE_INTEGER$3 = 9007199254740991; 4807 function isSafeInteger(value) { 4808 return isInteger(value) && value >= -MAX_SAFE_INTEGER$3 && value <= MAX_SAFE_INTEGER$3; 4809 } 4810 4811 function isUndefined$1(value) { 4812 return value === void 0; 4813 } 4814 4815 var weakMapTag = "[object WeakMap]"; 4816 function isWeakMap(value) { 4817 return isObjectLike(value) && getTag$1(value) == weakMapTag; 4818 } 4819 4820 var weakSetTag = "[object WeakSet]"; 4821 function isWeakSet(value) { 4822 return isObjectLike(value) && baseGetTag(value) == weakSetTag; 4823 } 4824 4825 var CLONE_DEEP_FLAG$3 = 1; 4826 function iteratee(func) { 4827 return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG$3)); 4828 } 4829 4830 var arrayProto$4 = Array.prototype; 4831 var nativeJoin = arrayProto$4.join; 4832 function join(array, separator) { 4833 return array == null ? "" : nativeJoin.call(array, separator); 4834 } 4835 4836 var kebabCase = createCompounder(function(result, word, index) { 4837 return result + (index ? "-" : "") + word.toLowerCase(); 4838 }); 4839 4840 var keyBy = createAggregator(function(result, value, key) { 4841 baseAssignValue(result, key, value); 4842 }); 4843 4844 function strictLastIndexOf(array, value, fromIndex) { 4845 var index = fromIndex + 1; 4846 while (index--) { 4847 if (array[index] === value) { 4848 return index; 4849 } 4850 } 4851 return index; 4852 } 4853 4854 var nativeMax$5 = Math.max; 4855 var nativeMin$7 = Math.min; 4856 function lastIndexOf(array, value, fromIndex) { 4857 var length = array == null ? 0 : array.length; 4858 if (!length) { 4859 return -1; 4860 } 4861 var index = length; 4862 if (fromIndex !== void 0) { 4863 index = toInteger(fromIndex); 4864 index = index < 0 ? nativeMax$5(length + index, 0) : nativeMin$7(index, length - 1); 4865 } 4866 return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true); 4867 } 4868 4869 var lowerCase = createCompounder(function(result, word, index) { 4870 return result + (index ? " " : "") + word.toLowerCase(); 4871 }); 4872 4873 var lowerFirst = createCaseFirst("toLowerCase"); 4874 4875 function baseLt(value, other) { 4876 return value < other; 4877 } 4878 4879 var lt$1 = createRelationalOperation(baseLt); 4880 4881 var lte = createRelationalOperation(function(value, other) { 4882 return value <= other; 4883 }); 4884 4885 function mapKeys(object, iteratee) { 4886 var result = {}; 4887 iteratee = baseIteratee(iteratee); 4888 baseForOwn(object, function(value, key, object2) { 4889 baseAssignValue(result, iteratee(value, key, object2), value); 4890 }); 4891 return result; 4892 } 4893 4894 function mapValues(object, iteratee) { 4895 var result = {}; 4896 iteratee = baseIteratee(iteratee); 4897 baseForOwn(object, function(value, key, object2) { 4898 baseAssignValue(result, key, iteratee(value, key, object2)); 4899 }); 4900 return result; 4901 } 4902 4903 var CLONE_DEEP_FLAG$2 = 1; 4904 function matches(source) { 4905 return baseMatches(baseClone(source, CLONE_DEEP_FLAG$2)); 4906 } 4907 4908 var CLONE_DEEP_FLAG$1 = 1; 4909 function matchesProperty(path, srcValue) { 4910 return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG$1)); 4911 } 4912 4913 function baseExtremum(array, iteratee, comparator) { 4914 var index = -1, length = array.length; 4915 while (++index < length) { 4916 var value = array[index], current = iteratee(value); 4917 if (current != null && (computed === void 0 ? current === current && !isSymbol(current) : comparator(current, computed))) { 4918 var computed = current, result = value; 4919 } 4920 } 4921 return result; 4922 } 4923 4924 function max$3(array) { 4925 return array && array.length ? baseExtremum(array, identity, baseGt) : void 0; 4926 } 4927 4928 function maxBy(array, iteratee) { 4929 return array && array.length ? baseExtremum(array, baseIteratee(iteratee), baseGt) : void 0; 4930 } 4931 4932 function baseSum(array, iteratee) { 4933 var result, index = -1, length = array.length; 4934 while (++index < length) { 4935 var current = iteratee(array[index]); 4936 if (current !== void 0) { 4937 result = result === void 0 ? current : result + current; 4938 } 4939 } 4940 return result; 4941 } 4942 4943 var NAN = 0 / 0; 4944 function baseMean(array, iteratee) { 4945 var length = array == null ? 0 : array.length; 4946 return length ? baseSum(array, iteratee) / length : NAN; 4947 } 4948 4949 function mean(array) { 4950 return baseMean(array, identity); 4951 } 4952 4953 function meanBy(array, iteratee) { 4954 return baseMean(array, baseIteratee(iteratee)); 4955 } 4956 4957 var merge = createAssigner(function(object, source, srcIndex) { 4958 baseMerge(object, source, srcIndex); 4959 }); 4960 4961 var method = baseRest(function(path, args) { 4962 return function(object) { 4963 return baseInvoke(object, path, args); 4964 }; 4965 }); 4966 4967 var methodOf = baseRest(function(object, args) { 4968 return function(path) { 4969 return baseInvoke(object, path, args); 4970 }; 4971 }); 4972 4973 function min$3(array) { 4974 return array && array.length ? baseExtremum(array, identity, baseLt) : void 0; 4975 } 4976 4977 function minBy(array, iteratee) { 4978 return array && array.length ? baseExtremum(array, baseIteratee(iteratee), baseLt) : void 0; 4979 } 4980 4981 function mixin$1(object, source, options) { 4982 var props = keys(source), methodNames = baseFunctions(source, props); 4983 var chain = !(isObject(options) && "chain" in options) || !!options.chain, isFunc = isFunction(object); 4984 arrayEach(methodNames, function(methodName) { 4985 var func = source[methodName]; 4986 object[methodName] = func; 4987 if (isFunc) { 4988 object.prototype[methodName] = function() { 4989 var chainAll = this.__chain__; 4990 if (chain || chainAll) { 4991 var result = object(this.__wrapped__), actions = result.__actions__ = copyArray(this.__actions__); 4992 actions.push({ "func": func, "args": arguments, "thisArg": object }); 4993 result.__chain__ = chainAll; 4994 return result; 4995 } 4996 return func.apply(object, arrayPush([this.value()], arguments)); 4997 }; 4998 } 4999 }); 5000 return object; 5001 } 5002 5003 var multiply = createMathOperation(function(multiplier, multiplicand) { 5004 return multiplier * multiplicand; 5005 }, 1); 5006
vendor: 5,915 bytes, lines 5007-5185
5007 var FUNC_ERROR_TEXT$3 = "Expected a function"; 5008 function negate(predicate) { 5009 if (typeof predicate != "function") { 5010 throw new TypeError(FUNC_ERROR_TEXT$3); 5011 } 5012 return function() { 5013 var args = arguments; 5014 switch (args.length) { 5015 case 0: 5016 return !predicate.call(this); 5017 case 1: 5018 return !predicate.call(this, args[0]); 5019 case 2: 5020 return !predicate.call(this, args[0], args[1]); 5021 case 3: 5022 return !predicate.call(this, args[0], args[1], args[2]); 5023 } 5024 return !predicate.apply(this, args); 5025 }; 5026 } 5027 5028 function iteratorToArray(iterator) { 5029 var data, result = []; 5030 while (!(data = iterator.next()).done) { 5031 result.push(data.value); 5032 } 5033 return result; 5034 } 5035 5036 var mapTag$1 = "[object Map]"; 5037 var setTag$1 = "[object Set]"; 5038 var symIterator$1 = Symbol$1 ? Symbol$1.iterator : void 0; 5039 function toArray(value) { 5040 if (!value) { 5041 return []; 5042 } 5043 if (isArrayLike(value)) { 5044 return isString(value) ? stringToArray(value) : copyArray(value); 5045 } 5046 if (symIterator$1 && value[symIterator$1]) { 5047 return iteratorToArray(value[symIterator$1]()); 5048 } 5049 var tag = getTag$1(value), func = tag == mapTag$1 ? mapToArray : tag == setTag$1 ? setToArray : values; 5050 return func(value); 5051 } 5052 5053 function wrapperNext() { 5054 if (this.__values__ === void 0) { 5055 this.__values__ = toArray(this.value()); 5056 } 5057 var done = this.__index__ >= this.__values__.length, value = done ? void 0 : this.__values__[this.__index__++]; 5058 return { "done": done, "value": value }; 5059 } 5060 5061 function baseNth(array, n) { 5062 var length = array.length; 5063 if (!length) { 5064 return; 5065 } 5066 n += n < 0 ? length : 0; 5067 return isIndex(n, length) ? array[n] : void 0; 5068 } 5069 5070 function nth(array, n) { 5071 return array && array.length ? baseNth(array, toInteger(n)) : void 0; 5072 } 5073 5074 function nthArg(n) { 5075 n = toInteger(n); 5076 return baseRest(function(args) { 5077 return baseNth(args, n); 5078 }); 5079 } 5080 5081 function baseUnset(object, path) { 5082 path = castPath(path, object); 5083 object = parent(object, path); 5084 return object == null || delete object[toKey(last(path))]; 5085 } 5086 5087 function customOmitClone(value) { 5088 return isPlainObject(value) ? void 0 : value; 5089 } 5090 5091 var CLONE_DEEP_FLAG = 1; 5092 var CLONE_FLAT_FLAG = 2; 5093 var CLONE_SYMBOLS_FLAG = 4; 5094 var omit = flatRest(function(object, paths) { 5095 var result = {}; 5096 if (object == null) { 5097 return result; 5098 } 5099 var isDeep = false; 5100 paths = arrayMap(paths, function(path) { 5101 path = castPath(path, object); 5102 isDeep || (isDeep = path.length > 1); 5103 return path; 5104 }); 5105 copyObject(object, getAllKeysIn(object), result); 5106 if (isDeep) { 5107 result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); 5108 } 5109 var length = paths.length; 5110 while (length--) { 5111 baseUnset(result, paths[length]); 5112 } 5113 return result; 5114 }); 5115 5116 function baseSet(object, path, value, customizer) { 5117 if (!isObject(object)) { 5118 return object; 5119 } 5120 path = castPath(path, object); 5121 var index = -1, length = path.length, lastIndex = length - 1, nested = object; 5122 while (nested != null && ++index < length) { 5123 var key = toKey(path[index]), newValue = value; 5124 if (key === "__proto__" || key === "constructor" || key === "prototype") { 5125 return object; 5126 } 5127 if (index != lastIndex) { 5128 var objValue = nested[key]; 5129 newValue = customizer ? customizer(objValue, key, nested) : void 0; 5130 if (newValue === void 0) { 5131 newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {}; 5132 } 5133 } 5134 assignValue(nested, key, newValue); 5135 nested = nested[key]; 5136 } 5137 return object; 5138 } 5139 5140 function basePickBy(object, paths, predicate) { 5141 var index = -1, length = paths.length, result = {}; 5142 while (++index < length) { 5143 var path = paths[index], value = baseGet(object, path); 5144 if (predicate(value, path)) { 5145 baseSet(result, castPath(path, object), value); 5146 } 5147 } 5148 return result; 5149 } 5150 5151 function pickBy(object, predicate) { 5152 if (object == null) { 5153 return {}; 5154 } 5155 var props = arrayMap(getAllKeysIn(object), function(prop) { 5156 return [prop]; 5157 }); 5158 predicate = baseIteratee(predicate); 5159 return basePickBy(object, props, function(value, path) { 5160 return predicate(value, path[0]); 5161 }); 5162 } 5163 5164 function omitBy(object, predicate) { 5165 return pickBy(object, negate(baseIteratee(predicate))); 5166 } 5167 5168 function once(func) { 5169 return before(2, func); 5170 } 5171 5172 function baseSortBy(array, comparer) { 5173 var length = array.length; 5174 array.sort(comparer); 5175 while (length--) { 5176 array[length] = array[length].value; 5177 } 5178 return array; 5179 } 5180 5181 function compareAscending(value, other) { 5182 if (value !== other) { 5183 var valIsDefined = value !== void 0, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value); 5184 var othIsDefined = other !== void 0, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other); 5185 if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDef
vendor: 4,175 bytes, lines 5185-5306
5185ined && othIsReflexive || !valIsReflexive) { 5186 return 1; 5187 } 5188 if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) { 5189 return -1; 5190 } 5191 } 5192 return 0; 5193 } 5194 5195 function compareMultiple(object, other, orders) { 5196 var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length; 5197 while (++index < length) { 5198 var result = compareAscending(objCriteria[index], othCriteria[index]); 5199 if (result) { 5200 if (index >= ordersLength) { 5201 return result; 5202 } 5203 var order = orders[index]; 5204 return result * (order == "desc" ? -1 : 1); 5205 } 5206 } 5207 return object.index - other.index; 5208 } 5209 5210 function baseOrderBy(collection, iteratees, orders) { 5211 if (iteratees.length) { 5212 iteratees = arrayMap(iteratees, function(iteratee) { 5213 if (isArray(iteratee)) { 5214 return function(value) { 5215 return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee); 5216 }; 5217 } 5218 return iteratee; 5219 }); 5220 } else { 5221 iteratees = [identity]; 5222 } 5223 var index = -1; 5224 iteratees = arrayMap(iteratees, baseUnary(baseIteratee)); 5225 var result = baseMap(collection, function(value, key, collection2) { 5226 var criteria = arrayMap(iteratees, function(iteratee) { 5227 return iteratee(value); 5228 }); 5229 return { "criteria": criteria, "index": ++index, "value": value }; 5230 }); 5231 return baseSortBy(result, function(object, other) { 5232 return compareMultiple(object, other, orders); 5233 }); 5234 } 5235 5236 function orderBy$1(collection, iteratees, orders, guard) { 5237 if (collection == null) { 5238 return []; 5239 } 5240 if (!isArray(iteratees)) { 5241 iteratees = iteratees == null ? [] : [iteratees]; 5242 } 5243 orders = guard ? void 0 : orders; 5244 if (!isArray(orders)) { 5245 orders = orders == null ? [] : [orders]; 5246 } 5247 return baseOrderBy(collection, iteratees, orders); 5248 } 5249 5250 function createOver(arrayFunc) { 5251 return flatRest(function(iteratees) { 5252 iteratees = arrayMap(iteratees, baseUnary(baseIteratee)); 5253 return baseRest(function(args) { 5254 var thisArg = this; 5255 return arrayFunc(iteratees, function(iteratee) { 5256 return apply(iteratee, thisArg, args); 5257 }); 5258 }); 5259 }); 5260 } 5261 5262 var over = createOver(arrayMap); 5263 5264 var castRest = baseRest; 5265 5266 var nativeMin$6 = Math.min; 5267 var overArgs = castRest(function(func, transforms) { 5268 transforms = transforms.length == 1 && isArray(transforms[0]) ? arrayMap(transforms[0], baseUnary(baseIteratee)) : arrayMap(baseFlatten(transforms, 1), baseUnary(baseIteratee)); 5269 var funcsLength = transforms.length; 5270 return baseRest(function(args) { 5271 var index = -1, length = nativeMin$6(args.length, funcsLength); 5272 while (++index < length) { 5273 args[index] = transforms[index].call(this, args[index]); 5274 } 5275 return apply(func, this, args); 5276 }); 5277 }); 5278 5279 var overEvery = createOver(arrayEvery); 5280 5281 var overSome = createOver(arraySome); 5282 5283 var MAX_SAFE_INTEGER$2 = 9007199254740991; 5284 var nativeFloor$3 = Math.floor; 5285 function baseRepeat(string, n) { 5286 var result = ""; 5287 if (!string || n < 1 || n > MAX_SAFE_INTEGER$2) { 5288 return result; 5289 } 5290 do { 5291 if (n % 2) { 5292 result += string; 5293 } 5294 n = nativeFloor$3(n / 2); 5295 if (n) { 5296 string += string; 5297 } 5298 } while (n); 5299 return result; 5300 } 5301 5302 var asciiSize = baseProperty("length"); 5303 5304 var rsAstralRange = "\\ud800-\\udfff"; 5305 var rsComboMarksRange = "\\u0300-\\u036f"; 5306 var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
5307 var rsComboSymbolsRange = "\\u20d0-\\u20ff"; 5308 var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange; 5309 var rsVarRange = "\\ufe0e\\ufe0f"; 5310 var rsAstral = "[" + rsAstralRange + "]"; 5311 var rsCombo = "[" + rsComboRange + "]"; 5312 var rsFitz = "\\ud83c[\\udffb-\\udfff]"; 5313 var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")"; 5314 var rsNonAstral = "[^" + rsAstralRange + "]"; 5315 var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}"; 5316 var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]"; 5317 var rsZWJ = "\\u200d"; 5318 var reOptMod = rsModifier + "?"; 5319 var rsOptVar = "[" + rsVarRange + "]?"; 5320 var rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*"; 5321 var rsSeq = rsOptVar + reOptMod + rsOptJoin; 5322 var rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")"; 5323 var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g"); 5324 function unicodeSize(string) { 5325 var result = reUnicode.lastIndex = 0; 5326 while (reUnicode.test(string)) { 5327 ++result; 5328 } 5329 return result; 5330 } 5331 5332 function stringSize(string) { 5333 return hasUnicode(string) ? unicodeSize(string) : asciiSize(string); 5334 } 5335 5336 var nativeCeil$2 = Math.ceil; 5337 function createPadding(length, chars) { 5338 chars = chars === void 0 ? " " : baseToString(chars); 5339 var charsLength = chars.length; 5340 if (charsLength < 2) { 5341 return charsLength ? baseRepeat(chars, length) : chars; 5342 } 5343 var result = baseRepeat(chars, nativeCeil$2(length / stringSize(chars))); 5344 return hasUnicode(chars) ? castSlice(stringToArray(result), 0, length).join("") : result.slice(0, length); 5345 } 5346 5347 var nativeCeil$1 = Math.ceil; 5348 var nativeFloor$2 = Math.floor; 5349 function pad(string, length, chars) { 5350 string = toString(string); 5351 length = toInteger(length); 5352 var strLength = length ? stringSize(string) : 0; 5353 if (!length || strLength >= length) { 5354 return string; 5355 } 5356 var mid = (length - strLength) / 2; 5357 return createPadding(nativeFloor$2(mid), chars) + string + createPadding(nativeCeil$1(mid), chars); 5358 } 5359 5360 function padEnd(string, length, chars) { 5361 string = toString(string); 5362 length = toInteger(length); 5363 var strLength = length ? stringSize(string) : 0; 5364 return length && strLength < length ? string + createPadding(length - strLength, chars) : string; 5365 } 5366 5367 function padStart(string, length, chars) { 5368 string = toString(string); 5369 length = toInteger(length); 5370 var strLength = length ? stringSize(string) : 0; 5371 return length && strLength < length ? createPadding(length - strLength, chars) + string : string; 5372 } 5373 5374 var reTrimStart$1 = /^\s+/; 5375 var nativeParseInt = root.parseInt; 5376 function parseInt$1(string, radix, guard) { 5377 if (guard || radix == null) { 5378 radix = 0; 5379 } else if (radix) { 5380 radix = +radix; 5381 } 5382 return nativeParseInt(toString(string).replace(reTrimStart$1, ""), radix || 0); 5383 } 5384 5385 var WRAP_PARTIAL_FLAG = 32; 5386 var partial = baseRest(function(func, partials) { 5387 var holders = replaceHolders(partials, getHolder(partial)); 5388 return createWrap(func, WRAP_PARTIAL_FLAG, void 0, partials, holders); 5389 }); 5390 partial.placeholder = {}; 5391 5392 var WRAP_PARTIAL_RIGHT_FLAG = 64; 5393 var partialRight = baseRest(function(func, partials) { 5394 var holders = replaceHolders(partials, getHolder(partialRight)); 5395 return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, void 0, partials, holders); 5396 }); 5397 partialRight.placeholder = {}; 5398 5399 var partition = createAggregator(function(result, value, key) { 5400 result[key ? 0 : 1].push(value); 5401 }, function() { 5402 return [[], []]; 5403 }); 5404 5405 function basePick(object, paths) { 5406 return basePickBy(object, paths, function(value, path) { 5407 return hasIn(object, path); 5408 }); 5409 } 5410 5411 var pick = flatRest(function(object, paths) { 5412 return object == null ? {} : basePick(object, paths); 5413 });
vendor: 12,331 bytes, lines 5414-5794
5414 5415 function wrapperPlant(value) { 5416 var result, parent = this; 5417 while (parent instanceof baseLodash) { 5418 var clone = wrapperClone(parent); 5419 clone.__index__ = 0; 5420 clone.__values__ = void 0; 5421 if (result) { 5422 previous.__wrapped__ = clone; 5423 } else { 5424 result = clone; 5425 } 5426 var previous = clone; 5427 parent = parent.__wrapped__; 5428 } 5429 previous.__wrapped__ = value; 5430 return result; 5431 } 5432 5433 function propertyOf(object) { 5434 return function(path) { 5435 return object == null ? void 0 : baseGet(object, path); 5436 }; 5437 } 5438 5439 function baseIndexOfWith(array, value, fromIndex, comparator) { 5440 var index = fromIndex - 1, length = array.length; 5441 while (++index < length) { 5442 if (comparator(array[index], value)) { 5443 return index; 5444 } 5445 } 5446 return -1; 5447 } 5448 5449 var arrayProto$3 = Array.prototype; 5450 var splice$1 = arrayProto$3.splice; 5451 function basePullAll(array, values, iteratee, comparator) { 5452 var indexOf = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values.length, seen = array; 5453 if (array === values) { 5454 values = copyArray(values); 5455 } 5456 if (iteratee) { 5457 seen = arrayMap(array, baseUnary(iteratee)); 5458 } 5459 while (++index < length) { 5460 var fromIndex = 0, value = values[index], computed = iteratee ? iteratee(value) : value; 5461 while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) { 5462 if (seen !== array) { 5463 splice$1.call(seen, fromIndex, 1); 5464 } 5465 splice$1.call(array, fromIndex, 1); 5466 } 5467 } 5468 return array; 5469 } 5470 5471 function pullAll(array, values) { 5472 return array && array.length && values && values.length ? basePullAll(array, values) : array; 5473 } 5474 5475 var pull = baseRest(pullAll); 5476 5477 function pullAllBy(array, values, iteratee) { 5478 return array && array.length && values && values.length ? basePullAll(array, values, baseIteratee(iteratee)) : array; 5479 } 5480 5481 function pullAllWith(array, values, comparator) { 5482 return array && array.length && values && values.length ? basePullAll(array, values, void 0, comparator) : array; 5483 } 5484 5485 var arrayProto$2 = Array.prototype; 5486 var splice = arrayProto$2.splice; 5487 function basePullAt(array, indexes) { 5488 var length = array ? indexes.length : 0, lastIndex = length - 1; 5489 while (length--) { 5490 var index = indexes[length]; 5491 if (length == lastIndex || index !== previous) { 5492 var previous = index; 5493 if (isIndex(index)) { 5494 splice.call(array, index, 1); 5495 } else { 5496 baseUnset(array, index); 5497 } 5498 } 5499 } 5500 return array; 5501 } 5502 5503 var pullAt = flatRest(function(array, indexes) { 5504 var length = array == null ? 0 : array.length, result = baseAt(array, indexes); 5505 basePullAt(array, arrayMap(indexes, function(index) { 5506 return isIndex(index, length) ? +index : index; 5507 }).sort(compareAscending)); 5508 return result; 5509 }); 5510 5511 var nativeFloor$1 = Math.floor; 5512 var nativeRandom$1 = Math.random; 5513 function baseRandom(lower, upper) { 5514 return lower + nativeFloor$1(nativeRandom$1() * (upper - lower + 1)); 5515 } 5516 5517 var freeParseFloat = parseFloat; 5518 var nativeMin$5 = Math.min; 5519 var nativeRandom = Math.random; 5520 function random(lower, upper, floating) { 5521 if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) { 5522 upper = floating = void 0; 5523 } 5524 if (floating === void 0) { 5525 if (typeof upper == "boolean") { 5526 floating = upper; 5527 upper = void 0; 5528 } else if (typeof lower == "boolean") { 5529 floating = lower; 5530 lower = void 0; 5531 } 5532 } 5533 if (lower === void 0 && upper === void 0) { 5534 lower = 0; 5535 upper = 1; 5536 } else { 5537 lower = toFinite(lower); 5538 if (upper === void 0) { 5539 upper = lower; 5540 lower = 0; 5541 } else { 5542 upper = toFinite(upper); 5543 } 5544 } 5545 if (lower > upper) { 5546 var temp = lower; 5547 lower = upper; 5548 upper = temp; 5549 } 5550 if (floating || lower % 1 || upper % 1) { 5551 var rand = nativeRandom(); 5552 return nativeMin$5(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper); 5553 } 5554 return baseRandom(lower, upper); 5555 } 5556 5557 var nativeCeil = Math.ceil; 5558 var nativeMax$4 = Math.max; 5559 function baseRange(start, end, step, fromRight) { 5560 var index = -1, length = nativeMax$4(nativeCeil((end - start) / (step || 1)), 0), result = Array(length); 5561 while (length--) { 5562 result[fromRight ? length : ++index] = start; 5563 start += step; 5564 } 5565 return result; 5566 } 5567 5568 function createRange(fromRight) { 5569 return function(start, end, step) { 5570 if (step && typeof step != "number" && isIterateeCall(start, end, step)) { 5571 end = step = void 0; 5572 } 5573 start = toFinite(start); 5574 if (end === void 0) { 5575 end = start; 5576 start = 0; 5577 } else { 5578 end = toFinite(end); 5579 } 5580 step = step === void 0 ? start < end ? 1 : -1 : toFinite(step); 5581 return baseRange(start, end, step, fromRight); 5582 }; 5583 } 5584 5585 var range$1 = createRange(); 5586 5587 var rangeRight = createRange(true); 5588 5589 var WRAP_REARG_FLAG = 256; 5590 var rearg = flatRest(function(func, indexes) { 5591 return createWrap(func, WRAP_REARG_FLAG, void 0, void 0, void 0, indexes); 5592 }); 5593 5594 function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { 5595 eachFunc(collection, function(value, index, collection2) { 5596 accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2); 5597 }); 5598 return accumulator; 5599 } 5600 5601 function reduce(collection, iteratee, accumulator) { 5602 var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3; 5603 return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEach); 5604 } 5605 5606 function arrayReduceRight(array, iteratee, accumulator, initAccum) { 5607 var length = array == null ? 0 : array.length; 5608 if (initAccum && length) { 5609 accumulator = array[--length]; 5610 } 5611 while (length--) { 5612 accumulator = iteratee(accumulator, array[length], length, array); 5613 } 5614 return accumulator; 5615 } 5616 5617 function reduceRight(collection, iteratee, accumulator) { 5618 var func = isArray(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3; 5619 return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEachRight); 5620 } 5621 5622 function reject(collection, predicate) { 5623 var func = isArray(collection) ? arrayFilter : baseFilter; 5624 return func(collection, negate(baseIteratee(predicate))); 5625 } 5626 5627 function remove(array, predicate) { 5628 var result = []; 5629 if (!(array && array.length)) { 5630 return result; 5631 } 5632 var index = -1, indexes = [], length = array.length; 5633 predicate = baseIteratee(predicate); 5634 while (++index < length) { 5635 var value = array[index]; 5636 if (predicate(value, index, array)) { 5637 result.push(value); 5638 indexes.push(index); 5639 } 5640 } 5641 basePullAt(array, indexes); 5642 return result; 5643 } 5644 5645 function repeat(string, n, guard) { 5646 if (guard ? isIterateeCall(string, n, guard) : n === void 0) { 5647 n = 1; 5648 } else { 5649 n = toInteger(n); 5650 } 5651 return baseRepeat(toString(string), n); 5652 } 5653 5654 function replace() { 5655 var args = arguments, string = toString(args[0]); 5656 return args.length < 3 ? string : string.replace(args[1], args[2]); 5657 } 5658 5659 var FUNC_ERROR_TEXT$2 = "Expected a function"; 5660 function rest(func, start) { 5661 if (typeof func != "function") { 5662 throw new TypeError(FUNC_ERROR_TEXT$2); 5663 } 5664 start = start === void 0 ? start : toInteger(start); 5665 return baseRest(func, start); 5666 } 5667 5668 function result(object, path, defaultValue) { 5669 path = castPath(path, object); 5670 var index = -1, length = path.length; 5671 if (!length) { 5672 length = 1; 5673 object = void 0; 5674 } 5675 while (++index < length) { 5676 var value = object == null ? void 0 : object[toKey(path[index])]; 5677 if (value === void 0) { 5678 index = length; 5679 value = defaultValue; 5680 } 5681 object = isFunction(value) ? value.call(object) : value; 5682 } 5683 return object; 5684 } 5685 5686 var arrayProto$1 = Array.prototype; 5687 var nativeReverse = arrayProto$1.reverse; 5688 function reverse(array) { 5689 return array == null ? array : nativeReverse.call(array); 5690 } 5691 5692 var round$1 = createRound("round"); 5693 5694 function arraySample(array) { 5695 var length = array.length; 5696 return length ? array[baseRandom(0, length - 1)] : void 0; 5697 } 5698 5699 function baseSample(collection) { 5700 return arraySample(values(collection)); 5701 } 5702 5703 function sample(collection) { 5704 var func = isArray(collection) ? arraySample : baseSample; 5705 return func(collection); 5706 } 5707 5708 function shuffleSelf(array, size) { 5709 var index = -1, length = array.length, lastIndex = length - 1; 5710 size = size === void 0 ? length : size; 5711 while (++index < size) { 5712 var rand = baseRandom(index, lastIndex), value = array[rand]; 5713 array[rand] = array[index]; 5714 array[index] = value; 5715 } 5716 array.length = size; 5717 return array; 5718 } 5719 5720 function arraySampleSize(array, n) { 5721 return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); 5722 } 5723 5724 function baseSampleSize(collection, n) { 5725 var array = values(collection); 5726 return shuffleSelf(array, baseClamp(n, 0, array.length)); 5727 } 5728 5729 function sampleSize(collection, n, guard) { 5730 if (guard ? isIterateeCall(collection, n, guard) : n === void 0) { 5731 n = 1; 5732 } else { 5733 n = toInteger(n); 5734 } 5735 var func = isArray(collection) ? arraySampleSize : baseSampleSize; 5736 return func(collection, n); 5737 } 5738 5739 function set(object, path, value) { 5740 return object == null ? object : baseSet(object, path, value); 5741 } 5742 5743 function setWith(object, path, value, customizer) { 5744 customizer = typeof customizer == "function" ? customizer : void 0; 5745 return object == null ? object : baseSet(object, path, value, customizer); 5746 } 5747 5748 function arrayShuffle(array) { 5749 return shuffleSelf(copyArray(array)); 5750 } 5751 5752 function baseShuffle(collection) { 5753 return shuffleSelf(values(collection)); 5754 } 5755 5756 function shuffle(collection) { 5757 var func = isArray(collection) ? arrayShuffle : baseShuffle; 5758 return func(collection); 5759 } 5760 5761 var mapTag = "[object Map]"; 5762 var setTag = "[object Set]"; 5763 function size(collection) { 5764 if (collection == null) { 5765 return 0; 5766 } 5767 if (isArrayLike(collection)) { 5768 return isString(collection) ? stringSize(collection) : collection.length; 5769 } 5770 var tag = getTag$1(collection); 5771 if (tag == mapTag || tag == setTag) { 5772 return collection.size; 5773 } 5774 return baseKeys(collection).length; 5775 } 5776 5777 function slice(array, start, end) { 5778 var length = array == null ? 0 : array.length; 5779 if (!length) { 5780 return []; 5781 } 5782 if (end && typeof end != "number" && isIterateeCall(array, start, end)) { 5783 start = 0; 5784 end = length; 5785 } else { 5786 start = start == null ? 0 : toInteger(start); 5787 end = end === void 0 ? length : toInteger(end); 5788 } 5789 return baseSlice(array, start, end); 5790 } 5791 5792 var snakeCase = createCompounder(function(result, word, index) { 5793 return result + (index ? "_" : "") + word.toLowerCase(); 5794 });
vendor: 5,428 bytes, lines 5795-5945
5795 5796 function baseSome(collection, predicate) { 5797 var result; 5798 baseEach(collection, function(value, index, collection2) { 5799 result = predicate(value, index, collection2); 5800 return !result; 5801 }); 5802 return !!result; 5803 } 5804 5805 function some(collection, predicate, guard) { 5806 var func = isArray(collection) ? arraySome : baseSome; 5807 if (guard && isIterateeCall(collection, predicate, guard)) { 5808 predicate = void 0; 5809 } 5810 return func(collection, baseIteratee(predicate)); 5811 } 5812 5813 var sortBy = baseRest(function(collection, iteratees) { 5814 if (collection == null) { 5815 return []; 5816 } 5817 var length = iteratees.length; 5818 if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { 5819 iteratees = []; 5820 } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { 5821 iteratees = [iteratees[0]]; 5822 } 5823 return baseOrderBy(collection, baseFlatten(iteratees, 1), []); 5824 }); 5825 5826 var MAX_ARRAY_LENGTH$4 = 4294967295; 5827 var MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH$4 - 1; 5828 var nativeFloor = Math.floor; 5829 var nativeMin$4 = Math.min; 5830 function baseSortedIndexBy(array, value, iteratee, retHighest) { 5831 var low = 0, high = array == null ? 0 : array.length; 5832 if (high === 0) { 5833 return 0; 5834 } 5835 value = iteratee(value); 5836 var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === void 0; 5837 while (low < high) { 5838 var mid = nativeFloor((low + high) / 2), computed = iteratee(array[mid]), othIsDefined = computed !== void 0, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol(computed); 5839 if (valIsNaN) { 5840 var setLow = retHighest || othIsReflexive; 5841 } else if (valIsUndefined) { 5842 setLow = othIsReflexive && (retHighest || othIsDefined); 5843 } else if (valIsNull) { 5844 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); 5845 } else if (valIsSymbol) { 5846 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); 5847 } else if (othIsNull || othIsSymbol) { 5848 setLow = false; 5849 } else { 5850 setLow = retHighest ? computed <= value : computed < value; 5851 } 5852 if (setLow) { 5853 low = mid + 1; 5854 } else { 5855 high = mid; 5856 } 5857 } 5858 return nativeMin$4(high, MAX_ARRAY_INDEX); 5859 } 5860 5861 var MAX_ARRAY_LENGTH$3 = 4294967295; 5862 var HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH$3 >>> 1; 5863 function baseSortedIndex(array, value, retHighest) { 5864 var low = 0, high = array == null ? low : array.length; 5865 if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) { 5866 while (low < high) { 5867 var mid = low + high >>> 1, computed = array[mid]; 5868 if (computed !== null && !isSymbol(computed) && (retHighest ? computed <= value : computed < value)) { 5869 low = mid + 1; 5870 } else { 5871 high = mid; 5872 } 5873 } 5874 return high; 5875 } 5876 return baseSortedIndexBy(array, value, identity, retHighest); 5877 } 5878 5879 function sortedIndex(array, value) { 5880 return baseSortedIndex(array, value); 5881 } 5882 5883 function sortedIndexBy(array, value, iteratee) { 5884 return baseSortedIndexBy(array, value, baseIteratee(iteratee)); 5885 } 5886 5887 function sortedIndexOf(array, value) { 5888 var length = array == null ? 0 : array.length; 5889 if (length) { 5890 var index = baseSortedIndex(array, value); 5891 if (index < length && eq(array[index], value)) { 5892 return index; 5893 } 5894 } 5895 return -1; 5896 } 5897 5898 function sortedLastIndex(array, value) { 5899 return baseSortedIndex(array, value, true); 5900 } 5901 5902 function sortedLastIndexBy(array, value, iteratee) { 5903 return baseSortedIndexBy(array, value, baseIteratee(iteratee), true); 5904 } 5905 5906 function sortedLastIndexOf(array, value) { 5907 var length = array == null ? 0 : array.length; 5908 if (length) { 5909 var index = baseSortedIndex(array, value, true) - 1; 5910 if (eq(array[index], value)) { 5911 return index; 5912 } 5913 } 5914 return -1; 5915 } 5916 5917 function baseSortedUniq(array, iteratee) { 5918 var index = -1, length = array.length, resIndex = 0, result = []; 5919 while (++index < length) { 5920 var value = array[index], computed = iteratee ? iteratee(value) : value; 5921 if (!index || !eq(computed, seen)) { 5922 var seen = computed; 5923 result[resIndex++] = value === 0 ? 0 : value; 5924 } 5925 } 5926 return result; 5927 } 5928 5929 function sortedUniq(array) { 5930 return array && array.length ? baseSortedUniq(array) : []; 5931 } 5932 5933 function sortedUniqBy(array, iteratee) { 5934 return array && array.length ? baseSortedUniq(array, baseIteratee(iteratee)) : []; 5935 } 5936 5937 var MAX_ARRAY_LENGTH$2 = 4294967295; 5938 function split(string, separator, limit) { 5939 if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) { 5940 separator = limit = void 0; 5941 } 5942 limit = limit === void 0 ? MAX_ARRAY_LENGTH$2 : limit >>> 0; 5943 if (!limit) { 5944 return []; 5945 }
vendor: 14,577 bytes, lines 5946-6350
5946 string = toString(string); 5947 if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) { 5948 separator = baseToString(separator); 5949 if (!separator && hasUnicode(string)) { 5950 return castSlice(stringToArray(string), 0, limit); 5951 } 5952 } 5953 return string.split(separator, limit); 5954 } 5955 5956 var FUNC_ERROR_TEXT$1 = "Expected a function"; 5957 var nativeMax$3 = Math.max; 5958 function spread(func, start) { 5959 if (typeof func != "function") { 5960 throw new TypeError(FUNC_ERROR_TEXT$1); 5961 } 5962 start = start == null ? 0 : nativeMax$3(toInteger(start), 0); 5963 return baseRest(function(args) { 5964 var array = args[start], otherArgs = castSlice(args, 0, start); 5965 if (array) { 5966 arrayPush(otherArgs, array); 5967 } 5968 return apply(func, this, otherArgs); 5969 }); 5970 } 5971 5972 var startCase = createCompounder(function(result, word, index) { 5973 return result + (index ? " " : "") + upperFirst(word); 5974 }); 5975 5976 function startsWith(string, target, position) { 5977 string = toString(string); 5978 position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length); 5979 target = baseToString(target); 5980 return string.slice(position, position + target.length) == target; 5981 } 5982 5983 function stubObject() { 5984 return {}; 5985 } 5986 5987 function stubString() { 5988 return ""; 5989 } 5990 5991 function stubTrue() { 5992 return true; 5993 } 5994 5995 var subtract = createMathOperation(function(minuend, subtrahend) { 5996 return minuend - subtrahend; 5997 }, 0); 5998 5999 function sum$1(array) { 6000 return array && array.length ? baseSum(array, identity) : 0; 6001 } 6002 6003 function sumBy(array, iteratee) { 6004 return array && array.length ? baseSum(array, baseIteratee(iteratee)) : 0; 6005 } 6006 6007 function tail(array) { 6008 var length = array == null ? 0 : array.length; 6009 return length ? baseSlice(array, 1, length) : []; 6010 } 6011 6012 function take(array, n, guard) { 6013 if (!(array && array.length)) { 6014 return []; 6015 } 6016 n = guard || n === void 0 ? 1 : toInteger(n); 6017 return baseSlice(array, 0, n < 0 ? 0 : n); 6018 } 6019 6020 function takeRight(array, n, guard) { 6021 var length = array == null ? 0 : array.length; 6022 if (!length) { 6023 return []; 6024 } 6025 n = guard || n === void 0 ? 1 : toInteger(n); 6026 n = length - n; 6027 return baseSlice(array, n < 0 ? 0 : n, length); 6028 } 6029 6030 function takeRightWhile(array, predicate) { 6031 return array && array.length ? baseWhile(array, baseIteratee(predicate), false, true) : []; 6032 } 6033 6034 function takeWhile(array, predicate) { 6035 return array && array.length ? baseWhile(array, baseIteratee(predicate)) : []; 6036 } 6037 6038 function tap(value, interceptor) { 6039 interceptor(value); 6040 return value; 6041 } 6042 6043 var objectProto$2 = Object.prototype; 6044 var hasOwnProperty$2 = objectProto$2.hasOwnProperty; 6045 function customDefaultsAssignIn(objValue, srcValue, key, object) { 6046 if (objValue === void 0 || eq(objValue, objectProto$2[key]) && !hasOwnProperty$2.call(object, key)) { 6047 return srcValue; 6048 } 6049 return objValue; 6050 } 6051 6052 var stringEscapes = { 6053 "\\": "\\", 6054 "'": "'", 6055 "\n": "n", 6056 "\r": "r", 6057 "\u2028": "u2028", 6058 "\u2029": "u2029" 6059 }; 6060 function escapeStringChar(chr) { 6061 return "\\" + stringEscapes[chr]; 6062 } 6063 6064 var reInterpolate = /<%=([\s\S]+?)%>/g; 6065 6066 var reEscape = /<%-([\s\S]+?)%>/g; 6067 6068 var reEvaluate = /<%([\s\S]+?)%>/g; 6069 6070 var templateSettings = { 6071 "escape": reEscape, 6072 "evaluate": reEvaluate, 6073 "interpolate": reInterpolate, 6074 "variable": "", 6075 "imports": { 6076 "_": { "escape": escape } 6077 } 6078 }; 6079 6080 var INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`"; 6081 var reEmptyStringLeading = /\b__p \+= '';/g; 6082 var reEmptyStringMiddle = /\b(__p \+=) '' \+/g; 6083 var reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; 6084 var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; 6085 var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; 6086 var reNoMatch = /($^)/; 6087 var reUnescapedString = /['\n\r\u2028\u2029\\]/g; 6088 var objectProto$1 = Object.prototype; 6089 var hasOwnProperty$1 = objectProto$1.hasOwnProperty; 6090 function template(string, options, guard) { 6091 var settings = templateSettings.imports._.templateSettings || templateSettings; 6092 if (guard && isIterateeCall(string, options, guard)) { 6093 options = void 0; 6094 } 6095 string = toString(string); 6096 options = assignInWith({}, options, settings, customDefaultsAssignIn); 6097 var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys); 6098 var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '"; 6099 var reDelimiters = RegExp((options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g"); 6100 var sourceURL = hasOwnProperty$1.call(options, "sourceURL") ? "//# sourceURL=" + (options.sourceURL + "").replace(/\s/g, " ") + "\n" : ""; 6101 string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { 6102 interpolateValue || (interpolateValue = esTemplateValue); 6103 source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar); 6104 if (escapeValue) { 6105 isEscaping = true; 6106 source += "' +\n__e(" + escapeValue + ") +\n'"; 6107 } 6108 if (evaluateValue) { 6109 isEvaluating = true; 6110 source += "';\n" + evaluateValue + ";\n__p += '"; 6111 } 6112 if (interpolateValue) { 6113 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; 6114 } 6115 index = offset + match.length; 6116 return match; 6117 }); 6118 source += "';\n"; 6119 var variable = hasOwnProperty$1.call(options, "variable") && options.variable; 6120 if (!variable) { 6121 source = "with (obj) {\n" + source + "\n}\n"; 6122 } else if (reForbiddenIdentifierChars.test(variable)) { 6123 throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT); 6124 } 6125 source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;"); 6126 source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}"; 6127 var result = attempt(function() { 6128 return Function(importsKeys, sourceURL + "return " + source).apply(void 0, importsValues); 6129 }); 6130 result.source = source; 6131 if (isError(result)) { 6132 throw result; 6133 } 6134 return result; 6135 } 6136 6137 var FUNC_ERROR_TEXT = "Expected a function"; 6138 function throttle(func, wait, options) { 6139 var leading = true, trailing = true; 6140 if (typeof func != "function") { 6141 throw new TypeError(FUNC_ERROR_TEXT); 6142 } 6143 if (isObject(options)) { 6144 leading = "leading" in options ? !!options.leading : leading; 6145 trailing = "trailing" in options ? !!options.trailing : trailing; 6146 } 6147 return debounce(func, wait, { 6148 "leading": leading, 6149 "maxWait": wait, 6150 "trailing": trailing 6151 }); 6152 } 6153 6154 function thru(value, interceptor) { 6155 return interceptor(value); 6156 } 6157 6158 var MAX_SAFE_INTEGER$1 = 9007199254740991; 6159 var MAX_ARRAY_LENGTH$1 = 4294967295; 6160 var nativeMin$3 = Math.min; 6161 function times(n, iteratee) { 6162 n = toInteger(n); 6163 if (n < 1 || n > MAX_SAFE_INTEGER$1) { 6164 return []; 6165 } 6166 var index = MAX_ARRAY_LENGTH$1, length = nativeMin$3(n, MAX_ARRAY_LENGTH$1); 6167 iteratee = castFunction(iteratee); 6168 n -= MAX_ARRAY_LENGTH$1; 6169 var result = baseTimes(length, iteratee); 6170 while (++index < n) { 6171 iteratee(index); 6172 } 6173 return result; 6174 } 6175 6176 function wrapperToIterator() { 6177 return this; 6178 } 6179 6180 function baseWrapperValue(value, actions) { 6181 var result = value; 6182 if (result instanceof LazyWrapper) { 6183 result = result.value(); 6184 } 6185 return arrayReduce(actions, function(result2, action) { 6186 return action.func.apply(action.thisArg, arrayPush([result2], action.args)); 6187 }, result); 6188 } 6189 6190 function wrapperValue() { 6191 return baseWrapperValue(this.__wrapped__, this.__actions__); 6192 } 6193 6194 function toLower(value) { 6195 return toString(value).toLowerCase(); 6196 } 6197 6198 function toPath(value) { 6199 if (isArray(value)) { 6200 return arrayMap(value, toKey); 6201 } 6202 return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value))); 6203 } 6204 6205 var MAX_SAFE_INTEGER = 9007199254740991; 6206 function toSafeInteger(value) { 6207 return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0; 6208 } 6209 6210 function toUpper(value) { 6211 return toString(value).toUpperCase(); 6212 } 6213 6214 function transform(object, iteratee, accumulator) { 6215 var isArr = isArray(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object); 6216 iteratee = baseIteratee(iteratee); 6217 if (accumulator == null) { 6218 var Ctor = object && object.constructor; 6219 if (isArrLike) { 6220 accumulator = isArr ? new Ctor() : []; 6221 } else if (isObject(object)) { 6222 accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; 6223 } else { 6224 accumulator = {}; 6225 } 6226 } 6227 (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) { 6228 return iteratee(accumulator, value, index, object2); 6229 }); 6230 return accumulator; 6231 } 6232 6233 function charsEndIndex(strSymbols, chrSymbols) { 6234 var index = strSymbols.length; 6235 while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) { 6236 } 6237 return index; 6238 } 6239 6240 function charsStartIndex(strSymbols, chrSymbols) { 6241 var index = -1, length = strSymbols.length; 6242 while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) { 6243 } 6244 return index; 6245 } 6246 6247 function trim(string, chars, guard) { 6248 string = toString(string); 6249 if (string && (guard || chars === void 0)) { 6250 return baseTrim(string); 6251 } 6252 if (!string || !(chars = baseToString(chars))) { 6253 return string; 6254 } 6255 var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1; 6256 return castSlice(strSymbols, start, end).join(""); 6257 } 6258 6259 function trimEnd(string, chars, guard) { 6260 string = toString(string); 6261 if (string && (guard || chars === void 0)) { 6262 return string.slice(0, trimmedEndIndex(string) + 1); 6263 } 6264 if (!string || !(chars = baseToString(chars))) { 6265 return string; 6266 } 6267 var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1; 6268 return castSlice(strSymbols, 0, end).join(""); 6269 } 6270 6271 var reTrimStart = /^\s+/; 6272 function trimStart(string, chars, guard) { 6273 string = toString(string); 6274 if (string && (guard || chars === void 0)) { 6275 return string.replace(reTrimStart, ""); 6276 } 6277 if (!string || !(chars = baseToString(chars))) { 6278 return string; 6279 } 6280 var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars)); 6281 return castSlice(strSymbols, start).join(""); 6282 } 6283 6284 var DEFAULT_TRUNC_LENGTH = 30; 6285 var DEFAULT_TRUNC_OMISSION = "..."; 6286 var reFlags = /\w*$/; 6287 function truncate(string, options) { 6288 var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION; 6289 if (isObject(options)) { 6290 var separator = "separator" in options ? options.separator : separator; 6291 length = "length" in options ? toInteger(options.length) : length; 6292 omission = "omission" in options ? baseToString(options.omission) : omission; 6293 } 6294 string = toString(string); 6295 var strLength = string.length; 6296 if (hasUnicode(string)) { 6297 var strSymbols = stringToArray(string); 6298 strLength = strSymbols.length; 6299 } 6300 if (length >= strLength) { 6301 return string; 6302 } 6303 var end = length - stringSize(omission); 6304 if (end < 1) { 6305 return omission; 6306 } 6307 var result = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end); 6308 if (separator === void 0) { 6309 return result + omission; 6310 } 6311 if (strSymbols) { 6312 end += result.length - end; 6313 } 6314 if (isRegExp(separator)) { 6315 if (string.slice(end).search(separator)) { 6316 var match, substring = result; 6317 if (!separator.global) { 6318 separator = RegExp(separator.source, toString(reFlags.exec(separator)) + "g"); 6319 } 6320 separator.lastIndex = 0; 6321 while (match = separator.exec(substring)) { 6322 var newEnd = match.index; 6323 } 6324 result = result.slice(0, newEnd === void 0 ? end : newEnd); 6325 } 6326 } else if (string.indexOf(baseToString(separator), end) != end) { 6327 var index = result.lastIndexOf(separator); 6328 if (index > -1) { 6329 result = result.slice(0, index); 6330 } 6331 } 6332 return result + omission; 6333 } 6334 6335 function unary(func) { 6336 return ary(func, 1); 6337 } 6338 6339 var htmlUnescapes = { 6340 "&": "&", 6341 "<": "<", 6342 ">": ">", 6343 """: '"', 6344 "'": "'" 6345 }; 6346 var unescapeHtmlChar = basePropertyOf(htmlUnescapes); 6347 6348 var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g; 6349 var reHasEscapedHtml = RegExp(reEscapedHtml.source); 6350 function unescape(string) {
vendor: 4,601 bytes, lines 6351-6488
6351 string = toString(string); 6352 return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string; 6353 } 6354 6355 var INFINITY = 1 / 0; 6356 var createSet = !(Set$1 && 1 / setToArray(new Set$1([, -0]))[1] == INFINITY) ? noop : function(values) { 6357 return new Set$1(values); 6358 }; 6359 6360 var LARGE_ARRAY_SIZE = 200; 6361 function baseUniq(array, iteratee, comparator) { 6362 var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result; 6363 if (comparator) { 6364 isCommon = false; 6365 includes = arrayIncludesWith; 6366 } else if (length >= LARGE_ARRAY_SIZE) { 6367 var set = iteratee ? null : createSet(array); 6368 if (set) { 6369 return setToArray(set); 6370 } 6371 isCommon = false; 6372 includes = cacheHas; 6373 seen = new SetCache(); 6374 } else { 6375 seen = iteratee ? [] : result; 6376 } 6377 outer: 6378 while (++index < length) { 6379 var value = array[index], computed = iteratee ? iteratee(value) : value; 6380 value = comparator || value !== 0 ? value : 0; 6381 if (isCommon && computed === computed) { 6382 var seenIndex = seen.length; 6383 while (seenIndex--) { 6384 if (seen[seenIndex] === computed) { 6385 continue outer; 6386 } 6387 } 6388 if (iteratee) { 6389 seen.push(computed); 6390 } 6391 result.push(value); 6392 } else if (!includes(seen, computed, comparator)) { 6393 if (seen !== result) { 6394 seen.push(computed); 6395 } 6396 result.push(value); 6397 } 6398 } 6399 return result; 6400 } 6401 6402 var union = baseRest(function(arrays) { 6403 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); 6404 }); 6405 6406 var unionBy = baseRest(function(arrays) { 6407 var iteratee = last(arrays); 6408 if (isArrayLikeObject(iteratee)) { 6409 iteratee = void 0; 6410 } 6411 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), baseIteratee(iteratee)); 6412 }); 6413 6414 var unionWith = baseRest(function(arrays) { 6415 var comparator = last(arrays); 6416 comparator = typeof comparator == "function" ? comparator : void 0; 6417 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), void 0, comparator); 6418 }); 6419 6420 function uniq(array) { 6421 return array && array.length ? baseUniq(array) : []; 6422 } 6423 6424 function uniqBy(array, iteratee) { 6425 return array && array.length ? baseUniq(array, baseIteratee(iteratee)) : []; 6426 } 6427 6428 function uniqWith(array, comparator) { 6429 comparator = typeof comparator == "function" ? comparator : void 0; 6430 return array && array.length ? baseUniq(array, void 0, comparator) : []; 6431 } 6432 6433 var idCounter = 0; 6434 function uniqueId(prefix) { 6435 var id = ++idCounter; 6436 return toString(prefix) + id; 6437 } 6438 6439 function unset(object, path) { 6440 return object == null ? true : baseUnset(object, path); 6441 } 6442 6443 var nativeMax$2 = Math.max; 6444 function unzip(array) { 6445 if (!(array && array.length)) { 6446 return []; 6447 } 6448 var length = 0; 6449 array = arrayFilter(array, function(group) { 6450 if (isArrayLikeObject(group)) { 6451 length = nativeMax$2(group.length, length); 6452 return true; 6453 } 6454 }); 6455 return baseTimes(length, function(index) { 6456 return arrayMap(array, baseProperty(index)); 6457 }); 6458 } 6459 6460 function unzipWith(array, iteratee) { 6461 if (!(array && array.length)) { 6462 return []; 6463 } 6464 var result = unzip(array); 6465 if (iteratee == null) { 6466 return result; 6467 } 6468 return arrayMap(result, function(group) { 6469 return apply(iteratee, void 0, group); 6470 }); 6471 } 6472 6473 function baseUpdate(object, path, updater, customizer) { 6474 return baseSet(object, path, updater(baseGet(object, path)), customizer); 6475 } 6476 6477 function update(object, path, updater) { 6478 return object == null ? object : baseUpdate(object, path, castFunction(updater)); 6479 } 6480 6481 function updateWith(object, path, updater, customizer) { 6482 customizer = typeof customizer == "function" ? customizer : void 0; 6483 return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); 6484 } 6485 6486 var upperCase = createCompounder(function(result, word, index) { 6487 return result + (index ? " " : "") + word.toUpperCase(); 6488 });
vendor: 14,184 bytes, lines 6489-7071
6489 6490 function valuesIn(object) { 6491 return object == null ? [] : baseValues(object, keysIn(object)); 6492 } 6493 6494 var without = baseRest(function(array, values) { 6495 return isArrayLikeObject(array) ? baseDifference(array, values) : []; 6496 }); 6497 6498 function wrap(value, wrapper) { 6499 return partial(castFunction(wrapper), value); 6500 } 6501 6502 var wrapperAt = flatRest(function(paths) { 6503 var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) { 6504 return baseAt(object, paths); 6505 }; 6506 if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) { 6507 return this.thru(interceptor); 6508 } 6509 value = value.slice(start, +start + (length ? 1 : 0)); 6510 value.__actions__.push({ 6511 "func": thru, 6512 "args": [interceptor], 6513 "thisArg": void 0 6514 }); 6515 return new LodashWrapper(value, this.__chain__).thru(function(array) { 6516 if (length && !array.length) { 6517 array.push(void 0); 6518 } 6519 return array; 6520 }); 6521 }); 6522 6523 function wrapperChain() { 6524 return chain(this); 6525 } 6526 6527 function wrapperReverse() { 6528 var value = this.__wrapped__; 6529 if (value instanceof LazyWrapper) { 6530 var wrapped = value; 6531 if (this.__actions__.length) { 6532 wrapped = new LazyWrapper(this); 6533 } 6534 wrapped = wrapped.reverse(); 6535 wrapped.__actions__.push({ 6536 "func": thru, 6537 "args": [reverse], 6538 "thisArg": void 0 6539 }); 6540 return new LodashWrapper(wrapped, this.__chain__); 6541 } 6542 return this.thru(reverse); 6543 } 6544 6545 function baseXor(arrays, iteratee, comparator) { 6546 var length = arrays.length; 6547 if (length < 2) { 6548 return length ? baseUniq(arrays[0]) : []; 6549 } 6550 var index = -1, result = Array(length); 6551 while (++index < length) { 6552 var array = arrays[index], othIndex = -1; 6553 while (++othIndex < length) { 6554 if (othIndex != index) { 6555 result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator); 6556 } 6557 } 6558 } 6559 return baseUniq(baseFlatten(result, 1), iteratee, comparator); 6560 } 6561 6562 var xor = baseRest(function(arrays) { 6563 return baseXor(arrayFilter(arrays, isArrayLikeObject)); 6564 }); 6565 6566 var xorBy = baseRest(function(arrays) { 6567 var iteratee = last(arrays); 6568 if (isArrayLikeObject(iteratee)) { 6569 iteratee = void 0; 6570 } 6571 return baseXor(arrayFilter(arrays, isArrayLikeObject), baseIteratee(iteratee)); 6572 }); 6573 6574 var xorWith = baseRest(function(arrays) { 6575 var comparator = last(arrays); 6576 comparator = typeof comparator == "function" ? comparator : void 0; 6577 return baseXor(arrayFilter(arrays, isArrayLikeObject), void 0, comparator); 6578 }); 6579 6580 var zip = baseRest(unzip); 6581 6582 function baseZipObject(props, values, assignFunc) { 6583 var index = -1, length = props.length, valsLength = values.length, result = {}; 6584 while (++index < length) { 6585 var value = index < valsLength ? values[index] : void 0; 6586 assignFunc(result, props[index], value); 6587 } 6588 return result; 6589 } 6590 6591 function zipObject(props, values) { 6592 return baseZipObject(props || [], values || [], assignValue); 6593 } 6594 6595 function zipObjectDeep(props, values) { 6596 return baseZipObject(props || [], values || [], baseSet); 6597 } 6598 6599 var zipWith = baseRest(function(arrays) { 6600 var length = arrays.length, iteratee = length > 1 ? arrays[length - 1] : void 0; 6601 iteratee = typeof iteratee == "function" ? (arrays.pop(), iteratee) : void 0; 6602 return unzipWith(arrays, iteratee); 6603 }); 6604 6605 var array = { 6606 chunk, 6607 compact, 6608 concat, 6609 difference, 6610 differenceBy, 6611 differenceWith, 6612 drop, 6613 dropRight, 6614 dropRightWhile, 6615 dropWhile, 6616 fill, 6617 findIndex, 6618 findLastIndex, 6619 first: head, 6620 flatten, 6621 flattenDeep, 6622 flattenDepth, 6623 fromPairs, 6624 head, 6625 indexOf, 6626 initial, 6627 intersection, 6628 intersectionBy, 6629 intersectionWith, 6630 join, 6631 last, 6632 lastIndexOf, 6633 nth, 6634 pull, 6635 pullAll, 6636 pullAllBy, 6637 pullAllWith, 6638 pullAt, 6639 remove, 6640 reverse, 6641 slice, 6642 sortedIndex, 6643 sortedIndexBy, 6644 sortedIndexOf, 6645 sortedLastIndex, 6646 sortedLastIndexBy, 6647 sortedLastIndexOf, 6648 sortedUniq, 6649 sortedUniqBy, 6650 tail, 6651 take, 6652 takeRight, 6653 takeRightWhile, 6654 takeWhile, 6655 union, 6656 unionBy, 6657 unionWith, 6658 uniq, 6659 uniqBy, 6660 uniqWith, 6661 unzip, 6662 unzipWith, 6663 without, 6664 xor, 6665 xorBy, 6666 xorWith, 6667 zip, 6668 zipObject, 6669 zipObjectDeep, 6670 zipWith 6671 }; 6672 6673 var collection = { 6674 countBy, 6675 each: forEach, 6676 eachRight: forEachRight, 6677 every, 6678 filter, 6679 find, 6680 findLast, 6681 flatMap, 6682 flatMapDeep, 6683 flatMapDepth, 6684 forEach, 6685 forEachRight, 6686 groupBy, 6687 includes, 6688 invokeMap, 6689 keyBy, 6690 map, 6691 orderBy: orderBy$1, 6692 partition, 6693 reduce, 6694 reduceRight, 6695 reject, 6696 sample, 6697 sampleSize, 6698 shuffle, 6699 size, 6700 some, 6701 sortBy 6702 }; 6703 6704 var date$1 = { 6705 now 6706 }; 6707 6708 var func = { 6709 after, 6710 ary, 6711 before, 6712 bind, 6713 bindKey, 6714 curry, 6715 curryRight, 6716 debounce, 6717 defer, 6718 delay, 6719 flip, 6720 memoize, 6721 negate, 6722 once, 6723 overArgs, 6724 partial, 6725 partialRight, 6726 rearg, 6727 rest, 6728 spread, 6729 throttle, 6730 unary, 6731 wrap 6732 }; 6733 6734 var lang = { 6735 castArray: castArray$1, 6736 clone, 6737 cloneDeep, 6738 cloneDeepWith, 6739 cloneWith, 6740 conformsTo, 6741 eq, 6742 gt: gt$1, 6743 gte, 6744 isArguments, 6745 isArray, 6746 isArrayBuffer, 6747 isArrayLike, 6748 isArrayLikeObject, 6749 isBoolean: isBoolean$1, 6750 isBuffer, 6751 isDate, 6752 isElement: isElement$2, 6753 isEmpty: isEmpty$1, 6754 isEqual: isEqual$1, 6755 isEqualWith, 6756 isError, 6757 isFinite, 6758 isFunction, 6759 isInteger, 6760 isLength, 6761 isMap, 6762 isMatch, 6763 isMatchWith, 6764 isNaN: isNaN$1, 6765 isNative, 6766 isNil, 6767 isNull, 6768 isNumber: isNumber$1, 6769 isObject, 6770 isObjectLike, 6771 isPlainObject, 6772 isRegExp, 6773 isSafeInteger, 6774 isSet, 6775 isString, 6776 isSymbol, 6777 isTypedArray, 6778 isUndefined: isUndefined$1, 6779 isWeakMap, 6780 isWeakSet, 6781 lt: lt$1, 6782 lte, 6783 toArray, 6784 toFinite, 6785 toInteger, 6786 toLength, 6787 toNumber, 6788 toPlainObject, 6789 toSafeInteger, 6790 toString 6791 }; 6792 6793 var math = { 6794 add, 6795 ceil, 6796 divide, 6797 floor: floor$1, 6798 max: max$3, 6799 maxBy, 6800 mean, 6801 meanBy, 6802 min: min$3, 6803 minBy, 6804 multiply, 6805 round: round$1, 6806 subtract, 6807 sum: sum$1, 6808 sumBy 6809 }; 6810 6811 var number = { 6812 clamp, 6813 inRange, 6814 random 6815 }; 6816 6817 var object = { 6818 assign, 6819 assignIn, 6820 assignInWith, 6821 assignWith, 6822 at: at$1, 6823 create, 6824 defaults, 6825 defaultsDeep, 6826 entries: toPairs, 6827 entriesIn: toPairsIn, 6828 extend: assignIn, 6829 extendWith: assignInWith, 6830 findKey, 6831 findLastKey, 6832 forIn, 6833 forInRight, 6834 forOwn, 6835 forOwnRight, 6836 functions, 6837 functionsIn, 6838 get, 6839 has, 6840 hasIn, 6841 invert, 6842 invertBy, 6843 invoke, 6844 keys, 6845 keysIn, 6846 mapKeys, 6847 mapValues, 6848 merge, 6849 mergeWith, 6850 omit, 6851 omitBy, 6852 pick, 6853 pickBy, 6854 result, 6855 set, 6856 setWith, 6857 toPairs, 6858 toPairsIn, 6859 transform, 6860 unset, 6861 update, 6862 updateWith, 6863 values, 6864 valuesIn 6865 }; 6866 6867 var seq = { 6868 at: wrapperAt, 6869 chain, 6870 commit: wrapperCommit, 6871 lodash, 6872 next: wrapperNext, 6873 plant: wrapperPlant, 6874 reverse: wrapperReverse, 6875 tap, 6876 thru, 6877 toIterator: wrapperToIterator, 6878 toJSON: wrapperValue, 6879 value: wrapperValue, 6880 valueOf: wrapperValue, 6881 wrapperChain 6882 }; 6883 6884 var string$1 = { 6885 camelCase, 6886 capitalize: capitalize$1, 6887 deburr, 6888 endsWith, 6889 escape, 6890 escapeRegExp, 6891 kebabCase, 6892 lowerCase, 6893 lowerFirst, 6894 pad, 6895 padEnd, 6896 padStart, 6897 parseInt: parseInt$1, 6898 repeat, 6899 replace, 6900 snakeCase, 6901 split, 6902 startCase, 6903 startsWith, 6904 template, 6905 templateSettings, 6906 toLower, 6907 toUpper, 6908 trim, 6909 trimEnd, 6910 trimStart, 6911 truncate, 6912 unescape, 6913 upperCase, 6914 upperFirst, 6915 words 6916 }; 6917 6918 var util = { 6919 attempt, 6920 bindAll, 6921 cond, 6922 conforms, 6923 constant, 6924 defaultTo, 6925 flow, 6926 flowRight, 6927 identity, 6928 iteratee, 6929 matches, 6930 matchesProperty, 6931 method, 6932 methodOf, 6933 mixin: mixin$1, 6934 noop, 6935 nthArg, 6936 over, 6937 overEvery, 6938 overSome, 6939 property, 6940 propertyOf, 6941 range: range$1, 6942 rangeRight, 6943 stubArray, 6944 stubFalse, 6945 stubObject, 6946 stubString, 6947 stubTrue, 6948 times, 6949 toPath, 6950 uniqueId 6951 }; 6952 6953 function lazyClone() { 6954 var result = new LazyWrapper(this.__wrapped__); 6955 result.__actions__ = copyArray(this.__actions__); 6956 result.__dir__ = this.__dir__; 6957 result.__filtered__ = this.__filtered__; 6958 result.__iteratees__ = copyArray(this.__iteratees__); 6959 result.__takeCount__ = this.__takeCount__; 6960 result.__views__ = copyArray(this.__views__); 6961 return result; 6962 } 6963 6964 function lazyReverse() { 6965 if (this.__filtered__) { 6966 var result = new LazyWrapper(this); 6967 result.__dir__ = -1; 6968 result.__filtered__ = true; 6969 } else { 6970 result = this.clone(); 6971 result.__dir__ *= -1; 6972 } 6973 return result; 6974 } 6975 6976 var nativeMax$1 = Math.max; 6977 var nativeMin$2 = Math.min; 6978 function getView(start, end, transforms) { 6979 var index = -1, length = transforms.length; 6980 while (++index < length) { 6981 var data = transforms[index], size = data.size; 6982 switch (data.type) { 6983 case "drop": 6984 start += size; 6985 break; 6986 case "dropRight": 6987 end -= size; 6988 break; 6989 case "take": 6990 end = nativeMin$2(end, start + size); 6991 break; 6992 case "takeRight": 6993 start = nativeMax$1(start, end - size); 6994 break; 6995 } 6996 } 6997 return { "start": start, "end": end }; 6998 } 6999 7000 var LAZY_FILTER_FLAG$1 = 1; 7001 var LAZY_MAP_FLAG = 2; 7002 var nativeMin$1 = Math.min; 7003 function lazyValue() { 7004 var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin$1(length, this.__takeCount__); 7005 if (!isArr || !isRight && arrLength == length && takeCount == length) { 7006 return baseWrapperValue(array, this.__actions__); 7007 } 7008 var result = []; 7009 outer: 7010 while (length-- && resIndex < takeCount) { 7011 index += dir; 7012 var iterIndex = -1, value = array[index]; 7013 while (++iterIndex < iterLength) { 7014 var data = iteratees[iterIndex], iteratee = data.iteratee, type = data.type, computed = iteratee(value); 7015 if (type == LAZY_MAP_FLAG) { 7016 value = computed; 7017 } else if (!computed) { 7018 if (type == LAZY_FILTER_FLAG$1) { 7019 continue outer; 7020 } else { 7021 break outer; 7022 } 7023 } 7024 } 7025 result[resIndex++] = value; 7026 } 7027 return result; 7028 } 7029 7030 var VERSION = "4.17.21"; 7031 var WRAP_BIND_KEY_FLAG = 2; 7032 var LAZY_FILTER_FLAG = 1; 7033 var LAZY_WHILE_FLAG = 3; 7034 var MAX_ARRAY_LENGTH = 4294967295; 7035 var arrayProto = Array.prototype; 7036 var objectProto = Object.prototype; 7037 var hasOwnProperty = objectProto.hasOwnProperty; 7038 var symIterator = Symbol$1 ? Symbol$1.iterator : void 0; 7039 var nativeMax = Math.max; 7040 var nativeMin = Math.min; 7041 var mixin = function(func2) { 7042 return function(object2, source, options) { 7043 if (options == null) { 7044 var isObj = isObject(source), props = isObj && keys(source), methodNames = props && props.length && baseFunctions(source, props); 7045 if (!(methodNames ? methodNames.length : isObj)) { 7046 options = source; 7047 source = object2; 7048 object2 = this; 7049 } 7050 } 7051 return func2(object2, source, options); 7052 }; 7053 }(mixin$1); 7054 lodash.after = func.after; 7055 lodash.ary = func.ary; 7056 lodash.assign = object.assign; 7057 lodash.assignIn = object.assignIn; 7058 lodash.assignInWith = object.assignInWith; 7059 lodash.assignWith = object.assignWith; 7060 lodash.at = object.at; 7061 lodash.before = func.before; 7062 lodash.bind = func.bind; 7063 lodash.bindAll = util.bindAll; 7064 lodash.bindKey = func.bindKey; 7065 lodash.castArray = lang.castArray; 7066 lodash.chain = seq.chain; 7067 lodash.chunk = array.chunk; 7068 lodash.compact = array.compact; 7069 lodash.concat = array.concat; 7070 lodash.cond = util.cond; 7071 lodash.conforms = util.conforms;
7072 lodash.constant = util.constant; 7073 lodash.countBy = collection.countBy; 7074 lodash.create = object.create; 7075 lodash.curry = func.curry; 7076 lodash.curryRight = func.curryRight; 7077 lodash.debounce = func.debounce; 7078 lodash.defaults = object.defaults; 7079 lodash.defaultsDeep = object.defaultsDeep; 7080 lodash.defer = func.defer; 7081 lodash.delay = func.delay; 7082 lodash.difference = array.difference; 7083 lodash.differenceBy = array.differenceBy; 7084 lodash.differenceWith = array.differenceWith; 7085 lodash.drop = array.drop; 7086 lodash.dropRight = array.dropRight; 7087 lodash.dropRightWhile = array.dropRightWhile; 7088 lodash.dropWhile = array.dropWhile; 7089 lodash.fill = array.fill; 7090 lodash.filter = collection.filter; 7091 lodash.flatMap = collection.flatMap; 7092 lodash.flatMapDeep = collection.flatMapDeep; 7093 lodash.flatMapDepth = collection.flatMapDepth; 7094 lodash.flatten = array.flatten; 7095 lodash.flattenDeep = array.flattenDeep; 7096 lodash.flattenDepth = array.flattenDepth; 7097 lodash.flip = func.flip; 7098 lodash.flow = util.flow; 7099 lodash.flowRight = util.flowRight; 7100 lodash.fromPairs = array.fromPairs; 7101 lodash.functions = object.functions; 7102 lodash.functionsIn = object.functionsIn; 7103 lodash.groupBy = collection.groupBy; 7104 lodash.initial = array.initial; 7105 lodash.intersection = array.intersection; 7106 lodash.intersectionBy = array.intersectionBy; 7107 lodash.intersectionWith = array.intersectionWith; 7108 lodash.invert = object.invert; 7109 lodash.invertBy = object.invertBy; 7110 lodash.invokeMap = collection.invokeMap; 7111 lodash.iteratee = util.iteratee; 7112 lodash.keyBy = collection.keyBy; 7113 lodash.keys = keys; 7114 lodash.keysIn = object.keysIn; 7115 lodash.map = collection.map; 7116 lodash.mapKeys = object.mapKeys; 7117 lodash.mapValues = object.mapValues; 7118 lodash.matches = util.matches; 7119 lodash.matchesProperty = util.matchesProperty; 7120 lodash.memoize = func.memoize; 7121 lodash.merge = object.merge; 7122 lodash.mergeWith = object.mergeWith; 7123 lodash.method = util.method; 7124 lodash.methodOf = util.methodOf; 7125 lodash.mixin = mixin; 7126 lodash.negate = negate; 7127 lodash.nthArg = util.nthArg; 7128 lodash.omit = object.omit; 7129 lodash.omitBy = object.omitBy; 7130 lodash.once = func.once; 7131 lodash.orderBy = collection.orderBy; 7132 lodash.over = util.over; 7133 lodash.overArgs = func.overArgs; 7134 lodash.overEvery = util.overEvery; 7135 lodash.overSome = util.overSome; 7136 lodash.partial = func.partial; 7137 lodash.partialRight = func.partialRight; 7138 lodash.partition = collection.partition; 7139 lodash.pick = object.pick; 7140 lodash.pickBy = object.pickBy; 7141 lodash.property = util.property; 7142 lodash.propertyOf = util.propertyOf; 7143 lodash.pull = array.pull; 7144 lodash.pullAll = array.pullAll; 7145 lodash.pullAllBy = array.pullAllBy; 7146 lodash.pullAllWith = array.pullAllWith; 7147 lodash.pullAt = array.pullAt; 7148 lodash.range = util.range; 7149 lodash.rangeRight = util.rangeRight; 7150 lodash.rearg = func.rearg; 7151 lodash.reject = collection.reject; 7152 lodash.remove = array.remove; 7153 lodash.rest = func.rest; 7154 lodash.reverse = array.reverse; 7155 lodash.sampleSize = collection.sampleSize; 7156 lodash.set = object.set; 7157 lodash.setWith = object.setWith; 7158 lodash.shuffle = collection.shuffle; 7159 lodash.slice = array.slice; 7160 lodash.sortBy = collection.sortBy; 7161 lodash.sortedUniq = array.sortedUniq; 7162 lodash.sortedUniqBy = array.sortedUniqBy; 7163 lodash.split = string$1.split; 7164 lodash.spread = func.spread; 7165 lodash.tail = array.tail; 7166 lodash.take = array.take; 7167 lodash.takeRight = array.takeRight; 7168 lodash.takeRightWhile = array.takeRightWhile; 7169 lodash.takeWhile = array.takeWhile; 7170 lodash.tap = seq.tap; 7171 lodash.throttle = func.throttle; 7172 lodash.thru = thru; 7173 lodash.toArray = lang.toArray; 7174 lodash.toPairs = object.toPairs; 7175 lodash.toPairsIn = object.toPairsIn; 7176 lodash.toPath = util.toPath; 7177 lodash.toPlainObject = lang.toPlainObject; 7178 lodash.transform = object.transform; 7179 lodash.unary = func.unary; 7180 lodash.union = array.union; 7181 lodash.unionBy = array.unionBy; 7182 lodash.unionWith = array.unionWith; 7183 lodash.uniq = array.uniq; 7184 lodash.uniqBy = array.uniqBy; 7185 lodash.uniqWith = array.uniqWith; 7186 lodash.unset = object.unset; 7187 lodash.unzip = array.unzip; 7188 lodash.unzipWith = array.unzipWith; 7189 lodash.update = object.update; 7190 lodash.updateWith = object.updateWith; 7191 lodash.values = object.values;
7192 lodash.valuesIn = object.valuesIn; 7193 lodash.without = array.without; 7194 lodash.words = string$1.words; 7195 lodash.wrap = func.wrap; 7196 lodash.xor = array.xor; 7197 lodash.xorBy = array.xorBy; 7198 lodash.xorWith = array.xorWith; 7199 lodash.zip = array.zip; 7200 lodash.zipObject = array.zipObject; 7201 lodash.zipObjectDeep = array.zipObjectDeep; 7202 lodash.zipWith = array.zipWith; 7203 lodash.entries = object.toPairs; 7204 lodash.entriesIn = object.toPairsIn; 7205 lodash.extend = object.assignIn; 7206 lodash.extendWith = object.assignInWith; 7207 mixin(lodash, lodash); 7208 lodash.add = math.add; 7209 lodash.attempt = util.attempt; 7210 lodash.camelCase = string$1.camelCase; 7211 lodash.capitalize = string$1.capitalize; 7212 lodash.ceil = math.ceil; 7213 lodash.clamp = number.clamp; 7214 lodash.clone = lang.clone; 7215 lodash.cloneDeep = lang.cloneDeep; 7216 lodash.cloneDeepWith = lang.cloneDeepWith; 7217 lodash.cloneWith = lang.cloneWith; 7218 lodash.conformsTo = lang.conformsTo; 7219 lodash.deburr = string$1.deburr; 7220 lodash.defaultTo = util.defaultTo; 7221 lodash.divide = math.divide; 7222 lodash.endsWith = string$1.endsWith; 7223 lodash.eq = lang.eq; 7224 lodash.escape = string$1.escape; 7225 lodash.escapeRegExp = string$1.escapeRegExp; 7226 lodash.every = collection.every; 7227 lodash.find = collection.find; 7228 lodash.findIndex = array.findIndex; 7229 lodash.findKey = object.findKey; 7230 lodash.findLast = collection.findLast; 7231 lodash.findLastIndex = array.findLastIndex; 7232 lodash.findLastKey = object.findLastKey; 7233 lodash.floor = math.floor; 7234 lodash.forEach = collection.forEach; 7235 lodash.forEachRight = collection.forEachRight; 7236 lodash.forIn = object.forIn; 7237 lodash.forInRight = object.forInRight; 7238 lodash.forOwn = object.forOwn; 7239 lodash.forOwnRight = object.forOwnRight; 7240 lodash.get = object.get; 7241 lodash.gt = lang.gt; 7242 lodash.gte = lang.gte; 7243 lodash.has = object.has; 7244 lodash.hasIn = object.hasIn; 7245 lodash.head = array.head; 7246 lodash.identity = identity; 7247 lodash.includes = collection.includes; 7248 lodash.indexOf = array.indexOf; 7249 lodash.inRange = number.inRange; 7250 lodash.invoke = object.invoke; 7251 lodash.isArguments = lang.isArguments; 7252 lodash.isArray = isArray; 7253 lodash.isArrayBuffer = lang.isArrayBuffer; 7254 lodash.isArrayLike = lang.isArrayLike; 7255 lodash.isArrayLikeObject = lang.isArrayLikeObject; 7256 lodash.isBoolean = lang.isBoolean; 7257 lodash.isBuffer = lang.isBuffer; 7258 lodash.isDate = lang.isDate; 7259 lodash.isElement = lang.isElement; 7260 lodash.isEmpty = lang.isEmpty; 7261 lodash.isEqual = lang.isEqual; 7262 lodash.isEqualWith = lang.isEqualWith; 7263 lodash.isError = lang.isError; 7264 lodash.isFinite = lang.isFinite; 7265 lodash.isFunction = lang.isFunction; 7266 lodash.isInteger = lang.isInteger; 7267 lodash.isLength = lang.isLength; 7268 lodash.isMap = lang.isMap; 7269 lodash.isMatch = lang.isMatch; 7270 lodash.isMatchWith = lang.isMatchWith; 7271 lodash.isNaN = lang.isNaN; 7272 lodash.isNative = lang.isNative; 7273 lodash.isNil = lang.isNil; 7274 lodash.isNull = lang.isNull; 7275 lodash.isNumber = lang.isNumber; 7276 lodash.isObject = isObject; 7277 lodash.isObjectLike = lang.isObjectLike; 7278 lodash.isPlainObject = lang.isPlainObject; 7279 lodash.isRegExp = lang.isRegExp; 7280 lodash.isSafeInteger = lang.isSafeInteger; 7281 lodash.isSet = lang.isSet; 7282 lodash.isString = lang.isString; 7283 lodash.isSymbol = lang.isSymbol; 7284 lodash.isTypedArray = lang.isTypedArray; 7285 lodash.isUndefined = lang.isUndefined; 7286 lodash.isWeakMap = lang.isWeakMap; 7287 lodash.isWeakSet = lang.isWeakSet; 7288 lodash.join = array.join; 7289 lodash.kebabCase = string$1.kebabCase; 7290 lodash.last = last; 7291 lodash.lastIndexOf = array.lastIndexOf; 7292 lodash.lowerCase = string$1.lowerCase; 7293 lodash.lowerFirst = string$1.lowerFirst; 7294 lodash.lt = lang.lt; 7295 lodash.lte = lang.lte; 7296 lodash.max = math.max; 7297 lodash.maxBy = math.maxBy; 7298 lodash.mean = math.mean; 7299 lodash.meanBy = math.meanBy; 7300 lodash.min = math.min; 7301 lodash.minBy = math.minBy; 7302 lodash.stubArray = util.stubArray; 7303 lodash.stubFalse = util.stubFalse; 7304 lodash.stubObject = util.stubObject;
vendor: 7,021 bytes, lines 7305-7471
7305 lodash.stubString = util.stubString; 7306 lodash.stubTrue = util.stubTrue; 7307 lodash.multiply = math.multiply; 7308 lodash.nth = array.nth; 7309 lodash.noop = util.noop; 7310 lodash.now = date$1.now; 7311 lodash.pad = string$1.pad; 7312 lodash.padEnd = string$1.padEnd; 7313 lodash.padStart = string$1.padStart; 7314 lodash.parseInt = string$1.parseInt; 7315 lodash.random = number.random; 7316 lodash.reduce = collection.reduce; 7317 lodash.reduceRight = collection.reduceRight; 7318 lodash.repeat = string$1.repeat; 7319 lodash.replace = string$1.replace; 7320 lodash.result = object.result; 7321 lodash.round = math.round; 7322 lodash.sample = collection.sample; 7323 lodash.size = collection.size; 7324 lodash.snakeCase = string$1.snakeCase; 7325 lodash.some = collection.some; 7326 lodash.sortedIndex = array.sortedIndex; 7327 lodash.sortedIndexBy = array.sortedIndexBy; 7328 lodash.sortedIndexOf = array.sortedIndexOf; 7329 lodash.sortedLastIndex = array.sortedLastIndex; 7330 lodash.sortedLastIndexBy = array.sortedLastIndexBy; 7331 lodash.sortedLastIndexOf = array.sortedLastIndexOf; 7332 lodash.startCase = string$1.startCase; 7333 lodash.startsWith = string$1.startsWith; 7334 lodash.subtract = math.subtract; 7335 lodash.sum = math.sum; 7336 lodash.sumBy = math.sumBy; 7337 lodash.template = string$1.template; 7338 lodash.times = util.times; 7339 lodash.toFinite = lang.toFinite; 7340 lodash.toInteger = toInteger; 7341 lodash.toLength = lang.toLength; 7342 lodash.toLower = string$1.toLower; 7343 lodash.toNumber = lang.toNumber; 7344 lodash.toSafeInteger = lang.toSafeInteger; 7345 lodash.toString = lang.toString; 7346 lodash.toUpper = string$1.toUpper; 7347 lodash.trim = string$1.trim; 7348 lodash.trimEnd = string$1.trimEnd; 7349 lodash.trimStart = string$1.trimStart; 7350 lodash.truncate = string$1.truncate; 7351 lodash.unescape = string$1.unescape; 7352 lodash.uniqueId = util.uniqueId; 7353 lodash.upperCase = string$1.upperCase; 7354 lodash.upperFirst = string$1.upperFirst; 7355 lodash.each = collection.forEach; 7356 lodash.eachRight = collection.forEachRight; 7357 lodash.first = array.head; 7358 mixin(lodash, function() { 7359 var source = {}; 7360 baseForOwn(lodash, function(func2, methodName) { 7361 if (!hasOwnProperty.call(lodash.prototype, methodName)) { 7362 source[methodName] = func2; 7363 } 7364 }); 7365 return source; 7366 }(), { "chain": false }); 7367 lodash.VERSION = VERSION; 7368 (lodash.templateSettings = string$1.templateSettings).imports._ = lodash; 7369 arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) { 7370 lodash[methodName].placeholder = lodash; 7371 }); 7372 arrayEach(["drop", "take"], function(methodName, index) { 7373 LazyWrapper.prototype[methodName] = function(n) { 7374 n = n === void 0 ? 1 : nativeMax(toInteger(n), 0); 7375 var result = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone(); 7376 if (result.__filtered__) { 7377 result.__takeCount__ = nativeMin(n, result.__takeCount__); 7378 } else { 7379 result.__views__.push({ 7380 "size": nativeMin(n, MAX_ARRAY_LENGTH), 7381 "type": methodName + (result.__dir__ < 0 ? "Right" : "") 7382 }); 7383 } 7384 return result; 7385 }; 7386 LazyWrapper.prototype[methodName + "Right"] = function(n) { 7387 return this.reverse()[methodName](n).reverse(); 7388 }; 7389 }); 7390 arrayEach(["filter", "map", "takeWhile"], function(methodName, index) { 7391 var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; 7392 LazyWrapper.prototype[methodName] = function(iteratee) { 7393 var result = this.clone(); 7394 result.__iteratees__.push({ 7395 "iteratee": baseIteratee(iteratee), 7396 "type": type 7397 }); 7398 result.__filtered__ = result.__filtered__ || isFilter; 7399 return result; 7400 }; 7401 }); 7402 arrayEach(["head", "last"], function(methodName, index) { 7403 var takeName = "take" + (index ? "Right" : ""); 7404 LazyWrapper.prototype[methodName] = function() { 7405 return this[takeName](1).value()[0]; 7406 }; 7407 }); 7408 arrayEach(["initial", "tail"], function(methodName, index) { 7409 var dropName = "drop" + (index ? "" : "Right"); 7410 LazyWrapper.prototype[methodName] = function() { 7411 return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); 7412 }; 7413 }); 7414 LazyWrapper.prototype.compact = function() { 7415 return this.filter(identity); 7416 }; 7417 LazyWrapper.prototype.find = function(predicate) { 7418 return this.filter(predicate).head(); 7419 }; 7420 LazyWrapper.prototype.findLast = function(predicate) { 7421 return this.reverse().find(predicate); 7422 }; 7423 LazyWrapper.prototype.invokeMap = baseRest(function(path, args) { 7424 if (typeof path == "function") { 7425 return new LazyWrapper(this); 7426 } 7427 return this.map(function(value) { 7428 return baseInvoke(value, path, args); 7429 }); 7430 }); 7431 LazyWrapper.prototype.reject = function(predicate) { 7432 return this.filter(negate(baseIteratee(predicate))); 7433 }; 7434 LazyWrapper.prototype.slice = function(start, end) { 7435 start = toInteger(start); 7436 var result = this; 7437 if (result.__filtered__ && (start > 0 || end < 0)) { 7438 return new LazyWrapper(result); 7439 } 7440 if (start < 0) { 7441 result = result.takeRight(-start); 7442 } else if (start) { 7443 result = result.drop(start); 7444 } 7445 if (end !== void 0) { 7446 end = toInteger(end); 7447 result = end < 0 ? result.dropRight(-end) : result.take(end - start); 7448 } 7449 return result; 7450 }; 7451 LazyWrapper.prototype.takeRightWhile = function(predicate) { 7452 return this.reverse().takeWhile(predicate).reverse(); 7453 }; 7454 LazyWrapper.prototype.toArray = function() { 7455 return this.take(MAX_ARRAY_LENGTH); 7456 }; 7457 baseForOwn(LazyWrapper.prototype, function(func2, methodName) { 7458 var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName); 7459 if (!lodashFunc) { 7460 return; 7461 } 7462 lodash.prototype[methodName] = function() { 7463 var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee = args[0], useLazy = isLazy || isArray(value); 7464 var interceptor = function(value2) { 7465 var result2 = lodashFunc.apply(lodash, arrayPush([value2], args)); 7466 return isTaker && chainAll ? result2[0] : result2; 7467 }; 7468 if (useLazy && checkIteratee && typeof iteratee == "function" && iteratee.length != 1) { 7469 isLazy = useLazy = false; 7470 } 7471 var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !c
7471hainAll, onlyLazy = isLazy && !isHybrid; 7472 if (!retUnwrapped && useLazy) { 7473 value = onlyLazy ? value : new LazyWrapper(this); 7474 var result = func2.apply(value, args); 7475 result.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": void 0 }); 7476 return new LodashWrapper(result, chainAll); 7477 } 7478 if (isUnwrapped && onlyLazy) { 7479 return func2.apply(this, args); 7480 } 7481 result = this.thru(interceptor); 7482 return isUnwrapped ? isTaker ? result.value()[0] : result.value() : result; 7483 }; 7484 }); 7485 arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) { 7486 var func2 = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName); 7487 lodash.prototype[methodName] = function() { 7488 var args = arguments; 7489 if (retUnwrapped && !this.__chain__) { 7490 var value = this.value(); 7491 return func2.apply(isArray(value) ? value : [], args); 7492 } 7493 return this[chainName](function(value2) { 7494 return func2.apply(isArray(value2) ? value2 : [], args); 7495 }); 7496 }; 7497 }); 7498 baseForOwn(LazyWrapper.prototype, function(func2, methodName) { 7499 var lodashFunc = lodash[methodName]; 7500 if (lodashFunc) { 7501 var key = lodashFunc.name + ""; 7502 if (!hasOwnProperty.call(realNames, key)) { 7503 realNames[key] = []; 7504 } 7505 realNames[key].push({ "name": methodName, "func": lodashFunc }); 7506 } 7507 }); 7508 realNames[createHybrid(void 0, WRAP_BIND_KEY_FLAG).name] = [{ 7509 "name": "wrapper", 7510 "func": void 0 7511 }]; 7512 LazyWrapper.prototype.clone = lazyClone; 7513 LazyWrapper.prototype.reverse = lazyReverse; 7514 LazyWrapper.prototype.value = lazyValue; 7515 lodash.prototype.at = seq.at; 7516 lodash.prototype.chain = seq.wrapperChain; 7517 lodash.prototype.commit = seq.commit; 7518 lodash.prototype.next = seq.next; 7519 lodash.prototype.plant = seq.plant; 7520 lodash.prototype.reverse = seq.reverse; 7521 lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = seq.value; 7522 lodash.prototype.first = lodash.prototype.head; 7523 if (symIterator) { 7524 lodash.prototype[symIterator] = seq.toIterator; 7525 } 7526 /** 7527 * @license 7528 * Lodash (Custom Build) <https://lodash.com/> 7529 * Build: `lodash modularize exports="es" -o ./` 7530 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/> 7531 * Released under MIT license <https://lodash.com/license> 7532 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 7533 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 7534 */ 7535 7536 const isUndefined = (val) => val === void 0; 7537 const isBoolean = (val) => typeof val === "boolean"; 7538 const isNumber = (val) => typeof val === "number"; 7539 const isEmpty = (val) => !val && val !== 0 || isArray$1(val) && val.length === 0 || isObject$1(val) && !Object.keys(val).length; 7540 const isElement$1 = (e) => { 7541 if (typeof Element === "undefined") 7542 return false; 7543 return e instanceof Element; 7544 }; 7545 const isPropAbsent = (prop) => { 7546 return isNil(prop); 7547 }; 7548 const isStringNumber = (val) => { 7549 if (!isString$1(val)) { 7550 return false; 7551 } 7552 return !Number.isNaN(Number(val)); 7553 }; 7554 7555 const escapeStringRegexp = (string = "") => string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"); 7556 const capitalize = (str) => capitalize$2(str); 7557 7558 const keysOf = (arr) => Object.keys(arr); 7559 const entriesOf = (arr) => Object.entries(arr); 7560 const getProp = (obj, path, defaultValue) => { 7561 return { 7562 get value() { 7563 return get(obj, path, defaultValue); 7564 }, 7565 set value(val) { 7566 set(obj, path, val); 7567 } 7568 }; 7569 }; 7570 7571 class ElementPlusError extends Error { 7572 constructor(m) { 7573 super(m); 7574 this.name = "ElementPlusError"; 7575 } 7576 } 7577 function throwError(scope, m) { 7578 throw new ElementPlusError(`[${scope}] ${m}`); 7579 } 7580 function debugWarn(scope, message) { 7581 } 7582 7583 const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim()); 7584 const hasClass = (el, cls) => { 7585 if (!el || !cls) 7586 return false; 7587 if (cls.includes(" ")) 7588 throw new Error("className should not contain space."); 7589 return el.classList.contains(cls); 7590 }; 7591 const addClass = (el, cls) => { 7592 if (!el || !cls.trim()) 7593 return; 7594 el.classList.add(...classNameToArray(cls)); 7595 }; 7596 const removeClass = (el, cls) => { 7597 if (!el || !cls.trim()) 7598 return; 7599 el.classList.remove(...classNameToArray(cls)); 7600 }; 7601 const getStyle = (element, styleName) => { 7602 var _a; 7603 if (!isClient || !element || !styleName) 7604 return ""; 7605 let key = camelize(styleName); 7606 if (key === "float") 7607 key = "cssFloat";
7608 try { 7609 const style = element.style[key]; 7610 if (style) 7611 return style; 7612 const computed = (_a = document.defaultView) == null ? void 0 : _a.getComputedStyle(element, ""); 7613 return computed ? computed[key] : ""; 7614 } catch (e) { 7615 return element.style[key]; 7616 } 7617 }; 7618 function addUnit(value, defaultUnit = "px") { 7619 if (!value) 7620 return ""; 7621 if (isNumber(value) || isStringNumber(value)) { 7622 return `${value}${defaultUnit}`; 7623 } else if (isString$1(value)) { 7624 return value; 7625 } 7626 } 7627 7628 const isScroll = (el, isVertical) => { 7629 if (!isClient) 7630 return false; 7631 const key = { 7632 undefined: "overflow", 7633 true: "overflow-y", 7634 false: "overflow-x" 7635 }[String(isVertical)]; 7636 const overflow = getStyle(el, key); 7637 return ["scroll", "auto", "overlay"].some((s) => overflow.includes(s)); 7638 }; 7639 const getScrollContainer = (el, isVertical) => { 7640 if (!isClient) 7641 return; 7642 let parent = el; 7643 while (parent) { 7644 if ([window, document, document.documentElement].includes(parent)) 7645 return window; 7646 if (isScroll(parent, isVertical)) 7647 return parent; 7648 parent = parent.parentNode; 7649 } 7650 return parent; 7651 }; 7652 let scrollBarWidth; 7653 const getScrollBarWidth = (namespace) => { 7654 var _a; 7655 if (!isClient) 7656 return 0; 7657 if (scrollBarWidth !== void 0) 7658 return scrollBarWidth; 7659 const outer = document.createElement("div"); 7660 outer.className = `${namespace}-scrollbar__wrap`; 7661 outer.style.visibility = "hidden"; 7662 outer.style.width = "100px"; 7663 outer.style.position = "absolute"; 7664 outer.style.top = "-9999px"; 7665 document.body.appendChild(outer); 7666 const widthNoScroll = outer.offsetWidth; 7667 outer.style.overflow = "scroll"; 7668 const inner = document.createElement("div"); 7669 inner.style.width = "100%"; 7670 outer.appendChild(inner); 7671 const widthWithScroll = inner.offsetWidth; 7672 (_a = outer.parentNode) == null ? void 0 : _a.removeChild(outer); 7673 scrollBarWidth = widthNoScroll - widthWithScroll; 7674 return scrollBarWidth; 7675 }; 7676 function scrollIntoView(container, selected) { 7677 if (!isClient) 7678 return; 7679 if (!selected) { 7680 container.scrollTop = 0; 7681 return; 7682 } 7683 const offsetParents = []; 7684 let pointer = selected.offsetParent; 7685 while (pointer !== null && container !== pointer && container.contains(pointer)) { 7686 offsetParents.push(pointer); 7687 pointer = pointer.offsetParent; 7688 } 7689 const top = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0); 7690 const bottom = top + selected.offsetHeight; 7691 const viewRectTop = container.scrollTop; 7692 const viewRectBottom = viewRectTop + container.clientHeight; 7693 if (top < viewRectTop) { 7694 container.scrollTop = top; 7695 } else if (bottom > viewRectBottom) { 7696 container.scrollTop = bottom - container.clientHeight; 7697 } 7698 } 7699 7700 let target = !isClient ? void 0 : document.body; 7701 function createGlobalNode(id) { 7702 const el = document.createElement("div"); 7703 if (id !== void 0) { 7704 el.setAttribute("id", id); 7705 } 7706 target.appendChild(el); 7707 return el; 7708 } 7709 function removeGlobalNode(el) { 7710 el.remove(); 7711 } 7712 7713 var export_helper_default = (sfc, props) => { 7714 let target = sfc.__vccOpts || sfc; 7715 for (let [key, val] of props) 7716 target[key] = val; 7717 return target; 7718 }; 7719 var _sfc_main6 = { 7720 name: "ArrowDown" 7721 }; 7722 var _hoisted_16$1 = { 7723 viewBox: "0 0 1024 1024", 7724 xmlns: "http://www.w3.org/2000/svg" 7725 }; 7726 var _hoisted_26 = /* @__PURE__ */ vue.createElementVNode("path", { 7727 fill: "currentColor", 7728 d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z" 7729 }, null, -1); 7730 var _hoisted_36 = [ 7731 _hoisted_26 7732 ]; 7733 function _sfc_render6(_ctx, _cache, $props, $setup, $data, $options) {
7734 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_16$1, _hoisted_36); 7735 } 7736 var arrow_down_default = /* @__PURE__ */ export_helper_default(_sfc_main6, [["render", _sfc_render6], ["__file", "arrow-down.vue"]]); 7737 var _sfc_main8 = { 7738 name: "ArrowLeft" 7739 }; 7740 var _hoisted_18$1 = { 7741 viewBox: "0 0 1024 1024", 7742 xmlns: "http://www.w3.org/2000/svg" 7743 }; 7744 var _hoisted_28 = /* @__PURE__ */ vue.createElementVNode("path", { 7745 fill: "currentColor", 7746 d: "M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z" 7747 }, null, -1); 7748 var _hoisted_38 = [ 7749 _hoisted_28 7750 ]; 7751 function _sfc_render8(_ctx, _cache, $props, $setup, $data, $options) { 7752 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_18$1, _hoisted_38); 7753 } 7754 var arrow_left_default = /* @__PURE__ */ export_helper_default(_sfc_main8, [["render", _sfc_render8], ["__file", "arrow-left.vue"]]); 7755 var _sfc_main10 = { 7756 name: "ArrowRight" 7757 }; 7758 var _hoisted_110 = { 7759 viewBox: "0 0 1024 1024", 7760 xmlns: "http://www.w3.org/2000/svg" 7761 }; 7762 var _hoisted_210 = /* @__PURE__ */ vue.createElementVNode("path", { 7763 fill: "currentColor", 7764 d: "M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z" 7765 }, null, -1); 7766 var _hoisted_310 = [ 7767 _hoisted_210 7768 ]; 7769 function _sfc_render10(_ctx, _cache, $props, $setup, $data, $options) { 7770 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_110, _hoisted_310); 7771 } 7772 var arrow_right_default = /* @__PURE__ */ export_helper_default(_sfc_main10, [["render", _sfc_render10], ["__file", "arrow-right.vue"]]); 7773 var _sfc_main12 = { 7774 name: "ArrowUp" 7775 }; 7776 var _hoisted_112 = { 7777 viewBox: "0 0 1024 1024", 7778 xmlns: "http://www.w3.org/2000/svg" 7779 }; 7780 var _hoisted_212 = /* @__PURE__ */ vue.createElementVNode("path", { 7781 fill: "currentColor", 7782 d: "m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0z" 7783 }, null, -1); 7784 var _hoisted_312 = [ 7785 _hoisted_212 7786 ]; 7787 function _sfc_render12(_ctx, _cache, $props, $setup, $data, $options) { 7788 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_112, _hoisted_312); 7789 } 7790 var arrow_up_default = /* @__PURE__ */ export_helper_default(_sfc_main12, [["render", _sfc_render12], ["__file", "arrow-up.vue"]]); 7791 var _sfc_main14 = { 7792 name: "Back" 7793 }; 7794 var _hoisted_114 = { 7795 viewBox: "0 0 1024 1024", 7796 xmlns: "http://www.w3.org/2000/svg" 7797 }; 7798 var _hoisted_214 = /* @__PURE__ */ vue.createElementVNode("path", { 7799 fill: "currentColor", 7800 d: "M224 480h640a32 32 0 1 1 0 64H224a32 32 0 0 1 0-64z" 7801 }, null, -1); 7802 var _hoisted_314 = /* @__PURE__ */ vue.createElementVNode("path", { 7803 fill: "currentColor", 7804 d: "m237.248 512 265.408 265.344a32 32 0 0 1-45.312 45.312l-288-288a32 32 0 0 1 0-45.312l288-288a32 32 0 1 1 45.312 45.312L237.248 512z" 7805 }, null, -1); 7806 var _hoisted_44 = [ 7807 _hoisted_214, 7808 _hoisted_314 7809 ]; 7810 function _sfc_render14(_ctx, _cache, $props, $setup, $data, $options) { 7811 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_114, _hoisted_44); 7812 } 7813 var back_default = /* @__PURE__ */ export_helper_default(_sfc_main14, [["render", _sfc_render14], ["__file", "back.vue"]]); 7814 var _sfc_main29 = { 7815 name: "Calendar" 7816 }; 7817 var _hoisted_129 = { 7818 viewBox: "0 0 1024 1024", 7819 xmlns: "http://www.w3.org/2000/svg" 7820 }; 7821 var _hoisted_229 = /* @__PURE__ */ vue.createElementVNode("path", { 7822 fill: "currentColor", 7823 d: "M128 384v512h768V192H768v32a32 32 0 1 1-64 0v-32H320v32a32 32 0 0 1-64 0v-32H128v128h768v64H128zm192-256h384V96a32 32 0 1 1 64 0v32h160a32 32 0 0 1 32 32v768a32 32 0 0 1-32 32H96a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h160V96a32 32 0 0 1 64 0v32zm-32 384h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm192-192h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm192-192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64z" 7824 }, null, -1); 7825 var _hoisted_328 = [ 7826 _hoisted_229 7827 ]; 7828 function _sfc_render29(_ctx, _cache, $props, $setup, $data, $options) {
7829 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_129, _hoisted_328); 7830 } 7831 var calendar_default = /* @__PURE__ */ export_helper_default(_sfc_main29, [["render", _sfc_render29], ["__file", "calendar.vue"]]); 7832 var _sfc_main34 = { 7833 name: "CaretRight" 7834 }; 7835 var _hoisted_134 = { 7836 viewBox: "0 0 1024 1024", 7837 xmlns: "http://www.w3.org/2000/svg" 7838 }; 7839 var _hoisted_234 = /* @__PURE__ */ vue.createElementVNode("path", { 7840 fill: "currentColor", 7841 d: "M384 192v640l384-320.064z" 7842 }, null, -1); 7843 var _hoisted_333 = [ 7844 _hoisted_234 7845 ]; 7846 function _sfc_render34(_ctx, _cache, $props, $setup, $data, $options) { 7847 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_134, _hoisted_333); 7848 } 7849 var caret_right_default = /* @__PURE__ */ export_helper_default(_sfc_main34, [["render", _sfc_render34], ["__file", "caret-right.vue"]]); 7850 var _sfc_main35 = { 7851 name: "CaretTop" 7852 }; 7853 var _hoisted_135 = { 7854 viewBox: "0 0 1024 1024", 7855 xmlns: "http://www.w3.org/2000/svg" 7856 }; 7857 var _hoisted_235 = /* @__PURE__ */ vue.createElementVNode("path", { 7858 fill: "currentColor", 7859 d: "M512 320 192 704h639.936z" 7860 }, null, -1); 7861 var _hoisted_334 = [ 7862 _hoisted_235 7863 ]; 7864 function _sfc_render35(_ctx, _cache, $props, $setup, $data, $options) { 7865 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_135, _hoisted_334); 7866 } 7867 var caret_top_default = /* @__PURE__ */ export_helper_default(_sfc_main35, [["render", _sfc_render35], ["__file", "caret-top.vue"]]); 7868 var _sfc_main43 = { 7869 name: "Check" 7870 }; 7871 var _hoisted_143 = { 7872 viewBox: "0 0 1024 1024", 7873 xmlns: "http://www.w3.org/2000/svg" 7874 }; 7875 var _hoisted_243 = /* @__PURE__ */ vue.createElementVNode("path", { 7876 fill: "currentColor", 7877 d: "M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z" 7878 }, null, -1); 7879 var _hoisted_342 = [ 7880 _hoisted_243 7881 ]; 7882 function _sfc_render43(_ctx, _cache, $props, $setup, $data, $options) { 7883 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_143, _hoisted_342); 7884 } 7885 var check_default = /* @__PURE__ */ export_helper_default(_sfc_main43, [["render", _sfc_render43], ["__file", "check.vue"]]); 7886 var _sfc_main47 = { 7887 name: "CircleCheckFilled" 7888 }; 7889 var _hoisted_147 = { 7890 viewBox: "0 0 1024 1024", 7891 xmlns: "http://www.w3.org/2000/svg" 7892 }; 7893 var _hoisted_247 = /* @__PURE__ */ vue.createElementVNode("path", { 7894 fill: "currentColor", 7895 d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336L456.192 600.384z" 7896 }, null, -1); 7897 var _hoisted_346 = [ 7898 _hoisted_247 7899 ]; 7900 function _sfc_render47(_ctx, _cache, $props, $setup, $data, $options) { 7901 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_147, _hoisted_346); 7902 } 7903 var circle_check_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main47, [["render", _sfc_render47], ["__file", "circle-check-filled.vue"]]); 7904 var _sfc_main48 = { 7905 name: "CircleCheck" 7906 }; 7907 var _hoisted_148 = { 7908 viewBox: "0 0 1024 1024", 7909 xmlns: "http://www.w3.org/2000/svg" 7910 }; 7911 var _hoisted_248 = /* @__PURE__ */ vue.createElementVNode("path", { 7912 fill: "currentColor", 7913 d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z" 7914 }, null, -1); 7915 var _hoisted_347 = /* @__PURE__ */ vue.createElementVNode("path", { 7916 fill: "currentColor", 7917 d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z" 7918 }, null, -1); 7919 var _hoisted_414 = [ 7920 _hoisted_248, 7921 _hoisted_347 7922 ]; 7923 function _sfc_render48(_ctx, _cache, $props, $setup, $data, $options) {
7924 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_148, _hoisted_414); 7925 } 7926 var circle_check_default = /* @__PURE__ */ export_helper_default(_sfc_main48, [["render", _sfc_render48], ["__file", "circle-check.vue"]]); 7927 var _sfc_main49 = { 7928 name: "CircleCloseFilled" 7929 }; 7930 var _hoisted_149 = { 7931 viewBox: "0 0 1024 1024", 7932 xmlns: "http://www.w3.org/2000/svg" 7933 }; 7934 var _hoisted_249 = /* @__PURE__ */ vue.createElementVNode("path", { 7935 fill: "currentColor", 7936 d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336L512 457.664z" 7937 }, null, -1); 7938 var _hoisted_348 = [ 7939 _hoisted_249 7940 ]; 7941 function _sfc_render49(_ctx, _cache, $props, $setup, $data, $options) { 7942 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_149, _hoisted_348); 7943 } 7944 var circle_close_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main49, [["render", _sfc_render49], ["__file", "circle-close-filled.vue"]]); 7945 var _sfc_main50 = { 7946 name: "CircleClose" 7947 }; 7948 var _hoisted_150 = { 7949 viewBox: "0 0 1024 1024", 7950 xmlns: "http://www.w3.org/2000/svg" 7951 }; 7952 var _hoisted_250 = /* @__PURE__ */ vue.createElementVNode("path", { 7953 fill: "currentColor", 7954 d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248L466.752 512z" 7955 }, null, -1); 7956 var _hoisted_349 = /* @__PURE__ */ vue.createElementVNode("path", { 7957 fill: "currentColor", 7958 d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z" 7959 }, null, -1); 7960 var _hoisted_415 = [ 7961 _hoisted_250, 7962 _hoisted_349 7963 ]; 7964 function _sfc_render50(_ctx, _cache, $props, $setup, $data, $options) { 7965 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_150, _hoisted_415); 7966 } 7967 var circle_close_default = /* @__PURE__ */ export_helper_default(_sfc_main50, [["render", _sfc_render50], ["__file", "circle-close.vue"]]); 7968 var _sfc_main53 = { 7969 name: "Clock" 7970 }; 7971 var _hoisted_153 = { 7972 viewBox: "0 0 1024 1024", 7973 xmlns: "http://www.w3.org/2000/svg" 7974 }; 7975 var _hoisted_253 = /* @__PURE__ */ vue.createElementVNode("path", { 7976 fill: "currentColor", 7977 d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z" 7978 }, null, -1); 7979 var _hoisted_352 = /* @__PURE__ */ vue.createElementVNode("path", { 7980 fill: "currentColor", 7981 d: "M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32z" 7982 }, null, -1); 7983 var _hoisted_417 = /* @__PURE__ */ vue.createElementVNode("path", { 7984 fill: "currentColor", 7985 d: "M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32z" 7986 }, null, -1); 7987 var _hoisted_55 = [ 7988 _hoisted_253, 7989 _hoisted_352, 7990 _hoisted_417 7991 ]; 7992 function _sfc_render53(_ctx, _cache, $props, $setup, $data, $options) { 7993 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_153, _hoisted_55); 7994 } 7995 var clock_default = /* @__PURE__ */ export_helper_default(_sfc_main53, [["render", _sfc_render53], ["__file", "clock.vue"]]); 7996 var _sfc_main55 = { 7997 name: "Close" 7998 }; 7999 var _hoisted_155 = { 8000 viewBox: "0 0 1024 1024", 8001 xmlns: "http://www.w3.org/2000/svg" 8002 }; 8003 var _hoisted_255 = /* @__PURE__ */ vue.createElementVNode("path", { 8004 fill: "currentColor", 8005 d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z" 8006 }, null, -1); 8007 var _hoisted_354 = [ 8008 _hoisted_255 8009 ]; 8010 function _sfc_render55(_ctx, _cache, $props, $setup, $data, $options) {
8011 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_155, _hoisted_354); 8012 } 8013 var close_default = /* @__PURE__ */ export_helper_default(_sfc_main55, [["render", _sfc_render55], ["__file", "close.vue"]]); 8014 var _sfc_main71 = { 8015 name: "DArrowLeft" 8016 }; 8017 var _hoisted_171 = { 8018 viewBox: "0 0 1024 1024", 8019 xmlns: "http://www.w3.org/2000/svg" 8020 }; 8021 var _hoisted_271 = /* @__PURE__ */ vue.createElementVNode("path", { 8022 fill: "currentColor", 8023 d: "M529.408 149.376a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L259.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L197.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224zm256 0a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L515.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L453.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224z" 8024 }, null, -1); 8025 var _hoisted_370 = [ 8026 _hoisted_271 8027 ]; 8028 function _sfc_render71(_ctx, _cache, $props, $setup, $data, $options) { 8029 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_171, _hoisted_370); 8030 } 8031 var d_arrow_left_default = /* @__PURE__ */ export_helper_default(_sfc_main71, [["render", _sfc_render71], ["__file", "d-arrow-left.vue"]]); 8032 var _sfc_main72 = { 8033 name: "DArrowRight" 8034 }; 8035 var _hoisted_172 = { 8036 viewBox: "0 0 1024 1024", 8037 xmlns: "http://www.w3.org/2000/svg" 8038 }; 8039 var _hoisted_272 = /* @__PURE__ */ vue.createElementVNode("path", { 8040 fill: "currentColor", 8041 d: "M452.864 149.312a29.12 29.12 0 0 1 41.728.064L826.24 489.664a32 32 0 0 1 0 44.672L494.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L764.736 512 452.864 192a30.592 30.592 0 0 1 0-42.688zm-256 0a29.12 29.12 0 0 1 41.728.064L570.24 489.664a32 32 0 0 1 0 44.672L238.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L508.736 512 196.864 192a30.592 30.592 0 0 1 0-42.688z" 8042 }, null, -1); 8043 var _hoisted_371 = [ 8044 _hoisted_272 8045 ]; 8046 function _sfc_render72(_ctx, _cache, $props, $setup, $data, $options) { 8047 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_172, _hoisted_371); 8048 } 8049 var d_arrow_right_default = /* @__PURE__ */ export_helper_default(_sfc_main72, [["render", _sfc_render72], ["__file", "d-arrow-right.vue"]]); 8050 var _sfc_main79 = { 8051 name: "Delete" 8052 }; 8053 var _hoisted_179 = { 8054 viewBox: "0 0 1024 1024", 8055 xmlns: "http://www.w3.org/2000/svg" 8056 }; 8057 var _hoisted_279 = /* @__PURE__ */ vue.createElementVNode("path", { 8058 fill: "currentColor", 8059 d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32zm192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32z" 8060 }, null, -1); 8061 var _hoisted_378 = [ 8062 _hoisted_279 8063 ]; 8064 function _sfc_render79(_ctx, _cache, $props, $setup, $data, $options) { 8065 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_179, _hoisted_378); 8066 } 8067 var delete_default = /* @__PURE__ */ export_helper_default(_sfc_main79, [["render", _sfc_render79], ["__file", "delete.vue"]]); 8068 var _sfc_main89 = { 8069 name: "Document" 8070 }; 8071 var _hoisted_189 = { 8072 viewBox: "0 0 1024 1024", 8073 xmlns: "http://www.w3.org/2000/svg" 8074 }; 8075 var _hoisted_289 = /* @__PURE__ */ vue.createElementVNode("path", { 8076 fill: "currentColor", 8077 d: "M832 384H576V128H192v768h640V384zm-26.496-64L640 154.496V320h165.504zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32zm160 448h384v64H320v-64zm0-192h160v64H320v-64zm0 384h384v64H320v-64z" 8078 }, null, -1); 8079 var _hoisted_388 = [ 8080 _hoisted_289 8081 ]; 8082 function _sfc_render89(_ctx, _cache, $props, $setup, $data, $options) { 8083 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_189, _hoisted_388); 8084 } 8085 var document_default = /* @__PURE__ */ export_helper_default(_sfc_main89, [["render", _sfc_render89], ["__file", "document.vue"]]); 8086 var _sfc_main117 = { 8087 name: "FullScreen" 8088 }; 8089 var _hoisted_1117 = {
8090 viewBox: "0 0 1024 1024", 8091 xmlns: "http://www.w3.org/2000/svg" 8092 }; 8093 var _hoisted_2117 = /* @__PURE__ */ vue.createElementVNode("path", { 8094 fill: "currentColor", 8095 d: "m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64v.064zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64l-192 .192zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64l192-.192zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64v-.064z" 8096 }, null, -1); 8097 var _hoisted_3116 = [ 8098 _hoisted_2117 8099 ]; 8100 function _sfc_render117(_ctx, _cache, $props, $setup, $data, $options) { 8101 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1117, _hoisted_3116); 8102 } 8103 var full_screen_default = /* @__PURE__ */ export_helper_default(_sfc_main117, [["render", _sfc_render117], ["__file", "full-screen.vue"]]); 8104 var _sfc_main130 = { 8105 name: "Hide" 8106 }; 8107 var _hoisted_1130 = { 8108 viewBox: "0 0 1024 1024", 8109 xmlns: "http://www.w3.org/2000/svg" 8110 }; 8111 var _hoisted_2130 = /* @__PURE__ */ vue.createElementVNode("path", { 8112 d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2L371.2 588.8ZM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z", 8113 fill: "currentColor" 8114 }, null, -1); 8115 var _hoisted_3129 = /* @__PURE__ */ vue.createElementVNode("path", { 8116 d: "M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z", 8117 fill: "currentColor" 8118 }, null, -1); 8119 var _hoisted_436 = [ 8120 _hoisted_2130, 8121 _hoisted_3129 8122 ]; 8123 function _sfc_render130(_ctx, _cache, $props, $setup, $data, $options) { 8124 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1130, _hoisted_436); 8125 } 8126 var hide_default = /* @__PURE__ */ export_helper_default(_sfc_main130, [["render", _sfc_render130], ["__file", "hide.vue"]]); 8127 var _sfc_main140 = { 8128 name: "InfoFilled" 8129 }; 8130 var _hoisted_1140 = { 8131 viewBox: "0 0 1024 1024", 8132 xmlns: "http://www.w3.org/2000/svg" 8133 }; 8134 var _hoisted_2140 = /* @__PURE__ */ vue.createElementVNode("path", { 8135 fill: "currentColor", 8136 d: "M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64zm67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344zM590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z" 8137 }, null, -1); 8138 var _hoisted_3139 = [ 8139 _hoisted_2140 8140 ]; 8141 function _sfc_render140(_ctx, _cache, $props, $setup, $data, $options) {
8142 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1140, _hoisted_3139); 8143 } 8144 var info_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main140, [["render", _sfc_render140], ["__file", "info-filled.vue"]]); 8145 var _sfc_main147 = { 8146 name: "Loading" 8147 }; 8148 var _hoisted_1147 = { 8149 viewBox: "0 0 1024 1024", 8150 xmlns: "http://www.w3.org/2000/svg" 8151 }; 8152 var _hoisted_2147 = /* @__PURE__ */ vue.createElementVNode("path", { 8153 fill: "currentColor", 8154 d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z" 8155 }, null, -1); 8156 var _hoisted_3146 = [ 8157 _hoisted_2147 8158 ]; 8159 function _sfc_render147(_ctx, _cache, $props, $setup, $data, $options) { 8160 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1147, _hoisted_3146); 8161 } 8162 var loading_default = /* @__PURE__ */ export_helper_default(_sfc_main147, [["render", _sfc_render147], ["__file", "loading.vue"]]); 8163 var _sfc_main165 = { 8164 name: "Minus" 8165 }; 8166 var _hoisted_1165 = { 8167 viewBox: "0 0 1024 1024", 8168 xmlns: "http://www.w3.org/2000/svg" 8169 }; 8170 var _hoisted_2165 = /* @__PURE__ */ vue.createElementVNode("path", { 8171 fill: "currentColor", 8172 d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z" 8173 }, null, -1); 8174 var _hoisted_3164 = [ 8175 _hoisted_2165 8176 ]; 8177 function _sfc_render165(_ctx, _cache, $props, $setup, $data, $options) { 8178 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1165, _hoisted_3164); 8179 } 8180 var minus_default = /* @__PURE__ */ export_helper_default(_sfc_main165, [["render", _sfc_render165], ["__file", "minus.vue"]]); 8181 var _sfc_main170 = { 8182 name: "MoreFilled" 8183 }; 8184 var _hoisted_1170 = { 8185 viewBox: "0 0 1024 1024", 8186 xmlns: "http://www.w3.org/2000/svg" 8187 }; 8188 var _hoisted_2170 = /* @__PURE__ */ vue.createElementVNode("path", { 8189 fill: "currentColor", 8190 d: "M176 416a112 112 0 1 1 0 224 112 112 0 0 1 0-224zm336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224zm336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224z" 8191 }, null, -1); 8192 var _hoisted_3169 = [ 8193 _hoisted_2170 8194 ]; 8195 function _sfc_render170(_ctx, _cache, $props, $setup, $data, $options) { 8196 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1170, _hoisted_3169); 8197 } 8198 var more_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main170, [["render", _sfc_render170], ["__file", "more-filled.vue"]]); 8199 var _sfc_main171 = { 8200 name: "More" 8201 }; 8202 var _hoisted_1171 = { 8203 viewBox: "0 0 1024 1024", 8204 xmlns: "http://www.w3.org/2000/svg" 8205 }; 8206 var _hoisted_2171 = /* @__PURE__ */ vue.createElementVNode("path", { 8207 fill: "currentColor", 8208 d: "M176 416a112 112 0 1 0 0 224 112 112 0 0 0 0-224m0 64a48 48 0 1 1 0 96 48 48 0 0 1 0-96zm336-64a112 112 0 1 1 0 224 112 112 0 0 1 0-224zm0 64a48 48 0 1 0 0 96 48 48 0 0 0 0-96zm336-64a112 112 0 1 1 0 224 112 112 0 0 1 0-224zm0 64a48 48 0 1 0 0 96 48 48 0 0 0 0-96z" 8209 }, null, -1); 8210 var _hoisted_3170 = [ 8211 _hoisted_2171 8212 ]; 8213 function _sfc_render171(_ctx, _cache, $props, $setup, $data, $options) { 8214 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1171, _hoisted_3170); 8215 } 8216 var more_default = /* @__PURE__ */ export_helper_default(_sfc_main171, [["render", _sfc_render171], ["__file", "more.vue"]]); 8217 var _sfc_main191 = { 8218 name: "PictureFilled" 8219 }; 8220 var _hoisted_1191 = {
8221 viewBox: "0 0 1024 1024", 8222 xmlns: "http://www.w3.org/2000/svg" 8223 }; 8224 var _hoisted_2191 = /* @__PURE__ */ vue.createElementVNode("path", { 8225 fill: "currentColor", 8226 d: "M96 896a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h832a32 32 0 0 1 32 32v704a32 32 0 0 1-32 32H96zm315.52-228.48-68.928-68.928a32 32 0 0 0-45.248 0L128 768.064h778.688l-242.112-290.56a32 32 0 0 0-49.216 0L458.752 665.408a32 32 0 0 1-47.232 2.112zM256 384a96 96 0 1 0 192.064-.064A96 96 0 0 0 256 384z" 8227 }, null, -1); 8228 var _hoisted_3190 = [ 8229 _hoisted_2191 8230 ]; 8231 function _sfc_render191(_ctx, _cache, $props, $setup, $data, $options) { 8232 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1191, _hoisted_3190); 8233 } 8234 var picture_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main191, [["render", _sfc_render191], ["__file", "picture-filled.vue"]]); 8235 var _sfc_main197 = { 8236 name: "Plus" 8237 }; 8238 var _hoisted_1197 = { 8239 viewBox: "0 0 1024 1024", 8240 xmlns: "http://www.w3.org/2000/svg" 8241 }; 8242 var _hoisted_2197 = /* @__PURE__ */ vue.createElementVNode("path", { 8243 fill: "currentColor", 8244 d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64h352z" 8245 }, null, -1); 8246 var _hoisted_3196 = [ 8247 _hoisted_2197 8248 ]; 8249 function _sfc_render197(_ctx, _cache, $props, $setup, $data, $options) { 8250 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1197, _hoisted_3196); 8251 } 8252 var plus_default = /* @__PURE__ */ export_helper_default(_sfc_main197, [["render", _sfc_render197], ["__file", "plus.vue"]]); 8253 var _sfc_main206 = { 8254 name: "QuestionFilled" 8255 }; 8256 var _hoisted_1206 = { 8257 viewBox: "0 0 1024 1024", 8258 xmlns: "http://www.w3.org/2000/svg" 8259 }; 8260 var _hoisted_2206 = /* @__PURE__ */ vue.createElementVNode("path", { 8261 fill: "currentColor", 8262 d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592 0-42.944-14.08-76.736-42.24-101.376-28.16-25.344-65.472-37.312-111.232-37.312zm-12.672 406.208a54.272 54.272 0 0 0-38.72 14.784 49.408 49.408 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.848 54.848 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.968 51.968 0 0 0-15.488-38.016 55.936 55.936 0 0 0-39.424-14.784z" 8263 }, null, -1); 8264 var _hoisted_3205 = [ 8265 _hoisted_2206 8266 ]; 8267 function _sfc_render206(_ctx, _cache, $props, $setup, $data, $options) { 8268 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1206, _hoisted_3205); 8269 } 8270 var question_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main206, [["render", _sfc_render206], ["__file", "question-filled.vue"]]); 8271 var _sfc_main210 = { 8272 name: "RefreshLeft" 8273 }; 8274 var _hoisted_1210 = { 8275 viewBox: "0 0 1024 1024", 8276 xmlns: "http://www.w3.org/2000/svg" 8277 }; 8278 var _hoisted_2210 = /* @__PURE__ */ vue.createElementVNode("path", { 8279 fill: "currentColor", 8280 d: "M289.088 296.704h92.992a32 32 0 0 1 0 64H232.96a32 32 0 0 1-32-32V179.712a32 32 0 0 1 64 0v50.56a384 384 0 0 1 643.84 282.88 384 384 0 0 1-383.936 384 384 384 0 0 1-384-384h64a320 320 0 1 0 640 0 320 320 0 0 0-555.712-216.448z" 8281 }, null, -1); 8282 var _hoisted_3209 = [ 8283 _hoisted_2210 8284 ]; 8285 function _sfc_render210(_ctx, _cache, $props, $setup, $data, $options) { 8286 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1210, _hoisted_3209); 8287 } 8288 var refresh_left_default = /* @__PURE__ */ export_helper_default(_sfc_main210, [["render", _sfc_render210], ["__file", "refresh-left.vue"]]); 8289 var _sfc_main211 = { 8290 name: "RefreshRight" 8291 }; 8292 var _hoisted_1211 = {
8293 viewBox: "0 0 1024 1024", 8294 xmlns: "http://www.w3.org/2000/svg" 8295 }; 8296 var _hoisted_2211 = /* @__PURE__ */ vue.createElementVNode("path", { 8297 fill: "currentColor", 8298 d: "M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88z" 8299 }, null, -1); 8300 var _hoisted_3210 = [ 8301 _hoisted_2211 8302 ]; 8303 function _sfc_render211(_ctx, _cache, $props, $setup, $data, $options) { 8304 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1211, _hoisted_3210); 8305 } 8306 var refresh_right_default = /* @__PURE__ */ export_helper_default(_sfc_main211, [["render", _sfc_render211], ["__file", "refresh-right.vue"]]); 8307 var _sfc_main217 = { 8308 name: "ScaleToOriginal" 8309 }; 8310 var _hoisted_1217 = { 8311 viewBox: "0 0 1024 1024", 8312 xmlns: "http://www.w3.org/2000/svg" 8313 }; 8314 var _hoisted_2217 = /* @__PURE__ */ vue.createElementVNode("path", { 8315 fill: "currentColor", 8316 d: "M813.176 180.706a60.235 60.235 0 0 1 60.236 60.235v481.883a60.235 60.235 0 0 1-60.236 60.235H210.824a60.235 60.235 0 0 1-60.236-60.235V240.94a60.235 60.235 0 0 1 60.236-60.235h602.352zm0-60.235H210.824A120.47 120.47 0 0 0 90.353 240.94v481.883a120.47 120.47 0 0 0 120.47 120.47h602.353a120.47 120.47 0 0 0 120.471-120.47V240.94a120.47 120.47 0 0 0-120.47-120.47zm-120.47 180.705a30.118 30.118 0 0 0-30.118 30.118v301.177a30.118 30.118 0 0 0 60.236 0V331.294a30.118 30.118 0 0 0-30.118-30.118zm-361.412 0a30.118 30.118 0 0 0-30.118 30.118v301.177a30.118 30.118 0 1 0 60.236 0V331.294a30.118 30.118 0 0 0-30.118-30.118zM512 361.412a30.118 30.118 0 0 0-30.118 30.117v30.118a30.118 30.118 0 0 0 60.236 0V391.53A30.118 30.118 0 0 0 512 361.412zM512 512a30.118 30.118 0 0 0-30.118 30.118v30.117a30.118 30.118 0 0 0 60.236 0v-30.117A30.118 30.118 0 0 0 512 512z" 8317 }, null, -1); 8318 var _hoisted_3216 = [ 8319 _hoisted_2217 8320 ]; 8321 function _sfc_render217(_ctx, _cache, $props, $setup, $data, $options) { 8322 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1217, _hoisted_3216); 8323 } 8324 var scale_to_original_default = /* @__PURE__ */ export_helper_default(_sfc_main217, [["render", _sfc_render217], ["__file", "scale-to-original.vue"]]); 8325 var _sfc_main220 = { 8326 name: "Search" 8327 }; 8328 var _hoisted_1220 = { 8329 viewBox: "0 0 1024 1024", 8330 xmlns: "http://www.w3.org/2000/svg" 8331 }; 8332 var _hoisted_2220 = /* @__PURE__ */ vue.createElementVNode("path", { 8333 fill: "currentColor", 8334 d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704z" 8335 }, null, -1); 8336 var _hoisted_3219 = [ 8337 _hoisted_2220 8338 ]; 8339 function _sfc_render220(_ctx, _cache, $props, $setup, $data, $options) { 8340 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1220, _hoisted_3219); 8341 } 8342 var search_default = /* @__PURE__ */ export_helper_default(_sfc_main220, [["render", _sfc_render220], ["__file", "search.vue"]]); 8343 var _sfc_main236 = { 8344 name: "SortDown" 8345 }; 8346 var _hoisted_1236 = { 8347 viewBox: "0 0 1024 1024", 8348 xmlns: "http://www.w3.org/2000/svg" 8349 }; 8350 var _hoisted_2236 = /* @__PURE__ */ vue.createElementVNode("path", { 8351 fill: "currentColor", 8352 d: "M576 96v709.568L333.312 562.816A32 32 0 1 0 288 608l297.408 297.344A32 32 0 0 0 640 882.688V96a32 32 0 0 0-64 0z" 8353 }, null, -1); 8354 var _hoisted_3235 = [ 8355 _hoisted_2236 8356 ]; 8357 function _sfc_render236(_ctx, _cache, $props, $setup, $data, $options) { 8358 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1236, _hoisted_3235); 8359 } 8360 var sort_down_default = /* @__PURE__ */ export_helper_default(_sfc_main236, [["render", _sfc_render236], ["__file", "sort-down.vue"]]); 8361 var _sfc_main237 = { 8362 name: "SortUp" 8363 }; 8364 var _hoisted_1237 = { 8365 viewBox: "0 0 1024 1024", 8366 xmlns: "http://www.w3.org/2000/svg" 8367 }; 8368 var _hoisted_2237 = /* @__PURE__ */ vue.createElementVNode("path", { 8369 fill: "currentColor", 8370 d: "M384 141.248V928a32 32 0 1 0 64 0V218.56l242.688 242.688A32 32 0 1 0 736 416L438.592 118.656A32 32 0 0 0 384 141.248z" 8371 }, null, -1); 8372 var _hoisted_3236 = [ 8373 _hoisted_2237 8374 ]; 8375 function _sfc_render237(_ctx, _cache, $props, $setup, $data, $options) {
8376 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1237, _hoisted_3236); 8377 } 8378 var sort_up_default = /* @__PURE__ */ export_helper_default(_sfc_main237, [["render", _sfc_render237], ["__file", "sort-up.vue"]]); 8379 var _sfc_main240 = { 8380 name: "StarFilled" 8381 }; 8382 var _hoisted_1240 = { 8383 viewBox: "0 0 1024 1024", 8384 xmlns: "http://www.w3.org/2000/svg" 8385 }; 8386 var _hoisted_2240 = /* @__PURE__ */ vue.createElementVNode("path", { 8387 fill: "currentColor", 8388 d: "M283.84 867.84 512 747.776l228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72z" 8389 }, null, -1); 8390 var _hoisted_3239 = [ 8391 _hoisted_2240 8392 ]; 8393 function _sfc_render240(_ctx, _cache, $props, $setup, $data, $options) { 8394 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1240, _hoisted_3239); 8395 } 8396 var star_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main240, [["render", _sfc_render240], ["__file", "star-filled.vue"]]); 8397 var _sfc_main241 = { 8398 name: "Star" 8399 }; 8400 var _hoisted_1241 = { 8401 viewBox: "0 0 1024 1024", 8402 xmlns: "http://www.w3.org/2000/svg" 8403 }; 8404 var _hoisted_2241 = /* @__PURE__ */ vue.createElementVNode("path", { 8405 fill: "currentColor", 8406 d: "m512 747.84 228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72L512 747.84zM313.6 924.48a70.4 70.4 0 0 1-102.144-74.24l37.888-220.928L88.96 472.96A70.4 70.4 0 0 1 128 352.896l221.76-32.256 99.2-200.96a70.4 70.4 0 0 1 126.208 0l99.2 200.96 221.824 32.256a70.4 70.4 0 0 1 39.04 120.064L774.72 629.376l37.888 220.928a70.4 70.4 0 0 1-102.144 74.24L512 820.096l-198.4 104.32z" 8407 }, null, -1); 8408 var _hoisted_3240 = [ 8409 _hoisted_2241 8410 ]; 8411 function _sfc_render241(_ctx, _cache, $props, $setup, $data, $options) { 8412 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1241, _hoisted_3240); 8413 } 8414 var star_default = /* @__PURE__ */ export_helper_default(_sfc_main241, [["render", _sfc_render241], ["__file", "star.vue"]]); 8415 var _sfc_main243 = { 8416 name: "SuccessFilled" 8417 }; 8418 var _hoisted_1243 = { 8419 viewBox: "0 0 1024 1024", 8420 xmlns: "http://www.w3.org/2000/svg" 8421 }; 8422 var _hoisted_2243 = /* @__PURE__ */ vue.createElementVNode("path", { 8423 fill: "currentColor", 8424 d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336L456.192 600.384z" 8425 }, null, -1); 8426 var _hoisted_3242 = [ 8427 _hoisted_2243 8428 ]; 8429 function _sfc_render243(_ctx, _cache, $props, $setup, $data, $options) { 8430 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1243, _hoisted_3242); 8431 } 8432 var success_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main243, [["render", _sfc_render243], ["__file", "success-filled.vue"]]); 8433 var _sfc_main274 = { 8434 name: "View" 8435 }; 8436 var _hoisted_1274 = { 8437 viewBox: "0 0 1024 1024", 8438 xmlns: "http://www.w3.org/2000/svg" 8439 }; 8440 var _hoisted_2274 = /* @__PURE__ */ vue.createElementVNode("path", { 8441 fill: "currentColor", 8442 d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448zm0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z" 8443 }, null, -1); 8444 var _hoisted_3273 = [ 8445 _hoisted_2274 8446 ]; 8447 function _sfc_render274(_ctx, _cache, $props, $setup, $data, $options) {
8448 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1274, _hoisted_3273); 8449 } 8450 var view_default = /* @__PURE__ */ export_helper_default(_sfc_main274, [["render", _sfc_render274], ["__file", "view.vue"]]); 8451 var _sfc_main277 = { 8452 name: "WarningFilled" 8453 }; 8454 var _hoisted_1277 = { 8455 viewBox: "0 0 1024 1024", 8456 xmlns: "http://www.w3.org/2000/svg" 8457 }; 8458 var _hoisted_2277 = /* @__PURE__ */ vue.createElementVNode("path", { 8459 fill: "currentColor", 8460 d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256zm0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4z" 8461 }, null, -1); 8462 var _hoisted_3276 = [ 8463 _hoisted_2277 8464 ]; 8465 function _sfc_render277(_ctx, _cache, $props, $setup, $data, $options) { 8466 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1277, _hoisted_3276); 8467 } 8468 var warning_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main277, [["render", _sfc_render277], ["__file", "warning-filled.vue"]]); 8469 var _sfc_main282 = { 8470 name: "ZoomIn" 8471 }; 8472 var _hoisted_1282 = { 8473 viewBox: "0 0 1024 1024", 8474 xmlns: "http://www.w3.org/2000/svg" 8475 }; 8476 var _hoisted_2282 = /* @__PURE__ */ vue.createElementVNode("path", { 8477 fill: "currentColor", 8478 d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704zm-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64h96z" 8479 }, null, -1); 8480 var _hoisted_3281 = [ 8481 _hoisted_2282 8482 ]; 8483 function _sfc_render282(_ctx, _cache, $props, $setup, $data, $options) { 8484 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1282, _hoisted_3281); 8485 } 8486 var zoom_in_default = /* @__PURE__ */ export_helper_default(_sfc_main282, [["render", _sfc_render282], ["__file", "zoom-in.vue"]]); 8487 var _sfc_main283 = { 8488 name: "ZoomOut" 8489 }; 8490 var _hoisted_1283 = { 8491 viewBox: "0 0 1024 1024", 8492 xmlns: "http://www.w3.org/2000/svg" 8493 }; 8494 var _hoisted_2283 = /* @__PURE__ */ vue.createElementVNode("path", { 8495 fill: "currentColor", 8496 d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704zM352 448h256a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64z" 8497 }, null, -1); 8498 var _hoisted_3282 = [ 8499 _hoisted_2283 8500 ]; 8501 function _sfc_render283(_ctx, _cache, $props, $setup, $data, $options) { 8502 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1283, _hoisted_3282); 8503 } 8504 var zoom_out_default = /* @__PURE__ */ export_helper_default(_sfc_main283, [["render", _sfc_render283], ["__file", "zoom-out.vue"]]); 8505 /*! Element Plus Icons Vue v2.0.6 */ 8506 8507 const epPropKey = "__epPropKey"; 8508 const definePropType = (val) => val; 8509 const isEpProp = (val) => isObject$1(val) && !!val[epPropKey]; 8510 const buildProp = (prop, key) => { 8511 if (!isObject$1(prop) || isEpProp(prop)) 8512 return prop; 8513 const { values, required, default: defaultValue, type, validator } = prop; 8514 const _validator = values || validator ? (val) => { 8515 let valid = false; 8516 let allowedValues = []; 8517 if (values) { 8518 allowedValues = Array.from(values); 8519 if (hasOwn(prop, "default")) { 8520 allowedValues.push(defaultValue); 8521 } 8522 valid || (valid = allowedValues.includes(val)); 8523 } 8524 if (validator) 8525 valid || (valid = validator(val)); 8526 if (!valid && allowedValues.length > 0) { 8527 const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", "); 8528 vue.warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`); 8529 } 8530 return valid; 8531 } : void 0; 8532 const epProp = { 8533 type, 8534 required: !!required, 8535 validator: _validator, 8536 [epPropKey]: true 8537 }; 8538 if (hasOwn(prop, "default")) 8539 epProp.default = defaultValue; 8540 return epProp; 8541 }; 8542 const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [ 8543 key, 8544 buildProp(option, key) 8545 ])); 8546 8547 const iconPropType = definePropType([ 8548 String, 8549 Object, 8550 Function 8551 ]); 8552 const CloseComponents = { 8553 Close: close_default 8554 }; 8555 const TypeComponents = { 8556 Close: close_default, 8557 SuccessFilled: success_filled_default, 8558 InfoFilled: info_filled_default, 8559 WarningFilled: warning_filled_default, 8560 CircleCloseFilled: circle_close_filled_default 8561 }; 8562 const TypeComponentsMap = { 8563 success: success_filled_default, 8564 warning: warning_filled_default, 8565 error: circle_close_filled_default, 8566 info: info_filled_default 8567 }; 8568 const ValidateComponentsMap = { 8569 validating: loading_default, 8570 success: circle_check_default, 8571 error: circle_close_default 8572 }; 8573 8574 const withInstall = (main, extra) => { 8575 main.install = (app) => { 8576 for (const comp of [main, ...Object.values(extra != null ? extra : {})]) { 8577 app.component(comp.name, comp); 8578 } 8579 }; 8580 if (extra) { 8581 for (const [key, comp] of Object.entries(extra)) { 8582 main[key] = comp; 8583 } 8584 } 8585 return main; 8586 }; 8587 const withInstallFunction = (fn, name) => { 8588 fn.install = (app) => { 8589 fn._context = app._context; 8590 app.config.globalProperties[name] = fn; 8591 }; 8592 return fn; 8593 }; 8594 const withInstallDirective = (directive, name) => { 8595 directive.install = (app) => { 8596 app.directive(name, directive); 8597 }; 8598 return directive; 8599 }; 8600 const withNoopInstall = (component) => { 8601 component.install = NOOP; 8602 return component; 8603 }; 8604 8605 const composeRefs = (...refs) => { 8606 return (el) => {
8607 refs.forEach((ref) => { 8608 if (isFunction$1(ref)) { 8609 ref(el); 8610 } else { 8611 ref.value = el; 8612 } 8613 }); 8614 }; 8615 }; 8616 8617 const EVENT_CODE = { 8618 tab: "Tab", 8619 enter: "Enter", 8620 space: "Space", 8621 left: "ArrowLeft", 8622 up: "ArrowUp", 8623 right: "ArrowRight", 8624 down: "ArrowDown", 8625 esc: "Escape", 8626 delete: "Delete", 8627 backspace: "Backspace", 8628 numpadEnter: "NumpadEnter", 8629 pageUp: "PageUp", 8630 pageDown: "PageDown", 8631 home: "Home", 8632 end: "End" 8633 }; 8634 8635 const datePickTypes = [ 8636 "year", 8637 "month", 8638 "date", 8639 "dates", 8640 "week", 8641 "datetime", 8642 "datetimerange", 8643 "daterange", 8644 "monthrange" 8645 ]; 8646 const WEEK_DAYS = [ 8647 "sun", 8648 "mon", 8649 "tue", 8650 "wed", 8651 "thu", 8652 "fri", 8653 "sat" 8654 ]; 8655 8656 const UPDATE_MODEL_EVENT = "update:modelValue"; 8657 const CHANGE_EVENT = "change"; 8658 const INPUT_EVENT = "input"; 8659 8660 const INSTALLED_KEY = Symbol("INSTALLED_KEY"); 8661 8662 const componentSizes = ["", "default", "small", "large"]; 8663 const componentSizeMap = { 8664 large: 40, 8665 default: 32, 8666 small: 24 8667 }; 8668 8669 const getComponentSize = (size) => { 8670 return componentSizeMap[size || "default"]; 8671 }; 8672 8673 const isValidComponentSize = (val) => ["", ...componentSizes].includes(val); 8674 8675 var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => { 8676 PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT"; 8677 PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS"; 8678 PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE"; 8679 PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS"; 8680 PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS"; 8681 PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS"; 8682 PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT"; 8683 PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT"; 8684 PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT"; 8685 PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH"; 8686 PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS"; 8687 PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED"; 8688 PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL"; 8689 return PatchFlags2; 8690 })(PatchFlags || {}); 8691 function isFragment(node) { 8692 return vue.isVNode(node) && node.type === vue.Fragment; 8693 } 8694 function isComment(node) { 8695 return vue.isVNode(node) && node.type === vue.Comment; 8696 } 8697 function isValidElementNode(node) { 8698 return vue.isVNode(node) && !isFragment(node) && !isComment(node); 8699 } 8700 const getNormalizedProps = (node) => { 8701 if (!vue.isVNode(node)) { 8702 return {}; 8703 } 8704 const raw = node.props || {}; 8705 const type = (vue.isVNode(node.type) ? node.type.props : void 0) || {}; 8706 const props = {}; 8707 Object.keys(type).forEach((key) => { 8708 if (hasOwn(type[key], "default")) { 8709 props[key] = type[key].default; 8710 } 8711 });
8712 Object.keys(raw).forEach((key) => { 8713 props[camelize(key)] = raw[key]; 8714 }); 8715 return props; 8716 }; 8717 const ensureOnlyChild = (children) => { 8718 if (!isArray$1(children) || children.length > 1) { 8719 throw new Error("expect to receive a single Vue element child"); 8720 } 8721 return children[0]; 8722 }; 8723 const flattedChildren = (children) => { 8724 const vNodes = isArray$1(children) ? children : [children]; 8725 const result = []; 8726 vNodes.forEach((child) => { 8727 var _a; 8728 if (isArray$1(child)) { 8729 result.push(...flattedChildren(child)); 8730 } else if (vue.isVNode(child) && isArray$1(child.children)) { 8731 result.push(...flattedChildren(child.children)); 8732 } else { 8733 result.push(child); 8734 if (vue.isVNode(child) && ((_a = child.component) == null ? void 0 : _a.subTree)) { 8735 result.push(...flattedChildren(child.component.subTree)); 8736 } 8737 } 8738 }); 8739 return result; 8740 }; 8741 8742 const unique = (arr) => [...new Set(arr)]; 8743 const castArray = (arr) => { 8744 if (!arr && arr !== 0) 8745 return []; 8746 return Array.isArray(arr) ? arr : [arr]; 8747 }; 8748 8749 const isKorean = (text) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(text); 8750 8751 const rAF = (fn) => isClient ? window.requestAnimationFrame(fn) : setTimeout(fn, 16); 8752 const cAF = (handle) => isClient ? window.cancelAnimationFrame(handle) : clearTimeout(handle); 8753 8754 const generateId = () => Math.floor(Math.random() * 1e4); 8755 8756 const mutable = (val) => val; 8757 8758 const DEFAULT_EXCLUDE_KEYS = ["class", "style"]; 8759 const LISTENER_PREFIX = /^on[A-Z]/; 8760 const useAttrs = (params = {}) => { 8761 const { excludeListeners = false, excludeKeys } = params; 8762 const allExcludeKeys = vue.computed(() => { 8763 return ((excludeKeys == null ? void 0 : excludeKeys.value) || []).concat(DEFAULT_EXCLUDE_KEYS); 8764 }); 8765 const instance = vue.getCurrentInstance(); 8766 if (!instance) { 8767 return vue.computed(() => ({})); 8768 } 8769 return vue.computed(() => { 8770 var _a; 8771 return fromPairs(Object.entries((_a = instance.proxy) == null ? void 0 : _a.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key)))); 8772 }); 8773 }; 8774 8775 const useDeprecated = ({ from, replacement, scope, version, ref, type = "API" }, condition) => { 8776 vue.watch(() => vue.unref(condition), (val) => { 8777 }, { 8778 immediate: true 8779 }); 8780 }; 8781 8782 const useDraggable = (targetRef, dragRef, draggable) => { 8783 let transform = { 8784 offsetX: 0, 8785 offsetY: 0 8786 }; 8787 const onMousedown = (e) => { 8788 const downX = e.clientX; 8789 const downY = e.clientY; 8790 const { offsetX, offsetY } = transform; 8791 const targetRect = targetRef.value.getBoundingClientRect(); 8792 const targetLeft = targetRect.left; 8793 const targetTop = targetRect.top; 8794 const targetWidth = targetRect.width; 8795 const targetHeight = targetRect.height; 8796 const clientWidth = document.documentElement.clientWidth; 8797 const clientHeight = document.documentElement.clientHeight; 8798 const minLeft = -targetLeft + offsetX; 8799 const minTop = -targetTop + offsetY; 8800 const maxLeft = clientWidth - targetLeft - targetWidth + offsetX; 8801 const maxTop = clientHeight - targetTop - targetHeight + offsetY; 8802 const onMousemove = (e2) => { 8803 const moveX = Math.min(Math.max(offsetX + e2.clientX - downX, minLeft), maxLeft); 8804 const moveY = Math.min(Math.max(offsetY + e2.clientY - downY, minTop), maxTop); 8805 transform = { 8806 offsetX: moveX, 8807 offsetY: moveY 8808 }; 8809 targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`; 8810 }; 8811 const onMouseup = () => { 8812 document.removeEventListener("mousemove", onMousemove); 8813 document.removeEventListener("mouseup", onMouseup); 8814 }; 8815 document.addEventListener("mousemove", onMousemove); 8816 document.addEventListener("mouseup", onMouseup); 8817 }; 8818 const onDraggable = () => { 8819 if (dragRef.value && targetRef.value) { 8820 dragRef.value.addEventListener("mousedown", onMousedown);
8821 } 8822 }; 8823 const offDraggable = () => { 8824 if (dragRef.value && targetRef.value) { 8825 dragRef.value.removeEventListener("mousedown", onMousedown); 8826 } 8827 }; 8828 vue.onMounted(() => { 8829 vue.watchEffect(() => { 8830 if (draggable.value) { 8831 onDraggable(); 8832 } else { 8833 offDraggable(); 8834 } 8835 }); 8836 }); 8837 vue.onBeforeUnmount(() => { 8838 offDraggable(); 8839 }); 8840 }; 8841 8842 const useFocus = (el) => { 8843 return { 8844 focus: () => { 8845 var _a, _b; 8846 (_b = (_a = el.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a); 8847 } 8848 }; 8849 }; 8850 8851 var English = { 8852 name: "en", 8853 el: { 8854 colorpicker: { 8855 confirm: "OK", 8856 clear: "Clear", 8857 defaultLabel: "color picker", 8858 description: "current color is {color}. press enter to select a new color." 8859 }, 8860 datepicker: { 8861 now: "Now", 8862 today: "Today", 8863 cancel: "Cancel", 8864 clear: "Clear", 8865 confirm: "OK", 8866 dateTablePrompt: "Use the arrow keys and enter to select the day of the month", 8867 monthTablePrompt: "Use the arrow keys and enter to select the month", 8868 yearTablePrompt: "Use the arrow keys and enter to select the year", 8869 selectedDate: "Selected date", 8870 selectDate: "Select date", 8871 selectTime: "Select time", 8872 startDate: "Start Date", 8873 startTime: "Start Time", 8874 endDate: "End Date", 8875 endTime: "End Time", 8876 prevYear: "Previous Year", 8877 nextYear: "Next Year", 8878 prevMonth: "Previous Month", 8879 nextMonth: "Next Month", 8880 year: "", 8881 month1: "January", 8882 month2: "February", 8883 month3: "March", 8884 month4: "April", 8885 month5: "May", 8886 month6: "June", 8887 month7: "July", 8888 month8: "August", 8889 month9: "September", 8890 month10: "October", 8891 month11: "November", 8892 month12: "December", 8893 week: "week", 8894 weeks: { 8895 sun: "Sun", 8896 mon: "Mon", 8897 tue: "Tue", 8898 wed: "Wed", 8899 thu: "Thu", 8900 fri: "Fri", 8901 sat: "Sat" 8902 }, 8903 weeksFull: { 8904 sun: "Sunday", 8905 mon: "Monday", 8906 tue: "Tuesday", 8907 wed: "Wednesday", 8908 thu: "Thursday", 8909 fri: "Friday", 8910 sat: "Saturday" 8911 }, 8912 months: { 8913 jan: "Jan", 8914 feb: "Feb", 8915 mar: "Mar", 8916 apr: "Apr", 8917 may: "May", 8918 jun: "Jun", 8919 jul: "Jul", 8920 aug: "Aug", 8921 sep: "Sep", 8922 oct: "Oct", 8923 nov: "Nov", 8924 dec: "Dec" 8925 } 8926 }, 8927 inputNumber: { 8928 decrease: "decrease number", 8929 increase: "increase number" 8930 }, 8931 select: { 8932 loading: "Loading", 8933 noMatch: "No matching data", 8934 noData: "No data", 8935 placeholder: "Select" 8936 }, 8937 dropdown: { 8938 toggleDropdown: "Toggle Dropdown" 8939 }, 8940 cascader: { 8941 noMatch: "No matching data", 8942 loading: "Loading", 8943 placeholder: "Select", 8944 noData: "No data" 8945 }, 8946 pagination: { 8947 goto: "Go to", 8948 pagesize: "/page", 8949 total: "Total {total}", 8950 pageClassifier: "", 8951 page: "Page", 8952 prev: "Go to previous page", 8953 next: "Go to next page", 8954 currentPage: "page {pager}", 8955 prevPages: "Previous {pager} pages", 8956 nextPages: "Next {pager} pages", 8957 deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details" 8958 }, 8959 dialog: { 8960 close: "Close this dialog" 8961 }, 8962 drawer: { 8963 close: "Close this dialog" 8964 }, 8965 messagebox: { 8966 title: "Message", 8967 confirm: "OK", 8968 cancel: "Cancel", 8969 error: "Illegal input", 8970 close: "Close this dialog" 8971 }, 8972 upload: { 8973 deleteTip: "press delete to remove", 8974 delete: "Delete", 8975 preview: "Preview", 8976 continue: "Continue" 8977 }, 8978 slider: { 8979 defaultLabel: "slider between {min} and {max}", 8980 defaultRangeStartLabel: "pick start value", 8981 defaultRangeEndLabel: "pick end value" 8982 }, 8983 table: { 8984 emptyText: "No Data", 8985 confirmFilter: "Confirm", 8986 resetFilter: "Reset", 8987 clearFilter: "All", 8988 sumText: "Sum" 8989 }, 8990 tree: { 8991 emptyText: "No Data" 8992 }, 8993 transfer: { 8994 noMatch: "No matching data", 8995 noData: "No data", 8996 titles: ["List 1", "List 2"], 8997 filterPlaceholder: "Enter keyword", 8998 noCheckedFormat: "{total} items", 8999 hasCheckedFormat: "{checked}/{total} checked" 9000 }, 9001 image: { 9002 error: "FAILED" 9003 }, 9004 pageHeader: { 9005 title: "Back" 9006 }, 9007 popconfirm: { 9008 confirmButtonText: "Yes", 9009 cancelButtonText: "No" 9010 } 9011 } 9012 }; 9013 9014 const buildTranslator = (locale) => (path, option) => translate(path, option, vue.unref(locale)); 9015 const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => { 9016 var _a; 9017 return `${(_a = option == null ? void 0 : option[key]) != null ? _a : `{${key}}`}`; 9018 });
9019 const buildLocaleContext = (locale) => { 9020 const lang = vue.computed(() => vue.unref(locale).name); 9021 const localeRef = vue.isRef(locale) ? locale : vue.ref(locale); 9022 return { 9023 lang, 9024 locale: localeRef, 9025 t: buildTranslator(locale) 9026 }; 9027 }; 9028 const localeContextKey = Symbol("localeContextKey"); 9029 const useLocale = (localeOverrides) => { 9030 const locale = localeOverrides || vue.inject(localeContextKey, vue.ref()); 9031 return buildLocaleContext(vue.computed(() => locale.value || English)); 9032 }; 9033 9034 let activeEffectScope; 9035 function recordEffectScope(effect2, scope = activeEffectScope) { 9036 if (scope && scope.active) { 9037 scope.effects.push(effect2); 9038 } 9039 } 9040 const createDep = (effects) => { 9041 const dep = new Set(effects); 9042 dep.w = 0; 9043 dep.n = 0; 9044 return dep; 9045 }; 9046 const wasTracked = (dep) => (dep.w & trackOpBit) > 0; 9047 const newTracked = (dep) => (dep.n & trackOpBit) > 0; 9048 const initDepMarkers = ({ deps }) => { 9049 if (deps.length) { 9050 for (let i = 0; i < deps.length; i++) { 9051 deps[i].w |= trackOpBit; 9052 } 9053 } 9054 }; 9055 const finalizeDepMarkers = (effect2) => { 9056 const { deps } = effect2; 9057 if (deps.length) { 9058 let ptr = 0; 9059 for (let i = 0; i < deps.length; i++) { 9060 const dep = deps[i]; 9061 if (wasTracked(dep) && !newTracked(dep)) { 9062 dep.delete(effect2); 9063 } else { 9064 deps[ptr++] = dep; 9065 } 9066 dep.w &= ~trackOpBit; 9067 dep.n &= ~trackOpBit; 9068 } 9069 deps.length = ptr; 9070 } 9071 }; 9072 let effectTrackDepth = 0; 9073 let trackOpBit = 1; 9074 const maxMarkerBits = 30; 9075 let activeEffect; 9076 class ReactiveEffect { 9077 constructor(fn, scheduler2 = null, scope) { 9078 this.fn = fn; 9079 this.scheduler = scheduler2; 9080 this.active = true; 9081 this.deps = []; 9082 this.parent = void 0; 9083 recordEffectScope(this, scope); 9084 } 9085 run() { 9086 if (!this.active) { 9087 return this.fn(); 9088 } 9089 let parent = activeEffect; 9090 let lastShouldTrack = shouldTrack; 9091 while (parent) { 9092 if (parent === this) { 9093 return; 9094 } 9095 parent = parent.parent; 9096 } 9097 try { 9098 this.parent = activeEffect; 9099 activeEffect = this; 9100 shouldTrack = true; 9101 trackOpBit = 1 << ++effectTrackDepth; 9102 if (effectTrackDepth <= maxMarkerBits) { 9103 initDepMarkers(this); 9104 } else { 9105 cleanupEffect(this); 9106 } 9107 return this.fn(); 9108 } finally { 9109 if (effectTrackDepth <= maxMarkerBits) { 9110 finalizeDepMarkers(this); 9111 } 9112 trackOpBit = 1 << --effectTrackDepth; 9113 activeEffect = this.parent; 9114 shouldTrack = lastShouldTrack; 9115 this.parent = void 0; 9116 if (this.deferStop) { 9117 this.stop(); 9118 } 9119 } 9120 } 9121 stop() { 9122 if (activeEffect === this) { 9123 this.deferStop = true; 9124 } else if (this.active) { 9125 cleanupEffect(this); 9126 if (this.onStop) { 9127 this.onStop(); 9128 } 9129 this.active = false; 9130 } 9131 } 9132 } 9133 function cleanupEffect(effect2) { 9134 const { deps } = effect2; 9135 if (deps.length) { 9136 for (let i = 0; i < deps.length; i++) { 9137 deps[i].delete(effect2); 9138 } 9139 deps.length = 0; 9140 } 9141 } 9142 let shouldTrack = true; 9143 function trackEffects(dep, debuggerEventExtraInfo) { 9144 let shouldTrack2 = false; 9145 if (effectTrackDepth <= maxMarkerBits) { 9146 if (!newTracked(dep)) { 9147 dep.n |= trackOpBit; 9148 shouldTrack2 = !wasTracked(dep); 9149 } 9150 } else { 9151 shouldTrack2 = !dep.has(activeEffect); 9152 } 9153 if (shouldTrack2) { 9154 dep.add(activeEffect); 9155 activeEffect.deps.push(dep); 9156 } 9157 } 9158 function triggerEffects(dep, debuggerEventExtraInfo) { 9159 const effects = isArray$1(dep) ? dep : [...dep]; 9160 for (const effect2 of effects) { 9161 if (effect2.computed) { 9162 triggerEffect(effect2); 9163 } 9164 } 9165 for (const effect2 of effects) { 9166 if (!effect2.computed) { 9167 triggerEffect(effect2); 9168 } 9169 } 9170 } 9171 function triggerEffect(effect2, debuggerEventExtraInfo) { 9172 if (effect2 !== activeEffect || effect2.allowRecurse) { 9173 if (effect2.scheduler) { 9174 effect2.scheduler(); 9175 } else { 9176 effect2.run(); 9177 } 9178 } 9179 } 9180 function toRaw(observed) { 9181 const raw = observed && observed["__v_raw"]; 9182 return raw ? toRaw(raw) : observed; 9183 } 9184 function trackRefValue(ref2) { 9185 if (shouldTrack && activeEffect) { 9186 ref2 = toRaw(ref2); 9187 { 9188 trackEffects(ref2.dep || (ref2.dep = createDep())); 9189 } 9190 } 9191 } 9192 function triggerRefValue(ref2, newVal) { 9193 ref2 = toRaw(ref2); 9194 if (ref2.dep) { 9195 { 9196 triggerEffects(ref2.dep); 9197 } 9198 } 9199 } 9200 class ComputedRefImpl { 9201 constructor(getter, _setter, isReadonly2, isSSR) { 9202 this._setter = _setter; 9203 this.dep = void 0; 9204 this.__v_isRef = true; 9205 this._dirty = true; 9206 this.effect = new ReactiveEffect(getter, () => { 9207 if (!this._dirty) { 9208 this._dirty = true; 9209 triggerRefValue(this); 9210 } 9211 }); 9212 this.effect.computed = this; 9213 this.effect.active = this._cacheable = !isSSR; 9214 this["__v_isReadonly"] = isReadonly2; 9215 } 9216 get value() { 9217 const self = toRaw(this); 9218 trackRefValue(self); 9219 if (self._dirty || !self._cacheable) { 9220 self._dirty = false; 9221 self._value = self.effect.run(); 9222 } 9223 return self._value; 9224 } 9225 set value(newValue) { 9226 this._setter(newValue); 9227 } 9228 } 9229 function computed(getterOrOptions, debugOptions, isSSR = false) { 9230 let getter; 9231 let setter; 9232 const onlyGetter = isFunction$1(getterOrOptions); 9233 if (onlyGetter) { 9234 getter = getterOrOptions; 9235 setter = NOOP; 9236 } else { 9237 getter = getterOrOptions.get; 9238 setter = getterOrOptions.set; 9239 } 9240 const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR); 9241 return cRef; 9242 } 9243 9244 const defaultNamespace = "el"; 9245 const statePrefix = "is-"; 9246 const _bem = (namespace, block, blockSuffix, element, modifier) => { 9247 let cls = `${namespace}-${block}`; 9248 if (blockSuffix) { 9249 cls += `-${blockSuffix}`; 9250 } 9251 if (element) { 9252 cls += `__${element}`; 9253 } 9254 if (modifier) { 9255 cls += `--${modifier}`; 9256 } 9257 return cls; 9258 }; 9259 const namespaceContextKey = Symbol("namespaceContextKey"); 9260 const useGetDerivedNamespace = (namespaceOverrides) => { 9261 const derivedNamespace = namespaceOverrides || vue.inject(namespaceContextKey, vue.ref(defaultNamespace)); 9262 const namespace = vue.computed(() => { 9263 return vue.unref(derivedNamespace) || defaultNamespace; 9264 }); 9265 return namespace; 9266 }; 9267 const useNamespace = (block, namespaceOverrides) => { 9268 const namespace = useGetDerivedNamespace(namespaceOverrides); 9269 const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", ""); 9270 const e = (element) => element ? _bem(namespace.value, block, "", element, "") : ""; 9271 const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : ""; 9272 const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : ""; 9273 const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : ""; 9274 const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : ""; 9275 const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : ""; 9276 const is = (name, ...args) => { 9277 const state = args.length >= 1 ? args[0] : true; 9278 return name && state ? `${statePrefix}${name}` : ""; 9279 }; 9280 const cssVar = (object) => { 9281 const styles = {}; 9282 for (const key in object) { 9283 if (object[key]) { 9284 styles[`--${namespace.value}-${key}`] = object[key]; 9285 } 9286 } 9287 return styles; 9288 }; 9289 const cssVarBlock = (object) => { 9290 const styles = {}; 9291 for (const key in object) { 9292 if (object[key]) { 9293 styles[`--${namespace.value}-${block}-${key}`] = object[key]; 9294 } 9295 } 9296 return styles; 9297 }; 9298 const cssVarName = (name) => `--${namespace.value}-${name}`; 9299 const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`; 9300 return { 9301 namespace, 9302 b, 9303 e, 9304 m, 9305 be, 9306 em, 9307 bm, 9308 bem, 9309 is, 9310 cssVar, 9311 cssVarName, 9312 cssVarBlock, 9313 cssVarBlockName 9314 }; 9315 }; 9316
9317 const useLockscreen = (trigger, options = {}) => { 9318 if (!vue.isRef(trigger)) { 9319 throwError("[useLockscreen]", "You need to pass a ref param to this function"); 9320 } 9321 const ns = options.ns || useNamespace("popup"); 9322 const hiddenCls = computed(() => ns.bm("parent", "hidden")); 9323 if (!isClient || hasClass(document.body, hiddenCls.value)) { 9324 return; 9325 } 9326 let scrollBarWidth = 0; 9327 let withoutHiddenClass = false; 9328 let bodyWidth = "0"; 9329 const cleanup = () => { 9330 setTimeout(() => { 9331 removeClass(document == null ? void 0 : document.body, hiddenCls.value); 9332 if (withoutHiddenClass && document) { 9333 document.body.style.width = bodyWidth; 9334 } 9335 }, 200); 9336 }; 9337 vue.watch(trigger, (val) => { 9338 if (!val) { 9339 cleanup(); 9340 return; 9341 } 9342 withoutHiddenClass = !hasClass(document.body, hiddenCls.value); 9343 if (withoutHiddenClass) { 9344 bodyWidth = document.body.style.width; 9345 } 9346 scrollBarWidth = getScrollBarWidth(ns.namespace.value); 9347 const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight; 9348 const bodyOverflowY = getStyle(document.body, "overflowY"); 9349 if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) { 9350 document.body.style.width = `calc(100% - ${scrollBarWidth}px)`; 9351 } 9352 addClass(document.body, hiddenCls.value); 9353 }); 9354 vue.onScopeDispose(() => cleanup()); 9355 }; 9356 9357 const modalStack = []; 9358 const closeModal = (e) => { 9359 if (modalStack.length === 0) 9360 return; 9361 if (e.code === EVENT_CODE.esc) { 9362 e.stopPropagation(); 9363 const topModal = modalStack[modalStack.length - 1]; 9364 topModal.handleClose(); 9365 } 9366 }; 9367 const useModal = (instance, visibleRef) => { 9368 vue.watch(visibleRef, (val) => { 9369 if (val) { 9370 modalStack.push(instance); 9371 } else { 9372 modalStack.splice(modalStack.indexOf(instance), 1); 9373 } 9374 }); 9375 }; 9376 if (isClient) 9377 useEventListener(document, "keydown", closeModal); 9378 9379 const _prop = buildProp({ 9380 type: definePropType(Boolean), 9381 default: null 9382 }); 9383 const _event = buildProp({ 9384 type: definePropType(Function) 9385 }); 9386 const createModelToggleComposable = (name) => { 9387 const updateEventKey = `update:${name}`; 9388 const updateEventKeyRaw = `onUpdate:${name}`; 9389 const useModelToggleEmits2 = [updateEventKey]; 9390 const useModelToggleProps2 = { 9391 [name]: _prop, 9392 [updateEventKeyRaw]: _event 9393 }; 9394 const useModelToggle2 = ({ 9395 indicator, 9396 toggleReason, 9397 shouldHideWhenRouteChanges, 9398 shouldProceed, 9399 onShow, 9400 onHide 9401 }) => { 9402 const instance = vue.getCurrentInstance(); 9403 const { emit } = instance; 9404 const props = instance.props; 9405 const hasUpdateHandler = vue.computed(() => isFunction$1(props[updateEventKeyRaw])); 9406 const isModelBindingAbsent = vue.computed(() => props[name] === null); 9407 const doShow = (event) => { 9408 if (indicator.value === true) { 9409 return; 9410 } 9411 indicator.value = true; 9412 if (toggleReason) { 9413 toggleReason.value = event; 9414 } 9415 if (isFunction$1(onShow)) { 9416 onShow(event); 9417 } 9418 }; 9419 const doHide = (event) => { 9420 if (indicator.value === false) { 9421 return; 9422 } 9423 indicator.value = false; 9424 if (toggleReason) { 9425 toggleReason.value = event; 9426 } 9427 if (isFunction$1(onHide)) { 9428 onHide(event); 9429 } 9430 }; 9431 const show = (event) => { 9432 if (props.disabled === true || isFunction$1(shouldProceed) && !shouldProceed()) 9433 return; 9434 const shouldEmit = hasUpdateHandler.value && isClient; 9435 if (shouldEmit) { 9436 emit(updateEventKey, true); 9437 } 9438 if (isModelBindingAbsent.value || !shouldEmit) { 9439 doShow(event); 9440 } 9441 }; 9442 const hide = (event) => { 9443 if (props.disabled === true || !isClient) 9444 return; 9445 const shouldEmit = hasUpdateHandler.value && isClient; 9446 if (shouldEmit) { 9447 emit(updateEventKey, false); 9448 } 9449 if (isModelBindingAbsent.value || !shouldEmit) { 9450 doHide(event); 9451 } 9452 }; 9453 const onChange = (val) => { 9454 if (!isBoolean(val)) 9455 return; 9456 if (props.disabled && val) { 9457 if (hasUpdateHandler.value) { 9458 emit(updateEventKey, false); 9459 } 9460 } else if (indicator.value !== val) { 9461 if (val) { 9462 doShow(); 9463 } else { 9464 doHide(); 9465 } 9466 } 9467 }; 9468 const toggle = () => { 9469 if (indicator.value) { 9470 hide(); 9471 } else { 9472 show(); 9473 } 9474 }; 9475 vue.watch(() => props[name], onChange);
9476 if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) { 9477 vue.watch(() => ({ 9478 ...instance.proxy.$route 9479 }), () => { 9480 if (shouldHideWhenRouteChanges.value && indicator.value) { 9481 hide(); 9482 } 9483 }); 9484 } 9485 vue.onMounted(() => { 9486 onChange(props[name]); 9487 }); 9488 return { 9489 hide, 9490 show, 9491 toggle, 9492 hasUpdateHandler 9493 }; 9494 }; 9495 return { 9496 useModelToggle: useModelToggle2, 9497 useModelToggleProps: useModelToggleProps2, 9498 useModelToggleEmits: useModelToggleEmits2 9499 }; 9500 }; 9501 const { useModelToggle, useModelToggleProps, useModelToggleEmits } = createModelToggleComposable("modelValue"); 9502 9503 const usePreventGlobal = (indicator, evt, cb) => { 9504 const prevent = (e) => { 9505 if (cb(e)) 9506 e.stopImmediatePropagation(); 9507 }; 9508 let stop = void 0; 9509 vue.watch(() => indicator.value, (val) => { 9510 if (val) { 9511 stop = useEventListener(document, evt, prevent, true); 9512 } else { 9513 stop == null ? void 0 : stop(); 9514 } 9515 }, { immediate: true }); 9516 }; 9517 9518 const useProp = (name) => { 9519 const vm = vue.getCurrentInstance(); 9520 return vue.computed(() => { 9521 var _a, _b; 9522 return (_b = (_a = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a.$props) == null ? void 0 : _b[name]; 9523 }); 9524 }; 9525 9526 var E$1="top",R="bottom",W="right",P$1="left",me="auto",G=[E$1,R,W,P$1],U$1="start",J="end",Xe="clippingParents",je="viewport",K="popper",Ye="reference",De=G.reduce(function(t,e){return t.concat([e+"-"+U$1,e+"-"+J])},[]),Ee=[].concat(G,[me]).reduce(function(t,e){return t.concat([e,e+"-"+U$1,e+"-"+J])},[]),Ge="beforeRead",Je="read",Ke="afterRead",Qe="beforeMain",Ze="main",et="afterMain",tt="beforeWrite",nt="write",rt="afterWrite",ot=[Ge,Je,Ke,Qe,Ze,et,tt,nt,rt];function C(t){return t?(t.nodeName||"").toLowerCase():null}function H(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Q(t){var e=H(t).Element;return t instanceof e||t instanceof Element}function B(t){var e=H(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Pe(t){if(typeof ShadowRoot=="undefined")return !1;var e=H(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function Mt(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},o=e.attributes[n]||{},i=e.elements[n];!B(i)||!C(i)||(Object.assign(i.style,r),Object.keys(o).forEach(function(a){var s=o[a];s===!1?i.removeAttribute(a):i.setAttribute(a,s===!0?"":s);}));});}function Rt(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var o=e.elements[r],i=e.attributes[r]||{},a=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),s=a.reduce(function(f,c){return f[c]="",f},{});
vendor: 9,528 bytes, line 9526
9526!B(o)||!C(o)||(Object.assign(o.style,s),Object.keys(i).forEach(function(f){o.removeAttribute(f);}));});}}var Ae={name:"applyStyles",enabled:!0,phase:"write",fn:Mt,effect:Rt,requires:["computeStyles"]};function q(t){return t.split("-")[0]}var X$1=Math.max,ve=Math.min,Z=Math.round;function ee(t,e){e===void 0&&(e=!1);var n=t.getBoundingClientRect(),r=1,o=1;if(B(t)&&e){var i=t.offsetHeight,a=t.offsetWidth;a>0&&(r=Z(n.width)/a||1),i>0&&(o=Z(n.height)/i||1);}return {width:n.width/r,height:n.height/o,top:n.top/o,right:n.right/r,bottom:n.bottom/o,left:n.left/r,x:n.left/r,y:n.top/o}}function ke(t){var e=ee(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function it(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return !0;if(n&&Pe(n)){var r=e;do{if(r&&t.isSameNode(r))return !0;r=r.parentNode||r.host;}while(r)}return !1}function N$1(t){return H(t).getComputedStyle(t)}function Wt(t){return ["table","td","th"].indexOf(C(t))>=0}function I$1(t){return ((Q(t)?t.ownerDocument:t.document)||window.document).documentElement}function ge(t){return C(t)==="html"?t:t.assignedSlot||t.parentNode||(Pe(t)?t.host:null)||I$1(t)}function at(t){return !B(t)||N$1(t).position==="fixed"?null:t.offsetParent}function Bt(t){var e=navigator.userAgent.toLowerCase().indexOf("firefox")!==-1,n=navigator.userAgent.indexOf("Trident")!==-1;if(n&&B(t)){var r=N$1(t);if(r.position==="fixed")return null}var o=ge(t);for(Pe(o)&&(o=o.host);B(o)&&["html","body"].indexOf(C(o))<0;){var i=N$1(o);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||e&&i.willChange==="filter"||e&&i.filter&&i.filter!=="none")return o;o=o.parentNode;}return null}function se(t){for(var e=H(t),n=at(t);n&&Wt(n)&&N$1(n).position==="static";)n=at(n);return n&&(C(n)==="html"||C(n)==="body"&&N$1(n).position==="static")?e:n||Bt(t)||e}function Le(t){return ["top","bottom"].indexOf(t)>=0?"x":"y"}function fe(t,e,n){return X$1(t,ve(e,n))}function St(t,e,n){var r=fe(t,e,n);return r>n?n:r}function st(){return {top:0,right:0,bottom:0,left:0}}function ft(t){return Object.assign({},st(),t)}function ct(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var Tt=function(t,e){return t=typeof t=="function"?t(Object.assign({},e.rects,{placement:e.placement})):t,ft(typeof t!="number"?t:ct(t,G))};function Ht(t){var e,n=t.state,r=t.name,o=t.options,i=n.elements.arrow,a=n.modifiersData.popperOffsets,s=q(n.placement),f=Le(s),c=[P$1,W].indexOf(s)>=0,u=c?"height":"width";if(!(!i||!a)){var m=Tt(o.padding,n),v=ke(i),l=f==="y"?E$1:P$1,h=f==="y"?R:W,p=n.rects.reference[u]+n.rects.reference[f]-a[f]-n.rects.popper[u],g=a[f]-n.rects.reference[f],x=se(i),y=x?f==="y"?x.clientHeight||0:x.clientWidth||0:0,$=p/2-g/2,d=m[l],b=y-v[u]-m[h],w=y/2-v[u]/2+$,O=fe(d,w,b),j=f;n.modifiersData[r]=(e={},e[j]=O,e.centerOffset=O-w,e);}}function Ct(t){var e=t.state,n=t.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=e.elements.popper.querySelector(o),!o)||!it(e.elements.popper,o)||(e.elements.arrow=o));}var pt={name:"arrow",enabled:!0,phase:"main",fn:Ht,effect:Ct,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function te(t){return t.split("-")[1]}var qt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Vt(t){var e=t.x,n=t.y,r=window,o=r.devicePixelRatio||1;return {x:Z(e*o)/o||0,y:Z(n*o)/o||0}}function ut(t){var e,n=t.popper,r=t.popperRect,o=t.placement,i=t.variation,a=t.offsets,s=t.position,f=t.gpuAcceleration,c=t.adaptive,u=t.roundOffsets,m=t.isFixed,v=a.x,l=v===void 0?0:v,h=a.y,p=h===void 0?0:h,g=typeof u=="function"?u({x:l,y:p}):{x:l,y:p};l=g.x,p=g.y;var x=a.hasOwnProperty("x"),y=a.hasOwnProperty("y"),$=P$1,d=E$1,b=window;if(c){var w=se(n),O="clientHeight",j="clientWidth";if(w===H(n)&&(w=I$1(n),N$1(w).position!=="static"&&s==="absolute"&&(O="scrollHeight",j="scrollWidth")),w=w,o===E$1||(o===P$1||o===W)&&i===J){d=R;var A=m&&w===b&&b.visualViewport?b.visualViewport.height:w[O];p-=A-r.height,p*=f?1:-1;}if(o===P$1||(o===E$1||o===R)&&i===J){$=W;var k=m&&w===b&&b.visualViewport?b.visualViewport.width:w[j];l-=k-r.width,l*=f?1:-1;}}var D=Object.assign({position:s},c&&qt),S=u===!0?Vt({x:l,y:p}):{x:l,y:p};if(l=S.x,p=S.y,f){var L;return Object.assign({},D,(L={},L[d]=y?"0":"",L[$]=x?"0":"",L.transform=(b.devicePixelRatio||1)<=1?"translate("+l+"px, "+p+"px)":"translate3d("+l+"px, "+p+"px, 0)",L))}return Object.assign({},D,(e={},e[d]=y?p+"px":"",e[$]=x?l+"px":"",e.transform="",e))}function Nt(t){var e=t.state,n=t.options,r=n.gpuAcceleration,o=r===void 0?!0:r,i=n.adaptive,a=i===void 0?!0:i,s=n.roundOffsets,f=s===void 0?!0:s,c={placement:q(e.placement),variation:te(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:o,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,ut(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:f})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,ut(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:f})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement});}var Me={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Nt,data:{}},ye={passive:!0};function It(t){var e=t.state,n=t.instance,r=t.options,o=r.scroll,i=o===void 0?!0:o,a=r.resize,s=a===void 0?!0:a,f=H(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&c.forEach(function(u){u.addEventListener("scroll",n.update,ye);}),s&&f.addEventListener("resize",n.update,ye),function(){i&&c.forEach(function(u){u.removeEventListener("scroll",n.update,ye);}),s&&f.removeEventListener("resize",n.update,ye);}}var Re={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:It,data:{}},_t={left:"right",right:"left",bottom:"top",top:"bottom"};function be(t){return t.replace(/left|right|bottom|top/g,function(e){return _t[e]})}var zt={start:"end",end:"start"};function lt(t){return t.replace(/start|end/g,function(e){return zt[e]})}function We(t){var e=H(t),n=e.pageXOffset,r=e.pageYOffset;return {scrollLeft:n,scrollTop:r}}function Be(t){return ee(I$1(t)).left+We(t).scrollLeft}function Ft(t){var e=H(t),n=I$1(t),r=e.visualViewport,o=n.clientWidth,i=n.clientHeight,a=0,s=0;return r&&(o=r.width,i=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=r.offsetLeft,s=r.offsetTop)),{width:o,height:i,x:a+Be(t),y:s}}function Ut(t){var e,n=I$1(t),r=We(t),o=(e=t.ownerDocument)==null?void 0:e.body,i=X$1(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=X$1(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-r.scrollLeft+Be(t),f=-r.scrollTop;return N$1(o||n).direction==="rtl"&&(s+=X$1(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:s,y:f}}function Se(t){var e=N$1(t),n=e.overflow,r=e.overflowX,o=e.overflowY;return /auto|scroll|overlay|hidden/.test(n+o+r)}function dt(t){return ["html","body","#document"].indexOf(C(t))>=0?t.ownerDocument.body:B(t)&&Se(t)?t:dt(ge(t))}function ce(t,e){var n;e===void 0&&(e=[]);var r=dt(t),o=r===((n=t.ownerDocument)==null?void 0:n.body),i=H(r),a=o?[i].concat(i.visualViewport||[],Se(r)?r:[]):r,s=e.concat(a);return o?s:s.concat(ce(ge(a)))}function Te(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function Xt(t){var e=ee(t);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}function ht(t,e){return e===je?Te(Ft(t)):Q(e)?Xt(e):Te(Ut(I$1(t)))}function Yt(t){var e=ce(ge(t)),n=["absolute","fixed"].indexOf(N$1(t).position)>=0,r=n&&B(t)?se(t):t;return Q(r)?e.filter(function(o){return Q(o)&&it(o,r)&&C(o)!=="body"}):[]}function Gt(t,e,n){var r=e==="clippingParents"?Yt(t):[].concat(e),o=[].concat(r,[n]),i=o[0],a=o.reduce(function(s,f){var c=ht(t,f);return s.top=X$1(c.top,s.top),s.right=ve(c.right,s.right),s.bottom=ve(c.bottom,s.bottom),s.left=X$1(c.left,s.left),s},ht(t,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function mt(t){var e=t.reference,n=t.element,r=t.placement,o=r?q(r):null,i=r?te(r):null,a=e.x+e.width/2-n.width/2,s=e.y+e.height/2-n.height/2,f;switch(o){case E$1:f={x:a,y:e.y-n.height};break;case R:f={x:a,y:e.y+e.height};break;case W:f={x:e.x+e.width,y:s};break;case P$1:f={x:e.x-n.width,y:s};break;default:f={x:e.x,y:e.y};}var c=o?Le(o):null;if(c!=null){var u=c==="y"?"height":"width";switch(i){case U$1:f[c]=f[c]-(e[u]/2-n[u]/2);break;case J:f[c]=f[c]+(e[u]/2-n[u]/2);break}}return f}function ne(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=r===void 0?t.placement:r,i=n.boundary,a=i===void 0?Xe:i,s=n.rootBoundary,f=s===void 0?je:s,c=n.elementContext,u=c===void 0?K:c,m=n.altBoundary,v=m===void 0?!1:m,l=n.padding,h=l===void 0?0:l,p=ft(typeof h!="number"?h:ct(h,G)),g=u===K?Ye:K,x=t.rects.popper,y=t.elements[v?g:u],$=Gt(Q(y)?y:y.contextElement||I$1(t.elements.popper),a,f),d=ee(t.elements.reference),b=mt({reference:d,element:x,strategy:"absolute",placement:o}),w=Te(Object.assign({},x,b)),O=u===K?w:d,j={top:$.top-O.top+p.top,bottom:O.bottom-$.bottom+p.bottom,left:$.left-O.left+p.left,right:O.right-$.right+p.right},A=t.modifiersData.offset;if(u===K&&A){var k=A[o];
vendor: 4,579 bytes, line 9526
9526Object.keys(j).forEach(function(D){var S=[W,R].indexOf(D)>=0?1:-1,L=[E$1,R].indexOf(D)>=0?"y":"x";j[D]+=k[L]*S;});}return j}function Jt(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=n.boundary,i=n.rootBoundary,a=n.padding,s=n.flipVariations,f=n.allowedAutoPlacements,c=f===void 0?Ee:f,u=te(r),m=u?s?De:De.filter(function(h){return te(h)===u}):G,v=m.filter(function(h){return c.indexOf(h)>=0});v.length===0&&(v=m);var l=v.reduce(function(h,p){return h[p]=ne(t,{placement:p,boundary:o,rootBoundary:i,padding:a})[q(p)],h},{});return Object.keys(l).sort(function(h,p){return l[h]-l[p]})}function Kt(t){if(q(t)===me)return [];var e=be(t);return [lt(t),e,lt(e)]}function Qt(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var o=n.mainAxis,i=o===void 0?!0:o,a=n.altAxis,s=a===void 0?!0:a,f=n.fallbackPlacements,c=n.padding,u=n.boundary,m=n.rootBoundary,v=n.altBoundary,l=n.flipVariations,h=l===void 0?!0:l,p=n.allowedAutoPlacements,g=e.options.placement,x=q(g),y=x===g,$=f||(y||!h?[be(g)]:Kt(g)),d=[g].concat($).reduce(function(z,V){return z.concat(q(V)===me?Jt(e,{placement:V,boundary:u,rootBoundary:m,padding:c,flipVariations:h,allowedAutoPlacements:p}):V)},[]),b=e.rects.reference,w=e.rects.popper,O=new Map,j=!0,A=d[0],k=0;k<d.length;k++){var D=d[k],S=q(D),L=te(D)===U$1,re=[E$1,R].indexOf(S)>=0,oe=re?"width":"height",M=ne(e,{placement:D,boundary:u,rootBoundary:m,altBoundary:v,padding:c}),T=re?L?W:P$1:L?R:E$1;b[oe]>w[oe]&&(T=be(T));var pe=be(T),_=[];if(i&&_.push(M[S]<=0),s&&_.push(M[T]<=0,M[pe]<=0),_.every(function(z){return z})){A=D,j=!1;break}O.set(D,_);}if(j)for(var ue=h?3:1,xe=function(z){var V=d.find(function(de){var ae=O.get(de);if(ae)return ae.slice(0,z).every(function(Y){return Y})});if(V)return A=V,"break"},ie=ue;ie>0;ie--){var le=xe(ie);if(le==="break")break}e.placement!==A&&(e.modifiersData[r]._skip=!0,e.placement=A,e.reset=!0);}}var vt={name:"flip",enabled:!0,phase:"main",fn:Qt,requiresIfExists:["offset"],data:{_skip:!1}};function gt(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function yt(t){return [E$1,W,R,P$1].some(function(e){return t[e]>=0})}function Zt(t){var e=t.state,n=t.name,r=e.rects.reference,o=e.rects.popper,i=e.modifiersData.preventOverflow,a=ne(e,{elementContext:"reference"}),s=ne(e,{altBoundary:!0}),f=gt(a,r),c=gt(s,o,i),u=yt(f),m=yt(c);e.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:m},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":m});}var bt={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Zt};function en(t,e,n){var r=q(t),o=[P$1,E$1].indexOf(r)>=0?-1:1,i=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,a=i[0],s=i[1];return a=a||0,s=(s||0)*o,[P$1,W].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}function tn(t){var e=t.state,n=t.options,r=t.name,o=n.offset,i=o===void 0?[0,0]:o,a=Ee.reduce(function(u,m){return u[m]=en(m,e.rects,i),u},{}),s=a[e.placement],f=s.x,c=s.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=f,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=a;}var wt={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:tn};function nn(t){var e=t.state,n=t.name;e.modifiersData[n]=mt({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement});}var He={name:"popperOffsets",enabled:!0,phase:"read",fn:nn,data:{}};function rn(t){return t==="x"?"y":"x"}function on(t){var e=t.state,n=t.options,r=t.name,o=n.mainAxis,i=o===void 0?!0:o,a=n.altAxis,s=a===void 0?!1:a,f=n.boundary,c=n.rootBoundary,u=n.altBoundary,m=n.padding,v=n.tether,l=v===void 0?!0:v,h=n.tetherOffset,p=h===void 0?0:h,g=ne(e,{boundary:f,rootBoundary:c,padding:m,altBoundary:u}),x=q(e.placement),y=te(e.placement),$=!y,d=Le(x),b=rn(d),w=e.modifiersData.popperOffsets,O=e.rects.reference,j=e.rects.popper,A=typeof p=="function"?p(Object.assign({},e.rects,{placement:e.placement})):p,k=typeof A=="number"?{mainAxis:A,altAxis:A}:Object.assign({mainAxis:0,altAxis:0},A),D=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,S={x:0,y:0};if(w){if(i){var L,re=d==="y"?E$1:P$1,oe=d==="y"?R:W,M=d==="y"?"height":"width",T=w[d],pe=T+g[re],_=T-g[oe],ue=l?-j[M]/2:0,xe=y===U$1?O[M]:j[M],ie=y===U$1?-j[M]:-O[M],le=e.elements.arrow,z=l&&le?ke(le):{width:0,height:0},V=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:st(),de=V[re],ae=V[oe],Y=fe(0,O[M],z[M]),jt=$?O[M]
vendor: 4,779 bytes, lines 9526-9544
9526/2-ue-Y-de-k.mainAxis:xe-Y-de-k.mainAxis,Dt=$?-O[M]/2+ue+Y+ae+k.mainAxis:ie+Y+ae+k.mainAxis,Oe=e.elements.arrow&&se(e.elements.arrow),Et=Oe?d==="y"?Oe.clientTop||0:Oe.clientLeft||0:0,Ce=(L=D==null?void 0:D[d])!=null?L:0,Pt=T+jt-Ce-Et,At=T+Dt-Ce,qe=fe(l?ve(pe,Pt):pe,T,l?X$1(_,At):_);w[d]=qe,S[d]=qe-T;}if(s){var Ve,kt=d==="x"?E$1:P$1,Lt=d==="x"?R:W,F=w[b],he=b==="y"?"height":"width",Ne=F+g[kt],Ie=F-g[Lt],$e=[E$1,P$1].indexOf(x)!==-1,_e=(Ve=D==null?void 0:D[b])!=null?Ve:0,ze=$e?Ne:F-O[he]-j[he]-_e+k.altAxis,Fe=$e?F+O[he]+j[he]-_e-k.altAxis:Ie,Ue=l&&$e?St(ze,F,Fe):fe(l?ze:Ne,F,l?Fe:Ie);w[b]=Ue,S[b]=Ue-F;}e.modifiersData[r]=S;}}var xt={name:"preventOverflow",enabled:!0,phase:"main",fn:on,requiresIfExists:["offset"]};function an(t){return {scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function sn(t){return t===H(t)||!B(t)?We(t):an(t)}function fn(t){var e=t.getBoundingClientRect(),n=Z(e.width)/t.offsetWidth||1,r=Z(e.height)/t.offsetHeight||1;return n!==1||r!==1}function cn(t,e,n){n===void 0&&(n=!1);var r=B(e),o=B(e)&&fn(e),i=I$1(e),a=ee(t,o),s={scrollLeft:0,scrollTop:0},f={x:0,y:0};return (r||!r&&!n)&&((C(e)!=="body"||Se(i))&&(s=sn(e)),B(e)?(f=ee(e,!0),f.x+=e.clientLeft,f.y+=e.clientTop):i&&(f.x=Be(i))),{x:a.left+s.scrollLeft-f.x,y:a.top+s.scrollTop-f.y,width:a.width,height:a.height}}function pn(t){var e=new Map,n=new Set,r=[];t.forEach(function(i){e.set(i.name,i);});function o(i){n.add(i.name);var a=[].concat(i.requires||[],i.requiresIfExists||[]);a.forEach(function(s){if(!n.has(s)){var f=e.get(s);f&&o(f);}}),r.push(i);}return t.forEach(function(i){n.has(i.name)||o(i);}),r}function un(t){var e=pn(t);return ot.reduce(function(n,r){return n.concat(e.filter(function(o){return o.phase===r}))},[])}function ln(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t());});})),e}}function dn(t){var e=t.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var Ot={placement:"bottom",modifiers:[],strategy:"absolute"};function $t(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return !e.some(function(r){return !(r&&typeof r.getBoundingClientRect=="function")})}function we(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,o=e.defaultOptions,i=o===void 0?Ot:o;return function(a,s,f){f===void 0&&(f=i);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ot,i),modifiersData:{},elements:{reference:a,popper:s},attributes:{},styles:{}},u=[],m=!1,v={state:c,setOptions:function(p){var g=typeof p=="function"?p(c.options):p;h(),c.options=Object.assign({},i,c.options,g),c.scrollParents={reference:Q(a)?ce(a):a.contextElement?ce(a.contextElement):[],popper:ce(s)};var x=un(dn([].concat(r,c.options.modifiers)));return c.orderedModifiers=x.filter(function(y){return y.enabled}),l(),v.update()},forceUpdate:function(){if(!m){var p=c.elements,g=p.reference,x=p.popper;if($t(g,x)){c.rects={reference:cn(g,se(x),c.options.strategy==="fixed"),popper:ke(x)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(j){return c.modifiersData[j.name]=Object.assign({},j.data)});for(var y=0;y<c.orderedModifiers.length;y++){if(c.reset===!0){c.reset=!1,y=-1;continue}var $=c.orderedModifiers[y],d=$.fn,b=$.options,w=b===void 0?{}:b,O=$.name;typeof d=="function"&&(c=d({state:c,options:w,name:O,instance:v})||c);}}}},update:ln(function(){return new Promise(function(p){v.forceUpdate(),p(c);})}),destroy:function(){h(),m=!0;}};if(!$t(a,s))return v;v.setOptions(f).then(function(p){!m&&f.onFirstUpdate&&f.onFirstUpdate(p);});function l(){c.orderedModifiers.forEach(function(p){var g=p.name,x=p.options,y=x===void 0?{}:x,$=p.effect;if(typeof $=="function"){var d=$({state:c,name:g,instance:v,options:y}),b=function(){};u.push(d||b);}});}function h(){u.forEach(function(p){return p()}),u=[];}return v}}we();var mn=[Re,He,Me,Ae];we({defaultModifiers:mn});var gn=[Re,He,Me,Ae,wt,vt,xt,pt,bt],yn=we({defaultModifiers:gn}); 9527 9528 const usePopper = (referenceElementRef, popperElementRef, opts = {}) => { 9529 const stateUpdater = { 9530 name: "updateState", 9531 enabled: true, 9532 phase: "write", 9533 fn: ({ state }) => { 9534 const derivedState = deriveState(state); 9535 Object.assign(states.value, derivedState); 9536 }, 9537 requires: ["computeStyles"] 9538 }; 9539 const options = vue.computed(() => { 9540 const { onFirstUpdate, placement, strategy, modifiers } = vue.unref(opts); 9541 return { 9542 onFirstUpdate, 9543 placement: placement || "bottom", 9544 strategy: strategy || "absolute",
9545 modifiers: [ 9546 ...modifiers || [], 9547 stateUpdater, 9548 { name: "applyStyles", enabled: false } 9549 ] 9550 }; 9551 }); 9552 const instanceRef = vue.shallowRef(); 9553 const states = vue.ref({ 9554 styles: { 9555 popper: { 9556 position: vue.unref(options).strategy, 9557 left: "0", 9558 top: "0" 9559 }, 9560 arrow: { 9561 position: "absolute" 9562 } 9563 }, 9564 attributes: {} 9565 }); 9566 const destroy = () => { 9567 if (!instanceRef.value) 9568 return; 9569 instanceRef.value.destroy(); 9570 instanceRef.value = void 0; 9571 }; 9572 vue.watch(options, (newOptions) => { 9573 const instance = vue.unref(instanceRef); 9574 if (instance) { 9575 instance.setOptions(newOptions); 9576 } 9577 }, { 9578 deep: true 9579 }); 9580 vue.watch([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => { 9581 destroy(); 9582 if (!referenceElement || !popperElement) 9583 return; 9584 instanceRef.value = yn(referenceElement, popperElement, vue.unref(options)); 9585 }); 9586 vue.onBeforeUnmount(() => { 9587 destroy(); 9588 }); 9589 return { 9590 state: vue.computed(() => { 9591 var _a; 9592 return { ...((_a = vue.unref(instanceRef)) == null ? void 0 : _a.state) || {} }; 9593 }), 9594 styles: vue.computed(() => vue.unref(states).styles), 9595 attributes: vue.computed(() => vue.unref(states).attributes), 9596 update: () => { 9597 var _a; 9598 return (_a = vue.unref(instanceRef)) == null ? void 0 : _a.update(); 9599 }, 9600 forceUpdate: () => { 9601 var _a; 9602 return (_a = vue.unref(instanceRef)) == null ? void 0 : _a.forceUpdate(); 9603 }, 9604 instanceRef: vue.computed(() => vue.unref(instanceRef)) 9605 }; 9606 }; 9607 function deriveState(state) { 9608 const elements = Object.keys(state.elements); 9609 const styles = fromPairs(elements.map((element) => [element, state.styles[element] || {}])); 9610 const attributes = fromPairs(elements.map((element) => [element, state.attributes[element]])); 9611 return { 9612 styles, 9613 attributes 9614 }; 9615 } 9616 9617 const useRestoreActive = (toggle, initialFocus) => { 9618 let previousActive; 9619 vue.watch(() => toggle.value, (val) => { 9620 var _a, _b; 9621 if (val) { 9622 previousActive = document.activeElement; 9623 if (vue.isRef(initialFocus)) { 9624 (_b = (_a = initialFocus.value).focus) == null ? void 0 : _b.call(_a); 9625 } 9626 } else { 9627 { 9628 previousActive.focus(); 9629 } 9630 } 9631 }); 9632 }; 9633 9634 const useSameTarget = (handleClick) => { 9635 if (!handleClick) { 9636 return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP }; 9637 } 9638 let mousedownTarget = false; 9639 let mouseupTarget = false; 9640 const onClick = (e) => { 9641 if (mousedownTarget && mouseupTarget) { 9642 handleClick(e); 9643 } 9644 mousedownTarget = mouseupTarget = false; 9645 }; 9646 const onMousedown = (e) => { 9647 mousedownTarget = e.target === e.currentTarget; 9648 }; 9649 const onMouseup = (e) => { 9650 mouseupTarget = e.target === e.currentTarget; 9651 }; 9652 return { onClick, onMousedown, onMouseup }; 9653 }; 9654 9655 const useTeleport = (contentRenderer, appendToBody) => { 9656 const isTeleportVisible = vue.ref(false); 9657 if (!isClient) { 9658 return { 9659 isTeleportVisible, 9660 showTeleport: NOOP, 9661 hideTeleport: NOOP, 9662 renderTeleport: NOOP 9663 }; 9664 } 9665 let $el = null; 9666 const showTeleport = () => { 9667 isTeleportVisible.value = true; 9668 if ($el !== null) 9669 return; 9670 $el = createGlobalNode(); 9671 }; 9672 const hideTeleport = () => { 9673 isTeleportVisible.value = false; 9674 if ($el !== null) { 9675 removeGlobalNode($el); 9676 $el = null; 9677 } 9678 }; 9679 const renderTeleport = () => { 9680 return appendToBody.value !== true ? contentRenderer() : isTeleportVisible.value ? [vue.h(vue.Teleport, { to: $el }, contentRenderer())] : void 0; 9681 }; 9682 vue.onUnmounted(hideTeleport); 9683 return { 9684 isTeleportVisible, 9685 showTeleport, 9686 hideTeleport, 9687 renderTeleport 9688 }; 9689 }; 9690 9691 const useThrottleRender = (loading, throttle = 0) => { 9692 if (throttle === 0) 9693 return loading; 9694 const throttled = vue.ref(false); 9695 let timeoutHandle = 0; 9696 const dispatchThrottling = () => { 9697 if (timeoutHandle) { 9698 clearTimeout(timeoutHandle); 9699 } 9700 timeoutHandle = window.setTimeout(() => { 9701 throttled.value = loading.value; 9702 }, throttle); 9703 }; 9704 vue.onMounted(dispatchThrottling); 9705 vue.watch(() => loading.value, (val) => { 9706 if (val) { 9707 dispatchThrottling(); 9708 } else { 9709 throttled.value = val; 9710 } 9711 }); 9712 return throttled; 9713 }; 9714 9715 function useTimeout() { 9716 let timeoutHandle; 9717 const registerTimeout = (fn, delay) => { 9718 cancelTimeout(); 9719 timeoutHandle = window.setTimeout(fn, delay); 9720 }; 9721 const cancelTimeout = () => window.clearTimeout(timeoutHandle);
9722 tryOnScopeDispose(() => cancelTimeout()); 9723 return { 9724 registerTimeout, 9725 cancelTimeout 9726 }; 9727 } 9728 9729 const AFTER_APPEAR = "after-appear"; 9730 const AFTER_ENTER = "after-enter"; 9731 const AFTER_LEAVE = "after-leave"; 9732 const APPEAR = "appear"; 9733 const APPEAR_CANCELLED = "appear-cancelled"; 9734 const BEFORE_ENTER = "before-enter"; 9735 const BEFORE_LEAVE = "before-leave"; 9736 const ENTER = "enter"; 9737 const ENTER_CANCELLED = "enter-cancelled"; 9738 const LEAVE = "leave"; 9739 const LEAVE_CANCELLED = "leave-cancelled"; 9740 const useTransitionFallthroughEmits = [ 9741 AFTER_APPEAR, 9742 AFTER_ENTER, 9743 AFTER_LEAVE, 9744 APPEAR, 9745 APPEAR_CANCELLED, 9746 BEFORE_ENTER, 9747 BEFORE_LEAVE, 9748 ENTER, 9749 ENTER_CANCELLED, 9750 LEAVE, 9751 LEAVE_CANCELLED 9752 ]; 9753 const useTransitionFallthrough = () => { 9754 const { emit } = vue.getCurrentInstance(); 9755 return { 9756 onAfterAppear: () => { 9757 emit(AFTER_APPEAR); 9758 }, 9759 onAfterEnter: () => { 9760 emit(AFTER_ENTER); 9761 }, 9762 onAfterLeave: () => { 9763 emit(AFTER_LEAVE); 9764 }, 9765 onAppearCancelled: () => { 9766 emit(APPEAR_CANCELLED); 9767 }, 9768 onBeforeEnter: () => { 9769 emit(BEFORE_ENTER); 9770 }, 9771 onBeforeLeave: () => { 9772 emit(BEFORE_LEAVE); 9773 }, 9774 onEnter: () => { 9775 emit(ENTER); 9776 }, 9777 onEnterCancelled: () => { 9778 emit(ENTER_CANCELLED); 9779 }, 9780 onLeave: () => { 9781 emit(LEAVE); 9782 }, 9783 onLeaveCancelled: () => { 9784 emit(LEAVE_CANCELLED); 9785 } 9786 }; 9787 }; 9788 9789 const defaultIdInjection = { 9790 prefix: Math.floor(Math.random() * 1e4), 9791 current: 0 9792 }; 9793 const ID_INJECTION_KEY = Symbol("elIdInjection"); 9794 const useIdInjection = () => { 9795 return vue.getCurrentInstance() ? vue.inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection; 9796 }; 9797 const useId = (deterministicId) => { 9798 const idInjection = useIdInjection(); 9799 const namespace = useGetDerivedNamespace(); 9800 const idRef = vue.computed(() => vue.unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`); 9801 return idRef; 9802 }; 9803 9804 let registeredEscapeHandlers = []; 9805 const cachedHandler = (e) => { 9806 const event = e; 9807 if (event.key === EVENT_CODE.esc) { 9808 registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event)); 9809 } 9810 }; 9811 const useEscapeKeydown = (handler) => { 9812 vue.onMounted(() => { 9813 if (registeredEscapeHandlers.length === 0) { 9814 document.addEventListener("keydown", cachedHandler); 9815 } 9816 if (isClient) 9817 registeredEscapeHandlers.push(handler); 9818 }); 9819 vue.onBeforeUnmount(() => { 9820 registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler); 9821 if (registeredEscapeHandlers.length === 0) { 9822 if (isClient) 9823 document.removeEventListener("keydown", cachedHandler); 9824 } 9825 }); 9826 }; 9827
9828 let cachedContainer; 9829 const usePopperContainerId = () => { 9830 const namespace = useGetDerivedNamespace(); 9831 const idInjection = useIdInjection(); 9832 const id = vue.computed(() => { 9833 return `${namespace.value}-popper-container-${idInjection.prefix}`; 9834 }); 9835 const selector = vue.computed(() => `#${id.value}`); 9836 return { 9837 id, 9838 selector 9839 }; 9840 }; 9841 const createContainer = (id) => { 9842 const container = document.createElement("div"); 9843 container.id = id; 9844 document.body.appendChild(container); 9845 return container; 9846 }; 9847 const usePopperContainer = () => { 9848 const { id, selector } = usePopperContainerId(); 9849 vue.onBeforeMount(() => { 9850 if (!isClient) 9851 return; 9852 if (!cachedContainer && !document.body.querySelector(selector.value)) { 9853 cachedContainer = createContainer(id.value); 9854 } 9855 }); 9856 return { 9857 id, 9858 selector 9859 }; 9860 }; 9861 9862 const useDelayedRender = ({ 9863 indicator, 9864 intermediateIndicator, 9865 shouldSetIntermediate = () => true, 9866 beforeShow, 9867 afterShow, 9868 afterHide, 9869 beforeHide 9870 }) => { 9871 vue.watch(() => vue.unref(indicator), (val) => { 9872 if (val) { 9873 beforeShow == null ? void 0 : beforeShow(); 9874 vue.nextTick(() => { 9875 if (!vue.unref(indicator)) 9876 return; 9877 if (shouldSetIntermediate("show")) { 9878 intermediateIndicator.value = true; 9879 } 9880 }); 9881 } else { 9882 beforeHide == null ? void 0 : beforeHide(); 9883 vue.nextTick(() => { 9884 if (vue.unref(indicator)) 9885 return; 9886 if (shouldSetIntermediate("hide")) { 9887 intermediateIndicator.value = false; 9888 } 9889 }); 9890 } 9891 }); 9892 vue.watch(() => intermediateIndicator.value, (val) => { 9893 if (val) { 9894 afterShow == null ? void 0 : afterShow(); 9895 } else { 9896 afterHide == null ? void 0 : afterHide(); 9897 } 9898 }); 9899 }; 9900 9901 const useDelayedToggleProps = buildProps({ 9902 showAfter: { 9903 type: Number, 9904 default: 0 9905 }, 9906 hideAfter: { 9907 type: Number, 9908 default: 200 9909 }, 9910 autoClose: { 9911 type: Number, 9912 default: 0 9913 } 9914 }); 9915 const useDelayedToggle = ({ 9916 showAfter, 9917 hideAfter, 9918 autoClose, 9919 open, 9920 close 9921 }) => { 9922 const { registerTimeout } = useTimeout(); 9923 const { 9924 registerTimeout: registerTimeoutForAutoClose, 9925 cancelTimeout: cancelTimeoutForAutoClose 9926 } = useTimeout(); 9927 const onOpen = (event) => { 9928 registerTimeout(() => { 9929 open(event); 9930 const _autoClose = vue.unref(autoClose); 9931 if (isNumber(_autoClose) && _autoClose > 0) { 9932 registerTimeoutForAutoClose(() => { 9933 close(event); 9934 }, _autoClose); 9935 } 9936 }, vue.unref(showAfter)); 9937 }; 9938 const onClose = (event) => { 9939 cancelTimeoutForAutoClose(); 9940 registerTimeout(() => { 9941 close(event); 9942 }, vue.unref(hideAfter)); 9943 }; 9944 return { 9945 onOpen, 9946 onClose 9947 }; 9948 }; 9949 9950 const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef"); 9951 const useForwardRef = (forwardRef) => { 9952 const setForwardRef = (el) => { 9953 forwardRef.value = el; 9954 }; 9955 vue.provide(FORWARD_REF_INJECTION_KEY, { 9956 setForwardRef 9957 }); 9958 }; 9959 const useForwardRefDirective = (setForwardRef) => { 9960 return { 9961 mounted(el) { 9962 setForwardRef(el); 9963 }, 9964 updated(el) { 9965 setForwardRef(el); 9966 }, 9967 unmounted() { 9968 setForwardRef(null); 9969 } 9970 }; 9971 }; 9972 9973 const zIndex = vue.ref(0);
9974 const defaultInitialZIndex = 2e3; 9975 const zIndexContextKey = Symbol("zIndexContextKey"); 9976 const useZIndex = (zIndexOverrides) => { 9977 const zIndexInjection = zIndexOverrides || vue.inject(zIndexContextKey, void 0); 9978 const initialZIndex = vue.computed(() => { 9979 const zIndexFromInjection = vue.unref(zIndexInjection); 9980 return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex; 9981 }); 9982 const currentZIndex = vue.computed(() => initialZIndex.value + zIndex.value); 9983 const nextZIndex = () => { 9984 zIndex.value++; 9985 return currentZIndex.value; 9986 }; 9987 return { 9988 initialZIndex, 9989 currentZIndex, 9990 nextZIndex 9991 }; 9992 }; 9993 9994 function getSide(placement) { 9995 return placement.split('-')[0]; 9996 } 9997 9998 function getAlignment(placement) { 9999 return placement.split('-')[1]; 10000 } 10001 10002 function getMainAxisFromPlacement(placement) { 10003 return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y'; 10004 } 10005 10006 function getLengthFromAxis(axis) { 10007 return axis === 'y' ? 'height' : 'width'; 10008 } 10009 10010 function computeCoordsFromPlacement(_ref, placement, rtl) { 10011 let { 10012 reference, 10013 floating 10014 } = _ref; 10015 const commonX = reference.x + reference.width / 2 - floating.width / 2; 10016 const commonY = reference.y + reference.height / 2 - floating.height / 2; 10017 const mainAxis = getMainAxisFromPlacement(placement); 10018 const length = getLengthFromAxis(mainAxis); 10019 const commonAlign = reference[length] / 2 - floating[length] / 2; 10020 const side = getSide(placement); 10021 const isVertical = mainAxis === 'x'; 10022 let coords; 10023 10024 switch (side) { 10025 case 'top': 10026 coords = { 10027 x: commonX, 10028 y: reference.y - floating.height 10029 }; 10030 break; 10031 10032 case 'bottom': 10033 coords = { 10034 x: commonX, 10035 y: reference.y + reference.height 10036 }; 10037 break; 10038 10039 case 'right': 10040 coords = { 10041 x: reference.x + reference.width, 10042 y: commonY 10043 }; 10044 break; 10045 10046 case 'left': 10047 coords = { 10048 x: reference.x - floating.width, 10049 y: commonY 10050 }; 10051 break; 10052 10053 default: 10054 coords = { 10055 x: reference.x, 10056 y: reference.y 10057 }; 10058 } 10059 10060 switch (getAlignment(placement)) { 10061 case 'start': 10062 coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); 10063 break; 10064 10065 case 'end': 10066 coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1); 10067 break; 10068 } 10069 10070 return coords; 10071 } 10072 10073 /** 10074 * Computes the `x` and `y` coordinates that will place the floating element 10075 * next to a reference element when it is given a certain positioning strategy. 10076 * 10077 * This export does not have any `platform` interface logic. You will need to 10078 * write one for the platform you are using Floating UI with. 10079 */ 10080 10081 const computePosition$1 = async (reference, floating, config) => { 10082 const { 10083 placement = 'bottom', 10084 strategy = 'absolute', 10085 middleware = [], 10086 platform 10087 } = config; 10088 const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating)); 10089 10090 if (process.env.NODE_ENV !== "production") { 10091 if (platform == null) { 10092 console.error(['Floating UI: `platform` property was not passed to config. If you', 'want to use Floating UI on the web, install @floating-ui/dom', 'instead of the /core package. Otherwise, you can create your own', '`platform`: https://floating-ui.com/docs/platform'].join(' ')); 10093 } 10094 10095 if (middleware.filter(_ref => { 10096 let { 10097 name 10098 } = _ref; 10099 return name === 'autoPlacement' || name === 'flip'; 10100 }).length > 1) { 10101 throw new Error(['Floating UI: duplicate `flip` and/or `autoPlacement`', 'middleware detected. This will lead to an infinite loop. Ensure only', 'one of either has been passed to the `middleware` array.'].join(' '));
10102 } 10103 } 10104 10105 let rects = await platform.getElementRects({ 10106 reference, 10107 floating, 10108 strategy 10109 }); 10110 let { 10111 x, 10112 y 10113 } = computeCoordsFromPlacement(rects, placement, rtl); 10114 let statefulPlacement = placement; 10115 let middlewareData = {}; 10116 let resetCount = 0; 10117 10118 for (let i = 0; i < middleware.length; i++) { 10119 const { 10120 name, 10121 fn 10122 } = middleware[i]; 10123 const { 10124 x: nextX, 10125 y: nextY, 10126 data, 10127 reset 10128 } = await fn({ 10129 x, 10130 y, 10131 initialPlacement: placement, 10132 placement: statefulPlacement, 10133 strategy, 10134 middlewareData, 10135 rects, 10136 platform, 10137 elements: { 10138 reference, 10139 floating 10140 } 10141 }); 10142 x = nextX != null ? nextX : x; 10143 y = nextY != null ? nextY : y; 10144 middlewareData = { ...middlewareData, 10145 [name]: { ...middlewareData[name], 10146 ...data 10147 } 10148 }; 10149 10150 if (process.env.NODE_ENV !== "production") { 10151 if (resetCount > 50) { 10152 console.warn(['Floating UI: The middleware lifecycle appears to be running in an', 'infinite loop. This is usually caused by a `reset` continually', 'being returned without a break condition.'].join(' ')); 10153 } 10154 } 10155 10156 if (reset && resetCount <= 50) { 10157 resetCount++; 10158 10159 if (typeof reset === 'object') { 10160 if (reset.placement) { 10161 statefulPlacement = reset.placement; 10162 } 10163 10164 if (reset.rects) { 10165 rects = reset.rects === true ? await platform.getElementRects({ 10166 reference, 10167 floating, 10168 strategy 10169 }) : reset.rects; 10170 } 10171 10172 ({ 10173 x, 10174 y 10175 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); 10176 } 10177 10178 i = -1; 10179 continue; 10180 } 10181 } 10182 10183 return { 10184 x, 10185 y, 10186 placement: statefulPlacement, 10187 strategy, 10188 middlewareData 10189 }; 10190 }; 10191 10192 function expandPaddingObject(padding) { 10193 return { 10194 top: 0, 10195 right: 0, 10196 bottom: 0, 10197 left: 0, 10198 ...padding 10199 }; 10200 } 10201 10202 function getSideObjectFromPadding(padding) { 10203 return typeof padding !== 'number' ? expandPaddingObject(padding) : { 10204 top: padding, 10205 right: padding, 10206 bottom: padding, 10207 left: padding 10208 }; 10209 } 10210 10211 function rectToClientRect(rect) { 10212 return { ...rect, 10213 top: rect.y, 10214 left: rect.x, 10215 right: rect.x + rect.width, 10216 bottom: rect.y + rect.height 10217 }; 10218 } 10219 10220 const min$2 = Math.min; 10221 const max$2 = Math.max; 10222 10223 function within(min$1, value, max$1) { 10224 return max$2(min$1, min$2(value, max$1)); 10225 } 10226 10227 /** 10228 * Positions an inner element of the floating element such that it is centered 10229 * to the reference element. 10230 * @see https://floating-ui.com/docs/arrow 10231 */ 10232 const arrow = options => ({ 10233 name: 'arrow', 10234 options, 10235 10236 async fn(middlewareArguments) { 10237 // Since `element` is required, we don't Partial<> the type 10238 const { 10239 element, 10240 padding = 0 10241 } = options != null ? options : {}; 10242 const { 10243 x, 10244 y, 10245 placement, 10246 rects, 10247 platform 10248 } = middlewareArguments; 10249 10250 if (element == null) { 10251 if (process.env.NODE_ENV !== "production") { 10252 console.warn('Floating UI: No `element` was passed to the `arrow` middleware.'); 10253 } 10254 10255 return {}; 10256 } 10257 10258 const paddingObject = getSideObjectFromPadding(padding); 10259 const coords = { 10260 x, 10261 y 10262 }; 10263 const axis = getMainAxisFromPlacement(placement); 10264 const alignment = getAlignment(placement); 10265 const length = getLengthFromAxis(axis); 10266 const arrowDimensions = await platform.getDimensions(element); 10267 const minProp = axis === 'y' ? 'top' : 'left'; 10268 const maxProp = axis === 'y' ? 'bottom' : 'right'; 10269 const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; 10270 const startDiff = coords[axis] - rects.reference[axis]; 10271 const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element)); 10272 let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0; 10273 10274 if (clientSize === 0) { 10275 clientSize = rects.floating[length]; 10276 } 10277 10278 const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center 10279 // point is outside the floating element's bounds 10280 10281 const min = paddingObject[minProp]; 10282 const max = clientSize - arrowDimensions[length] - paddingObject[maxPro
10282p]; 10283 const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; 10284 const offset = within(min, center, max); // Make sure that arrow points at the reference 10285 10286 const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp]; 10287 const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length]; 10288 const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0; 10289 return { 10290 [axis]: coords[axis] - alignmentOffset, 10291 data: { 10292 [axis]: offset, 10293 centerOffset: center - offset 10294 } 10295 }; 10296 } 10297 10298 }); 10299 10300 async function convertValueToCoords(middlewareArguments, value) { 10301 const { 10302 placement, 10303 platform, 10304 elements 10305 } = middlewareArguments; 10306 const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)); 10307 const side = getSide(placement); 10308 const alignment = getAlignment(placement); 10309 const isVertical = getMainAxisFromPlacement(placement) === 'x'; 10310 const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1; 10311 const crossAxisMulti = rtl && isVertical ? -1 : 1; 10312 const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const 10313 10314 let { 10315 mainAxis, 10316 crossAxis, 10317 alignmentAxis 10318 } = typeof rawValue === 'number' ? { 10319 mainAxis: rawValue, 10320 crossAxis: 0, 10321 alignmentAxis: null 10322 } : { 10323 mainAxis: 0, 10324 crossAxis: 0, 10325 alignmentAxis: null, 10326 ...rawValue 10327 }; 10328 10329 if (alignment && typeof alignmentAxis === 'number') { 10330 crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis; 10331 } 10332 10333 return isVertical ? { 10334 x: crossAxis * crossAxisMulti, 10335 y: mainAxis * mainAxisMulti 10336 } : { 10337 x: mainAxis * mainAxisMulti, 10338 y: crossAxis * crossAxisMulti 10339 }; 10340 } 10341 /** 10342 * Displaces the floating element from its reference element. 10343 * @see https://floating-ui.com/docs/offset 10344 */ 10345 10346 const offset = function (value) { 10347 if (value === void 0) { 10348 value = 0; 10349 } 10350 10351 return { 10352 name: 'offset', 10353 options: value, 10354 10355 async fn(middlewareArguments) { 10356 const { 10357 x, 10358 y 10359 } = middlewareArguments; 10360 const diffCoords = await convertValueToCoords(middlewareArguments, value); 10361 return { 10362 x: x + diffCoords.x, 10363 y: y + diffCoords.y, 10364 data: diffCoords 10365 }; 10366 } 10367 10368 }; 10369 }; 10370 10371 function isWindow(value) { 10372 return value && value.document && value.location && value.alert && value.setInterval; 10373 } 10374 function getWindow(node) { 10375 if (node == null) { 10376 return window; 10377 } 10378 10379 if (!isWindow(node)) { 10380 const ownerDocument = node.ownerDocument; 10381 return ownerDocument ? ownerDocument.defaultView || window : window; 10382 } 10383 10384 return node; 10385 } 10386 10387 function getComputedStyle$1(element) { 10388 return getWindow(element).getComputedStyle(element); 10389 } 10390 10391 function getNodeName(node) { 10392 return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : ''; 10393 } 10394 10395 function getUAString() { 10396 const uaData = navigator.userAgentData; 10397 10398 if (uaData != null && uaData.brands) { 10399 return uaData.brands.map(item => item.brand + "/" + item.version).join(' '); 10400 } 10401 10402 return navigator.userAgent; 10403 } 10404 10405 function isHTMLElement(value) { 10406 return value instanceof getWindow(value).HTMLElement; 10407 } 10408 function isElement(value) { 10409 return value instanceof getWindow(value).Element; 10410 } 10411 function isNode(value) { 10412 return value instanceof getWindow(value).Node; 10413 } 10414 function isShadowRoot(node) { 10415 // Browsers without `ShadowRoot` support 10416 if (typeof ShadowRoot === 'undefined') { 10417 return false; 10418 } 10419 10420 const OwnElement = getWindow(node).ShadowRoot; 10421 return node instanceof OwnElement || node instanceof ShadowRoot; 10422 } 10423 function isOverflowElement(element) { 10424 // Firefox wants us to check `-x` and `-y` variations as well 10425 const { 10426 overflow, 10427 overflowX, 10428 overflowY 10429 } = getComputedStyle$1(element); 10430 return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX); 10431 } 10432 function isTableElement(element) { 10433 return ['table', 'td', 'th'].includes(getNodeName(element)); 10434 } 10435 function isContainingBlock(element) { 10436 // TODO: Try and use feature detection here instead 10437 const isFirefox = /firefox/i.test(getUAString()); 10438 const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that 10439 // create a containing block. 10440 // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block 10441 10442 return css.transform !== 'none' || css.perspective !== 'none' || // @ts-ignore (TS 4.1 compat) 10443 css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false); 10444 } 10445 function isLayoutViewport() { 10446 // Not Safari 10447 return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways 10448 // • Always-visible scrollbar or not 10449 // • Width of <html>, etc.
10450 // const vV = win.visualViewport; 10451 // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true; 10452 } 10453 10454 const min$1 = Math.min; 10455 const max$1 = Math.max; 10456 const round = Math.round; 10457 10458 function getBoundingClientRect(element, includeScale, isFixedStrategy) { 10459 var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2; 10460 10461 if (includeScale === void 0) { 10462 includeScale = false; 10463 } 10464 10465 if (isFixedStrategy === void 0) { 10466 isFixedStrategy = false; 10467 } 10468 10469 const clientRect = element.getBoundingClientRect(); 10470 let scaleX = 1; 10471 let scaleY = 1; 10472 10473 if (includeScale && isHTMLElement(element)) { 10474 scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1; 10475 scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1; 10476 } 10477 10478 const win = isElement(element) ? getWindow(element) : window; 10479 const addVisualOffsets = !isLayoutViewport() && isFixedStrategy; 10480 const x = (clientRect.left + (addVisualOffsets ? (_win$visualViewport$o = (_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) != null ? _win$visualViewport$o : 0 : 0)) / scaleX; 10481 const y = (clientRect.top + (addVisualOffsets ? (_win$visualViewport$o2 = (_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) != null ? _win$visualViewport$o2 : 0 : 0)) / scaleY; 10482 const width = clientRect.width / scaleX; 10483 const height = clientRect.height / scaleY; 10484 return { 10485 width, 10486 height, 10487 top: y, 10488 right: x + width, 10489 bottom: y + height, 10490 left: x, 10491 x, 10492 y 10493 }; 10494 } 10495 10496 function getDocumentElement(node) { 10497 return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement; 10498 } 10499 10500 function getNodeScroll(element) { 10501 if (isElement(element)) { 10502 return { 10503 scrollLeft: element.scrollLeft, 10504 scrollTop: element.scrollTop 10505 }; 10506 } 10507 10508 return { 10509 scrollLeft: element.pageXOffset, 10510 scrollTop: element.pageYOffset 10511 }; 10512 } 10513 10514 function getWindowScrollBarX(element) { 10515 // If <html> has a CSS width greater than the viewport, then this will be 10516 // incorrect for RTL. 10517 return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft; 10518 } 10519 10520 function isScaled(element) { 10521 const rect = getBoundingClientRect(element); 10522 return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight; 10523 } 10524 10525 function getRectRelativeToOffsetParent(element, offsetParent, strategy) { 10526 const isOffsetParentAnElement = isHTMLElement(offsetParent); 10527 const documentElement = getDocumentElement(offsetParent); 10528 const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat) 10529 isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed'); 10530 let scroll = { 10531 scrollLeft: 0, 10532 scrollTop: 0 10533 }; 10534 const offsets = { 10535 x: 0, 10536 y: 0 10537 }; 10538 10539 if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') { 10540 if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) { 10541 scroll = getNodeScroll(offsetParent); 10542 } 10543 10544 if (isHTMLElement(offsetParent)) { 10545 const offsetRect = getBoundingClientRect(offsetParent, true); 10546 offsets.x = offsetRect.x + offsetParent.clientLeft; 10547 offsets.y = offsetRect.y + offsetParent.clientTop; 10548 } else if (documentElement) { 10549 offsets.x = getWindowScrollBarX(documentElement); 10550 } 10551 } 10552 10553 return { 10554 x: rect.left + scroll.scrollLeft - offsets.x, 10555 y: rect.top + scroll.scrollTop - offsets.y, 10556 width: rect.width, 10557 height: rect.height 10558 }; 10559 } 10560 10561 function getParentNode(node) { 10562 if (getNodeName(node) === 'html') { 10563 return node; 10564 } 10565 10566 return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle 10567 // @ts-ignore 10568 node.assignedSlot || // step into the shadow DOM of the parent of a slotted node 10569 node.parentNode || ( // DOM Element detected 10570 isShadowRoot(node) ? node.host : null) || // ShadowRoot detected 10571 getDocumentElement(node) // fallback 10572 10573 ); 10574 } 10575 10576 function getTrueOffsetParent(element) { 10577 if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') { 10578 return null; 10579 } 10580 10581 return composedOffsetParent(element); 10582 } 10583 /** 10584 * Polyfills the old offsetParent behavior from before the spec was changed: 10585 * https://github.com/w3c/csswg-drafts/issues/159 10586 */ 10587 10588 10589 function composedOffsetParent(element) { 10590 let { 10591 offsetParent 10592 } = element; 10593 let ancestor = element; 10594 let foundInsideSlot = false; 10595 10596 while (ancestor && ancestor !== offsetParent) { 10597 const { 10598 assignedSlot 10599 } = ancestor; 10600 10601 if (assignedSlot) { 10602 let newOffsetParent = assignedSlot.offsetParent; 10603 10604 if (getComputedStyle$1(assignedSlot).display === 'contents') { 10605 const hadStyleAttribute = assignedSlot.hasAttribute('style'); 10606 const oldDisplay = assignedSlot.style.display; 10607 assignedSlot.style.display = getComputedStyle$1(ancestor).display; 10608 newOffsetParent = assignedSlot.offsetParent; 10609 assignedSlot.style.display = oldDisplay; 10610 10611 if (!hadStyleAttribute) { 10612 assignedSlot.removeAttribute('style'); 10613 } 10614 } 10615 10616 ancestor = assignedSlot; 10617 10618 if (offsetParent !== newOffsetParent) { 10619 offsetParent = newOffsetParent; 10620 foundInsideSlot = true; 10621 } 10622 } else if (isShadowRoot(ancestor) && ancestor.host && foundInsideSlot) { 10623 break; 10624 } 10625 10626 ancestor = isShadowRoot(ancestor) && ancestor.host || ancestor.parentNode; 10627 } 10628 10629 return offsetParent; 10630 } 10631 10632 function getContainingBlock(element) { 10633 let currentNode = getParentNode(element); 10634 10635 if (isShadowRoot(currentNode)) { 10636 currentNode = currentNode.host; 10637 } 10638 10639 while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) { 10640 if (isContainingBlock(currentNode)) { 10641 return currentNode; 10642 } else { 10643 const parent = currentNode.parentNode; 10644 currentNode = isShadowRoot(parent) ? parent.host : parent; 10645 } 10646 } 10647 10648 return null; 10649 } // Gets the closest ancestor positioned element. Handles some edge cases, 10650 // such as table ancestors and cross browser bugs. 10651 10652 10653 function getOffsetParent(element) { 10654 const window = getWindow(element); 10655 let offsetParent = getTrueOffsetParent(element); 10656 10657 while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') { 10658 offsetParent = getTrueOffsetParent(offsetParent); 10659 } 10660 10661 if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) { 10662 return window; 10663 } 10664 10665 return offsetParent || getContainingBlock(element) || window; 10666 } 10667 10668 function getDimensions(element) { 10669 if (isHTMLElement(element)) { 10670 return { 10671 width: element.offsetWidth, 10672 height: element.offsetHeight 10673 }; 10674 } 10675 10676 const rect = getBoundingClientRect(element); 10677 return { 10678 width: rect.width, 10679 height: rect.height 10680 }; 10681 } 10682 10683 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { 10684 let { 10685 rect, 10686 offsetParent, 10687 strategy 10688 } = _ref; 10689 const isOffsetParentAnElement = isHTMLElement(offsetParent); 10690 const documentElement = getDocumentElement(offsetParent); 10691 10692 if (offsetParent === documentElement) { 10693 return rect; 10694 } 10695 10696 let scroll = { 10697 scrollLeft: 0, 10698 scrollTop: 0 10699 }; 10700 const offsets = { 10701 x: 0, 10702 y: 0 10703 }; 10704 10705 if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') { 10706 if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) { 10707 scroll = getNodeScroll(offsetParent); 10708 } 10709 10710 if (isHTMLElement(offsetParent)) { 10711 const offsetRect = getBoundingClientRect(offsetParent, true); 10712 offsets.x = offsetRect.x + offsetParent.clientLeft; 10713 offsets.y = offsetRect.y + offsetParent.clientTop; 10714 } // This doesn't appear to be need to be negated. 10715 // else if (documentElement) { 10716 // offsets.x = getWindowScrollBarX(documentElement); 10717 // } 10718 10719 } 10720 10721 return { ...rect, 10722 x: rect.x - scroll.scrollLeft + offsets.x, 10723 y: rect.y - scroll.scrollTop + offsets.y 10724 }; 10725 } 10726 10727 function getViewportRect(element, strategy) { 10728 const win = getWindow(element); 10729 const html = getDocumentElement(element);
10730 const visualViewport = win.visualViewport; 10731 let width = html.clientWidth; 10732 let height = html.clientHeight; 10733 let x = 0; 10734 let y = 0; 10735 10736 if (visualViewport) { 10737 width = visualViewport.width; 10738 height = visualViewport.height; 10739 const layoutViewport = isLayoutViewport(); 10740 10741 if (layoutViewport || !layoutViewport && strategy === 'fixed') { 10742 x = visualViewport.offsetLeft; 10743 y = visualViewport.offsetTop; 10744 } 10745 } 10746 10747 return { 10748 width, 10749 height, 10750 x, 10751 y 10752 }; 10753 } 10754 10755 // of the `<html>` and `<body>` rect bounds if horizontally scrollable 10756 10757 function getDocumentRect(element) { 10758 var _element$ownerDocumen; 10759 10760 const html = getDocumentElement(element); 10761 const scroll = getNodeScroll(element); 10762 const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body; 10763 const width = max$1(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0); 10764 const height = max$1(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0); 10765 let x = -scroll.scrollLeft + getWindowScrollBarX(element); 10766 const y = -scroll.scrollTop; 10767 10768 if (getComputedStyle$1(body || html).direction === 'rtl') {
10769 x += max$1(html.clientWidth, body ? body.clientWidth : 0) - width; 10770 } 10771 10772 return { 10773 width, 10774 height, 10775 x, 10776 y 10777 }; 10778 } 10779 10780 function getNearestOverflowAncestor(node) { 10781 const parentNode = getParentNode(node); 10782 10783 if (['html', 'body', '#document'].includes(getNodeName(parentNode))) { 10784 // @ts-ignore assume body is always available 10785 return node.ownerDocument.body; 10786 } 10787 10788 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { 10789 return parentNode; 10790 } 10791 10792 return getNearestOverflowAncestor(parentNode); 10793 } 10794 10795 function getOverflowAncestors(node, list) { 10796 var _node$ownerDocument; 10797 10798 if (list === void 0) { 10799 list = []; 10800 } 10801 10802 const scrollableAncestor = getNearestOverflowAncestor(node); 10803 const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body); 10804 const win = getWindow(scrollableAncestor); 10805 const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor; 10806 const updatedList = list.concat(target); 10807 return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here 10808 updatedList.concat(getOverflowAncestors(target)); 10809 } 10810 10811 function contains(parent, child) { 10812 const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method 10813 10814 if (parent.contains(child)) { 10815 return true; 10816 } // then fallback to custom implementation with Shadow DOM support 10817 else if (rootNode && isShadowRoot(rootNode)) { 10818 let next = child; 10819 10820 do { 10821 // use `===` replace node.isSameNode() 10822 if (next && parent === next) { 10823 return true; 10824 } // @ts-ignore: need a better way to handle this... 10825 10826 10827 next = next.parentNode || next.host; 10828 } while (next); 10829 } 10830 10831 return false; 10832 } 10833 10834 function getInnerBoundingClientRect(element, strategy) { 10835 const clientRect = getBoundingClientRect(element, false, strategy === 'fixed'); 10836 const top = clientRect.top + element.clientTop; 10837 const left = clientRect.left + element.clientLeft; 10838 return { 10839 top, 10840 left, 10841 x: left, 10842 y: top, 10843 right: left + element.clientWidth, 10844 bottom: top + element.clientHeight, 10845 width: element.clientWidth, 10846 height: element.clientHeight 10847 }; 10848 } 10849 10850 function getClientRectFromClippingAncestor(element, clippingParent, strategy) { 10851 if (clippingParent === 'viewport') { 10852 return rectToClientRect(getViewportRect(element, strategy)); 10853 } 10854 10855 if (isElement(clippingParent)) { 10856 return getInnerBoundingClientRect(clippingParent, strategy); 10857 } 10858 10859 return rectToClientRect(getDocumentRect(getDocumentElement(element))); 10860 } // A "clipping ancestor" is an overflowable container with the characteristic of 10861 // clipping (or hiding) overflowing elements with a position different from 10862 // `initial` 10863 10864 10865 function getClippingAncestors(element) { 10866 const clippingAncestors = getOverflowAncestors(element); 10867 const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle$1(element).position); 10868 const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element; 10869 10870 if (!isElement(clipperElement)) { 10871 return []; 10872 } // @ts-ignore isElement check ensures we return Array<Element> 10873 10874 10875 return clippingAncestors.filter(clippingAncestors => isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body'); 10876 } // Gets the maximum area that the element is visible in due to any number of 10877 // clipping ancestors 10878 10879 10880 function getClippingRect(_ref) { 10881 let { 10882 element, 10883 boundary, 10884 rootBoundary, 10885 strategy 10886 } = _ref; 10887 const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary); 10888 const clippingAncestors = [...mainClippingAncestors, rootBoundary]; 10889 const firstClippingAncestor = clippingAncestors[0]; 10890 const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => { 10891 const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy); 10892 accRect.top = max$1(rect.top, accRect.top); 10893 accRect.right = min$1(rect.right, accRect.right); 10894 accRect.bottom = min$1(rect.bottom, accRect.bottom); 10895 accRect.left = max$1(rect.left, accRect.left); 10896 return accRect; 10897 }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy)); 10898 return { 10899 width: clippingRect.right - clippingRect.left, 10900 height: clippingRect.bottom - clippingRect.top, 10901 x: clippingRect.left, 10902 y: clippingRect.top 10903 }; 10904 } 10905 10906 const platform = { 10907 getClippingRect, 10908 convertOffsetParentRelativeRectToViewportRelativeRect, 10909 isElement, 10910 getDimensions, 10911 getOffsetParent, 10912 getDocumentElement, 10913 getElementRects: _ref => { 10914 let { 10915 reference, 10916 floating, 10917 strategy 10918 } = _ref; 10919 return { 10920 reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy), 10921 floating: { ...getDimensions(floating), 10922 x: 0, 10923 y: 0 10924 } 10925 }; 10926 }, 10927 getClientRects: element => Array.from(element.getClientRects()), 10928 isRTL: element => getComputedStyle$1(element).direction === 'rtl'
10929 }; 10930 10931 /** 10932 * Computes the `x` and `y` coordinates that will place the floating element 10933 * next to a reference element when it is given a certain CSS positioning 10934 * strategy. 10935 */ 10936 10937 const computePosition = (reference, floating, options) => computePosition$1(reference, floating, { 10938 platform, 10939 ...options 10940 }); 10941 10942 const useFloatingProps = buildProps({}); 10943 const unrefReference = (elRef) => { 10944 if (!isClient) 10945 return; 10946 if (!elRef) 10947 return elRef; 10948 const unrefEl = unrefElement(elRef); 10949 if (unrefEl) 10950 return unrefEl; 10951 return vue.isRef(elRef) ? unrefEl : elRef; 10952 }; 10953 const getPositionDataWithUnit = (record, key) => { 10954 const value = record == null ? void 0 : record[key]; 10955 return isNil(value) ? "" : `${value}px`; 10956 }; 10957 const useFloating = ({ 10958 middleware, 10959 placement, 10960 strategy 10961 }) => { 10962 const referenceRef = vue.ref(); 10963 const contentRef = vue.ref(); 10964 const x = vue.ref(); 10965 const y = vue.ref(); 10966 const middlewareData = vue.ref({}); 10967 const states = { 10968 x, 10969 y, 10970 placement, 10971 strategy, 10972 middlewareData 10973 }; 10974 const update = async () => { 10975 if (!isClient) 10976 return; 10977 const referenceEl = unrefReference(referenceRef); 10978 const contentEl = unrefElement(contentRef); 10979 if (!referenceEl || !contentEl) 10980 return; 10981 const data = await computePosition(referenceEl, contentEl, { 10982 placement: vue.unref(placement), 10983 strategy: vue.unref(strategy), 10984 middleware: vue.unref(middleware) 10985 }); 10986 keysOf(states).forEach((key) => { 10987 states[key].value = data[key]; 10988 }); 10989 }; 10990 vue.onMounted(() => { 10991 vue.watchEffect(() => { 10992 update(); 10993 }); 10994 }); 10995 return { 10996 ...states, 10997 update, 10998 referenceRef, 10999 contentRef 11000 }; 11001 }; 11002 const arrowMiddleware = ({ 11003 arrowRef, 11004 padding 11005 }) => { 11006 return { 11007 name: "arrow", 11008 options: { 11009 element: arrowRef, 11010 padding 11011 }, 11012 fn(args) { 11013 const arrowEl = vue.unref(arrowRef); 11014 if (!arrowEl) 11015 return {}; 11016 return arrow({ 11017 element: arrowEl, 11018 padding 11019 }).fn(args); 11020 } 11021 }; 11022 }; 11023 11024 function useCursor(input) { 11025 const selectionRef = vue.ref(); 11026 function recordCursor() { 11027 if (input.value == void 0) 11028 return; 11029 const { selectionStart, selectionEnd, value } = input.value; 11030 if (selectionStart == null || selectionEnd == null) 11031 return; 11032 const beforeTxt = value.slice(0, Math.max(0, selectionStart)); 11033 const afterTxt = value.slice(Math.max(0, selectionEnd)); 11034 selectionRef.value = { 11035 selectionStart, 11036 selectionEnd, 11037 value, 11038 beforeTxt, 11039 afterTxt 11040 }; 11041 } 11042 function setCursor() { 11043 if (input.value == void 0 || selectionRef.value == void 0) 11044 return; 11045 const { value } = input.value; 11046 const { beforeTxt, afterTxt, selectionStart } = selectionRef.value; 11047 if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0) 11048 return; 11049 let startPos = value.length; 11050 if (value.endsWith(afterTxt)) { 11051 startPos = value.length - afterTxt.length; 11052 } else if (value.startsWith(beforeTxt)) { 11053 startPos = beforeTxt.length; 11054 } else { 11055 const beforeLastChar = beforeTxt[selectionStart - 1]; 11056 const newIndex = value.indexOf(beforeLastChar, selectionStart - 1); 11057 if (newIndex !== -1) { 11058 startPos = newIndex + 1; 11059 } 11060 } 11061 input.value.setSelectionRange(startPos, startPos); 11062 } 11063 return [recordCursor, setCursor]; 11064 } 11065 11066 const getOrderedChildren = (vm, childComponentName, children) => { 11067 const nodes = flattedChildren(vm.subTree).filter((n) => { 11068 var _a; 11069 return vue.isVNode(n) && ((_a = n.type) == null ? void 0 : _a.name) === childComponentName && !!n.component; 11070 }); 11071 const uids = nodes.map((n) => n.component.uid); 11072 return uids.map((uid) => children[uid]).filter((p) => !!p); 11073 }; 11074 const useOrderedChildren = (vm, childComponentName) => { 11075 const children = {}; 11076 const orderedChildren = vue.shallowRef([]); 11077 const addChild = (child) => { 11078 children[child.uid] = child; 11079 orderedChildren.value = getOrderedChildren(vm, childComponentName, children); 11080 }; 11081 const removeChild = (uid) => { 11082 delete children[uid]; 11083 orderedChildren.value = orderedChildren.value.filter((children2) => children2.uid !== uid); 11084 }; 11085 return { 11086 children: orderedChildren, 11087 addChild, 11088 removeChild 11089 }; 11090 }; 11091 11092 const useSizeProp = buildProp({
11093 type: String, 11094 values: componentSizes, 11095 required: false 11096 }); 11097 const useSizeProps = { 11098 size: useSizeProp 11099 }; 11100 const SIZE_INJECTION_KEY = Symbol("size"); 11101 const useGlobalSize = () => { 11102 const injectedSize = vue.inject(SIZE_INJECTION_KEY, {}); 11103 return vue.computed(() => { 11104 return vue.unref(injectedSize.size) || ""; 11105 }); 11106 }; 11107 11108 const configProviderContextKey = Symbol(); 11109 11110 const globalConfig = vue.ref(); 11111 function useGlobalConfig(key, defaultValue = void 0) { 11112 const config = vue.getCurrentInstance() ? vue.inject(configProviderContextKey, globalConfig) : globalConfig; 11113 if (key) { 11114 return vue.computed(() => { 11115 var _a, _b; 11116 return (_b = (_a = config.value) == null ? void 0 : _a[key]) != null ? _b : defaultValue; 11117 }); 11118 } else { 11119 return config; 11120 } 11121 } 11122 function useGlobalComponentSettings(block, sizeFallback) { 11123 const config = useGlobalConfig(); 11124 const ns = useNamespace(block, vue.computed(() => { 11125 var _a; 11126 return ((_a = config.value) == null ? void 0 : _a.namespace) || defaultNamespace; 11127 })); 11128 const locale = useLocale(vue.computed(() => { 11129 var _a; 11130 return (_a = config.value) == null ? void 0 : _a.locale; 11131 })); 11132 const zIndex = useZIndex(vue.computed(() => { 11133 var _a; 11134 return ((_a = config.value) == null ? void 0 : _a.zIndex) || defaultInitialZIndex; 11135 })); 11136 const size = vue.computed(() => { 11137 var _a; 11138 return vue.unref(sizeFallback) || ((_a = config.value) == null ? void 0 : _a.size) || ""; 11139 }); 11140 provideGlobalConfig(vue.computed(() => vue.unref(config) || {})); 11141 return { 11142 ns, 11143 locale, 11144 zIndex, 11145 size 11146 }; 11147 } 11148 const provideGlobalConfig = (config, app, global = false) => { 11149 var _a; 11150 const inSetup = !!vue.getCurrentInstance(); 11151 const oldConfig = inSetup ? useGlobalConfig() : void 0; 11152 const provideFn = (_a = app == null ? void 0 : app.provide) != null ? _a : inSetup ? vue.provide : void 0; 11153 if (!provideFn) { 11154 return; 11155 } 11156 const context = vue.computed(() => { 11157 const cfg = vue.unref(config); 11158 if (!(oldConfig == null ? void 0 : oldConfig.value)) 11159 return cfg; 11160 return mergeConfig(oldConfig.value, cfg); 11161 }); 11162 provideFn(configProviderContextKey, context); 11163 provideFn(localeContextKey, vue.computed(() => context.value.locale)); 11164 provideFn(namespaceContextKey, vue.computed(() => context.value.namespace)); 11165 provideFn(zIndexContextKey, vue.computed(() => context.value.zIndex)); 11166 provideFn(SIZE_INJECTION_KEY, { 11167 size: vue.computed(() => context.value.size || "") 11168 }); 11169 if (global || !globalConfig.value) { 11170 globalConfig.value = context.value; 11171 } 11172 return context; 11173 }; 11174 const mergeConfig = (a, b) => { 11175 var _a; 11176 const keys = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])]; 11177 const obj = {}; 11178 for (const key of keys) { 11179 obj[key] = (_a = b[key]) != null ? _a : a[key]; 11180 } 11181 return obj; 11182 }; 11183 11184 const configProviderProps = buildProps({ 11185 a11y: { 11186 type: Boolean, 11187 default: true 11188 }, 11189 locale: { 11190 type: definePropType(Object) 11191 }, 11192 size: useSizeProp, 11193 button: { 11194 type: definePropType(Object) 11195 }, 11196 experimentalFeatures: { 11197 type: definePropType(Object) 11198 }, 11199 keyboardNavigation: { 11200 type: Boolean, 11201 default: true 11202 }, 11203 message: { 11204 type: definePropType(Object) 11205 }, 11206 zIndex: Number, 11207 namespace: { 11208 type: String, 11209 default: "el" 11210 } 11211 }); 11212 11213 const messageConfig = {}; 11214 const ConfigProvider = vue.defineComponent({ 11215 name: "ElConfigProvider", 11216 props: configProviderProps, 11217 setup(props, { slots }) { 11218 vue.watch(() => props.message, (val) => { 11219 Object.assign(messageConfig, val != null ? val : {}); 11220 }, { immediate: true, deep: true });
11221 const config = provideGlobalConfig(props); 11222 return () => vue.renderSlot(slots, "default", { config: config == null ? void 0 : config.value }); 11223 } 11224 }); 11225 11226 const ElConfigProvider = withInstall(ConfigProvider); 11227 11228 const version$1 = "2.3.5"; 11229 11230 const makeInstaller = (components = []) => { 11231 const install = (app, options) => { 11232 if (app[INSTALLED_KEY]) 11233 return; 11234 app[INSTALLED_KEY] = true; 11235 components.forEach((c) => app.use(c)); 11236 if (options) 11237 provideGlobalConfig(options, app, true); 11238 }; 11239 return { 11240 version: version$1, 11241 install 11242 }; 11243 }; 11244 11245 const affixProps = buildProps({ 11246 zIndex: { 11247 type: definePropType([Number, String]), 11248 default: 100 11249 }, 11250 target: { 11251 type: String, 11252 default: "" 11253 }, 11254 offset: { 11255 type: Number, 11256 default: 0 11257 }, 11258 position: { 11259 type: String, 11260 values: ["top", "bottom"], 11261 default: "top" 11262 } 11263 }); 11264 const affixEmits = { 11265 scroll: ({ scrollTop, fixed }) => isNumber(scrollTop) && isBoolean(fixed), 11266 [CHANGE_EVENT]: (fixed) => isBoolean(fixed) 11267 }; 11268 11269 var _export_sfc = (sfc, props) => { 11270 const target = sfc.__vccOpts || sfc; 11271 for (const [key, val] of props) { 11272 target[key] = val; 11273 } 11274 return target; 11275 }; 11276 11277 const COMPONENT_NAME$n = "ElAffix"; 11278 const __default__$1C = vue.defineComponent({ 11279 name: COMPONENT_NAME$n 11280 }); 11281 const _sfc_main$2i = /* @__PURE__ */ vue.defineComponent({ 11282 ...__default__$1C, 11283 props: affixProps, 11284 emits: affixEmits, 11285 setup(__props, { expose, emit }) { 11286 const props = __props; 11287 const ns = useNamespace("affix"); 11288 const target = vue.shallowRef(); 11289 const root = vue.shallowRef(); 11290 const scrollContainer = vue.shallowRef(); 11291 const { height: windowHeight } = useWindowSize(); 11292 const { 11293 height: rootHeight, 11294 width: rootWidth, 11295 top: rootTop, 11296 bottom: rootBottom, 11297 update: updateRoot 11298 } = useElementBounding(root, { windowScroll: false }); 11299 const targetRect = useElementBounding(target); 11300 const fixed = vue.ref(false); 11301 const scrollTop = vue.ref(0);
11302 const transform = vue.ref(0); 11303 const rootStyle = vue.computed(() => { 11304 return { 11305 height: fixed.value ? `${rootHeight.value}px` : "", 11306 width: fixed.value ? `${rootWidth.value}px` : "" 11307 }; 11308 }); 11309 const affixStyle = vue.computed(() => { 11310 if (!fixed.value) 11311 return {}; 11312 const offset = props.offset ? addUnit(props.offset) : 0; 11313 return { 11314 height: `${rootHeight.value}px`, 11315 width: `${rootWidth.value}px`, 11316 top: props.position === "top" ? offset : "", 11317 bottom: props.position === "bottom" ? offset : "", 11318 transform: transform.value ? `translateY(${transform.value}px)` : "", 11319 zIndex: props.zIndex 11320 }; 11321 }); 11322 const update = () => { 11323 if (!scrollContainer.value) 11324 return; 11325 scrollTop.value = scrollContainer.value instanceof Window ? document.documentElement.scrollTop : scrollContainer.value.scrollTop || 0; 11326 if (props.position === "top") { 11327 if (props.target) { 11328 const difference = targetRect.bottom.value - props.offset - rootHeight.value; 11329 fixed.value = props.offset > rootTop.value && targetRect.bottom.value > 0; 11330 transform.value = difference < 0 ? difference : 0; 11331 } else { 11332 fixed.value = props.offset > rootTop.value; 11333 } 11334 } else if (props.target) { 11335 const difference = windowHeight.value - targetRect.top.value - props.offset - rootHeight.value; 11336 fixed.value = windowHeight.value - props.offset < rootBottom.value && windowHeight.value > targetRect.top.value; 11337 transform.value = difference < 0 ? -difference : 0; 11338 } else { 11339 fixed.value = windowHeight.value - props.offset < rootBottom.value; 11340 } 11341 }; 11342 const handleScroll = () => { 11343 updateRoot(); 11344 emit("scroll", { 11345 scrollTop: scrollTop.value, 11346 fixed: fixed.value 11347 }); 11348 }; 11349 vue.watch(fixed, (val) => emit("change", val)); 11350 vue.onMounted(() => { 11351 var _a; 11352 if (props.target) { 11353 target.value = (_a = document.querySelector(props.target)) != null ? _a : void 0; 11354 if (!target.value) 11355 throwError(COMPONENT_NAME$n, `Target is not existed: ${props.target}`); 11356 } else { 11357 target.value = document.documentElement; 11358 } 11359 scrollContainer.value = getScrollContainer(root.value, true); 11360 updateRoot(); 11361 }); 11362 useEventListener(scrollContainer, "scroll", handleScroll); 11363 vue.watchEffect(update); 11364 expose({ 11365 update, 11366 updateRoot 11367 }); 11368 return (_ctx, _cache) => { 11369 return vue.openBlock(), vue.createElementBlock("div", { 11370 ref_key: "root", 11371 ref: root, 11372 class: vue.normalizeClass(vue.unref(ns).b()), 11373 style: vue.normalizeStyle(vue.unref(rootStyle)) 11374 }, [ 11375 vue.createElementVNode("div", { 11376 class: vue.normalizeClass({ [vue.unref(ns).m("fixed")]: fixed.value }), 11377 style: vue.normalizeStyle(vue.unref(affixStyle)) 11378 }, [ 11379 vue.renderSlot(_ctx.$slots, "default") 11380 ], 6) 11381 ], 6); 11382 }; 11383 } 11384 }); 11385 var Affix = /* @__PURE__ */ _export_sfc(_sfc_main$2i, [["__file", "affix.vue"]]); 11386 11387 const ElAffix = withInstall(Affix); 11388 11389 const iconProps = buildProps({ 11390 size: { 11391 type: definePropType([Number, String]) 11392 }, 11393 color: { 11394 type: String 11395 } 11396 }); 11397 11398 const __default__$1B = vue.defineComponent({ 11399 name: "ElIcon", 11400 inheritAttrs: false 11401 }); 11402 const _sfc_main$2h = /* @__PURE__ */ vue.defineComponent({ 11403 ...__default__$1B, 11404 props: iconProps, 11405 setup(__props) { 11406 const props = __props; 11407 const ns = useNamespace("icon"); 11408 const style = vue.computed(() => { 11409 const { size, color } = props; 11410 if (!size && !color) 11411 return {}; 11412 return { 11413 fontSize: isUndefined(size) ? void 0 : addUnit(size), 11414 "--color": color 11415 }; 11416 }); 11417 return (_ctx, _cache) => {
11418 return vue.openBlock(), vue.createElementBlock("i", vue.mergeProps({ 11419 class: vue.unref(ns).b(), 11420 style: vue.unref(style) 11421 }, _ctx.$attrs), [ 11422 vue.renderSlot(_ctx.$slots, "default") 11423 ], 16); 11424 }; 11425 } 11426 }); 11427 var Icon = /* @__PURE__ */ _export_sfc(_sfc_main$2h, [["__file", "icon.vue"]]); 11428 11429 const ElIcon = withInstall(Icon); 11430 11431 const alertEffects = ["light", "dark"]; 11432 const alertProps = buildProps({ 11433 title: { 11434 type: String, 11435 default: "" 11436 }, 11437 description: { 11438 type: String, 11439 default: "" 11440 }, 11441 type: { 11442 type: String, 11443 values: keysOf(TypeComponentsMap), 11444 default: "info" 11445 }, 11446 closable: { 11447 type: Boolean, 11448 default: true 11449 }, 11450 closeText: { 11451 type: String, 11452 default: "" 11453 }, 11454 showIcon: Boolean, 11455 center: Boolean, 11456 effect: { 11457 type: String, 11458 values: alertEffects, 11459 default: "light" 11460 } 11461 }); 11462 const alertEmits = { 11463 close: (evt) => evt instanceof MouseEvent 11464 }; 11465 11466 const __default__$1A = vue.defineComponent({ 11467 name: "ElAlert" 11468 }); 11469 const _sfc_main$2g = /* @__PURE__ */ vue.defineComponent({ 11470 ...__default__$1A, 11471 props: alertProps, 11472 emits: alertEmits, 11473 setup(__props, { emit }) { 11474 const props = __props; 11475 const { Close } = TypeComponents; 11476 const slots = vue.useSlots(); 11477 const ns = useNamespace("alert"); 11478 const visible = vue.ref(true); 11479 const iconComponent = vue.computed(() => TypeComponentsMap[props.type]); 11480 const iconClass = vue.computed(() => [ 11481 ns.e("icon"), 11482 { [ns.is("big")]: !!props.description || !!slots.default } 11483 ]); 11484 const isBoldTitle = vue.computed(() => { 11485 return { [ns.is("bold")]: props.description || slots.default }; 11486 }); 11487 const close = (evt) => { 11488 visible.value = false; 11489 emit("close", evt); 11490 }; 11491 return (_ctx, _cache) => { 11492 return vue.openBlock(), vue.createBlock(vue.Transition, { 11493 name: vue.unref(ns).b("fade"), 11494 persisted: "" 11495 }, { 11496 default: vue.withCtx(() => [ 11497 vue.withDirectives(vue.createElementVNode("div", { 11498 class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.type), vue.unref(ns).is("center", _ctx.center), vue.unref(ns).is(_ctx.effect)]), 11499 role: "alert" 11500 }, [ 11501 _ctx.showIcon && vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 11502 key: 0, 11503 class: vue.normalizeClass(vue.unref(iconClass)) 11504 }, { 11505 default: vue.withCtx(() => [ 11506 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent)))) 11507 ]), 11508 _: 1 11509 }, 8, ["class"])) : vue.createCommentVNode("v-if", true), 11510 vue.createElementVNode("div", { 11511 class: vue.normalizeClass(vue.unref(ns).e("content")) 11512 }, [ 11513 _ctx.title || _ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("span", { 11514 key: 0, 11515 class: vue.normalizeClass([vue.unref(ns).e("title"), vue.unref(isBoldTitle)]) 11516 }, [ 11517 vue.renderSlot(_ctx.$slots, "title", {}, () => [ 11518 vue.createTextVNode(vue.toDisplayString(_ctx.title), 1) 11519 ]) 11520 ], 2)) : vue.createCommentVNode("v-if", true), 11521 _ctx.$slots.default || _ctx.description ? (vue.openBlock(), vue.createElementBlock("p", { 11522 key: 1, 11523 class: vue.normalizeClass(vue.unref(ns).e("description")) 11524 }, [ 11525 vue.renderSlot(_ctx.$slots, "default", {}, () => [ 11526 vue.createTextVNode(vue.toDisplayString(_ctx.description), 1) 11527 ]) 11528 ], 2)) : vue.createCommentVNode("v-if", true), 11529 _ctx.closable ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [ 11530 _ctx.closeText ? (vue.openBlock(), vue.createElementBlock("div", { 11531 key: 0, 11532 class: vue.normalizeClass([vue.unref(ns).e("close-btn"), vue.unref(ns).is("customed")]), 11533 onClick: close 11534 }, vue.toDisplayString(_ctx.closeText), 3)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 11535 key: 1, 11536 class: vue.normalizeClass(vue.unref(ns).e("close-btn")), 11537 onClick: close 11538 }, { 11539 default: vue.withCtx(() => [ 11540 vue.createVNode(vue.unref(Close)) 11541 ]), 11542 _: 1 11543 }, 8, ["class"])) 11544 ], 64)) : vue.createCommentVNode("v-if", true) 11545 ], 2) 11546 ], 2), [ 11547 [vue.vShow, visible.value] 11548 ]) 11549 ]), 11550 _: 3 11551 }, 8, ["name"]); 11552 }; 11553 } 11554 });
11555 var Alert = /* @__PURE__ */ _export_sfc(_sfc_main$2g, [["__file", "alert.vue"]]); 11556 11557 const ElAlert = withInstall(Alert); 11558 11559 const formContextKey = Symbol("formContextKey"); 11560 const formItemContextKey = Symbol("formItemContextKey"); 11561 11562 const useFormSize = (fallback, ignore = {}) => { 11563 const emptyRef = vue.ref(void 0); 11564 const size = ignore.prop ? emptyRef : useProp("size"); 11565 const globalConfig = ignore.global ? emptyRef : useGlobalSize(); 11566 const form = ignore.form ? { size: void 0 } : vue.inject(formContextKey, void 0); 11567 const formItem = ignore.formItem ? { size: void 0 } : vue.inject(formItemContextKey, void 0); 11568 return vue.computed(() => size.value || vue.unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig.value || ""); 11569 }; 11570 const useFormDisabled = (fallback) => { 11571 const disabled = useProp("disabled"); 11572 const form = vue.inject(formContextKey, void 0); 11573 return vue.computed(() => disabled.value || vue.unref(fallback) || (form == null ? void 0 : form.disabled) || false); 11574 }; 11575 const useSize = useFormSize; 11576 const useDisabled = useFormDisabled; 11577 11578 const useFormItem = () => { 11579 const form = vue.inject(formContextKey, void 0); 11580 const formItem = vue.inject(formItemContextKey, void 0); 11581 return { 11582 form, 11583 formItem 11584 }; 11585 }; 11586 const useFormItemInputId = (props, { 11587 formItemContext, 11588 disableIdGeneration, 11589 disableIdManagement 11590 }) => { 11591 if (!disableIdGeneration) { 11592 disableIdGeneration = vue.ref(false); 11593 } 11594 if (!disableIdManagement) { 11595 disableIdManagement = vue.ref(false); 11596 } 11597 const inputId = vue.ref(); 11598 let idUnwatch = void 0; 11599 const isLabeledByFormItem = vue.computed(() => { 11600 var _a; 11601 return !!(!props.label && formItemContext && formItemContext.inputIds && ((_a = formItemContext.inputIds) == null ? void 0 : _a.length) <= 1); 11602 }); 11603 vue.onMounted(() => { 11604 idUnwatch = vue.watch([vue.toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => { 11605 const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0; 11606 if (newId !== inputId.value) { 11607 if (formItemContext == null ? void 0 : formItemContext.removeInputId) { 11608 inputId.value && formItemContext.removeInputId(inputId.value); 11609 if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) { 11610 formItemContext.addInputId(newId); 11611 } 11612 } 11613 inputId.value = newId; 11614 } 11615 }, { immediate: true }); 11616 }); 11617 vue.onUnmounted(() => { 11618 idUnwatch && idUnwatch(); 11619 if (formItemContext == null ? void 0 : formItemContext.removeInputId) { 11620 inputId.value && formItemContext.removeInputId(inputId.value); 11621 } 11622 }); 11623 return { 11624 isLabeledByFormItem, 11625 inputId 11626 }; 11627 }; 11628 11629 const formMetaProps = buildProps({ 11630 size: { 11631 type: String, 11632 values: componentSizes 11633 }, 11634 disabled: Boolean 11635 }); 11636 const formProps = buildProps({ 11637 ...formMetaProps, 11638 model: Object, 11639 rules: { 11640 type: definePropType(Object) 11641 }, 11642 labelPosition: { 11643 type: String, 11644 values: ["left", "right", "top"], 11645 default: "right" 11646 }, 11647 requireAsteriskPosition: { 11648 type: String, 11649 values: ["left", "right"], 11650 default: "left" 11651 }, 11652 labelWidth: { 11653 type: [String, Number], 11654 default: "" 11655 }, 11656 labelSuffix: { 11657 type: String, 11658 default: "" 11659 }, 11660 inline: Boolean, 11661 inlineMessage: Boolean, 11662 statusIcon: Boolean, 11663 showMessage: { 11664 type: Boolean, 11665 default: true 11666 }, 11667 validateOnRuleChange: { 11668 type: Boolean, 11669 default: true 11670 }, 11671 hideRequiredAsterisk: { 11672 type: Boolean, 11673 default: false 11674 }, 11675 scrollToError: Boolean, 11676 scrollIntoViewOptions: { 11677 type: [Object, Boolean] 11678 } 11679 });
11680 const formEmits = { 11681 validate: (prop, isValid, message) => (isArray$1(prop) || isString$1(prop)) && isBoolean(isValid) && isString$1(message) 11682 }; 11683 11684 function useFormLabelWidth() { 11685 const potentialLabelWidthArr = vue.ref([]); 11686 const autoLabelWidth = vue.computed(() => { 11687 if (!potentialLabelWidthArr.value.length) 11688 return "0"; 11689 const max = Math.max(...potentialLabelWidthArr.value); 11690 return max ? `${max}px` : ""; 11691 }); 11692 function getLabelWidthIndex(width) { 11693 const index = potentialLabelWidthArr.value.indexOf(width); 11694 if (index === -1 && autoLabelWidth.value === "0") ; 11695 return index; 11696 } 11697 function registerLabelWidth(val, oldVal) { 11698 if (val && oldVal) { 11699 const index = getLabelWidthIndex(oldVal); 11700 potentialLabelWidthArr.value.splice(index, 1, val); 11701 } else if (val) { 11702 potentialLabelWidthArr.value.push(val); 11703 } 11704 } 11705 function deregisterLabelWidth(val) { 11706 const index = getLabelWidthIndex(val); 11707 if (index > -1) { 11708 potentialLabelWidthArr.value.splice(index, 1); 11709 } 11710 } 11711 return { 11712 autoLabelWidth, 11713 registerLabelWidth, 11714 deregisterLabelWidth 11715 }; 11716 } 11717 const filterFields = (fields, props) => { 11718 const normalized = castArray$1(props); 11719 return normalized.length > 0 ? fields.filter((field) => field.prop && normalized.includes(field.prop)) : fields; 11720 }; 11721 11722 const COMPONENT_NAME$m = "ElForm"; 11723 const __default__$1z = vue.defineComponent({ 11724 name: COMPONENT_NAME$m 11725 }); 11726 const _sfc_main$2f = /* @__PURE__ */ vue.defineComponent({ 11727 ...__default__$1z, 11728 props: formProps, 11729 emits: formEmits, 11730 setup(__props, { expose, emit }) { 11731 const props = __props; 11732 const fields = []; 11733 const formSize = useFormSize(); 11734 const ns = useNamespace("form"); 11735 const formClasses = vue.computed(() => { 11736 const { labelPosition, inline } = props; 11737 return [ 11738 ns.b(), 11739 ns.m(formSize.value || "default"), 11740 { 11741 [ns.m(`label-${labelPosition}`)]: labelPosition, 11742 [ns.m("inline")]: inline 11743 } 11744 ]; 11745 }); 11746 const addField = (field) => { 11747 fields.push(field); 11748 }; 11749 const removeField = (field) => { 11750 if (field.prop) { 11751 fields.splice(fields.indexOf(field), 1); 11752 } 11753 }; 11754 const resetFields = (properties = []) => { 11755 if (!props.model) { 11756 return; 11757 } 11758 filterFields(fields, properties).forEach((field) => field.resetField()); 11759 }; 11760 const clearValidate = (props2 = []) => { 11761 filterFields(fields, props2).forEach((field) => field.clearValidate()); 11762 }; 11763 const isValidatable = vue.computed(() => { 11764 const hasModel = !!props.model; 11765 return hasModel; 11766 }); 11767 const obtainValidateFields = (props2) => { 11768 if (fields.length === 0) 11769 return []; 11770 const filteredFields = filterFields(fields, props2); 11771 if (!filteredFields.length) { 11772 return []; 11773 } 11774 return filteredFields; 11775 }; 11776 const validate = async (callback) => validateField(void 0, callback); 11777 const doValidateField = async (props2 = []) => { 11778 if (!isValidatable.value) 11779 return false; 11780 const fields2 = obtainValidateFields(props2); 11781 if (fields2.length === 0) 11782 return true; 11783 let validationErrors = {}; 11784 for (const field of fields2) { 11785 try { 11786 await field.validate(""); 11787 } catch (fields3) { 11788 validationErrors = { 11789 ...validationErrors, 11790 ...fields3 11791 }; 11792 } 11793 } 11794 if (Object.keys(validationErrors).length === 0) 11795 return true; 11796 return Promise.reject(validationErrors); 11797 }; 11798 const validateField = async (modelProps = [], callback) => { 11799 const shouldThrow = !isFunction$1(callback); 11800 try { 11801 const result = await doValidateField(modelProps); 11802 if (result === true) { 11803 callback == null ? void 0 : callback(result); 11804 } 11805 return result; 11806 } catch (e) { 11807 if (e instanceof Error) 11808 throw e; 11809 const invalidFields = e; 11810 if (props.scrollToError) { 11811 scrollToField(Object.keys(invalidFields)[0]); 11812 } 11813 callback == null ? void 0 : callback(false, invalidFields); 11814 return shouldThrow && Promise.reject(invalidFields); 11815 } 11816 }; 11817 const scrollToField = (prop) => { 11818 var _a; 11819 const field = filterFields(fields, prop)[0]; 11820 if (field) { 11821 (_a = field.$el) == null ? void 0 : _a.scrollIntoView(props.scrollIntoViewOptions); 11822 } 11823 }; 11824 vue.watch(() => props.rules, () => { 11825 if (props.validateOnRuleChange) { 11826 validate().catch((err) => debugWarn()); 11827 } 11828 }, { deep: true });
11829 vue.provide(formContextKey, vue.reactive({ 11830 ...vue.toRefs(props), 11831 emit, 11832 resetFields, 11833 clearValidate, 11834 validateField, 11835 addField, 11836 removeField, 11837 ...useFormLabelWidth() 11838 })); 11839 expose({ 11840 validate, 11841 validateField, 11842 resetFields, 11843 clearValidate, 11844 scrollToField 11845 }); 11846 return (_ctx, _cache) => { 11847 return vue.openBlock(), vue.createElementBlock("form", { 11848 class: vue.normalizeClass(vue.unref(formClasses)) 11849 }, [ 11850 vue.renderSlot(_ctx.$slots, "default") 11851 ], 2); 11852 }; 11853 } 11854 }); 11855 var Form = /* @__PURE__ */ _export_sfc(_sfc_main$2f, [["__file", "form.vue"]]); 11856 11857 function _extends() { 11858 _extends = Object.assign ? Object.assign.bind() : function(target) { 11859 for (var i = 1; i < arguments.length; i++) { 11860 var source = arguments[i]; 11861 for (var key in source) { 11862 if (Object.prototype.hasOwnProperty.call(source, key)) { 11863 target[key] = source[key]; 11864 } 11865 } 11866 } 11867 return target; 11868 }; 11869 return _extends.apply(this, arguments); 11870 } 11871 function _inheritsLoose(subClass, superClass) { 11872 subClass.prototype = Object.create(superClass.prototype); 11873 subClass.prototype.constructor = subClass; 11874 _setPrototypeOf(subClass, superClass); 11875 } 11876 function _getPrototypeOf(o) { 11877 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) { 11878 return o2.__proto__ || Object.getPrototypeOf(o2); 11879 }; 11880 return _getPrototypeOf(o); 11881 } 11882 function _setPrototypeOf(o, p) { 11883 _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) { 11884 o2.__proto__ = p2; 11885 return o2; 11886 }; 11887 return _setPrototypeOf(o, p); 11888 } 11889 function _isNativeReflectConstruct() { 11890 if (typeof Reflect === "undefined" || !Reflect.construct) 11891 return false; 11892 if (Reflect.construct.sham) 11893 return false; 11894 if (typeof Proxy === "function") 11895 return true; 11896 try { 11897 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { 11898 })); 11899 return true; 11900 } catch (e) { 11901 return false; 11902 } 11903 } 11904 function _construct(Parent, args, Class) { 11905 if (_isNativeReflectConstruct()) { 11906 _construct = Reflect.construct.bind(); 11907 } else { 11908 _construct = function _construct2(Parent2, args2, Class2) { 11909 var a = [null]; 11910 a.push.apply(a, args2); 11911 var Constructor = Function.bind.apply(Parent2, a); 11912 var instance = new Constructor(); 11913 if (Class2) 11914 _setPrototypeOf(instance, Class2.prototype); 11915 return instance; 11916 }; 11917 } 11918 return _construct.apply(null, arguments); 11919 } 11920 function _isNativeFunction(fn) { 11921 return Function.toString.call(fn).indexOf("[native code]") !== -1; 11922 } 11923 function _wrapNativeSuper(Class) {
vendor: 4,440 bytes, lines 11924-12063
11924 var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0; 11925 _wrapNativeSuper = function _wrapNativeSuper2(Class2) { 11926 if (Class2 === null || !_isNativeFunction(Class2)) 11927 return Class2; 11928 if (typeof Class2 !== "function") { 11929 throw new TypeError("Super expression must either be null or a function"); 11930 } 11931 if (typeof _cache !== "undefined") { 11932 if (_cache.has(Class2)) 11933 return _cache.get(Class2); 11934 _cache.set(Class2, Wrapper); 11935 } 11936 function Wrapper() { 11937 return _construct(Class2, arguments, _getPrototypeOf(this).constructor); 11938 } 11939 Wrapper.prototype = Object.create(Class2.prototype, { 11940 constructor: { 11941 value: Wrapper, 11942 enumerable: false, 11943 writable: true, 11944 configurable: true 11945 } 11946 }); 11947 return _setPrototypeOf(Wrapper, Class2); 11948 }; 11949 return _wrapNativeSuper(Class); 11950 } 11951 var formatRegExp = /%[sdj%]/g; 11952 var warning = function warning2() { 11953 }; 11954 if (typeof process !== "undefined" && process.env && false) { 11955 warning = function warning3(type4, errors) { 11956 if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") { 11957 if (errors.every(function(e) { 11958 return typeof e === "string"; 11959 })) { 11960 console.warn(type4, errors); 11961 } 11962 } 11963 }; 11964 } 11965 function convertFieldsError(errors) { 11966 if (!errors || !errors.length) 11967 return null; 11968 var fields = {}; 11969 errors.forEach(function(error) { 11970 var field = error.field; 11971 fields[field] = fields[field] || []; 11972 fields[field].push(error); 11973 }); 11974 return fields; 11975 } 11976 function format(template) { 11977 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 11978 args[_key - 1] = arguments[_key]; 11979 } 11980 var i = 0; 11981 var len = args.length; 11982 if (typeof template === "function") { 11983 return template.apply(null, args); 11984 } 11985 if (typeof template === "string") { 11986 var str = template.replace(formatRegExp, function(x) { 11987 if (x === "%%") { 11988 return "%"; 11989 } 11990 if (i >= len) { 11991 return x; 11992 } 11993 switch (x) { 11994 case "%s": 11995 return String(args[i++]); 11996 case "%d": 11997 return Number(args[i++]); 11998 case "%j": 11999 try { 12000 return JSON.stringify(args[i++]); 12001 } catch (_) { 12002 return "[Circular]"; 12003 } 12004 break; 12005 default: 12006 return x; 12007 } 12008 }); 12009 return str; 12010 } 12011 return template; 12012 } 12013 function isNativeStringType(type4) { 12014 return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern"; 12015 } 12016 function isEmptyValue(value, type4) { 12017 if (value === void 0 || value === null) { 12018 return true; 12019 } 12020 if (type4 === "array" && Array.isArray(value) && !value.length) { 12021 return true; 12022 } 12023 if (isNativeStringType(type4) && typeof value === "string" && !value) { 12024 return true; 12025 } 12026 return false; 12027 } 12028 function asyncParallelArray(arr, func, callback) { 12029 var results = []; 12030 var total = 0; 12031 var arrLength = arr.length; 12032 function count(errors) { 12033 results.push.apply(results, errors || []); 12034 total++; 12035 if (total === arrLength) { 12036 callback(results); 12037 } 12038 } 12039 arr.forEach(function(a) { 12040 func(a, count); 12041 }); 12042 } 12043 function asyncSerialArray(arr, func, callback) { 12044 var index = 0; 12045 var arrLength = arr.length; 12046 function next(errors) { 12047 if (errors && errors.length) { 12048 callback(errors); 12049 return; 12050 } 12051 var original = index; 12052 index = index + 1; 12053 if (original < arrLength) { 12054 func(arr[original], next); 12055 } else { 12056 callback([]); 12057 } 12058 } 12059 next([]); 12060 } 12061 function flattenObjArr(objArr) { 12062 var ret = []; 12063 Object.keys(objArr).forEach(function(k) {
12064 ret.push.apply(ret, objArr[k] || []); 12065 }); 12066 return ret; 12067 } 12068 var AsyncValidationError = /* @__PURE__ */ function(_Error) { 12069 _inheritsLoose(AsyncValidationError2, _Error); 12070 function AsyncValidationError2(errors, fields) { 12071 var _this; 12072 _this = _Error.call(this, "Async Validation Error") || this; 12073 _this.errors = errors; 12074 _this.fields = fields; 12075 return _this; 12076 } 12077 return AsyncValidationError2; 12078 }(/* @__PURE__ */ _wrapNativeSuper(Error)); 12079 function asyncMap(objArr, option, func, callback, source) { 12080 if (option.first) { 12081 var _pending = new Promise(function(resolve, reject) { 12082 var next = function next2(errors) { 12083 callback(errors); 12084 return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source); 12085 }; 12086 var flattenArr = flattenObjArr(objArr); 12087 asyncSerialArray(flattenArr, func, next); 12088 }); 12089 _pending["catch"](function(e) { 12090 return e; 12091 }); 12092 return _pending; 12093 } 12094 var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || []; 12095 var objArrKeys = Object.keys(objArr); 12096 var objArrLength = objArrKeys.length; 12097 var total = 0; 12098 var results = []; 12099 var pending = new Promise(function(resolve, reject) { 12100 var next = function next2(errors) { 12101 results.push.apply(results, errors); 12102 total++; 12103 if (total === objArrLength) { 12104 callback(results); 12105 return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source); 12106 } 12107 }; 12108 if (!objArrKeys.length) { 12109 callback(results); 12110 resolve(source); 12111 } 12112 objArrKeys.forEach(function(key) { 12113 var arr = objArr[key]; 12114 if (firstFields.indexOf(key) !== -1) { 12115 asyncSerialArray(arr, func, next); 12116 } else { 12117 asyncParallelArray(arr, func, next); 12118 } 12119 }); 12120 }); 12121 pending["catch"](function(e) { 12122 return e; 12123 }); 12124 return pending; 12125 } 12126 function isErrorObj(obj) { 12127 return !!(obj && obj.message !== void 0); 12128 } 12129 function getValue(value, path) { 12130 var v = value; 12131 for (var i = 0; i < path.length; i++) { 12132 if (v == void 0) { 12133 return v; 12134 } 12135 v = v[path[i]]; 12136 } 12137 return v; 12138 } 12139 function complementError(rule, source) { 12140 return function(oe) { 12141 var fieldValue; 12142 if (rule.fullFields) { 12143 fieldValue = getValue(source, rule.fullFields); 12144 } else { 12145 fieldValue = source[oe.field || rule.fullField]; 12146 } 12147 if (isErrorObj(oe)) { 12148 oe.field = oe.field || rule.fullField; 12149 oe.fieldValue = fieldValue; 12150 return oe; 12151 } 12152 return { 12153 message: typeof oe === "function" ? oe() : oe, 12154 fieldValue, 12155 field: oe.field || rule.fullField 12156 }; 12157 }; 12158 } 12159 function deepMerge(target, source) { 12160 if (source) { 12161 for (var s in source) { 12162 if (source.hasOwnProperty(s)) { 12163 var value = source[s]; 12164 if (typeof value === "object" && typeof target[s] === "object") { 12165 target[s] = _extends({}, target[s], value); 12166 } else { 12167 target[s] = value; 12168 } 12169 } 12170 } 12171 } 12172 return target; 12173 } 12174 var required$1 = function required(rule, value, source, errors, options, type4) { 12175 if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) { 12176 errors.push(format(options.messages.required, rule.fullField)); 12177 } 12178 }; 12179 var whitespace = function whitespace2(rule, value, source, errors, options) { 12180 if (/^\s+$/.test(value) || value === "") { 12181 errors.push(format(options.messages.whitespace, rule.fullField)); 12182 } 12183 }; 12184 var urlReg; 12185 var getUrlRegex = function() { 12186 if (urlReg) { 12187 return urlReg; 12188 } 12189 var word = "[a-fA-F\\d:]"; 12190 var b = function b2(options) { 12191 return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : ""; 12192 }; 12193 var v4 = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}"; 12194 var v6seg = "[a-fA-F\\d]{1,4}"; 12195 var v6 = ("\n(?:\n(?:" + v6seg + ":){7}
vendor: 5,389 bytes, lines 12195-12285
12195(?:" + v6seg + "|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:" + v6seg + ":){6}(?:" + v4 + "|:" + v6seg + "|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:" + v6seg + ":){5}(?::" + v4 + "|(?::" + v6seg + "){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:" + v6seg + ":){4}(?:(?::" + v6seg + "){0,1}:" + v4 + "|(?::" + v6seg + "){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:" + v6seg + ":){3}(?:(?::" + v6seg + "){0,2}:" + v4 + "|(?::" + v6seg + "){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:" + v6seg + ":){2}(?:(?::" + v6seg + "){0,3}:" + v4 + "|(?::" + v6seg + "){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:" + v6seg + ":){1}(?:(?::" + v6seg + "){0,4}:" + v4 + "|(?::" + v6seg + "){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::" + v6seg + "){0,5}:" + v4 + "|(?::" + v6seg + "){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n").replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(); 12196 var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)"); 12197 var v4exact = new RegExp("^" + v4 + "$"); 12198 var v6exact = new RegExp("^" + v6 + "$"); 12199 var ip = function ip2(options) { 12200 return options && options.exact ? v46Exact : new RegExp("(?:" + b(options) + v4 + b(options) + ")|(?:" + b(options) + v6 + b(options) + ")", "g"); 12201 }; 12202 ip.v4 = function(options) { 12203 return options && options.exact ? v4exact : new RegExp("" + b(options) + v4 + b(options), "g"); 12204 }; 12205 ip.v6 = function(options) { 12206 return options && options.exact ? v6exact : new RegExp("" + b(options) + v6 + b(options), "g"); 12207 }; 12208 var protocol = "(?:(?:[a-z]+:)?//)"; 12209 var auth = "(?:\\S+(?::\\S*)?@)?"; 12210 var ipv4 = ip.v4().source; 12211 var ipv6 = ip.v6().source; 12212 var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)"; 12213 var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*"; 12214 var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))"; 12215 var port = "(?::\\d{2,5})?"; 12216 var path = '(?:[/?#][^\\s"]*)?'; 12217 var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host + domain + tld + ")" + port + path; 12218 urlReg = new RegExp("(?:^" + regex + "$)", "i"); 12219 return urlReg; 12220 }; 12221 var pattern$2 = { 12222 email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/, 12223 hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i 12224 }; 12225 var types = { 12226 integer: function integer(value) { 12227 return types.number(value) && parseInt(value, 10) === value; 12228 }, 12229 "float": function float(value) { 12230 return types.number(value) && !types.integer(value); 12231 }, 12232 array: function array(value) { 12233 return Array.isArray(value); 12234 }, 12235 regexp: function regexp(value) { 12236 if (value instanceof RegExp) { 12237 return true; 12238 } 12239 try { 12240 return !!new RegExp(value); 12241 } catch (e) { 12242 return false; 12243 } 12244 }, 12245 date: function date(value) { 12246 return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime()); 12247 }, 12248 number: function number(value) { 12249 if (isNaN(value)) { 12250 return false; 12251 } 12252 return typeof value === "number"; 12253 }, 12254 object: function object(value) { 12255 return typeof value === "object" && !types.array(value); 12256 }, 12257 method: function method(value) { 12258 return typeof value === "function"; 12259 }, 12260 email: function email(value) { 12261 return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email); 12262 }, 12263 url: function url(value) { 12264 return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex()); 12265 }, 12266 hex: function hex(value) { 12267 return typeof value === "string" && !!value.match(pattern$2.hex); 12268 } 12269 }; 12270 var type$1 = function type(rule, value, source, errors, options) { 12271 if (rule.required && value === void 0) { 12272 required$1(rule, value, source, errors, options); 12273 return; 12274 } 12275 var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"]; 12276 var ruleType = rule.type; 12277 if (custom.indexOf(ruleType) > -1) { 12278 if (!types[ruleType](value)) { 12279 errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type)); 12280 } 12281 } else if (ruleType && typeof value !== rule.type) { 12282 errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type)); 12283 } 12284 }; 12285 var range = function range2(rule, value, source, errors, options) {
vendor: 4,548 bytes, lines 12286-12405
12286 var len = typeof rule.len === "number"; 12287 var min = typeof rule.min === "number"; 12288 var max = typeof rule.max === "number"; 12289 var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; 12290 var val = value; 12291 var key = null; 12292 var num = typeof value === "number"; 12293 var str = typeof value === "string"; 12294 var arr = Array.isArray(value); 12295 if (num) { 12296 key = "number"; 12297 } else if (str) { 12298 key = "string"; 12299 } else if (arr) { 12300 key = "array"; 12301 } 12302 if (!key) { 12303 return false; 12304 } 12305 if (arr) { 12306 val = value.length; 12307 } 12308 if (str) { 12309 val = value.replace(spRegexp, "_").length; 12310 } 12311 if (len) { 12312 if (val !== rule.len) { 12313 errors.push(format(options.messages[key].len, rule.fullField, rule.len)); 12314 } 12315 } else if (min && !max && val < rule.min) { 12316 errors.push(format(options.messages[key].min, rule.fullField, rule.min)); 12317 } else if (max && !min && val > rule.max) { 12318 errors.push(format(options.messages[key].max, rule.fullField, rule.max)); 12319 } else if (min && max && (val < rule.min || val > rule.max)) { 12320 errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max)); 12321 } 12322 }; 12323 var ENUM$1 = "enum"; 12324 var enumerable$1 = function enumerable(rule, value, source, errors, options) { 12325 rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : []; 12326 if (rule[ENUM$1].indexOf(value) === -1) { 12327 errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", "))); 12328 } 12329 }; 12330 var pattern$1 = function pattern(rule, value, source, errors, options) { 12331 if (rule.pattern) { 12332 if (rule.pattern instanceof RegExp) { 12333 rule.pattern.lastIndex = 0; 12334 if (!rule.pattern.test(value)) { 12335 errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern)); 12336 } 12337 } else if (typeof rule.pattern === "string") { 12338 var _pattern = new RegExp(rule.pattern); 12339 if (!_pattern.test(value)) { 12340 errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern)); 12341 } 12342 } 12343 } 12344 }; 12345 var rules = { 12346 required: required$1, 12347 whitespace, 12348 type: type$1, 12349 range, 12350 "enum": enumerable$1, 12351 pattern: pattern$1 12352 }; 12353 var string = function string2(rule, value, callback, source, options) { 12354 var errors = []; 12355 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 12356 if (validate) { 12357 if (isEmptyValue(value, "string") && !rule.required) { 12358 return callback(); 12359 } 12360 rules.required(rule, value, source, errors, options, "string"); 12361 if (!isEmptyValue(value, "string")) { 12362 rules.type(rule, value, source, errors, options); 12363 rules.range(rule, value, source, errors, options); 12364 rules.pattern(rule, value, source, errors, options); 12365 if (rule.whitespace === true) { 12366 rules.whitespace(rule, value, source, errors, options); 12367 } 12368 } 12369 } 12370 callback(errors); 12371 }; 12372 var method2 = function method3(rule, value, callback, source, options) { 12373 var errors = []; 12374 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 12375 if (validate) { 12376 if (isEmptyValue(value) && !rule.required) { 12377 return callback(); 12378 } 12379 rules.required(rule, value, source, errors, options); 12380 if (value !== void 0) { 12381 rules.type(rule, value, source, errors, options); 12382 } 12383 } 12384 callback(errors); 12385 }; 12386 var number2 = function number3(rule, value, callback, source, options) { 12387 var errors = []; 12388 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 12389 if (validate) { 12390 if (value === "") { 12391 value = void 0; 12392 } 12393 if (isEmptyValue(value) && !rule.required) { 12394 return callback(); 12395 } 12396 rules.required(rule, value, source, errors, options); 12397 if (value !== void 0) { 12398 rules.type(rule, value, source, errors, options); 12399 rules.range(rule, value, source, errors, options); 12400 } 12401 } 12402 callback(errors); 12403 }; 12404 var _boolean = function _boolean2(rule, value, callback, source, options) { 12405 var errors = [];
12406 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 12407 if (validate) { 12408 if (isEmptyValue(value) && !rule.required) { 12409 return callback(); 12410 } 12411 rules.required(rule, value, source, errors, options); 12412 if (value !== void 0) { 12413 rules.type(rule, value, source, errors, options); 12414 } 12415 } 12416 callback(errors); 12417 }; 12418 var regexp2 = function regexp3(rule, value, callback, source, options) { 12419 var errors = []; 12420 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 12421 if (validate) { 12422 if (isEmptyValue(value) && !rule.required) { 12423 return callback(); 12424 } 12425 rules.required(rule, value, source, errors, options); 12426 if (!isEmptyValue(value)) { 12427 rules.type(rule, value, source, errors, options); 12428 } 12429 } 12430 callback(errors); 12431 }; 12432 var integer2 = function integer3(rule, value, callback, source, options) { 12433 var errors = []; 12434 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 12435 if (validate) { 12436 if (isEmptyValue(value) && !rule.required) { 12437 return callback(); 12438 } 12439 rules.required(rule, value, source, errors, options); 12440 if (value !== void 0) { 12441 rules.type(rule, value, source, errors, options); 12442 rules.range(rule, value, source, errors, options); 12443 } 12444 } 12445 callback(errors); 12446 }; 12447 var floatFn = function floatFn2(rule, value, callback, source, options) { 12448 var errors = []; 12449 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 12450 if (validate) { 12451 if (isEmptyValue(value) && !rule.required) { 12452 return callback(); 12453 } 12454 rules.required(rule, value, source, errors, options); 12455 if (value !== void 0) { 12456 rules.type(rule, value, source, errors, options); 12457 rules.range(rule, value, source, errors, options); 12458 } 12459 } 12460 callback(errors); 12461 }; 12462 var array2 = function array3(rule, value, callback, source, options) { 12463 var errors = []; 12464 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 12465 if (validate) { 12466 if ((value === void 0 || value === null) && !rule.required) { 12467 return callback(); 12468 } 12469 rules.required(rule, value, source, errors, options, "array"); 12470 if (value !== void 0 && value !== null) { 12471 rules.type(rule, value, source, errors, options); 12472 rules.range(rule, value, source, errors, options); 12473 } 12474 } 12475 callback(errors); 12476 }; 12477 var object2 = function object3(rule, value, callback, source, options) { 12478 var errors = []; 12479 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 12480 if (validate) { 12481 if (isEmptyValue(value) && !rule.required) { 12482 return callback(); 12483 } 12484 rules.required(rule, value, source, errors, options); 12485 if (value !== void 0) { 12486 rules.type(rule, value, source, errors, options); 12487 } 12488 } 12489 callback(errors); 12490 }; 12491 var ENUM = "enum"; 12492 var enumerable2 = function enumerable3(rule, value, callback, source, options) { 12493 var errors = []; 12494 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 12495 if (validate) { 12496 if (isEmptyValue(value) && !rule.required) { 12497 return callback(); 12498 } 12499 rules.required(rule, value, source, errors, options); 12500 if (value !== void 0) { 12501 rules[ENUM](rule, value, source, errors, options); 12502 } 12503 } 12504 callback(errors); 12505 }; 12506 var pattern2 = function pattern3(rule, value, callback, source, options) { 12507 var errors = []; 12508 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 12509 if (validate) { 12510 if (isEmptyValue(value, "string") && !rule.required) { 12511 return callback(); 12512 } 12513 rules.required(rule, value, source, errors, options); 12514 if (!isEmptyValue(value, "string")) { 12515 rules.pattern(rule, value, source, errors, options); 12516 } 12517 } 12518 callback(errors); 12519 }; 12520 var date2 = function date3(rule, value, callback, source, options) { 12521 var errors = [];
12522 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 12523 if (validate) { 12524 if (isEmptyValue(value, "date") && !rule.required) { 12525 return callback(); 12526 } 12527 rules.required(rule, value, source, errors, options); 12528 if (!isEmptyValue(value, "date")) { 12529 var dateObject; 12530 if (value instanceof Date) { 12531 dateObject = value; 12532 } else { 12533 dateObject = new Date(value); 12534 } 12535 rules.type(rule, dateObject, source, errors, options); 12536 if (dateObject) { 12537 rules.range(rule, dateObject.getTime(), source, errors, options); 12538 } 12539 } 12540 } 12541 callback(errors); 12542 }; 12543 var required2 = function required3(rule, value, callback, source, options) { 12544 var errors = []; 12545 var type4 = Array.isArray(value) ? "array" : typeof value; 12546 rules.required(rule, value, source, errors, options, type4); 12547 callback(errors); 12548 }; 12549 var type2 = function type3(rule, value, callback, source, options) { 12550 var ruleType = rule.type; 12551 var errors = []; 12552 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 12553 if (validate) { 12554 if (isEmptyValue(value, ruleType) && !rule.required) { 12555 return callback(); 12556 } 12557 rules.required(rule, value, source, errors, options, ruleType); 12558 if (!isEmptyValue(value, ruleType)) { 12559 rules.type(rule, value, source, errors, options); 12560 } 12561 } 12562 callback(errors); 12563 }; 12564 var any = function any2(rule, value, callback, source, options) { 12565 var errors = []; 12566 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 12567 if (validate) { 12568 if (isEmptyValue(value) && !rule.required) { 12569 return callback(); 12570 } 12571 rules.required(rule, value, source, errors, options); 12572 } 12573 callback(errors); 12574 }; 12575 var validators = { 12576 string, 12577 method: method2, 12578 number: number2, 12579 "boolean": _boolean, 12580 regexp: regexp2, 12581 integer: integer2, 12582 "float": floatFn, 12583 array: array2, 12584 object: object2, 12585 "enum": enumerable2, 12586 pattern: pattern2, 12587 date: date2, 12588 url: type2, 12589 hex: type2, 12590 email: type2, 12591 required: required2, 12592 any 12593 }; 12594 function newMessages() { 12595 return { 12596 "default": "Validation error on field %s", 12597 required: "%s is required", 12598 "enum": "%s must be one of %s", 12599 whitespace: "%s cannot be empty", 12600 date: { 12601 format: "%s date %s is invalid for format %s", 12602 parse: "%s date could not be parsed, %s is invalid ", 12603 invalid: "%s date %s is invalid" 12604 }, 12605 types: { 12606 string: "%s is not a %s", 12607 method: "%s is not a %s (function)", 12608 array: "%s is not an %s", 12609 object: "%s is not an %s", 12610 number: "%s is not a %s", 12611 date: "%s is not a %s", 12612 "boolean": "%s is not a %s", 12613 integer: "%s is not an %s", 12614 "float": "%s is not a %s", 12615 regexp: "%s is not a valid %s", 12616 email: "%s is not a valid %s", 12617 url: "%s is not a valid %s", 12618 hex: "%s is not a valid %s" 12619 }, 12620 string: { 12621 len: "%s must be exactly %s characters", 12622 min: "%s must be at least %s characters", 12623 max: "%s cannot be longer than %s characters", 12624 range: "%s must be between %s and %s characters" 12625 }, 12626 number: { 12627 len: "%s must equal %s", 12628 min: "%s cannot be less than %s", 12629 max: "%s cannot be greater than %s", 12630 range: "%s must be between %s and %s" 12631 }, 12632 array: { 12633 len: "%s must be exactly %s in length", 12634 min: "%s cannot be less than %s in length", 12635 max: "%s cannot be greater than %s in length", 12636 range: "%s must be between %s and %s in length" 12637 }, 12638 pattern: { 12639 mismatch: "%s value %s does not match pattern %s" 12640 }, 12641 clone: function clone() { 12642 var cloned = JSON.parse(JSON.stringify(this)); 12643 cloned.clone = this.clone; 12644 return cloned; 12645 } 12646 }; 12647 } 12648 var messages = newMessages();
12649 var Schema = /* @__PURE__ */ function() { 12650 function Schema2(descriptor) { 12651 this.rules = null; 12652 this._messages = messages; 12653 this.define(descriptor); 12654 } 12655 var _proto = Schema2.prototype; 12656 _proto.define = function define(rules2) { 12657 var _this = this; 12658 if (!rules2) { 12659 throw new Error("Cannot configure a schema with no rules"); 12660 } 12661 if (typeof rules2 !== "object" || Array.isArray(rules2)) { 12662 throw new Error("Rules must be an object"); 12663 } 12664 this.rules = {}; 12665 Object.keys(rules2).forEach(function(name) { 12666 var item = rules2[name]; 12667 _this.rules[name] = Array.isArray(item) ? item : [item]; 12668 }); 12669 }; 12670 _proto.messages = function messages2(_messages) { 12671 if (_messages) { 12672 this._messages = deepMerge(newMessages(), _messages); 12673 } 12674 return this._messages; 12675 }; 12676 _proto.validate = function validate(source_, o, oc) { 12677 var _this2 = this; 12678 if (o === void 0) { 12679 o = {}; 12680 } 12681 if (oc === void 0) { 12682 oc = function oc2() { 12683 }; 12684 } 12685 var source = source_; 12686 var options = o; 12687 var callback = oc; 12688 if (typeof options === "function") { 12689 callback = options; 12690 options = {}; 12691 } 12692 if (!this.rules || Object.keys(this.rules).length === 0) { 12693 if (callback) { 12694 callback(null, source); 12695 } 12696 return Promise.resolve(source); 12697 } 12698 function complete(results) { 12699 var errors = []; 12700 var fields = {}; 12701 function add(e) { 12702 if (Array.isArray(e)) { 12703 var _errors; 12704 errors = (_errors = errors).concat.apply(_errors, e); 12705 } else { 12706 errors.push(e); 12707 } 12708 } 12709 for (var i = 0; i < results.length; i++) { 12710 add(results[i]); 12711 } 12712 if (!errors.length) { 12713 callback(null, source); 12714 } else { 12715 fields = convertFieldsError(errors); 12716 callback(errors, fields); 12717 } 12718 } 12719 if (options.messages) { 12720 var messages$1 = this.messages(); 12721 if (messages$1 === messages) { 12722 messages$1 = newMessages(); 12723 } 12724 deepMerge(messages$1, options.messages); 12725 options.messages = messages$1; 12726 } else { 12727 options.messages = this.messages(); 12728 } 12729 var series = {}; 12730 var keys = options.keys || Object.keys(this.rules); 12731 keys.forEach(function(z) { 12732 var arr = _this2.rules[z]; 12733 var value = source[z]; 12734 arr.forEach(function(r) { 12735 var rule = r; 12736 if (typeof rule.transform === "function") { 12737 if (source === source_) { 12738 source = _extends({}, source); 12739 } 12740 value = source[z] = rule.transform(value); 12741 } 12742 if (typeof rule === "function") { 12743 rule = { 12744 validator: rule 12745 }; 12746 } else { 12747 rule = _extends({}, rule); 12748 } 12749 rule.validator = _this2.getValidationMethod(rule); 12750 if (!rule.validator) { 12751 return; 12752 } 12753 rule.field = z; 12754 rule.fullField = rule.fullField || z; 12755 rule.type = _this2.getType(rule); 12756 series[z] = series[z] || []; 12757 series[z].push({ 12758 rule, 12759 value, 12760 source, 12761 field: z 12762 }); 12763 }); 12764 }); 12765 var errorFields = {}; 12766 return asyncMap(series, options, function(data, doIt) { 12767 var rule = data.rule; 12768 var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object"); 12769 deep = deep && (rule.required || !rule.required && data.value); 12770 rule.field = data.field; 12771 function addFullField(key, schema) { 12772 return _extends({}, schema, { 12773 fullField: rule.fullField + "." + key, 12774 fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key] 12775 }); 12776 } 12777 function cb(e) { 12778 if (e === void 0) { 12779 e = []; 12780 } 12781 var errorList = Array.isArray(e) ? e : [e]; 12782 if (!options.suppressWarning && errorList.length) {
12783 Schema2.warning("async-validator:", errorList); 12784 } 12785 if (errorList.length && rule.message !== void 0) { 12786 errorList = [].concat(rule.message); 12787 } 12788 var filledErrors = errorList.map(complementError(rule, source)); 12789 if (options.first && filledErrors.length) { 12790 errorFields[rule.field] = 1; 12791 return doIt(filledErrors); 12792 } 12793 if (!deep) { 12794 doIt(filledErrors); 12795 } else { 12796 if (rule.required && !data.value) { 12797 if (rule.message !== void 0) { 12798 filledErrors = [].concat(rule.message).map(complementError(rule, source)); 12799 } else if (options.error) { 12800 filledErrors = [options.error(rule, format(options.messages.required, rule.field))]; 12801 } 12802 return doIt(filledErrors); 12803 } 12804 var fieldsSchema = {}; 12805 if (rule.defaultField) { 12806 Object.keys(data.value).map(function(key) { 12807 fieldsSchema[key] = rule.defaultField; 12808 }); 12809 } 12810 fieldsSchema = _extends({}, fieldsSchema, data.rule.fields); 12811 var paredFieldsSchema = {}; 12812 Object.keys(fieldsSchema).forEach(function(field) { 12813 var fieldSchema = fieldsSchema[field]; 12814 var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema]; 12815 paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field)); 12816 }); 12817 var schema = new Schema2(paredFieldsSchema); 12818 schema.messages(options.messages); 12819 if (data.rule.options) { 12820 data.rule.options.messages = options.messages; 12821 data.rule.options.error = options.error; 12822 } 12823 schema.validate(data.value, data.rule.options || options, function(errs) { 12824 var finalErrors = []; 12825 if (filledErrors && filledErrors.length) { 12826 finalErrors.push.apply(finalErrors, filledErrors); 12827 } 12828 if (errs && errs.length) { 12829 finalErrors.push.apply(finalErrors, errs); 12830 } 12831 doIt(finalErrors.length ? finalErrors : null); 12832 }); 12833 } 12834 } 12835 var res; 12836 if (rule.asyncValidator) { 12837 res = rule.asyncValidator(rule, data.value, cb, data.source, options); 12838 } else if (rule.validator) { 12839 try { 12840 res = rule.validator(rule, data.value, cb, data.source, options); 12841 } catch (error) { 12842 console.error == null ? void 0 : console.error(error); 12843 if (!options.suppressValidatorError) { 12844 setTimeout(function() { 12845 throw error; 12846 }, 0); 12847 } 12848 cb(error.message); 12849 } 12850 if (res === true) { 12851 cb(); 12852 } else if (res === false) { 12853 cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails"); 12854 } else if (res instanceof Array) { 12855 cb(res); 12856 } else if (res instanceof Error) { 12857 cb(res.message); 12858 } 12859 } 12860 if (res && res.then) { 12861 res.then(function() { 12862 return cb(); 12863 }, function(e) { 12864 return cb(e); 12865 }); 12866 } 12867 }, function(results) { 12868 complete(results); 12869 }, source); 12870 }; 12871 _proto.getType = function getType(rule) { 12872 if (rule.type === void 0 && rule.pattern instanceof RegExp) { 12873 rule.type = "pattern"; 12874 } 12875 if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) { 12876 throw new Error(format("Unknown rule type %s", rule.type)); 12877 } 12878 return rule.type || "string"; 12879 }; 12880 _proto.getValidationMethod = function getValidationMethod(rule) { 12881 if (typeof rule.validator === "function") { 12882 return rule.validator; 12883 } 12884 var keys = Object.keys(rule); 12885 var messageIndex = keys.indexOf("message"); 12886 if (messageIndex !== -1) { 12887 keys.splice(messageIndex, 1); 12888 } 12889 if (keys.length === 1 && keys[0] === "required") { 12890 return validators.required; 12891 } 12892 return validators[this.getType(rule)] || void 0; 12893 }; 12894 return Schema2; 12895 }(); 12896 Schema.register = function register(type4, validator) { 12897 if (typeof validator !== "function") { 12898 throw new Error("Cannot register a validator by type, validator is not a function"); 12899 } 12900 validators[type4] = validator; 12901 }; 12902 Schema.warning = warning; 12903 Schema.messages = messages; 12904 Schema.validators = validators; 12905 12906 const formItemValidateStates = [ 12907 "", 12908 "error", 12909 "validating", 12910 "success" 12911 ]; 12912 const formItemProps = buildProps({ 12913 label: String, 12914 labelWidth: { 12915 type: [String, Number], 12916 default: "" 12917 }, 12918 prop: { 12919 type: definePropType([String, Array]) 12920 }, 12921 required: { 12922 type: Boolean, 12923 default: void 0 12924 }, 12925 rules: { 12926 type: definePropType([Object, Array]) 12927 }, 12928 error: String, 12929 validateStatus: { 12930 type: String, 12931 values: formItemValidateStates 12932 }, 12933 for: String, 12934 inlineMessage: { 12935 type: [String, Boolean], 12936 default: "" 12937 }, 12938 showMessage: { 12939 type: Boolean, 12940 default: true 12941 }, 12942 size: { 12943 type: String, 12944 values: componentSizes 12945 } 12946 });
12947 12948 const COMPONENT_NAME$l = "ElLabelWrap"; 12949 var FormLabelWrap = vue.defineComponent({ 12950 name: COMPONENT_NAME$l, 12951 props: { 12952 isAutoWidth: Boolean, 12953 updateAll: Boolean 12954 }, 12955 setup(props, { 12956 slots 12957 }) { 12958 const formContext = vue.inject(formContextKey, void 0); 12959 const formItemContext = vue.inject(formItemContextKey); 12960 if (!formItemContext) 12961 throwError(COMPONENT_NAME$l, "usage: <el-form-item><label-wrap /></el-form-item>"); 12962 const ns = useNamespace("form"); 12963 const el = vue.ref(); 12964 const computedWidth = vue.ref(0); 12965 const getLabelWidth = () => { 12966 var _a; 12967 if ((_a = el.value) == null ? void 0 : _a.firstElementChild) { 12968 const width = window.getComputedStyle(el.value.firstElementChild).width; 12969 return Math.ceil(Number.parseFloat(width)); 12970 } else { 12971 return 0; 12972 } 12973 }; 12974 const updateLabelWidth = (action = "update") => { 12975 vue.nextTick(() => { 12976 if (slots.default && props.isAutoWidth) { 12977 if (action === "update") { 12978 computedWidth.value = getLabelWidth(); 12979 } else if (action === "remove") { 12980 formContext == null ? void 0 : formContext.deregisterLabelWidth(computedWidth.value); 12981 } 12982 } 12983 }); 12984 }; 12985 const updateLabelWidthFn = () => updateLabelWidth("update"); 12986 vue.onMounted(() => { 12987 updateLabelWidthFn(); 12988 }); 12989 vue.onBeforeUnmount(() => { 12990 updateLabelWidth("remove"); 12991 }); 12992 vue.onUpdated(() => updateLabelWidthFn()); 12993 vue.watch(computedWidth, (val, oldVal) => { 12994 if (props.updateAll) { 12995 formContext == null ? void 0 : formContext.registerLabelWidth(val, oldVal); 12996 } 12997 }); 12998 useResizeObserver(vue.computed(() => { 12999 var _a, _b; 13000 return (_b = (_a = el.value) == null ? void 0 : _a.firstElementChild) != null ? _b : null; 13001 }), updateLabelWidthFn); 13002 return () => { 13003 var _a, _b; 13004 if (!slots) 13005 return null; 13006 const { 13007 isAutoWidth 13008 } = props; 13009 if (isAutoWidth) { 13010 const autoLabelWidth = formContext == null ? void 0 : formContext.autoLabelWidth; 13011 const hasLabel = formItemContext == null ? void 0 : formItemContext.hasLabel; 13012 const style = {}; 13013 if (hasLabel && autoLabelWidth && autoLabelWidth !== "auto") { 13014 const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value); 13015 const marginPosition = formContext.labelPosition === "left" ? "marginRight" : "marginLeft"; 13016 if (marginWidth) { 13017 style[marginPosition] = `${marginWidth}px`; 13018 } 13019 } 13020 return vue.createVNode("div", { 13021 "ref": el, 13022 "class": [ns.be("item", "label-wrap")], 13023 "style": style 13024 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]); 13025 } else { 13026 return vue.createVNode(vue.Fragment, { 13027 "ref": el 13028 }, [(_b = slots.default) == null ? void 0 : _b.call(slots)]); 13029 } 13030 }; 13031 } 13032 }); 13033 13034 const _hoisted_1$12 = ["role", "aria-labelledby"]; 13035 const __default__$1y = vue.defineComponent({ 13036 name: "ElFormItem" 13037 }); 13038 const _sfc_main$2e = /* @__PURE__ */ vue.defineComponent({ 13039 ...__default__$1y, 13040 props: formItemProps, 13041 setup(__props, { expose }) { 13042 const props = __props; 13043 const slots = vue.useSlots(); 13044 const formContext = vue.inject(formContextKey, void 0); 13045 const parentFormItemContext = vue.inject(formItemContextKey, void 0); 13046 const _size = useFormSize(void 0, { formItem: false }); 13047 const ns = useNamespace("form-item"); 13048 const labelId = useId().value; 13049 const inputIds = vue.ref([]);
13050 const validateState = vue.ref(""); 13051 const validateStateDebounced = refDebounced(validateState, 100); 13052 const validateMessage = vue.ref(""); 13053 const formItemRef = vue.ref(); 13054 let initialValue = void 0; 13055 let isResettingField = false; 13056 const labelStyle = vue.computed(() => { 13057 if ((formContext == null ? void 0 : formContext.labelPosition) === "top") { 13058 return {}; 13059 } 13060 const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || ""); 13061 if (labelWidth) 13062 return { width: labelWidth }; 13063 return {}; 13064 }); 13065 const contentStyle = vue.computed(() => { 13066 if ((formContext == null ? void 0 : formContext.labelPosition) === "top" || (formContext == null ? void 0 : formContext.inline)) { 13067 return {}; 13068 } 13069 if (!props.label && !props.labelWidth && isNested) { 13070 return {}; 13071 } 13072 const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || ""); 13073 if (!props.label && !slots.label) { 13074 return { marginLeft: labelWidth }; 13075 } 13076 return {}; 13077 }); 13078 const formItemClasses = vue.computed(() => [ 13079 ns.b(), 13080 ns.m(_size.value), 13081 ns.is("error", validateState.value === "error"), 13082 ns.is("validating", validateState.value === "validating"), 13083 ns.is("success", validateState.value === "success"), 13084 ns.is("required", isRequired.value || props.required), 13085 ns.is("no-asterisk", formContext == null ? void 0 : formContext.hideRequiredAsterisk), 13086 (formContext == null ? void 0 : formContext.requireAsteriskPosition) === "right" ? "asterisk-right" : "asterisk-left", 13087 { [ns.m("feedback")]: formContext == null ? void 0 : formContext.statusIcon } 13088 ]); 13089 const _inlineMessage = vue.computed(() => isBoolean(props.inlineMessage) ? props.inlineMessage : (formContext == null ? void 0 : formContext.inlineMessage) || false); 13090 const validateClasses = vue.computed(() => [ 13091 ns.e("error"), 13092 { [ns.em("error", "inline")]: _inlineMessage.value } 13093 ]); 13094 const propString = vue.computed(() => { 13095 if (!props.prop) 13096 return ""; 13097 return isString$1(props.prop) ? props.prop : props.prop.join("."); 13098 }); 13099 const hasLabel = vue.computed(() => { 13100 return !!(props.label || slots.label); 13101 }); 13102 const labelFor = vue.computed(() => { 13103 return props.for || inputIds.value.length === 1 ? inputIds.value[0] : void 0; 13104 }); 13105 const isGroup = vue.computed(() => { 13106 return !labelFor.value && hasLabel.value; 13107 }); 13108 const isNested = !!parentFormItemContext; 13109 const fieldValue = vue.computed(() => { 13110 const model = formContext == null ? void 0 : formContext.model; 13111 if (!model || !props.prop) { 13112 return; 13113 } 13114 return getProp(model, props.prop).value; 13115 }); 13116 const normalizedRules = vue.computed(() => { 13117 const { required } = props; 13118 const rules = []; 13119 if (props.rules) { 13120 rules.push(...castArray$1(props.rules)); 13121 } 13122 const formRules = formContext == null ? void 0 : formContext.rules; 13123 if (formRules && props.prop) { 13124 const _rules = getProp(formRules, props.prop).value; 13125 if (_rules) { 13126 rules.push(...castArray$1(_rules)); 13127 } 13128 } 13129 if (required !== void 0) { 13130 const requiredRules = rules.map((rule, i) => [rule, i]).filter(([rule]) => Object.keys(rule).includes("required")); 13131 if (requiredRules.length > 0) { 13132 for (const [rule, i] of requiredRules) { 13133 if (rule.required === required) 13134 continue; 13135 rules[i] = { ...rule, required }; 13136 } 13137 } else { 13138 rules.push({ required }); 13139 } 13140 } 13141 return rules; 13142 }); 13143 const validateEnabled = vue.computed(() => normalizedRules.value.length > 0); 13144 const getFilteredRule = (trigger) => { 13145 const rules = normalizedRules.value; 13146 return rules.filter((rule) => { 13147 if (!rule.trigger || !trigger) 13148 return true; 13149 if (Array.isArray(rule.trigger)) { 13150 return rule.trigger.includes(trigger); 13151 } else { 13152 return rule.trigger === trigger; 13153 } 13154 }).map(({ trigger: trigger2, ...rule }) => rule); 13155 }; 13156 const isRequired = vue.computed(() => normalizedRules.value.some((rule) => rule.required)); 13157 const shouldShowError = vue.computed(() => { 13158 var _a; 13159 return validateStateDebounced.value === "error" && props.showMessage && ((_a = formContext == null ? void 0 : formContext.showMessage) != null ? _a : true); 13160 }); 13161 const currentLabel = vue.computed(() => `${props.label || ""}
13161${(formContext == null ? void 0 : formContext.labelSuffix) || ""}`); 13162 const setValidationState = (state) => { 13163 validateState.value = state; 13164 }; 13165 const onValidationFailed = (error) => { 13166 var _a, _b; 13167 const { errors, fields } = error; 13168 if (!errors || !fields) { 13169 console.error(error); 13170 } 13171 setValidationState("error"); 13172 validateMessage.value = errors ? (_b = (_a = errors == null ? void 0 : errors[0]) == null ? void 0 : _a.message) != null ? _b : `${props.prop} is required` : ""; 13173 formContext == null ? void 0 : formContext.emit("validate", props.prop, false, validateMessage.value); 13174 }; 13175 const onValidationSucceeded = () => { 13176 setValidationState("success"); 13177 formContext == null ? void 0 : formContext.emit("validate", props.prop, true, ""); 13178 }; 13179 const doValidate = async (rules) => { 13180 const modelName = propString.value; 13181 const validator = new Schema({ 13182 [modelName]: rules 13183 }); 13184 return validator.validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => { 13185 onValidationSucceeded(); 13186 return true; 13187 }).catch((err) => { 13188 onValidationFailed(err); 13189 return Promise.reject(err); 13190 }); 13191 }; 13192 const validate = async (trigger, callback) => { 13193 if (isResettingField || !props.prop) { 13194 return false; 13195 } 13196 const hasCallback = isFunction$1(callback); 13197 if (!validateEnabled.value) { 13198 callback == null ? void 0 : callback(false); 13199 return false; 13200 } 13201 const rules = getFilteredRule(trigger); 13202 if (rules.length === 0) { 13203 callback == null ? void 0 : callback(true); 13204 return true; 13205 } 13206 setValidationState("validating"); 13207 return doValidate(rules).then(() => { 13208 callback == null ? void 0 : callback(true); 13209 return true; 13210 }).catch((err) => { 13211 const { fields } = err; 13212 callback == null ? void 0 : callback(false, fields); 13213 return hasCallback ? false : Promise.reject(fields); 13214 }); 13215 }; 13216 const clearValidate = () => { 13217 setValidationState(""); 13218 validateMessage.value = ""; 13219 isResettingField = false; 13220 }; 13221 const resetField = async () => { 13222 const model = formContext == null ? void 0 : formContext.model; 13223 if (!model || !props.prop) 13224 return; 13225 const computedValue = getProp(model, props.prop); 13226 isResettingField = true; 13227 computedValue.value = clone(initialValue); 13228 await vue.nextTick(); 13229 clearValidate(); 13230 isResettingField = false; 13231 }; 13232 const addInputId = (id) => { 13233 if (!inputIds.value.includes(id)) { 13234 inputIds.value.push(id); 13235 } 13236 }; 13237 const removeInputId = (id) => { 13238 inputIds.value = inputIds.value.filter((listId) => listId !== id); 13239 }; 13240 vue.watch(() => props.error, (val) => { 13241 validateMessage.value = val || ""; 13242 setValidationState(val ? "error" : ""); 13243 }, { immediate: true }); 13244 vue.watch(() => props.validateStatus, (val) => setValidationState(val || "")); 13245 const context = vue.reactive({ 13246 ...vue.toRefs(props), 13247 $el: formItemRef, 13248 size: _size, 13249 validateState, 13250 labelId, 13251 inputIds, 13252 isGroup, 13253 hasLabel, 13254 addInputId, 13255 removeInputId, 13256 resetField, 13257 clearValidate, 13258 validate 13259 }); 13260 vue.provide(formItemContextKey, context); 13261 vue.onMounted(() => { 13262 if (props.prop) { 13263 formContext == null ? void 0 : formContext.addField(context); 13264 initialValue = clone(fieldValue.value); 13265 } 13266 }); 13267 vue.onBeforeUnmount(() => { 13268 formContext == null ? void 0 : formContext.removeField(context); 13269 }); 13270 expose({ 13271 size: _size, 13272 validateMessage, 13273 validateState, 13274 validate, 13275 clearValidate, 13276 resetField 13277 }); 13278 return (_ctx, _cache) => { 13279 var _a;
13280 return vue.openBlock(), vue.createElementBlock("div", { 13281 ref_key: "formItemRef", 13282 ref: formItemRef, 13283 class: vue.normalizeClass(vue.unref(formItemClasses)), 13284 role: vue.unref(isGroup) ? "group" : void 0, 13285 "aria-labelledby": vue.unref(isGroup) ? vue.unref(labelId) : void 0 13286 }, [ 13287 vue.createVNode(vue.unref(FormLabelWrap), { 13288 "is-auto-width": vue.unref(labelStyle).width === "auto", 13289 "update-all": ((_a = vue.unref(formContext)) == null ? void 0 : _a.labelWidth) === "auto" 13290 }, { 13291 default: vue.withCtx(() => [ 13292 vue.unref(hasLabel) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(labelFor) ? "label" : "div"), { 13293 key: 0, 13294 id: vue.unref(labelId), 13295 for: vue.unref(labelFor), 13296 class: vue.normalizeClass(vue.unref(ns).e("label")), 13297 style: vue.normalizeStyle(vue.unref(labelStyle)) 13298 }, { 13299 default: vue.withCtx(() => [ 13300 vue.renderSlot(_ctx.$slots, "label", { label: vue.unref(currentLabel) }, () => [ 13301 vue.createTextVNode(vue.toDisplayString(vue.unref(currentLabel)), 1) 13302 ]) 13303 ]), 13304 _: 3 13305 }, 8, ["id", "for", "class", "style"])) : vue.createCommentVNode("v-if", true) 13306 ]), 13307 _: 3 13308 }, 8, ["is-auto-width", "update-all"]), 13309 vue.createElementVNode("div", { 13310 class: vue.normalizeClass(vue.unref(ns).e("content")), 13311 style: vue.normalizeStyle(vue.unref(contentStyle)) 13312 }, [ 13313 vue.renderSlot(_ctx.$slots, "default"), 13314 vue.createVNode(vue.TransitionGroup, { 13315 name: `${vue.unref(ns).namespace.value}-zoom-in-top` 13316 }, { 13317 default: vue.withCtx(() => [ 13318 vue.unref(shouldShowError) ? vue.renderSlot(_ctx.$slots, "error", { 13319 key: 0, 13320 error: validateMessage.value 13321 }, () => [ 13322 vue.createElementVNode("div", { 13323 class: vue.normalizeClass(vue.unref(validateClasses)) 13324 }, vue.toDisplayString(validateMessage.value), 3) 13325 ]) : vue.createCommentVNode("v-if", true) 13326 ]), 13327 _: 3 13328 }, 8, ["name"]) 13329 ], 6) 13330 ], 10, _hoisted_1$12); 13331 }; 13332 } 13333 }); 13334 var FormItem = /* @__PURE__ */ _export_sfc(_sfc_main$2e, [["__file", "form-item.vue"]]); 13335 13336 const ElForm = withInstall(Form, { 13337 FormItem 13338 }); 13339 const ElFormItem = withNoopInstall(FormItem); 13340 13341 let hiddenTextarea = void 0; 13342 const HIDDEN_STYLE = ` 13343 height:0 !important; 13344 visibility:hidden !important; 13345 ${isFirefox() ? "" : "overflow:hidden !important;"} 13346 position:absolute !important; 13347 z-index:-1000 !important; 13348 top:0 !important; 13349 right:0 !important; 13350 `; 13351 const CONTEXT_STYLE = [ 13352 "letter-spacing", 13353 "line-height", 13354 "padding-top", 13355 "padding-bottom", 13356 "font-family", 13357 "font-weight", 13358 "font-size", 13359 "text-rendering", 13360 "text-transform", 13361 "width", 13362 "text-indent", 13363 "padding-left", 13364 "padding-right", 13365 "border-width", 13366 "box-sizing" 13367 ]; 13368 function calculateNodeStyling(targetElement) { 13369 const style = window.getComputedStyle(targetElement); 13370 const boxSizing = style.getPropertyValue("box-sizing"); 13371 const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top")); 13372 const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width")); 13373 const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";"); 13374 return { contextStyle, paddingSize, borderSize, boxSizing }; 13375 } 13376 function calcTextareaHeight(targetElement, minRows = 1, maxRows) { 13377 var _a; 13378 if (!hiddenTextarea) { 13379 hiddenTextarea = document.createElement("textarea"); 13380 document.body.appendChild(hiddenTextarea); 13381 } 13382 const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement); 13383 hiddenTextarea.setAttribute("style", `${contextStyle};${HIDDEN_STYLE}`); 13384 hiddenTextarea.value = targetElement.value || targetElement.placeholder || ""; 13385 let height = hiddenTextarea.scrollHeight; 13386 const result = {}; 13387 if (boxSizing === "border-box") { 13388 height = height + borderSize; 13389 } else if (boxSizing === "content-box") { 13390 height = height - paddingSize; 13391 } 13392 hiddenTextarea.value = ""; 13393 const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize; 13394 if (isNumber(minRows)) { 13395 let minHeight = singleRowHeight * minRows; 13396 if (boxSizing === "border-box") { 13397 minHeight = minHeight + paddingSize + borderSize; 13398 } 13399 height = Math.max(minHeight, height); 13400 result.minHeight = `${minHeight}px`; 13401 } 13402 if (isNumber(maxRows)) { 13403 let maxHeight = singleRowHeight * maxRows; 13404 if (boxSizing === "border-box") { 13405 maxHeight = maxHeight + paddingSize + borderSize; 13406 } 13407 height = Math.min(maxHeight, height); 13408 } 13409 result.height = `${height}px`; 13410 (_a = hiddenTextarea.parentNode) == null ? void 0 : _a.removeChild(hiddenTextarea); 13411 hiddenTextarea = void 0; 13412 return result; 13413 } 13414 13415 const inputProps = buildProps({ 13416 id: { 13417 type: String, 13418 default: void 0 13419 }, 13420 size: useSizeProp, 13421 disabled: Boolean, 13422 modelValue: { 13423 type: definePropType([ 13424 String, 13425 Number, 13426 Object 13427 ]), 13428 default: "" 13429 }, 13430 type: { 13431 type: String, 13432 default: "text" 13433 }, 13434 resize: { 13435 type: String, 13436 values: ["none", "both", "horizontal", "vertical"] 13437 }, 13438 autosize: { 13439 type: definePropType([Boolean, Object]), 13440 default: false 13441 }, 13442 autocomplete: { 13443 type: String, 13444 default: "off" 13445 }, 13446 formatter: { 13447 type: Function 13448 }, 13449 parser: { 13450 type: Function 13451 }, 13452 placeholder: { 13453 type: String 13454 }, 13455 form: { 13456 type: String 13457 }, 13458 readonly: { 13459 type: Boolean, 13460 default: false 13461 }, 13462 clearable: { 13463 type: Boolean, 13464 default: false 13465 }, 13466 showPassword: { 13467 type: Boolean, 13468 default: false 13469 }, 13470 showWordLimit: { 13471 type: Boolean, 13472 default: false 13473 }, 13474 suffixIcon: { 13475 type: iconPropType 13476 }, 13477 prefixIcon: { 13478 type: iconPropType 13479 }, 13480 containerRole: { 13481 type: String, 13482 default: void 0 13483 }, 13484 label: { 13485 type: String, 13486 default: void 0 13487 }, 13488 tabindex: { 13489 type: [String, Number], 13490 default: 0 13491 }, 13492 validateEvent: { 13493 type: Boolean, 13494 default: true 13495 }, 13496 inputStyle: { 13497 type: definePropType([Object, Array, String]), 13498 default: () => mutable({}) 13499 } 13500 });
13501 const inputEmits = { 13502 [UPDATE_MODEL_EVENT]: (value) => isString$1(value), 13503 input: (value) => isString$1(value), 13504 change: (value) => isString$1(value), 13505 focus: (evt) => evt instanceof FocusEvent, 13506 blur: (evt) => evt instanceof FocusEvent, 13507 clear: () => true, 13508 mouseleave: (evt) => evt instanceof MouseEvent, 13509 mouseenter: (evt) => evt instanceof MouseEvent, 13510 keydown: (evt) => evt instanceof Event, 13511 compositionstart: (evt) => evt instanceof CompositionEvent, 13512 compositionupdate: (evt) => evt instanceof CompositionEvent, 13513 compositionend: (evt) => evt instanceof CompositionEvent 13514 }; 13515 13516 const _hoisted_1$11 = ["role"]; 13517 const _hoisted_2$G = ["id", "type", "disabled", "formatter", "parser", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form"]; 13518 const _hoisted_3$l = ["id", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form"]; 13519 const __default__$1x = vue.defineComponent({ 13520 name: "ElInput", 13521 inheritAttrs: false 13522 }); 13523 const _sfc_main$2d = /* @__PURE__ */ vue.defineComponent({ 13524 ...__default__$1x, 13525 props: inputProps, 13526 emits: inputEmits, 13527 setup(__props, { expose, emit }) { 13528 const props = __props; 13529 const rawAttrs = vue.useAttrs(); 13530 const slots = vue.useSlots(); 13531 const containerAttrs = vue.computed(() => { 13532 const comboBoxAttrs = {}; 13533 if (props.containerRole === "combobox") { 13534 comboBoxAttrs["aria-haspopup"] = rawAttrs["aria-haspopup"]; 13535 comboBoxAttrs["aria-owns"] = rawAttrs["aria-owns"]; 13536 comboBoxAttrs["aria-expanded"] = rawAttrs["aria-expanded"]; 13537 } 13538 return comboBoxAttrs; 13539 }); 13540 const containerKls = vue.computed(() => [ 13541 props.type === "textarea" ? nsTextarea.b() : nsInput.b(), 13542 nsInput.m(inputSize.value), 13543 nsInput.is("disabled", inputDisabled.value), 13544 nsInput.is("exceed", inputExceed.value), 13545 { 13546 [nsInput.b("group")]: slots.prepend || slots.append, 13547 [nsInput.bm("group", "append")]: slots.append, 13548 [nsInput.bm("group", "prepend")]: slots.prepend, 13549 [nsInput.m("prefix")]: slots.prefix || props.prefixIcon, 13550 [nsInput.m("suffix")]: slots.suffix || props.suffixIcon || props.clearable || props.showPassword, 13551 [nsInput.bm("suffix", "password-clear")]: showClear.value && showPwdVisible.value 13552 }, 13553 rawAttrs.class 13554 ]); 13555 const wrapperKls = vue.computed(() => [ 13556 nsInput.e("wrapper"), 13557 nsInput.is("focus", focused.value) 13558 ]); 13559 const attrs = useAttrs({ 13560 excludeKeys: vue.computed(() => { 13561 return Object.keys(containerAttrs.value); 13562 }) 13563 }); 13564 const { form, formItem } = useFormItem(); 13565 const { inputId } = useFormItemInputId(props, { 13566 formItemContext: formItem 13567 }); 13568 const inputSize = useFormSize(); 13569 const inputDisabled = useFormDisabled(); 13570 const nsInput = useNamespace("input"); 13571 const nsTextarea = useNamespace("textarea"); 13572 const input = vue.shallowRef(); 13573 const textarea = vue.shallowRef(); 13574 const focused = vue.ref(false); 13575 const hovering = vue.ref(false); 13576 const isComposing = vue.ref(false); 13577 const passwordVisible = vue.ref(false); 13578 const countStyle = vue.ref(); 13579 const textareaCalcStyle = vue.shallowRef(props.inputStyle); 13580 const _ref = vue.computed(() => input.value || textarea.value); 13581 const needStatusIcon = vue.computed(() => { 13582 var _a; 13583 return (_a = form == null ? void 0 : form.statusIcon) != null ? _a : false; 13584 }); 13585 const validateState = vue.computed(() => (formItem == null ? void 0 : formItem.validateState) || ""); 13586 const validateIcon = vue.computed(() => validateState.value && ValidateComponentsMap[validateState.value]); 13587 const passwordIcon = vue.computed(() => passwordVisible.value ? view_default : hide_default); 13588 const containerStyle = vue.computed(() => [ 13589 rawAttrs.style, 13590 props.inputStyle 13591 ]); 13592 const textareaStyle = vue.computed(() => [ 13593 props.inputStyle, 13594 textareaCalcStyle.value, 13595 { resize: props.resize } 13596 ]); 13597 const nativeInputValue = vue.computed(() => isNil(props.modelValue) ? "" : String(props.modelValue)); 13598 const showClear = vue.computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (focused.value || hovering.value)); 13599 const showPwdVisible = vue.computed(() => props.showPassword && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (!!nativeInputValue.value || focused.value)); 13600 const isWordLimitVisible = vue.computed(() => props.showWordLimit && !!attrs.value.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword); 13601 const textLength = vue.computed(() => nativeInputValue.value.length); 13602 const inputExceed = vue.computed(() => !!isWordLimitVisible.value && textLength.value > Number(attrs.value.maxlength)); 13603 const suffixVisible = vue.computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value); 13604 const [recordCursor, setCursor] = useCursor(input); 13605 useResizeObserver(textarea, (entries) => { 13606 onceInitSizeTextarea(); 13607 if (!isWordLimitVisible.value || props.resize !== "both") 13608 return; 13609 const entry = entries[0]; 13610 const { width } = entry.contentRect; 13611 countStyle.value = { 13612 right: `calc(100% - ${width + 15 + 6}px)` 13613 }; 13614 }); 13615 const resizeTextarea = () => { 13616 const { type, autosize } = props; 13617 if (!isClient || type !== "textarea" || !textarea.value) 13618 return; 13619 if (autosize) { 13620 const minRows = isObject$1(autosize) ? autosize.minRows : void 0; 13621 const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0; 13622 const textareaStyle2 = calcTextareaHeight(textarea.value, minRows, maxRows); 13623 textareaCalcStyle.value = { 13624 overflowY: "hidden", 13625 ...textareaStyle2 13626 }; 13627 vue.nextTick(() => { 13628 textarea.value.offsetHeight; 13629 textareaCalcStyle.value = textareaStyle2; 13630 }); 13631 } else { 13632 textareaCalcStyle.value = { 13633 minHeight: calcTextareaHeight(textarea.value).minHeight 13634 }; 13635 } 13636 }; 13637 const createOnceInitResize = (resizeTextarea2) => { 13638 let isInit = false; 13639 return () => { 13640 var _a; 13641 if (isInit || !props.autosize) 13642 return; 13643 const isElHidden = ((_a = textarea.value) == null ? void 0 : _a.offsetParent) === null; 13644 if (!isElHidden) { 13645 resizeTextarea2(); 13646 isInit = true; 13647 } 13648 }; 13649 }; 13650 const onceInitSizeTextarea = createOnceInitResize(resizeTextarea); 13651 const setNativeInputValue = () => { 13652 const input2 = _ref.value; 13653 if (!input2 || input2.value === nativeInputValue.value) 13654 return; 13655 input2.value = nativeInputValue.value; 13656 }; 13657 const handleInput = async (event) => { 13658 recordCursor(); 13659 let { value } = event.target; 13660 if (props.formatter) { 13661 value = props.parser ? props.parser(value) : value; 13662 value = props.formatter(value); 13663 } 13664 if (isComposing.value) 13665 return; 13666 if (value === nativeInputValue.value) { 13667 setNativeInputValue(); 13668 return; 13669 } 13670 emit(UPDATE_MODEL_EVENT, value); 13671 emit("input", value); 13672 await vue.nextTick(); 13673 setNativeInputValue(); 13674 setCursor(); 13675 }; 13676 const handleChange = (event) => { 13677 emit("change", event.target.value); 13678 }; 13679 const handleCompositionStart = (event) => { 13680 emit("compositionstart", event); 13681 isComposing.value = true; 13682 }; 13683 const handleCompositionUpdate = (event) => { 13684 var _a; 13685 emit("compositionupdate", event); 13686 const text = (_a = event.target) == null ? void 0 : _a.value; 13687 const lastCharacter = text[text.length - 1] || ""; 13688 isComposing.value = !isKorean(lastCharacter); 13689 }; 13690 const handleCompositionEnd = (event) => { 13691 emit("compositionend", event); 13692 if (isComposing.value) { 13693 isComposing.value = false; 13694 handleInput(event); 13695 } 13696 }; 13697 const handlePasswordVisible = () => { 13698 passwordVisible.value = !passwordVisible.value; 13699 focus(); 13700 }; 13701 const focus = async () => { 13702 var _a; 13703 await vue.nextTick(); 13704 (_a = _ref.value) == null ? void 0 : _a.focus(); 13705 }; 13706 const blur = () => { 13707 var _a; 13708 return (_a = _ref.value) == null ? void 0 : _a.blur(); 13709 }; 13710 const handleFocus = (event) => { 13711 focused.value = true; 13712 emit("focus", event); 13713 }; 13714 const handleBlur = (event) => { 13715 var _a; 13716 focused.value = false; 13717 emit("blur", event); 13718 if (props.validateEvent) { 13719 (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn()); 13720 } 13721 }; 13722 const handleMouseLeave = (evt) => { 13723 hovering.value = false; 13724 emit("mouseleave", evt); 13725 }; 13726 const handleMouseEnter = (evt) => { 13727 hovering.value = true; 13728 emit("mouseenter", evt); 13729 }; 13730 const handleKeydown = (evt) => { 13731 emit("keydown", evt); 13732 }; 13733 const select = () => { 13734 var _a; 13735 (_a = _ref.value) == null ? void 0 : _a.select(); 13736 }; 13737 const clear = () => { 13738 emit(UPDATE_MODEL_EVENT, ""); 13739 emit("change", ""); 13740 emit("clear"); 13741 emit("input", ""); 13742 }; 13743 vue.watch(() => props.modelValue, () => { 13744 var _a; 13745 vue.nextTick(() => resizeTextarea()); 13746 if (props.validateEvent) { 13747 (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn()); 13748 } 13749 }); 13750 vue.watch(nativeInputValue, () => setNativeInputValue()); 13751 vue.watch(() => props.type, async () => { 13752 await vue.nextTick(); 13753 setNativeInputValue(); 13754 resizeTextarea(); 13755 }); 13756 vue.onMounted(() => { 13757 if (!props.formatter && props.parser) ; 13758 setNativeInputValue(); 13759 vue.nextTick(resizeTextarea); 13760 }); 13761 expose({ 13762 input, 13763 textarea, 13764 ref: _ref, 13765 textareaStyle, 13766 autosize: vue.toRef(props, "autosize"), 13767 focus, 13768 blur, 13769 select, 13770 clear, 13771 resizeTextarea 13772 }); 13773 return (_ctx, _cache) => { 13774 return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", vue.mergeProps(vue.unref(containerAttrs), { 13775 class: vue.unref(containerKls), 13776 style: vue.unref(containerStyle), 13777 role: _ctx.containerRole, 13778 onMouseenter: handleMouseEnter, 13779 onMouseleave: handleMouseLeave 13780 }), [ 13781 vue.createCommentVNode(" input "), 13782 _ctx.type !== "textarea" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ 13783 vue.createCommentVNode(" prepend slot "), 13784 _ctx.$slots.prepend ? (vue.openBlock(), vue.createElementBlock("div", { 13785 key: 0, 13786 class: vue.normalizeClass(vue.unref(nsInput).be("group", "prepend")) 13787 }, [
13788 vue.renderSlot(_ctx.$slots, "prepend") 13789 ], 2)) : vue.createCommentVNode("v-if", true), 13790 vue.createElementVNode("div", { 13791 class: vue.normalizeClass(vue.unref(wrapperKls)) 13792 }, [ 13793 vue.createCommentVNode(" prefix slot "), 13794 _ctx.$slots.prefix || _ctx.prefixIcon ? (vue.openBlock(), vue.createElementBlock("span", { 13795 key: 0, 13796 class: vue.normalizeClass(vue.unref(nsInput).e("prefix")) 13797 }, [ 13798 vue.createElementVNode("span", { 13799 class: vue.normalizeClass(vue.unref(nsInput).e("prefix-inner")), 13800 onClick: focus 13801 }, [ 13802 vue.renderSlot(_ctx.$slots, "prefix"), 13803 _ctx.prefixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 13804 key: 0, 13805 class: vue.normalizeClass(vue.unref(nsInput).e("icon")) 13806 }, { 13807 default: vue.withCtx(() => [ 13808 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prefixIcon))) 13809 ]), 13810 _: 1 13811 }, 8, ["class"])) : vue.createCommentVNode("v-if", true) 13812 ], 2) 13813 ], 2)) : vue.createCommentVNode("v-if", true), 13814 vue.createElementVNode("input", vue.mergeProps({ 13815 id: vue.unref(inputId), 13816 ref_key: "input", 13817 ref: input, 13818 class: vue.unref(nsInput).e("inner") 13819 }, vue.unref(attrs), { 13820 type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type, 13821 disabled: vue.unref(inputDisabled), 13822 formatter: _ctx.formatter, 13823 parser: _ctx.parser, 13824 readonly: _ctx.readonly, 13825 autocomplete: _ctx.autocomplete, 13826 tabindex: _ctx.tabindex, 13827 "aria-label": _ctx.label, 13828 placeholder: _ctx.placeholder, 13829 style: _ctx.inputStyle, 13830 form: props.form, 13831 onCompositionstart: handleCompositionStart, 13832 onCompositionupdate: handleCompositionUpdate, 13833 onCompositionend: handleCompositionEnd, 13834 onInput: handleInput, 13835 onFocus: handleFocus, 13836 onBlur: handleBlur, 13837 onChange: handleChange, 13838 onKeydown: handleKeydown 13839 }), null, 16, _hoisted_2$G), 13840 vue.createCommentVNode(" suffix slot "), 13841 vue.unref(suffixVisible) ? (vue.openBlock(), vue.createElementBlock("span", { 13842 key: 1, 13843 class: vue.normalizeClass(vue.unref(nsInput).e("suffix")) 13844 }, [ 13845 vue.createElementVNode("span", { 13846 class: vue.normalizeClass(vue.unref(nsInput).e("suffix-inner")), 13847 onClick: focus 13848 }, [ 13849 !vue.unref(showClear) || !vue.unref(showPwdVisible) || !vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ 13850 vue.renderSlot(_ctx.$slots, "suffix"), 13851 _ctx.suffixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 13852 key: 0, 13853 class: vue.normalizeClass(vue.unref(nsInput).e("icon")) 13854 }, { 13855 default: vue.withCtx(() => [ 13856 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.suffixIcon))) 13857 ]), 13858 _: 1 13859 }, 8, ["class"])) : vue.createCommentVNode("v-if", true) 13860 ], 64)) : vue.createCommentVNode("v-if", true), 13861 vue.unref(showClear) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 13862 key: 1, 13863 class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsInput).e("clear")]), 13864 onMousedown: vue.withModifiers(vue.unref(NOOP), ["prevent"]), 13865 onClick: clear 13866 }, { 13867 default: vue.withCtx(() => [ 13868 vue.createVNode(vue.unref(circle_close_default)) 13869 ]), 13870 _: 1 13871 }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true), 13872 vue.unref(showPwdVisible) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 13873 key: 2, 13874 class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsInput).e("password")]), 13875 onClick: handlePasswordVisible 13876 }, { 13877 default: vue.withCtx(() => [ 13878 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(passwordIcon)))) 13879 ]), 13880 _: 1 13881 }, 8, ["class"])) : vue.createCommentVNode("v-if", true), 13882 vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock("span", { 13883 key: 3, 13884 class: vue.normalizeClass(vue.unref(nsInput).e("count")) 13885 }, [ 13886 vue.createElementVNode("span", { 13887 class: vue.normalizeClass(vue.unref(nsInput).e("count-inner")) 13888 }, vue.toDisplayString(vue.unref(textLength)) + " / " + vue.toDisplayString(vue.unref(attrs).maxlength), 3) 13889 ], 2)) : vue.createCommentVNode("v-if", true), 13890 vue.unref(validateState) && vue.unref(validateIcon) && vue.unref(needStatusIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 13891 key: 4, 13892 class: vue.normalizeClass([ 13893 vue.unref(nsInput).e("icon"), 13894 vue.unref(nsInput).e("validateIcon"), 13895 vue.unref(nsInput).is("loading", vue.unref(validateState) === "validating") 13896 ]) 13897 }, { 13898 default: vue.withCtx(() => [ 13899 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(validateIcon)))) 13900 ]), 13901 _: 1 13902 }, 8, ["class"])) : vue.createCommentVNode("v-if", true) 13903 ], 2) 13904 ], 2)) : vue.createCommentVNode("v-if", true) 13905 ], 2), 13906 vue.createCommentVNode(" append slot "), 13907 _ctx.$slots.append ? (vue.openBlock(), vue.createElementBlock("div", { 13908 key: 1, 13909 class: vue.normalizeClass(vue.unref(nsInput).be("group", "append")) 13910 }, [
13911 vue.renderSlot(_ctx.$slots, "append") 13912 ], 2)) : vue.createCommentVNode("v-if", true) 13913 ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [ 13914 vue.createCommentVNode(" textarea "), 13915 vue.createElementVNode("textarea", vue.mergeProps({ 13916 id: vue.unref(inputId), 13917 ref_key: "textarea", 13918 ref: textarea, 13919 class: vue.unref(nsTextarea).e("inner") 13920 }, vue.unref(attrs), { 13921 tabindex: _ctx.tabindex, 13922 disabled: vue.unref(inputDisabled), 13923 readonly: _ctx.readonly, 13924 autocomplete: _ctx.autocomplete, 13925 style: vue.unref(textareaStyle), 13926 "aria-label": _ctx.label, 13927 placeholder: _ctx.placeholder, 13928 form: props.form, 13929 onCompositionstart: handleCompositionStart, 13930 onCompositionupdate: handleCompositionUpdate, 13931 onCompositionend: handleCompositionEnd, 13932 onInput: handleInput, 13933 onFocus: handleFocus, 13934 onBlur: handleBlur, 13935 onChange: handleChange, 13936 onKeydown: handleKeydown 13937 }), null, 16, _hoisted_3$l), 13938 vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock("span", { 13939 key: 0, 13940 style: vue.normalizeStyle(countStyle.value), 13941 class: vue.normalizeClass(vue.unref(nsInput).e("count")) 13942 }, vue.toDisplayString(vue.unref(textLength)) + " / " + vue.toDisplayString(vue.unref(attrs).maxlength), 7)) : vue.createCommentVNode("v-if", true) 13943 ], 64)) 13944 ], 16, _hoisted_1$11)), [ 13945 [vue.vShow, _ctx.type !== "hidden"] 13946 ]); 13947 }; 13948 } 13949 }); 13950 var Input = /* @__PURE__ */ _export_sfc(_sfc_main$2d, [["__file", "input.vue"]]); 13951 13952 const ElInput = withInstall(Input); 13953 13954 const GAP = 4; 13955 const BAR_MAP = { 13956 vertical: { 13957 offset: "offsetHeight", 13958 scroll: "scrollTop", 13959 scrollSize: "scrollHeight", 13960 size: "height", 13961 key: "vertical", 13962 axis: "Y", 13963 client: "clientY", 13964 direction: "top" 13965 }, 13966 horizontal: { 13967 offset: "offsetWidth", 13968 scroll: "scrollLeft", 13969 scrollSize: "scrollWidth", 13970 size: "width", 13971 key: "horizontal", 13972 axis: "X", 13973 client: "clientX", 13974 direction: "left" 13975 } 13976 }; 13977 const renderThumbStyle$1 = ({ 13978 move, 13979 size, 13980 bar 13981 }) => ({ 13982 [bar.size]: size, 13983 transform: `translate${bar.axis}(${move}%)` 13984 }); 13985 13986 const scrollbarContextKey = Symbol("scrollbarContextKey"); 13987 13988 const thumbProps = buildProps({ 13989 vertical: Boolean, 13990 size: String, 13991 move: Number, 13992 ratio: { 13993 type: Number, 13994 required: true 13995 }, 13996 always: Boolean 13997 }); 13998 13999 const COMPONENT_NAME$k = "Thumb"; 14000 const _sfc_main$2c = /* @__PURE__ */ vue.defineComponent({ 14001 __name: "thumb", 14002 props: thumbProps, 14003 setup(__props) { 14004 const props = __props; 14005 const scrollbar = vue.inject(scrollbarContextKey); 14006 const ns = useNamespace("scrollbar"); 14007 if (!scrollbar) 14008 throwError(COMPONENT_NAME$k, "can not inject scrollbar context"); 14009 const instance = vue.ref(); 14010 const thumb = vue.ref(); 14011 const thumbState = vue.ref({}); 14012 const visible = vue.ref(false); 14013 let cursorDown = false; 14014 let cursorLeave = false; 14015 let originalOnSelectStart = isClient ? document.onselectstart : null; 14016 const bar = vue.computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]); 14017 const thumbStyle = vue.computed(() => renderThumbStyle$1({ 14018 size: props.size, 14019 move: props.move, 14020 bar: bar.value 14021 })); 14022 const offsetRatio = vue.computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]); 14023 const clickThumbHandler = (e) => { 14024 var _a; 14025 e.stopPropagation(); 14026 if (e.ctrlKey || [1, 2].includes(e.button)) 14027 return; 14028 (_a = window.getSelection()) == null ? void 0 : _a.removeAllRanges(); 14029 startDrag(e); 14030 const el = e.currentTarget; 14031 if (!el) 14032 return; 14033 thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]); 14034 }; 14035 const clickTrackHandler = (e) => { 14036 if (!thumb.value || !instance.value || !scrollbar.wrapElement) 14037 return; 14038 const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]); 14039 const thumbHalf = thumb.value[bar.value.offset] / 2; 14040 const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset]; 14041 scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100; 14042 }; 14043 const startDrag = (e) => { 14044 e.stopImmediatePropagation(); 14045 cursorDown = true; 14046 document.addEventListener("mousemove", mouseMoveDocumentHandler); 14047 document.addEventListener("mouseup", mouseUpDocumentHandler); 14048 originalOnSelectStart = document.onselectstart; 14049 document.onselectstart = () => false; 14050 }; 14051 const mouseMoveDocumentHandler = (e) => { 14052 if (!instance.value || !thumb.value) 14053 return; 14054 if (cursorDown === false) 14055 return; 14056 const prevPage = thumbState.value[bar.value.axis]; 14057 if (!prevPage) 14058 return; 14059 const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1; 14060 const thumbClickPosition = thumb.value[bar.value.offset] - prevPage; 14061 const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset]; 14062 scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100; 14063 }; 14064 const mouseUpDocumentHandler = () => { 14065 cursorDown = false; 14066 thumbState.value[bar.value.axis] = 0; 14067 document.removeEventListener("mousemove", mouseMoveDocumentHandler); 14068 document.removeEventListener("mouseup", mouseUpDocumentHandler); 14069 restoreOnselectstart(); 14070 if (cursorLeave) 14071 visible.value = false; 14072 }; 14073 const mouseMoveScrollbarHandler = () => { 14074 cursorLeave = false; 14075 visible.value = !!props.size; 14076 }; 14077 const mouseLeaveScrollbarHandler = () => { 14078 cursorLeave = true;
14079 visible.value = cursorDown; 14080 }; 14081 vue.onBeforeUnmount(() => { 14082 restoreOnselectstart(); 14083 document.removeEventListener("mouseup", mouseUpDocumentHandler); 14084 }); 14085 const restoreOnselectstart = () => { 14086 if (document.onselectstart !== originalOnSelectStart) 14087 document.onselectstart = originalOnSelectStart; 14088 }; 14089 useEventListener(vue.toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler); 14090 useEventListener(vue.toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler); 14091 return (_ctx, _cache) => { 14092 return vue.openBlock(), vue.createBlock(vue.Transition, { 14093 name: vue.unref(ns).b("fade"), 14094 persisted: "" 14095 }, { 14096 default: vue.withCtx(() => [ 14097 vue.withDirectives(vue.createElementVNode("div", { 14098 ref_key: "instance", 14099 ref: instance, 14100 class: vue.normalizeClass([vue.unref(ns).e("bar"), vue.unref(ns).is(vue.unref(bar).key)]), 14101 onMousedown: clickTrackHandler 14102 }, [ 14103 vue.createElementVNode("div", { 14104 ref_key: "thumb", 14105 ref: thumb, 14106 class: vue.normalizeClass(vue.unref(ns).e("thumb")), 14107 style: vue.normalizeStyle(vue.unref(thumbStyle)), 14108 onMousedown: clickThumbHandler 14109 }, null, 38) 14110 ], 34), [ 14111 [vue.vShow, _ctx.always || visible.value] 14112 ]) 14113 ]), 14114 _: 1 14115 }, 8, ["name"]); 14116 }; 14117 } 14118 }); 14119 var Thumb = /* @__PURE__ */ _export_sfc(_sfc_main$2c, [["__file", "thumb.vue"]]); 14120 14121 const barProps = buildProps({ 14122 always: { 14123 type: Boolean, 14124 default: true 14125 }, 14126 width: String, 14127 height: String, 14128 ratioX: { 14129 type: Number, 14130 default: 1 14131 }, 14132 ratioY: { 14133 type: Number, 14134 default: 1 14135 } 14136 }); 14137 14138 const _sfc_main$2b = /* @__PURE__ */ vue.defineComponent({ 14139 __name: "bar", 14140 props: barProps, 14141 setup(__props, { expose }) { 14142 const props = __props; 14143 const moveX = vue.ref(0);
14144 const moveY = vue.ref(0); 14145 const handleScroll = (wrap) => { 14146 if (wrap) { 14147 const offsetHeight = wrap.offsetHeight - GAP; 14148 const offsetWidth = wrap.offsetWidth - GAP; 14149 moveY.value = wrap.scrollTop * 100 / offsetHeight * props.ratioY; 14150 moveX.value = wrap.scrollLeft * 100 / offsetWidth * props.ratioX; 14151 } 14152 }; 14153 expose({ 14154 handleScroll 14155 }); 14156 return (_ctx, _cache) => { 14157 return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [ 14158 vue.createVNode(Thumb, { 14159 move: moveX.value, 14160 ratio: _ctx.ratioX, 14161 size: _ctx.width, 14162 always: _ctx.always 14163 }, null, 8, ["move", "ratio", "size", "always"]), 14164 vue.createVNode(Thumb, { 14165 move: moveY.value, 14166 ratio: _ctx.ratioY, 14167 size: _ctx.height, 14168 vertical: "", 14169 always: _ctx.always 14170 }, null, 8, ["move", "ratio", "size", "always"]) 14171 ], 64); 14172 }; 14173 } 14174 }); 14175 var Bar = /* @__PURE__ */ _export_sfc(_sfc_main$2b, [["__file", "bar.vue"]]); 14176 14177 const scrollbarProps = buildProps({ 14178 height: { 14179 type: [String, Number], 14180 default: "" 14181 }, 14182 maxHeight: { 14183 type: [String, Number], 14184 default: "" 14185 }, 14186 native: { 14187 type: Boolean, 14188 default: false 14189 }, 14190 wrapStyle: { 14191 type: definePropType([String, Object, Array]), 14192 default: "" 14193 }, 14194 wrapClass: { 14195 type: [String, Array], 14196 default: "" 14197 }, 14198 viewClass: { 14199 type: [String, Array], 14200 default: "" 14201 }, 14202 viewStyle: { 14203 type: [String, Array, Object], 14204 default: "" 14205 }, 14206 noresize: Boolean, 14207 tag: { 14208 type: String, 14209 default: "div" 14210 }, 14211 always: Boolean, 14212 minSize: { 14213 type: Number, 14214 default: 20 14215 } 14216 }); 14217 const scrollbarEmits = { 14218 scroll: ({ 14219 scrollTop, 14220 scrollLeft 14221 }) => [scrollTop, scrollLeft].every(isNumber) 14222 }; 14223 14224 const COMPONENT_NAME$j = "ElScrollbar"; 14225 const __default__$1w = vue.defineComponent({ 14226 name: COMPONENT_NAME$j 14227 }); 14228 const _sfc_main$2a = /* @__PURE__ */ vue.defineComponent({ 14229 ...__default__$1w, 14230 props: scrollbarProps, 14231 emits: scrollbarEmits, 14232 setup(__props, { expose, emit }) { 14233 const props = __props; 14234 const ns = useNamespace("scrollbar"); 14235 let stopResizeObserver = void 0; 14236 let stopResizeListener = void 0; 14237 const scrollbarRef = vue.ref(); 14238 const wrapRef = vue.ref(); 14239 const resizeRef = vue.ref(); 14240 const sizeWidth = vue.ref("0"); 14241 const sizeHeight = vue.ref("0"); 14242 const barRef = vue.ref(); 14243 const ratioY = vue.ref(1); 14244 const ratioX = vue.ref(1); 14245 const style = vue.computed(() => { 14246 const style2 = {}; 14247 if (props.height) 14248 style2.height = addUnit(props.height); 14249 if (props.maxHeight) 14250 style2.maxHeight = addUnit(props.maxHeight); 14251 return [props.wrapStyle, style2]; 14252 }); 14253 const wrapKls = vue.computed(() => { 14254 return [ 14255 props.wrapClass, 14256 ns.e("wrap"), 14257 { [ns.em("wrap", "hidden-default")]: !props.native } 14258 ]; 14259 }); 14260 const resizeKls = vue.computed(() => { 14261 return [ns.e("view"), props.viewClass]; 14262 }); 14263 const handleScroll = () => { 14264 var _a; 14265 if (wrapRef.value) { 14266 (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value); 14267 emit("scroll", { 14268 scrollTop: wrapRef.value.scrollTop, 14269 scrollLeft: wrapRef.value.scrollLeft 14270 }); 14271 } 14272 }; 14273 function scrollTo(arg1, arg2) { 14274 if (isObject$1(arg1)) { 14275 wrapRef.value.scrollTo(arg1); 14276 } else if (isNumber(arg1) && isNumber(arg2)) { 14277 wrapRef.value.scrollTo(arg1, arg2); 14278 } 14279 } 14280 const setScrollTop = (value) => { 14281 if (!isNumber(value)) { 14282 return; 14283 } 14284 wrapRef.value.scrollTop = value; 14285 }; 14286 const setScrollLeft = (value) => { 14287 if (!isNumber(value)) { 14288 return; 14289 } 14290 wrapRef.value.scrollLeft = value; 14291 }; 14292 const update = () => { 14293 if (!wrapRef.value) 14294 return; 14295 const offsetHeight = wrapRef.value.offsetHeight - GAP; 14296 const offsetWidth = wrapRef.value.offsetWidth - GAP; 14297 const originalHeight = offsetHeight ** 2 / wrapRef.value.scrollHeight; 14298 const originalWidth = offsetWidth ** 2 / wrapRef.value.scrollWidth; 14299 const height = Math.max(originalHeight, props.minSize); 14300 const width = Math.max(originalWidth, props.minSize); 14301 ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height)); 14302 ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width)); 14303 sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : ""; 14304 sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : ""; 14305 }; 14306 vue.watch(() =>
14306 props.noresize, (noresize) => { 14307 if (noresize) { 14308 stopResizeObserver == null ? void 0 : stopResizeObserver(); 14309 stopResizeListener == null ? void 0 : stopResizeListener(); 14310 } else { 14311 ({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update)); 14312 stopResizeListener = useEventListener("resize", update); 14313 } 14314 }, { immediate: true }); 14315 vue.watch(() => [props.maxHeight, props.height], () => { 14316 if (!props.native) 14317 vue.nextTick(() => { 14318 var _a; 14319 update(); 14320 if (wrapRef.value) { 14321 (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value); 14322 } 14323 }); 14324 }); 14325 vue.provide(scrollbarContextKey, vue.reactive({ 14326 scrollbarElement: scrollbarRef, 14327 wrapElement: wrapRef 14328 })); 14329 vue.onMounted(() => { 14330 if (!props.native) 14331 vue.nextTick(() => { 14332 update(); 14333 }); 14334 }); 14335 vue.onUpdated(() => update()); 14336 expose({ 14337 wrapRef, 14338 update, 14339 scrollTo, 14340 setScrollTop, 14341 setScrollLeft, 14342 handleScroll 14343 }); 14344 return (_ctx, _cache) => { 14345 return vue.openBlock(), vue.createElementBlock("div", { 14346 ref_key: "scrollbarRef", 14347 ref: scrollbarRef, 14348 class: vue.normalizeClass(vue.unref(ns).b()) 14349 }, [ 14350 vue.createElementVNode("div", { 14351 ref_key: "wrapRef", 14352 ref: wrapRef, 14353 class: vue.normalizeClass(vue.unref(wrapKls)), 14354 style: vue.normalizeStyle(vue.unref(style)), 14355 onScroll: handleScroll 14356 }, [ 14357 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), { 14358 ref_key: "resizeRef", 14359 ref: resizeRef, 14360 class: vue.normalizeClass(vue.unref(resizeKls)), 14361 style: vue.normalizeStyle(_ctx.viewStyle) 14362 }, { 14363 default: vue.withCtx(() => [ 14364 vue.renderSlot(_ctx.$slots, "default") 14365 ]), 14366 _: 3 14367 }, 8, ["class", "style"])) 14368 ], 38), 14369 !_ctx.native ? (vue.openBlock(), vue.createBlock(Bar, { 14370 key: 0, 14371 ref_key: "barRef", 14372 ref: barRef, 14373 height: sizeHeight.value, 14374 width: sizeWidth.value, 14375 always: _ctx.always, 14376 "ratio-x": ratioX.value, 14377 "ratio-y": ratioY.value 14378 }, null, 8, ["height", "width", "always", "ratio-x", "ratio-y"])) : vue.createCommentVNode("v-if", true) 14379 ], 2); 14380 }; 14381 } 14382 }); 14383 var Scrollbar$1 = /* @__PURE__ */ _export_sfc(_sfc_main$2a, [["__file", "scrollbar.vue"]]); 14384 14385 const ElScrollbar = withInstall(Scrollbar$1); 14386 14387 const POPPER_INJECTION_KEY = Symbol("popper"); 14388 const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent"); 14389 14390 const Effect = { 14391 LIGHT: "light", 14392 DARK: "dark" 14393 }; 14394 const roleTypes = [ 14395 "dialog", 14396 "grid", 14397 "group", 14398 "listbox", 14399 "menu", 14400 "navigation", 14401 "tooltip", 14402 "tree" 14403 ]; 14404 const popperProps = buildProps({ 14405 role: { 14406 type: String, 14407 values: roleTypes, 14408 default: "tooltip" 14409 } 14410 }); 14411 const usePopperProps = popperProps; 14412 14413 const __default__$1v = vue.defineComponent({ 14414 name: "ElPopper", 14415 inheritAttrs: false 14416 }); 14417 const _sfc_main$29 = /* @__PURE__ */ vue.defineComponent({ 14418 ...__default__$1v, 14419 props: popperProps, 14420 setup(__props, { expose }) { 14421 const props = __props; 14422 const triggerRef = vue.ref(); 14423 const popperInstanceRef = vue.ref(); 14424 const contentRef = vue.ref(); 14425 const referenceRef = vue.ref(); 14426 const role = vue.computed(() => props.role); 14427 const popperProvides = { 14428 triggerRef, 14429 popperInstanceRef, 14430 contentRef, 14431 referenceRef, 14432 role 14433 }; 14434 expose(popperProvides); 14435 vue.provide(POPPER_INJECTION_KEY, popperProvides); 14436 return (_ctx, _cache) => {
14437 return vue.renderSlot(_ctx.$slots, "default"); 14438 }; 14439 } 14440 }); 14441 var Popper = /* @__PURE__ */ _export_sfc(_sfc_main$29, [["__file", "popper.vue"]]); 14442 14443 const popperArrowProps = buildProps({ 14444 arrowOffset: { 14445 type: Number, 14446 default: 5 14447 } 14448 }); 14449 const usePopperArrowProps = popperArrowProps; 14450 14451 const __default__$1u = vue.defineComponent({ 14452 name: "ElPopperArrow", 14453 inheritAttrs: false 14454 }); 14455 const _sfc_main$28 = /* @__PURE__ */ vue.defineComponent({ 14456 ...__default__$1u, 14457 props: popperArrowProps, 14458 setup(__props, { expose }) { 14459 const props = __props; 14460 const ns = useNamespace("popper"); 14461 const { arrowOffset, arrowRef, arrowStyle } = vue.inject(POPPER_CONTENT_INJECTION_KEY, void 0); 14462 vue.watch(() => props.arrowOffset, (val) => { 14463 arrowOffset.value = val; 14464 }); 14465 vue.onBeforeUnmount(() => { 14466 arrowRef.value = void 0; 14467 }); 14468 expose({ 14469 arrowRef 14470 }); 14471 return (_ctx, _cache) => { 14472 return vue.openBlock(), vue.createElementBlock("span", { 14473 ref_key: "arrowRef", 14474 ref: arrowRef, 14475 class: vue.normalizeClass(vue.unref(ns).e("arrow")), 14476 style: vue.normalizeStyle(vue.unref(arrowStyle)), 14477 "data-popper-arrow": "" 14478 }, null, 6); 14479 }; 14480 } 14481 }); 14482 var ElPopperArrow = /* @__PURE__ */ _export_sfc(_sfc_main$28, [["__file", "arrow.vue"]]); 14483 14484 const NAME = "ElOnlyChild"; 14485 const OnlyChild = vue.defineComponent({ 14486 name: NAME, 14487 setup(_, { 14488 slots, 14489 attrs 14490 }) { 14491 var _a; 14492 const forwardRefInjection = vue.inject(FORWARD_REF_INJECTION_KEY); 14493 const forwardRefDirective = useForwardRefDirective((_a = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a : NOOP); 14494 return () => { 14495 var _a2; 14496 const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots, attrs); 14497 if (!defaultSlot) 14498 return null; 14499 if (defaultSlot.length > 1) { 14500 return null; 14501 } 14502 const firstLegitNode = findFirstLegitChild(defaultSlot); 14503 if (!firstLegitNode) { 14504 return null; 14505 } 14506 return vue.withDirectives(vue.cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]); 14507 }; 14508 } 14509 }); 14510 function findFirstLegitChild(node) { 14511 if (!node) 14512 return null; 14513 const children = node; 14514 for (const child of children) { 14515 if (isObject$1(child)) { 14516 switch (child.type) { 14517 case vue.Comment: 14518 continue; 14519 case vue.Text: 14520 case "svg": 14521 return wrapTextContent(child); 14522 case vue.Fragment: 14523 return findFirstLegitChild(child.children); 14524 default: 14525 return child; 14526 } 14527 } 14528 return wrapTextContent(child); 14529 } 14530 return null; 14531 } 14532 function wrapTextContent(s) { 14533 const ns = useNamespace("only-child"); 14534 return vue.createVNode("span", { 14535 "class": ns.e("content") 14536 }, [s]); 14537 } 14538 14539 const popperTriggerProps = buildProps({ 14540 virtualRef: { 14541 type: definePropType(Object) 14542 }, 14543 virtualTriggering: Boolean, 14544 onMouseenter: { 14545 type: definePropType(Function) 14546 }, 14547 onMouseleave: { 14548 type: definePropType(Function) 14549 }, 14550 onClick: { 14551 type: definePropType(Function) 14552 }, 14553 onKeydown: { 14554 type: definePropType(Function) 14555 }, 14556 onFocus: { 14557 type: definePropType(Function) 14558 }, 14559 onBlur: { 14560 type: definePropType(Function) 14561 }, 14562 onContextmenu: { 14563 type: definePropType(Function) 14564 }, 14565 id: String, 14566 open: Boolean 14567 }); 14568 const usePopperTriggerProps = popperTriggerProps; 14569 14570 const __default__$1t = vue.defineComponent({ 14571 name: "ElPopperTrigger", 14572 inheritAttrs: false 14573 });
14574 const _sfc_main$27 = /* @__PURE__ */ vue.defineComponent({ 14575 ...__default__$1t, 14576 props: popperTriggerProps, 14577 setup(__props, { expose }) { 14578 const props = __props; 14579 const { role, triggerRef } = vue.inject(POPPER_INJECTION_KEY, void 0); 14580 useForwardRef(triggerRef); 14581 const ariaControls = vue.computed(() => { 14582 return ariaHaspopup.value ? props.id : void 0; 14583 }); 14584 const ariaDescribedby = vue.computed(() => { 14585 if (role && role.value === "tooltip") { 14586 return props.open && props.id ? props.id : void 0; 14587 } 14588 return void 0; 14589 }); 14590 const ariaHaspopup = vue.computed(() => { 14591 if (role && role.value !== "tooltip") { 14592 return role.value; 14593 } 14594 return void 0; 14595 }); 14596 const ariaExpanded = vue.computed(() => { 14597 return ariaHaspopup.value ? `${props.open}` : void 0; 14598 }); 14599 let virtualTriggerAriaStopWatch = void 0; 14600 vue.onMounted(() => { 14601 vue.watch(() => props.virtualRef, (virtualEl) => { 14602 if (virtualEl) { 14603 triggerRef.value = unrefElement(virtualEl); 14604 } 14605 }, { 14606 immediate: true 14607 }); 14608 vue.watch(triggerRef, (el, prevEl) => { 14609 virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch(); 14610 virtualTriggerAriaStopWatch = void 0; 14611 if (isElement$1(el)) { 14612 [ 14613 "onMouseenter", 14614 "onMouseleave", 14615 "onClick", 14616 "onKeydown", 14617 "onFocus", 14618 "onBlur", 14619 "onContextmenu" 14620 ].forEach((eventName) => { 14621 var _a; 14622 const handler = props[eventName]; 14623 if (handler) { 14624 el.addEventListener(eventName.slice(2).toLowerCase(), handler); 14625 (_a = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a.call(prevEl, eventName.slice(2).toLowerCase(), handler); 14626 } 14627 }); 14628 virtualTriggerAriaStopWatch = vue.watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => { 14629 [ 14630 "aria-controls", 14631 "aria-describedby", 14632 "aria-haspopup", 14633 "aria-expanded" 14634 ].forEach((key, idx) => { 14635 isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]); 14636 }); 14637 }, { immediate: true }); 14638 } 14639 if (isElement$1(prevEl)) { 14640 [ 14641 "aria-controls", 14642 "aria-describedby", 14643 "aria-haspopup", 14644 "aria-expanded" 14645 ].forEach((key) => prevEl.removeAttribute(key)); 14646 } 14647 }, { 14648 immediate: true 14649 }); 14650 }); 14651 vue.onBeforeUnmount(() => { 14652 virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch(); 14653 virtualTriggerAriaStopWatch = void 0; 14654 }); 14655 expose({ 14656 triggerRef 14657 }); 14658 return (_ctx, _cache) => { 14659 return !_ctx.virtualTriggering ? (vue.openBlock(), vue.createBlock(vue.unref(OnlyChild), vue.mergeProps({ key: 0 }, _ctx.$attrs, { 14660 "aria-controls": vue.unref(ariaControls), 14661 "aria-describedby": vue.unref(ariaDescribedby), 14662 "aria-expanded": vue.unref(ariaExpanded), 14663 "aria-haspopup": vue.unref(ariaHaspopup) 14664 }), { 14665 default: vue.withCtx(() => [ 14666 vue.renderSlot(_ctx.$slots, "default") 14667 ]), 14668 _: 3 14669 }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : vue.createCommentVNode("v-if", true); 14670 }; 14671 } 14672 }); 14673 var ElPopperTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$27, [["__file", "trigger.vue"]]); 14674 14675 const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped"; 14676 const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released"; 14677 const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented"; 14678 const FOCUS_AFTER_TRAPPED_OPTS = { 14679 cancelable: true, 14680 bubbles: false 14681 }; 14682 const FOCUSOUT_PREVENTED_OPTS = { 14683 cancelable: true, 14684 bubbles: false 14685 }; 14686 const ON_TRAP_FOCUS_EVT = "focusAfterTrapped"; 14687 const ON_RELEASE_FOCUS_EVT = "focusAfterReleased"; 14688 const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap"); 14689 14690 const focusReason = vue.ref(); 14691 const lastUserFocusTimestamp = vue.ref(0);
14692 const lastAutomatedFocusTimestamp = vue.ref(0); 14693 let focusReasonUserCount = 0; 14694 const obtainAllFocusableElements = (element) => { 14695 const nodes = []; 14696 const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, { 14697 acceptNode: (node) => { 14698 const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden"; 14699 if (node.disabled || node.hidden || isHiddenInput) 14700 return NodeFilter.FILTER_SKIP; 14701 return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; 14702 } 14703 }); 14704 while (walker.nextNode()) 14705 nodes.push(walker.currentNode); 14706 return nodes; 14707 }; 14708 const getVisibleElement = (elements, container) => { 14709 for (const element of elements) { 14710 if (!isHidden(element, container)) 14711 return element; 14712 } 14713 }; 14714 const isHidden = (element, container) => { 14715 if (getComputedStyle(element).visibility === "hidden") 14716 return true; 14717 while (element) { 14718 if (container && element === container) 14719 return false; 14720 if (getComputedStyle(element).display === "none") 14721 return true; 14722 element = element.parentElement; 14723 } 14724 return false; 14725 }; 14726 const getEdges = (container) => { 14727 const focusable = obtainAllFocusableElements(container); 14728 const first = getVisibleElement(focusable, container); 14729 const last = getVisibleElement(focusable.reverse(), container); 14730 return [first, last]; 14731 }; 14732 const isSelectable = (element) => { 14733 return element instanceof HTMLInputElement && "select" in element; 14734 }; 14735 const tryFocus = (element, shouldSelect) => { 14736 if (element && element.focus) { 14737 const prevFocusedElement = document.activeElement; 14738 element.focus({ preventScroll: true }); 14739 lastAutomatedFocusTimestamp.value = window.performance.now(); 14740 if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) { 14741 element.select(); 14742 } 14743 } 14744 }; 14745 function removeFromStack(list, item) { 14746 const copy = [...list]; 14747 const idx = list.indexOf(item); 14748 if (idx !== -1) { 14749 copy.splice(idx, 1); 14750 } 14751 return copy; 14752 } 14753 const createFocusableStack = () => { 14754 let stack = []; 14755 const push = (layer) => { 14756 const currentLayer = stack[0]; 14757 if (currentLayer && layer !== currentLayer) { 14758 currentLayer.pause(); 14759 } 14760 stack = removeFromStack(stack, layer); 14761 stack.unshift(layer); 14762 }; 14763 const remove = (layer) => { 14764 var _a, _b; 14765 stack = removeFromStack(stack, layer); 14766 (_b = (_a = stack[0]) == null ? void 0 : _a.resume) == null ? void 0 : _b.call(_a); 14767 }; 14768 return { 14769 push, 14770 remove 14771 }; 14772 }; 14773 const focusFirstDescendant = (elements, shouldSelect = false) => { 14774 const prevFocusedElement = document.activeElement; 14775 for (const element of elements) { 14776 tryFocus(element, shouldSelect); 14777 if (document.activeElement !== prevFocusedElement) 14778 return; 14779 } 14780 }; 14781 const focusableStack = createFocusableStack(); 14782 const isFocusCausedByUserEvent = () => { 14783 return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value; 14784 }; 14785 const notifyFocusReasonPointer = () => { 14786 focusReason.value = "pointer"; 14787 lastUserFocusTimestamp.value = window.performance.now(); 14788 }; 14789 const notifyFocusReasonKeydown = () => { 14790 focusReason.value = "keyboard"; 14791 lastUserFocusTimestamp.value = window.performance.now(); 14792 }; 14793 const useFocusReason = () => { 14794 vue.onMounted(() => { 14795 if (focusReasonUserCount === 0) { 14796 document.addEventListener("mousedown", notifyFocusReasonPointer); 14797 document.addEventListener("touchstart", notifyFocusReasonPointer); 14798 document.addEventListener("keydown", notifyFocusReasonKeydown); 14799 } 14800 focusReasonUserCount++; 14801 }); 14802 vue.onBeforeUnmount(() => { 14803 focusReasonUserCount--; 14804 if (focusReasonUserCount <= 0) { 14805 document.removeEventListener("mousedown", notifyFocusReasonPointer); 14806 document.removeEventListener("touchstart", notifyFocusReasonPointer); 14807 document.removeEventListener("keydown", notifyFocusReasonKeydown); 14808 } 14809 }); 14810 return { 14811 focusReason, 14812 lastUserFocusTimestamp, 14813 lastAutomatedFocusTimestamp 14814 }; 14815 };
14816 const createFocusOutPreventedEvent = (detail) => { 14817 return new CustomEvent(FOCUSOUT_PREVENTED, { 14818 ...FOCUSOUT_PREVENTED_OPTS, 14819 detail 14820 }); 14821 }; 14822 14823 const _sfc_main$26 = vue.defineComponent({ 14824 name: "ElFocusTrap", 14825 inheritAttrs: false, 14826 props: { 14827 loop: Boolean, 14828 trapped: Boolean, 14829 focusTrapEl: Object, 14830 focusStartEl: { 14831 type: [Object, String], 14832 default: "first" 14833 } 14834 }, 14835 emits: [ 14836 ON_TRAP_FOCUS_EVT, 14837 ON_RELEASE_FOCUS_EVT, 14838 "focusin", 14839 "focusout", 14840 "focusout-prevented", 14841 "release-requested" 14842 ], 14843 setup(props, { emit }) { 14844 const forwardRef = vue.ref(); 14845 let lastFocusBeforeTrapped; 14846 let lastFocusAfterTrapped; 14847 const { focusReason } = useFocusReason(); 14848 useEscapeKeydown((event) => { 14849 if (props.trapped && !focusLayer.paused) { 14850 emit("release-requested", event); 14851 } 14852 }); 14853 const focusLayer = { 14854 paused: false, 14855 pause() { 14856 this.paused = true; 14857 }, 14858 resume() { 14859 this.paused = false; 14860 } 14861 }; 14862 const onKeydown = (e) => { 14863 if (!props.loop && !props.trapped) 14864 return; 14865 if (focusLayer.paused) 14866 return; 14867 const { key, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e; 14868 const { loop } = props; 14869 const isTabbing = key === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey; 14870 const currentFocusingEl = document.activeElement; 14871 if (isTabbing && currentFocusingEl) { 14872 const container = currentTarget; 14873 const [first, last] = getEdges(container); 14874 const isTabbable = first && last; 14875 if (!isTabbable) { 14876 if (currentFocusingEl === container) { 14877 const focusoutPreventedEvent = createFocusOutPreventedEvent({ 14878 focusReason: focusReason.value 14879 }); 14880 emit("focusout-prevented", focusoutPreventedEvent); 14881 if (!focusoutPreventedEvent.defaultPrevented) { 14882 e.preventDefault(); 14883 } 14884 } 14885 } else { 14886 if (!shiftKey && currentFocusingEl === last) { 14887 const focusoutPreventedEvent = createFocusOutPreventedEvent({ 14888 focusReason: focusReason.value 14889 }); 14890 emit("focusout-prevented", focusoutPreventedEvent); 14891 if (!focusoutPreventedEvent.defaultPrevented) { 14892 e.preventDefault(); 14893 if (loop) 14894 tryFocus(first, true); 14895 } 14896 } else if (shiftKey && [first, container].includes(currentFocusingEl)) { 14897 const focusoutPreventedEvent = createFocusOutPreventedEvent({ 14898 focusReason: focusReason.value 14899 }); 14900 emit("focusout-prevented", focusoutPreventedEvent); 14901 if (!focusoutPreventedEvent.defaultPrevented) { 14902 e.preventDefault(); 14903 if (loop) 14904 tryFocus(last, true); 14905 } 14906 } 14907 } 14908 } 14909 }; 14910 vue.provide(FOCUS_TRAP_INJECTION_KEY, { 14911 focusTrapRef: forwardRef, 14912 onKeydown 14913 }); 14914 vue.watch(() => props.focusTrapEl, (focusTrapEl) => { 14915 if (focusTrapEl) { 14916 forwardRef.value = focusTrapEl; 14917 } 14918 }, { immediate: true }); 14919 vue.watch([forwardRef], ([forwardRef2], [oldForwardRef]) => { 14920 if (forwardRef2) { 14921 forwardRef2.addEventListener("keydown", onKeydown); 14922 forwardRef2.addEventListener("focusin", onFocusIn); 14923 forwardRef2.addEventListener("focusout", onFocusOut); 14924 } 14925 if (oldForwardRef) { 14926 oldForwardRef.removeEventListener("keydown", onKeydown); 14927 oldForwardRef.removeEventListener("focusin", onFocusIn); 14928 oldForwardRef.removeEventListener("focusout", onFocusOut); 14929 } 14930 }); 14931 const trapOnFocus = (e) => { 14932 emit(ON_TRAP_FOCUS_EVT, e); 14933 }; 14934 const releaseOnFocus = (e) => emit(ON_RELEASE_FOCUS_EVT, e); 14935 const onFocusIn = (e) => { 14936 const trapContainer = vue.unref(forwardRef); 14937 if (!trapContainer) 14938 return; 14939 const target = e.target; 14940 const relatedTarget = e.relatedTarget; 14941 const isFocusedInTrap = target && trapContainer.contains(target); 14942 if (!props.trapped) { 14943 const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget); 14944 if (!isPrevFocusedInTrap) { 14945 lastFocusBeforeTrapped = relatedTarget; 14946 } 14947 } 14948 if (isFocusedInTrap) 14949 emit("focusin", e); 14950 if (focusLayer.paused) 14951 return; 14952 if (props.trapped) { 14953 if (isFocusedInTrap) { 14954 lastFocusAfterTrapped = target; 14955 } else { 14956 tryFocus(lastFocusAfterTrapped, true); 14957 } 14958 } 14959 }; 14960 const onFocusOut = (e) => { 14961 const trapContainer = vue.unref(forwardRef); 14962 if (focusLayer.paused || !trapContainer) 14963 return; 14964 if (props.trapped) { 14965 const relatedTarget = e.relatedTarget; 14966 if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) { 14967 setTimeout(() => { 14968 if (!focusLayer.paused && props.trapped) { 14969 const focusoutPreventedEvent = createFocusOutPreventedEvent({ 14970 focusReason: focusReason.value 14971 }); 14972 emit("focusout-prevented", focusoutPreventedEvent); 14973 if (!focusoutPreventedEvent.defaultPrevented) { 14974 tryFocus(lastFocusAfterTrapped, true); 14975 } 14976 } 14977 }, 0); 14978 } 14979 } else { 14980 const target = e.target; 14981 const isFocusedInTrap = target && trapContainer.contains(target); 14982 if (!isFocusedInTrap) 14983 emit("focusout", e); 14984 } 14985 }; 14986 async function startTrap() { 14987 await vue.nextTick(); 14988 const trapContainer = vue.unref(forwardRef); 14989 if (trapContainer) { 14990 focusableStack.push(focusLayer); 14991 const prevFocusedElement = trapContainer.contains(document.activeElement) ? lastFocusBeforeTrapped : document.activeElement; 14992 lastFocusBeforeTrapped = prevFocusedElement; 14993 const isPrevFocusContained = trapContainer.contains(prevFocusedElement); 14994 if (!isPrevFocusContained) { 14995 const focusEvent = new Event(FOCUS_AFTER_TRAPPED, FOCUS_AFTER_TRAPPED_OPTS); 14996 trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
14997 trapContainer.dispatchEvent(focusEvent); 14998 if (!focusEvent.defaultPrevented) { 14999 vue.nextTick(() => { 15000 let focusStartEl = props.focusStartEl; 15001 if (!isString$1(focusStartEl)) { 15002 tryFocus(focusStartEl); 15003 if (document.activeElement !== focusStartEl) { 15004 focusStartEl = "first"; 15005 } 15006 } 15007 if (focusStartEl === "first") { 15008 focusFirstDescendant(obtainAllFocusableElements(trapContainer), true); 15009 } 15010 if (document.activeElement === prevFocusedElement || focusStartEl === "container") { 15011 tryFocus(trapContainer); 15012 } 15013 }); 15014 } 15015 } 15016 } 15017 } 15018 function stopTrap() { 15019 const trapContainer = vue.unref(forwardRef); 15020 if (trapContainer) { 15021 trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus); 15022 const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, { 15023 ...FOCUS_AFTER_TRAPPED_OPTS, 15024 detail: { 15025 focusReason: focusReason.value 15026 } 15027 }); 15028 trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus); 15029 trapContainer.dispatchEvent(releasedEvent); 15030 if (!releasedEvent.defaultPrevented && (focusReason.value == "keyboard" || !isFocusCausedByUserEvent() || trapContainer.contains(document.activeElement))) { 15031 tryFocus(lastFocusBeforeTrapped != null ? lastFocusBeforeTrapped : document.body); 15032 } 15033 trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, trapOnFocus); 15034 focusableStack.remove(focusLayer); 15035 } 15036 } 15037 vue.onMounted(() => { 15038 if (props.trapped) { 15039 startTrap(); 15040 } 15041 vue.watch(() => props.trapped, (trapped) => { 15042 if (trapped) { 15043 startTrap(); 15044 } else { 15045 stopTrap(); 15046 } 15047 }); 15048 }); 15049 vue.onBeforeUnmount(() => { 15050 if (props.trapped) { 15051 stopTrap(); 15052 } 15053 }); 15054 return { 15055 onKeydown 15056 }; 15057 } 15058 }); 15059 function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) { 15060 return vue.renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown }); 15061 } 15062 var ElFocusTrap = /* @__PURE__ */ _export_sfc(_sfc_main$26, [["render", _sfc_render$v], ["__file", "focus-trap.vue"]]); 15063 15064 const POSITIONING_STRATEGIES = ["fixed", "absolute"]; 15065 const popperCoreConfigProps = buildProps({ 15066 boundariesPadding: { 15067 type: Number, 15068 default: 0 15069 }, 15070 fallbackPlacements: { 15071 type: definePropType(Array), 15072 default: void 0 15073 }, 15074 gpuAcceleration: { 15075 type: Boolean, 15076 default: true 15077 }, 15078 offset: { 15079 type: Number, 15080 default: 12 15081 }, 15082 placement: { 15083 type: String, 15084 values: Ee, 15085 default: "bottom" 15086 }, 15087 popperOptions: { 15088 type: definePropType(Object), 15089 default: () => ({}) 15090 }, 15091 strategy: { 15092 type: String, 15093 values: POSITIONING_STRATEGIES, 15094 default: "absolute" 15095 } 15096 }); 15097 const popperContentProps = buildProps({ 15098 ...popperCoreConfigProps, 15099 id: String, 15100 style: { 15101 type: definePropType([String, Array, Object]) 15102 }, 15103 className: { 15104 type: definePropType([String, Array, Object]) 15105 }, 15106 effect: { 15107 type: String, 15108 default: "dark" 15109 }, 15110 visible: Boolean, 15111 enterable: { 15112 type: Boolean, 15113 default: true 15114 }, 15115 pure: Boolean, 15116 focusOnShow: { 15117 type: Boolean, 15118 default: false 15119 }, 15120 trapping: { 15121 type: Boolean, 15122 default: false 15123 }, 15124 popperClass: { 15125 type: definePropType([String, Array, Object]) 15126 }, 15127 popperStyle: { 15128 type: definePropType([String, Array, Object]) 15129 }, 15130 referenceEl: { 15131 type: definePropType(Object) 15132 }, 15133 triggerTargetEl: { 15134 type: definePropType(Object) 15135 }, 15136 stopPopperMouseEvent: { 15137 type: Boolean, 15138 default: true 15139 }, 15140 ariaLabel: { 15141 type: String, 15142 default: void 0 15143 }, 15144 virtualTriggering: Boolean, 15145 zIndex: Number 15146 });
15147 const popperContentEmits = { 15148 mouseenter: (evt) => evt instanceof MouseEvent, 15149 mouseleave: (evt) => evt instanceof MouseEvent, 15150 focus: () => true, 15151 blur: () => true, 15152 close: () => true 15153 }; 15154 const usePopperCoreConfigProps = popperCoreConfigProps; 15155 const usePopperContentProps = popperContentProps; 15156 const usePopperContentEmits = popperContentEmits; 15157 15158 const buildPopperOptions = (props, modifiers = []) => { 15159 const { placement, strategy, popperOptions } = props; 15160 const options = { 15161 placement, 15162 strategy, 15163 ...popperOptions, 15164 modifiers: [...genModifiers(props), ...modifiers] 15165 }; 15166 deriveExtraModifiers(options, popperOptions == null ? void 0 : popperOptions.modifiers); 15167 return options; 15168 }; 15169 const unwrapMeasurableEl = ($el) => { 15170 if (!isClient) 15171 return; 15172 return unrefElement($el); 15173 }; 15174 function genModifiers(options) { 15175 const { offset, gpuAcceleration, fallbackPlacements } = options; 15176 return [ 15177 { 15178 name: "offset", 15179 options: { 15180 offset: [0, offset != null ? offset : 12] 15181 } 15182 }, 15183 { 15184 name: "preventOverflow", 15185 options: { 15186 padding: { 15187 top: 2, 15188 bottom: 2, 15189 left: 5, 15190 right: 5 15191 } 15192 } 15193 }, 15194 { 15195 name: "flip", 15196 options: { 15197 padding: 5, 15198 fallbackPlacements 15199 } 15200 }, 15201 { 15202 name: "computeStyles", 15203 options: { 15204 gpuAcceleration 15205 } 15206 } 15207 ]; 15208 } 15209 function deriveExtraModifiers(options, modifiers) { 15210 if (modifiers) { 15211 options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []]; 15212 } 15213 } 15214 15215 const DEFAULT_ARROW_OFFSET = 0; 15216 const usePopperContent = (props) => { 15217 const { popperInstanceRef, contentRef, triggerRef, role } = vue.inject(POPPER_INJECTION_KEY, void 0); 15218 const arrowRef = vue.ref(); 15219 const arrowOffset = vue.ref(); 15220 const eventListenerModifier = vue.computed(() => { 15221 return { 15222 name: "eventListeners", 15223 enabled: !!props.visible 15224 }; 15225 }); 15226 const arrowModifier = vue.computed(() => { 15227 var _a; 15228 const arrowEl = vue.unref(arrowRef); 15229 const offset = (_a = vue.unref(arrowOffset)) != null ? _a : DEFAULT_ARROW_OFFSET; 15230 return { 15231 name: "arrow", 15232 enabled: !isUndefined$1(arrowEl), 15233 options: { 15234 element: arrowEl, 15235 padding: offset 15236 } 15237 }; 15238 }); 15239 const options = vue.computed(() => { 15240 return { 15241 onFirstUpdate: () => { 15242 update(); 15243 }, 15244 ...buildPopperOptions(props, [ 15245 vue.unref(arrowModifier), 15246 vue.unref(eventListenerModifier) 15247 ]) 15248 }; 15249 }); 15250 const computedReference = vue.computed(() => unwrapMeasurableEl(props.referenceEl) || vue.unref(triggerRef)); 15251 const { attributes, state, styles, update, forceUpdate, instanceRef } = usePopper(computedReference, contentRef, options); 15252 vue.watch(instanceRef, (instance) => popperInstanceRef.value = instance); 15253 vue.onMounted(() => { 15254 vue.watch(() => { 15255 var _a; 15256 return (_a = vue.unref(computedReference)) == null ? void 0 : _a.getBoundingClientRect(); 15257 }, () => { 15258 update(); 15259 }); 15260 }); 15261 return { 15262 attributes, 15263 arrowRef, 15264 contentRef, 15265 instanceRef, 15266 state, 15267 styles, 15268 role, 15269 forceUpdate, 15270 update 15271 }; 15272 }; 15273 15274 const usePopperContentDOM = (props, { 15275 attributes, 15276 styles, 15277 role 15278 }) => { 15279 const { nextZIndex } = useZIndex(); 15280 const ns = useNamespace("popper"); 15281 const contentAttrs = vue.computed(() => vue.unref(attributes).popper); 15282 const contentZIndex = vue.ref(props.zIndex || nextZIndex()); 15283 const contentClass = vue.computed(() => [ 15284 ns.b(), 15285 ns.is("pure", props.pure), 15286 ns.is(props.effect), 15287 props.popperClass 15288 ]); 15289 const contentStyle = vue.computed(() => { 15290 return [ 15291 { zIndex: vue.unref(contentZIndex) }, 15292 props.popperStyle || {}, 15293 vue.unref(styles).popper 15294 ]; 15295 }); 15296 const ariaModal = vue.computed(() => role.value === "dialog" ? "false" : void 0); 15297 const arrowStyle = vue.computed(() => vue.unref(styles).arrow || {}); 15298 const updateZIndex = () => { 15299 contentZIndex.value = props.zIndex || nextZIndex(); 15300 }; 15301 return { 15302 ariaModal, 15303 arrowStyle, 15304 contentAttrs, 15305 contentClass, 15306 contentStyle, 15307 contentZIndex, 15308 updateZIndex 15309 }; 15310 }; 15311 15312 const usePopperContentFocusTrap = (props, emit) => { 15313 const trapped = vue.ref(false); 15314 const focusStartRef = vue.ref(); 15315 const onFocusAfterTrapped = () => { 15316 emit("focus"); 15317 }; 15318 const onFocusAfterReleased = (event) => { 15319 var _a; 15320 if (((_a = event.detail) == null ? void 0 : _a.focusReason) !== "pointer") { 15321 focusStartRef.value = "first"; 15322 emit("blur"); 15323 } 15324 }; 15325 const onFocusInTrap = (event) => { 15326 if (props.visible && !trapped.value) { 15327 if (event.target) { 15328 focusStartRef.value = event.target; 15329 } 15330 trapped.value = true; 15331 } 15332 }; 15333 const onFocusoutPrevented = (event) => { 15334 if (!props.trapping) { 15335 if (event.detail.focusReason === "pointer") { 15336 event.preventDefault(); 15337 } 15338 trapped.value = false; 15339 } 15340 }; 15341 const onReleaseRequested = () => { 15342 trapped.value = false; 15343 emit("close"); 15344 }; 15345 return { 15346 focusStartRef, 15347 trapped, 15348 onFocusAfterReleased, 15349 onFocusAfterTrapped, 15350 onFocusInTrap, 15351 onFocusoutPrevented, 15352 onReleaseRequested 15353 }; 15354 }; 15355 15356 const __default__$1s = vue.defineComponent({ 15357 name: "ElPopperContent" 15358 });
15359 const _sfc_main$25 = /* @__PURE__ */ vue.defineComponent({ 15360 ...__default__$1s, 15361 props: popperContentProps, 15362 emits: popperContentEmits, 15363 setup(__props, { expose, emit }) { 15364 const props = __props; 15365 const { 15366 focusStartRef, 15367 trapped, 15368 onFocusAfterReleased, 15369 onFocusAfterTrapped, 15370 onFocusInTrap, 15371 onFocusoutPrevented, 15372 onReleaseRequested 15373 } = usePopperContentFocusTrap(props, emit); 15374 const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props); 15375 const { 15376 ariaModal, 15377 arrowStyle, 15378 contentAttrs, 15379 contentClass, 15380 contentStyle, 15381 updateZIndex 15382 } = usePopperContentDOM(props, { 15383 styles, 15384 attributes, 15385 role 15386 }); 15387 const formItemContext = vue.inject(formItemContextKey, void 0); 15388 const arrowOffset = vue.ref(); 15389 vue.provide(POPPER_CONTENT_INJECTION_KEY, { 15390 arrowStyle, 15391 arrowRef, 15392 arrowOffset 15393 }); 15394 if (formItemContext && (formItemContext.addInputId || formItemContext.removeInputId)) { 15395 vue.provide(formItemContextKey, { 15396 ...formItemContext, 15397 addInputId: NOOP, 15398 removeInputId: NOOP 15399 }); 15400 } 15401 let triggerTargetAriaStopWatch = void 0; 15402 const updatePopper = (shouldUpdateZIndex = true) => { 15403 update(); 15404 shouldUpdateZIndex && updateZIndex(); 15405 }; 15406 const togglePopperAlive = () => { 15407 updatePopper(false); 15408 if (props.visible && props.focusOnShow) { 15409 trapped.value = true; 15410 } else if (props.visible === false) { 15411 trapped.value = false; 15412 } 15413 }; 15414 vue.onMounted(() => { 15415 vue.watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => { 15416 triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch(); 15417 triggerTargetAriaStopWatch = void 0; 15418 const el = vue.unref(triggerTargetEl || contentRef.value); 15419 const prevEl = vue.unref(prevTriggerTargetEl || contentRef.value); 15420 if (isElement$1(el)) { 15421 triggerTargetAriaStopWatch = vue.watch([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => { 15422 ["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => { 15423 isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]); 15424 }); 15425 }, { immediate: true }); 15426 } 15427 if (prevEl !== el && isElement$1(prevEl)) { 15428 ["role", "aria-label", "aria-modal", "id"].forEach((key) => { 15429 prevEl.removeAttribute(key); 15430 }); 15431 } 15432 }, { immediate: true }); 15433 vue.watch(() => props.visible, togglePopperAlive, { immediate: true }); 15434 }); 15435 vue.onBeforeUnmount(() => { 15436 triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch(); 15437 triggerTargetAriaStopWatch = void 0; 15438 }); 15439 expose({ 15440 popperContentRef: contentRef, 15441 popperInstanceRef: instanceRef, 15442 updatePopper, 15443 contentStyle 15444 }); 15445 return (_ctx, _cache) => { 15446 return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({ 15447 ref_key: "contentRef", 15448 ref: contentRef 15449 }, vue.unref(contentAttrs), { 15450 style: vue.unref(contentStyle), 15451 class: vue.unref(contentClass), 15452 tabindex: "-1", 15453 onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)), 15454 onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e)) 15455 }), [ 15456 vue.createVNode(vue.unref(ElFocusTrap), { 15457 trapped: vue.unref(trapped), 15458 "trap-on-focus-in": true, 15459 "focus-trap-el": vue.unref(contentRef), 15460 "focus-start-el": vue.unref(focusStartRef), 15461 onFocusAfterTrapped: vue.unref(onFocusAfterTrapped), 15462 onFocusAfterReleased: vue.unref(onFocusAfterReleased), 15463 onFocusin: vue.unref(onFocusInTrap), 15464 onFocusoutPrevented: vue.unref(onFocusoutPrevented), 15465 onReleaseRequested: vue.unref(onReleaseRequested) 15466 }, { 15467 default: vue.withCtx(() => [
15468 vue.renderSlot(_ctx.$slots, "default") 15469 ]), 15470 _: 3 15471 }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"]) 15472 ], 16); 15473 }; 15474 } 15475 }); 15476 var ElPopperContent = /* @__PURE__ */ _export_sfc(_sfc_main$25, [["__file", "content.vue"]]); 15477 15478 const ElPopper = withInstall(Popper); 15479 15480 const TOOLTIP_INJECTION_KEY = Symbol("elTooltip"); 15481 15482 const useTooltipContentProps = buildProps({ 15483 ...useDelayedToggleProps, 15484 ...popperContentProps, 15485 appendTo: { 15486 type: definePropType([String, Object]) 15487 }, 15488 content: { 15489 type: String, 15490 default: "" 15491 }, 15492 rawContent: { 15493 type: Boolean, 15494 default: false 15495 }, 15496 persistent: Boolean, 15497 ariaLabel: String, 15498 visible: { 15499 type: definePropType(Boolean), 15500 default: null 15501 }, 15502 transition: String, 15503 teleported: { 15504 type: Boolean, 15505 default: true 15506 }, 15507 disabled: Boolean 15508 }); 15509 15510 const useTooltipTriggerProps = buildProps({ 15511 ...popperTriggerProps, 15512 disabled: Boolean, 15513 trigger: { 15514 type: definePropType([String, Array]), 15515 default: "hover" 15516 }, 15517 triggerKeys: { 15518 type: definePropType(Array), 15519 default: () => [EVENT_CODE.enter, EVENT_CODE.space] 15520 } 15521 }); 15522 15523 const { 15524 useModelToggleProps: useTooltipModelToggleProps, 15525 useModelToggleEmits: useTooltipModelToggleEmits, 15526 useModelToggle: useTooltipModelToggle 15527 } = createModelToggleComposable("visible"); 15528 const useTooltipProps = buildProps({ 15529 ...popperProps, 15530 ...useTooltipModelToggleProps, 15531 ...useTooltipContentProps, 15532 ...useTooltipTriggerProps, 15533 ...popperArrowProps, 15534 showArrow: { 15535 type: Boolean, 15536 default: true 15537 } 15538 }); 15539 const tooltipEmits = [ 15540 ...useTooltipModelToggleEmits, 15541 "before-show", 15542 "before-hide", 15543 "show", 15544 "hide", 15545 "open", 15546 "close" 15547 ]; 15548 15549 const isTriggerType = (trigger, type) => { 15550 if (isArray$1(trigger)) { 15551 return trigger.includes(type); 15552 } 15553 return trigger === type; 15554 }; 15555 const whenTrigger = (trigger, type, handler) => { 15556 return (e) => { 15557 isTriggerType(vue.unref(trigger), type) && handler(e); 15558 }; 15559 }; 15560 15561 const __default__$1r = vue.defineComponent({ 15562 name: "ElTooltipTrigger" 15563 }); 15564 const _sfc_main$24 = /* @__PURE__ */ vue.defineComponent({ 15565 ...__default__$1r, 15566 props: useTooltipTriggerProps, 15567 setup(__props, { expose }) { 15568 const props = __props; 15569 const ns = useNamespace("tooltip"); 15570 const { controlled, id, open, onOpen, onClose, onToggle } = vue.inject(TOOLTIP_INJECTION_KEY, void 0); 15571 const triggerRef = vue.ref(null); 15572 const stopWhenControlledOrDisabled = () => { 15573 if (vue.unref(controlled) || props.disabled) { 15574 return true; 15575 } 15576 }; 15577 const trigger = vue.toRef(props, "trigger"); 15578 const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onOpen)); 15579 const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose)); 15580 const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => { 15581 if (e.button === 0) { 15582 onToggle(e); 15583 } 15584 })); 15585 const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen)); 15586 const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose)); 15587 const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => { 15588 e.preventDefault(); 15589 onToggle(e); 15590 })); 15591 const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => { 15592 const { code } = e; 15593 if (props.triggerKeys.includes(code)) { 15594 e.preventDefault(); 15595 onToggle(e); 15596 } 15597 }); 15598 expose({ 15599 triggerRef 15600 }); 15601 return (_ctx, _cache) => {
15602 return vue.openBlock(), vue.createBlock(vue.unref(ElPopperTrigger), { 15603 id: vue.unref(id), 15604 "virtual-ref": _ctx.virtualRef, 15605 open: vue.unref(open), 15606 "virtual-triggering": _ctx.virtualTriggering, 15607 class: vue.normalizeClass(vue.unref(ns).e("trigger")), 15608 onBlur: vue.unref(onBlur), 15609 onClick: vue.unref(onClick), 15610 onContextmenu: vue.unref(onContextMenu), 15611 onFocus: vue.unref(onFocus), 15612 onMouseenter: vue.unref(onMouseenter), 15613 onMouseleave: vue.unref(onMouseleave), 15614 onKeydown: vue.unref(onKeydown) 15615 }, { 15616 default: vue.withCtx(() => [ 15617 vue.renderSlot(_ctx.$slots, "default") 15618 ]), 15619 _: 3 15620 }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]); 15621 }; 15622 } 15623 }); 15624 var ElTooltipTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$24, [["__file", "trigger.vue"]]); 15625 15626 const __default__$1q = vue.defineComponent({ 15627 name: "ElTooltipContent", 15628 inheritAttrs: false 15629 }); 15630 const _sfc_main$23 = /* @__PURE__ */ vue.defineComponent({ 15631 ...__default__$1q, 15632 props: useTooltipContentProps, 15633 setup(__props, { expose }) { 15634 const props = __props; 15635 const { selector } = usePopperContainerId(); 15636 const ns = useNamespace("tooltip"); 15637 const contentRef = vue.ref(null); 15638 const destroyed = vue.ref(false); 15639 const { 15640 controlled, 15641 id, 15642 open, 15643 trigger, 15644 onClose, 15645 onOpen, 15646 onShow, 15647 onHide, 15648 onBeforeShow, 15649 onBeforeHide 15650 } = vue.inject(TOOLTIP_INJECTION_KEY, void 0); 15651 const transitionClass = vue.computed(() => { 15652 return props.transition || `${ns.namespace.value}-fade-in-linear`; 15653 }); 15654 const persistentRef = vue.computed(() => { 15655 return props.persistent; 15656 }); 15657 vue.onBeforeUnmount(() => { 15658 destroyed.value = true; 15659 }); 15660 const shouldRender = vue.computed(() => { 15661 return vue.unref(persistentRef) ? true : vue.unref(open); 15662 }); 15663 const shouldShow = vue.computed(() => { 15664 return props.disabled ? false : vue.unref(open); 15665 }); 15666 const appendTo = vue.computed(() => { 15667 return props.appendTo || selector.value; 15668 }); 15669 const contentStyle = vue.computed(() => { 15670 var _a; 15671 return (_a = props.style) != null ? _a : {}; 15672 }); 15673 const ariaHidden = vue.computed(() => !vue.unref(open)); 15674 const onTransitionLeave = () => { 15675 onHide(); 15676 }; 15677 const stopWhenControlled = () => { 15678 if (vue.unref(controlled)) 15679 return true; 15680 }; 15681 const onContentEnter = composeEventHandlers(stopWhenControlled, () => { 15682 if (props.enterable && vue.unref(trigger) === "hover") { 15683 onOpen(); 15684 } 15685 }); 15686 const onContentLeave = composeEventHandlers(stopWhenControlled, () => { 15687 if (vue.unref(trigger) === "hover") { 15688 onClose(); 15689 } 15690 }); 15691 const onBeforeEnter = () => { 15692 var _a, _b; 15693 (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a); 15694 onBeforeShow == null ? void 0 : onBeforeShow(); 15695 }; 15696 const onBeforeLeave = () => { 15697 onBeforeHide == null ? void 0 : onBeforeHide(); 15698 }; 15699 const onAfterShow = () => { 15700 onShow(); 15701 stopHandle = onClickOutside(vue.computed(() => { 15702 var _a; 15703 return (_a = contentRef.value) == null ? void 0 : _a.popperContentRef; 15704 }), () => { 15705 if (vue.unref(controlled)) 15706 return; 15707 const $trigger = vue.unref(trigger); 15708 if ($trigger !== "hover") { 15709 onClose(); 15710 } 15711 }); 15712 }; 15713 const onBlur = () => { 15714 if (!props.virtualTriggering) { 15715 onClose(); 15716 } 15717 }; 15718 let stopHandle; 15719 vue.watch(() => vue.unref(open), (val) => { 15720 if (!val) { 15721 stopHandle == null ? void 0 : stopHandle(); 15722 } 15723 }, { 15724 flush: "post" 15725 }); 15726 vue.watch(() => props.content, () => { 15727 var _a, _b; 15728 (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a); 15729 }); 15730 expose({ 15731 contentRef 15732 }); 15733 return (_ctx, _cache) => {
15734 return vue.openBlock(), vue.createBlock(vue.Teleport, { 15735 disabled: !_ctx.teleported, 15736 to: vue.unref(appendTo) 15737 }, [ 15738 vue.createVNode(vue.Transition, { 15739 name: vue.unref(transitionClass), 15740 onAfterLeave: onTransitionLeave, 15741 onBeforeEnter, 15742 onAfterEnter: onAfterShow, 15743 onBeforeLeave 15744 }, { 15745 default: vue.withCtx(() => [ 15746 vue.unref(shouldRender) ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElPopperContent), vue.mergeProps({ 15747 key: 0, 15748 id: vue.unref(id), 15749 ref_key: "contentRef", 15750 ref: contentRef 15751 }, _ctx.$attrs, { 15752 "aria-label": _ctx.ariaLabel, 15753 "aria-hidden": vue.unref(ariaHidden), 15754 "boundaries-padding": _ctx.boundariesPadding, 15755 "fallback-placements": _ctx.fallbackPlacements, 15756 "gpu-acceleration": _ctx.gpuAcceleration, 15757 offset: _ctx.offset, 15758 placement: _ctx.placement, 15759 "popper-options": _ctx.popperOptions, 15760 strategy: _ctx.strategy, 15761 effect: _ctx.effect, 15762 enterable: _ctx.enterable, 15763 pure: _ctx.pure, 15764 "popper-class": _ctx.popperClass, 15765 "popper-style": [_ctx.popperStyle, vue.unref(contentStyle)], 15766 "reference-el": _ctx.referenceEl, 15767 "trigger-target-el": _ctx.triggerTargetEl, 15768 visible: vue.unref(shouldShow), 15769 "z-index": _ctx.zIndex, 15770 onMouseenter: vue.unref(onContentEnter), 15771 onMouseleave: vue.unref(onContentLeave), 15772 onBlur, 15773 onClose: vue.unref(onClose) 15774 }), { 15775 default: vue.withCtx(() => [ 15776 !destroyed.value ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }) : vue.createCommentVNode("v-if", true) 15777 ]), 15778 _: 3 15779 }, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "onMouseenter", "onMouseleave", "onClose"])), [ 15780 [vue.vShow, vue.unref(shouldShow)] 15781 ]) : vue.createCommentVNode("v-if", true) 15782 ]), 15783 _: 3 15784 }, 8, ["name"]) 15785 ], 8, ["disabled", "to"]); 15786 }; 15787 } 15788 }); 15789 var ElTooltipContent = /* @__PURE__ */ _export_sfc(_sfc_main$23, [["__file", "content.vue"]]); 15790 15791 const _hoisted_1$10 = ["innerHTML"]; 15792 const _hoisted_2$F = { key: 1 }; 15793 const __default__$1p = vue.defineComponent({ 15794 name: "ElTooltip" 15795 }); 15796 const _sfc_main$22 = /* @__PURE__ */ vue.defineComponent({ 15797 ...__default__$1p, 15798 props: useTooltipProps, 15799 emits: tooltipEmits, 15800 setup(__props, { expose, emit }) { 15801 const props = __props; 15802 usePopperContainer(); 15803 const id = useId(); 15804 const popperRef = vue.ref(); 15805 const contentRef = vue.ref(); 15806 const updatePopper = () => { 15807 var _a; 15808 const popperComponent = vue.unref(popperRef); 15809 if (popperComponent) { 15810 (_a = popperComponent.popperInstanceRef) == null ? void 0 : _a.update(); 15811 } 15812 }; 15813 const open = vue.ref(false); 15814 const toggleReason = vue.ref(); 15815 const { show, hide, hasUpdateHandler } = useTooltipModelToggle({ 15816 indicator: open, 15817 toggleReason 15818 }); 15819 const { onOpen, onClose } = useDelayedToggle({ 15820 showAfter: vue.toRef(props, "showAfter"), 15821 hideAfter: vue.toRef(props, "hideAfter"), 15822 autoClose: vue.toRef(props, "autoClose"), 15823 open: show, 15824 close: hide 15825 }); 15826 const controlled = vue.computed(() => isBoolean(props.visible) && !hasUpdateHandler.value); 15827 vue.provide(TOOLTIP_INJECTION_KEY, { 15828 controlled, 15829 id, 15830 open: vue.readonly(open), 15831 trigger: vue.toRef(props, "trigger"), 15832 onOpen: (event) => { 15833 onOpen(event); 15834 }, 15835 onClose: (event) => { 15836 onClose(event); 15837 }, 15838 onToggle: (event) => { 15839 if (vue.unref(open)) { 15840 onClose(event); 15841 } else { 15842 onOpen(event); 15843 } 15844 }, 15845 onShow: () => { 15846 emit("show", toggleReason.value); 15847 }, 15848 onHide: () => { 15849 emit("hide", toggleReason.value); 15850 }, 15851 onBeforeShow: () => { 15852 emit("before-show", toggleReason.value); 15853 }, 15854 onBeforeHide: () => { 15855 emit("before-hide", toggleReason.value); 15856 }, 15857 updatePopper 15858 }); 15859 vue.watch(() => props.disabled, (disabled) => { 15860 if (disabled && open.value) { 15861 open.value = false; 15862 } 15863 }); 15864 const isFocusInsideContent = () => { 15865 var _a, _b; 15866 const popperContent = (_b = (_a = contentRef.value) == null ? void 0 : _a.contentRef) == null ? void 0 : _b.popperContentRef; 15867 return popperContent && popperContent.contains(document.activeElement); 15868 }; 15869 vue.onDeactivated(() => open.value && hide()); 15870 expose({ 15871 popperRef, 15872 contentRef, 15873 isFocusInsideContent, 15874 updatePopper, 15875 onOpen, 15876 onClose, 15877 hide 15878 }); 15879 return (_ctx, _cache) => {
15880 return vue.openBlock(), vue.createBlock(vue.unref(ElPopper), { 15881 ref_key: "popperRef", 15882 ref: popperRef, 15883 role: _ctx.role 15884 }, { 15885 default: vue.withCtx(() => [ 15886 vue.createVNode(ElTooltipTrigger, { 15887 disabled: _ctx.disabled, 15888 trigger: _ctx.trigger, 15889 "trigger-keys": _ctx.triggerKeys, 15890 "virtual-ref": _ctx.virtualRef, 15891 "virtual-triggering": _ctx.virtualTriggering 15892 }, { 15893 default: vue.withCtx(() => [ 15894 _ctx.$slots.default ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }) : vue.createCommentVNode("v-if", true) 15895 ]), 15896 _: 3 15897 }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]), 15898 vue.createVNode(ElTooltipContent, { 15899 ref_key: "contentRef", 15900 ref: contentRef, 15901 "aria-label": _ctx.ariaLabel, 15902 "boundaries-padding": _ctx.boundariesPadding, 15903 content: _ctx.content, 15904 disabled: _ctx.disabled, 15905 effect: _ctx.effect, 15906 enterable: _ctx.enterable, 15907 "fallback-placements": _ctx.fallbackPlacements, 15908 "hide-after": _ctx.hideAfter, 15909 "gpu-acceleration": _ctx.gpuAcceleration, 15910 offset: _ctx.offset, 15911 persistent: _ctx.persistent, 15912 "popper-class": _ctx.popperClass, 15913 "popper-style": _ctx.popperStyle, 15914 placement: _ctx.placement, 15915 "popper-options": _ctx.popperOptions, 15916 pure: _ctx.pure, 15917 "raw-content": _ctx.rawContent, 15918 "reference-el": _ctx.referenceEl, 15919 "trigger-target-el": _ctx.triggerTargetEl, 15920 "show-after": _ctx.showAfter, 15921 strategy: _ctx.strategy, 15922 teleported: _ctx.teleported, 15923 transition: _ctx.transition, 15924 "virtual-triggering": _ctx.virtualTriggering, 15925 "z-index": _ctx.zIndex, 15926 "append-to": _ctx.appendTo 15927 }, { 15928 default: vue.withCtx(() => [ 15929 vue.renderSlot(_ctx.$slots, "content", {}, () => [ 15930 _ctx.rawContent ? (vue.openBlock(), vue.createElementBlock("span", { 15931 key: 0, 15932 innerHTML: _ctx.content 15933 }, null, 8, _hoisted_1$10)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$F, vue.toDisplayString(_ctx.content), 1)) 15934 ]), 15935 _ctx.showArrow ? (vue.openBlock(), vue.createBlock(vue.unref(ElPopperArrow), { 15936 key: 0, 15937 "arrow-offset": _ctx.arrowOffset 15938 }, null, 8, ["arrow-offset"])) : vue.createCommentVNode("v-if", true) 15939 ]), 15940 _: 3 15941 }, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to"]) 15942 ]), 15943 _: 3 15944 }, 8, ["role"]); 15945 }; 15946 } 15947 }); 15948 var Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$22, [["__file", "tooltip.vue"]]); 15949 15950 const ElTooltip = withInstall(Tooltip); 15951 15952 const autocompleteProps = buildProps({ 15953 valueKey: { 15954 type: String, 15955 default: "value" 15956 }, 15957 modelValue: { 15958 type: [String, Number], 15959 default: "" 15960 }, 15961 debounce: { 15962 type: Number, 15963 default: 300 15964 }, 15965 placement: { 15966 type: definePropType(String), 15967 values: [ 15968 "top", 15969 "top-start", 15970 "top-end", 15971 "bottom", 15972 "bottom-start", 15973 "bottom-end" 15974 ], 15975 default: "bottom-start" 15976 }, 15977 fetchSuggestions: { 15978 type: definePropType([Function, Array]), 15979 default: NOOP 15980 }, 15981 popperClass: { 15982 type: String, 15983 default: "" 15984 }, 15985 triggerOnFocus: { 15986 type: Boolean, 15987 default: true 15988 }, 15989 selectWhenUnmatched: { 15990 type: Boolean, 15991 default: false 15992 }, 15993 hideLoading: { 15994 type: Boolean, 15995 default: false 15996 }, 15997 label: { 15998 type: String 15999 }, 16000 teleported: useTooltipContentProps.teleported, 16001 highlightFirstItem: { 16002 type: Boolean, 16003 default: false 16004 }, 16005 fitInputWidth: { 16006 type: Boolean, 16007 default: false 16008 }, 16009 clearable: { 16010 type: Boolean, 16011 default: false 16012 }, 16013 disabled: { 16014 type: Boolean, 16015 default: false 16016 }, 16017 name: String 16018 });
16019 const autocompleteEmits = { 16020 [UPDATE_MODEL_EVENT]: (value) => isString$1(value), 16021 [INPUT_EVENT]: (value) => isString$1(value), 16022 [CHANGE_EVENT]: (value) => isString$1(value), 16023 focus: (evt) => evt instanceof FocusEvent, 16024 blur: (evt) => evt instanceof FocusEvent, 16025 clear: () => true, 16026 select: (item) => isObject$1(item) 16027 }; 16028 16029 const _hoisted_1$$ = ["aria-expanded", "aria-owns"]; 16030 const _hoisted_2$E = { key: 0 }; 16031 const _hoisted_3$k = ["id", "aria-selected", "onClick"]; 16032 const COMPONENT_NAME$i = "ElAutocomplete"; 16033 const __default__$1o = vue.defineComponent({ 16034 name: COMPONENT_NAME$i, 16035 inheritAttrs: false 16036 }); 16037 const _sfc_main$21 = /* @__PURE__ */ vue.defineComponent({ 16038 ...__default__$1o, 16039 props: autocompleteProps, 16040 emits: autocompleteEmits, 16041 setup(__props, { expose, emit }) { 16042 const props = __props; 16043 const attrs = useAttrs(); 16044 const rawAttrs = vue.useAttrs(); 16045 const disabled = useFormDisabled(); 16046 const ns = useNamespace("autocomplete"); 16047 const inputRef = vue.ref(); 16048 const regionRef = vue.ref(); 16049 const popperRef = vue.ref(); 16050 const listboxRef = vue.ref(); 16051 let readonly = false; 16052 let ignoreFocusEvent = false; 16053 const suggestions = vue.ref([]); 16054 const highlightedIndex = vue.ref(-1); 16055 const dropdownWidth = vue.ref(""); 16056 const activated = vue.ref(false); 16057 const suggestionDisabled = vue.ref(false); 16058 const loading = vue.ref(false); 16059 const listboxId = vue.computed(() => ns.b(String(generateId()))); 16060 const styles = vue.computed(() => rawAttrs.style); 16061 const suggestionVisible = vue.computed(() => { 16062 const isValidData = suggestions.value.length > 0; 16063 return (isValidData || loading.value) && activated.value; 16064 }); 16065 const suggestionLoading = vue.computed(() => !props.hideLoading && loading.value); 16066 const refInput = vue.computed(() => { 16067 if (inputRef.value) { 16068 return Array.from(inputRef.value.$el.querySelectorAll("input")); 16069 } 16070 return []; 16071 }); 16072 const onSuggestionShow = async () => { 16073 await vue.nextTick(); 16074 if (suggestionVisible.value) { 16075 dropdownWidth.value = `${inputRef.value.$el.offsetWidth}px`; 16076 } 16077 }; 16078 const onHide = () => { 16079 highlightedIndex.value = -1; 16080 }; 16081 const getData = async (queryString) => { 16082 if (suggestionDisabled.value) 16083 return; 16084 const cb = (suggestionList) => { 16085 loading.value = false; 16086 if (suggestionDisabled.value) 16087 return; 16088 if (isArray$1(suggestionList)) { 16089 suggestions.value = suggestionList; 16090 highlightedIndex.value = props.highlightFirstItem ? 0 : -1; 16091 } else { 16092 throwError(COMPONENT_NAME$i, "autocomplete suggestions must be an array"); 16093 } 16094 }; 16095 loading.value = true; 16096 if (isArray$1(props.fetchSuggestions)) { 16097 cb(props.fetchSuggestions); 16098 } else { 16099 const result = await props.fetchSuggestions(queryString, cb); 16100 if (isArray$1(result)) 16101 cb(result); 16102 } 16103 }; 16104 const debouncedGetData = debounce(getData, props.debounce); 16105 const handleInput = (value) => { 16106 const valuePresented = !!value; 16107 emit(INPUT_EVENT, value); 16108 emit(UPDATE_MODEL_EVENT, value); 16109 suggestionDisabled.value = false; 16110 activated.value || (activated.value = valuePresented); 16111 if (!props.triggerOnFocus && !value) { 16112 suggestionDisabled.value = true; 16113 suggestions.value = []; 16114 return; 16115 } 16116 debouncedGetData(value); 16117 }; 16118 const handleMouseDown = (event) => { 16119 var _a; 16120 if (disabled.value) 16121 return; 16122 if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) { 16123 activated.value = true; 16124 } 16125 }; 16126 const handleChange = (value) => { 16127 emit(CHANGE_EVENT, value); 16128 }; 16129 const handleFocus = (evt) => { 16130 if (!ignoreFocusEvent) { 16131 activated.value = true; 16132 emit("focus", evt); 16133 if (props.triggerOnFocus && !readonly) { 16134 debouncedGetData(String(props.modelValue)); 16135 } 16136 } else { 16137 ignoreFocusEvent = false; 16138 } 16139 }; 16140 const handleBlur = (evt) => { 16141 setTimeout(() => { 16142 var _a; 16143 if ((_a = popperRef.value) == null ? void 0 : _a.isFocusInsideContent()) { 16144 ignoreFocusEvent = true; 16145 return; 16146 } 16147 activated.value && close(); 16148 emit("blur", evt); 16149 }); 16150 }; 16151 const handleClear = () => { 16152 activated.value = false; 16153 emit(UPDATE_MODEL_EVENT, ""); 16154 emit("clear"); 16155 }; 16156 const handleKeyEnter = async () => { 16157 if (suggestionVisible.value && highlightedIndex.value >= 0 && highlightedIndex.value < suggestions.value.length) { 16158 handleSelect(suggestions.value[highlightedIndex.value]); 16159 } else if (props.selectWhenUnmatched) { 16160 emit("select", { value: props.modelValue });
16161 suggestions.value = []; 16162 highlightedIndex.value = -1; 16163 } 16164 }; 16165 const handleKeyEscape = (evt) => { 16166 if (suggestionVisible.value) { 16167 evt.preventDefault(); 16168 evt.stopPropagation(); 16169 close(); 16170 } 16171 }; 16172 const close = () => { 16173 activated.value = false; 16174 }; 16175 const focus = () => { 16176 var _a; 16177 (_a = inputRef.value) == null ? void 0 : _a.focus(); 16178 }; 16179 const blur = () => { 16180 var _a; 16181 (_a = inputRef.value) == null ? void 0 : _a.blur(); 16182 }; 16183 const handleSelect = async (item) => { 16184 emit(INPUT_EVENT, item[props.valueKey]); 16185 emit(UPDATE_MODEL_EVENT, item[props.valueKey]); 16186 emit("select", item); 16187 suggestions.value = []; 16188 highlightedIndex.value = -1; 16189 }; 16190 const highlight = (index) => { 16191 if (!suggestionVisible.value || loading.value) 16192 return; 16193 if (index < 0) { 16194 highlightedIndex.value = -1; 16195 return; 16196 } 16197 if (index >= suggestions.value.length) { 16198 index = suggestions.value.length - 1; 16199 } 16200 const suggestion = regionRef.value.querySelector(`.${ns.be("suggestion", "wrap")}`); 16201 const suggestionList = suggestion.querySelectorAll(`.${ns.be("suggestion", "list")} li`); 16202 const highlightItem = suggestionList[index]; 16203 const scrollTop = suggestion.scrollTop; 16204 const { offsetTop, scrollHeight } = highlightItem; 16205 if (offsetTop + scrollHeight > scrollTop + suggestion.clientHeight) { 16206 suggestion.scrollTop += scrollHeight; 16207 } 16208 if (offsetTop < scrollTop) { 16209 suggestion.scrollTop -= scrollHeight; 16210 } 16211 highlightedIndex.value = index; 16212 inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`); 16213 }; 16214 onClickOutside(listboxRef, () => { 16215 suggestionVisible.value && close(); 16216 }); 16217 vue.onMounted(() => { 16218 inputRef.value.ref.setAttribute("role", "textbox"); 16219 inputRef.value.ref.setAttribute("aria-autocomplete", "list"); 16220 inputRef.value.ref.setAttribute("aria-controls", "id"); 16221 inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`); 16222 readonly = inputRef.value.ref.hasAttribute("readonly"); 16223 }); 16224 expose({ 16225 highlightedIndex, 16226 activated, 16227 loading, 16228 inputRef, 16229 popperRef, 16230 suggestions, 16231 handleSelect, 16232 handleKeyEnter, 16233 focus, 16234 blur, 16235 close, 16236 highlight 16237 }); 16238 return (_ctx, _cache) => { 16239 return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), { 16240 ref_key: "popperRef", 16241 ref: popperRef, 16242 visible: vue.unref(suggestionVisible), 16243 placement: _ctx.placement, 16244 "fallback-placements": ["bottom-start", "top-start"], 16245 "popper-class": [vue.unref(ns).e("popper"), _ctx.popperClass], 16246 teleported: _ctx.teleported, 16247 "gpu-acceleration": false, 16248 pure: "", 16249 "manual-mode": "", 16250 effect: "light", 16251 trigger: "click", 16252 transition: `${vue.unref(ns).namespace.value}-zoom-in-top`, 16253 persistent: "", 16254 onBeforeShow: onSuggestionShow, 16255 onHide 16256 }, { 16257 content: vue.withCtx(() => [ 16258 vue.createElementVNode("div", { 16259 ref_key: "regionRef", 16260 ref: regionRef, 16261 class: vue.normalizeClass([vue.unref(ns).b("suggestion"), vue.unref(ns).is("loading", vue.unref(suggestionLoading))]), 16262 style: vue.normalizeStyle({ 16263 [_ctx.fitInputWidth ? "width" : "minWidth"]: dropdownWidth.value, 16264 outline: "none" 16265 }),
16266 role: "region" 16267 }, [ 16268 vue.createVNode(vue.unref(ElScrollbar), { 16269 id: vue.unref(listboxId), 16270 tag: "ul", 16271 "wrap-class": vue.unref(ns).be("suggestion", "wrap"), 16272 "view-class": vue.unref(ns).be("suggestion", "list"), 16273 role: "listbox" 16274 }, { 16275 default: vue.withCtx(() => [ 16276 vue.unref(suggestionLoading) ? (vue.openBlock(), vue.createElementBlock("li", _hoisted_2$E, [ 16277 vue.createVNode(vue.unref(ElIcon), { 16278 class: vue.normalizeClass(vue.unref(ns).is("loading")) 16279 }, { 16280 default: vue.withCtx(() => [ 16281 vue.createVNode(vue.unref(loading_default)) 16282 ]), 16283 _: 1 16284 }, 8, ["class"]) 16285 ])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(suggestions.value, (item, index) => { 16286 return vue.openBlock(), vue.createElementBlock("li", { 16287 id: `${vue.unref(listboxId)}-item-${index}`, 16288 key: index, 16289 class: vue.normalizeClass({ highlighted: highlightedIndex.value === index }), 16290 role: "option", 16291 "aria-selected": highlightedIndex.value === index, 16292 onClick: ($event) => handleSelect(item) 16293 }, [ 16294 vue.renderSlot(_ctx.$slots, "default", { item }, () => [ 16295 vue.createTextVNode(vue.toDisplayString(item[_ctx.valueKey]), 1) 16296 ]) 16297 ], 10, _hoisted_3$k); 16298 }), 128)) 16299 ]), 16300 _: 3 16301 }, 8, ["id", "wrap-class", "view-class"]) 16302 ], 6) 16303 ]), 16304 default: vue.withCtx(() => [ 16305 vue.createElementVNode("div", { 16306 ref_key: "listboxRef", 16307 ref: listboxRef, 16308 class: vue.normalizeClass([vue.unref(ns).b(), _ctx.$attrs.class]), 16309 style: vue.normalizeStyle(vue.unref(styles)), 16310 role: "combobox", 16311 "aria-haspopup": "listbox", 16312 "aria-expanded": vue.unref(suggestionVisible), 16313 "aria-owns": vue.unref(listboxId) 16314 }, [ 16315 vue.createVNode(vue.unref(ElInput), vue.mergeProps({ 16316 ref_key: "inputRef", 16317 ref: inputRef 16318 }, vue.unref(attrs), { 16319 clearable: _ctx.clearable, 16320 disabled: vue.unref(disabled), 16321 name: _ctx.name, 16322 "model-value": _ctx.modelValue, 16323 onInput: handleInput, 16324 onChange: handleChange, 16325 onFocus: handleFocus, 16326 onBlur: handleBlur, 16327 onClear: handleClear, 16328 onKeydown: [ 16329 _cache[0] || (_cache[0] = vue.withKeys(vue.withModifiers(($event) => highlight(highlightedIndex.value - 1), ["prevent"]), ["up"])), 16330 _cache[1] || (_cache[1] = vue.withKeys(vue.withModifiers(($event) => highlight(highlightedIndex.value + 1), ["prevent"]), ["down"])), 16331 vue.withKeys(handleKeyEnter, ["enter"]), 16332 vue.withKeys(close, ["tab"]), 16333 vue.withKeys(handleKeyEscape, ["esc"]) 16334 ], 16335 onMousedown: handleMouseDown 16336 }), vue.createSlots({ _: 2 }, [ 16337 _ctx.$slots.prepend ? { 16338 name: "prepend", 16339 fn: vue.withCtx(() => [ 16340 vue.renderSlot(_ctx.$slots, "prepend") 16341 ]) 16342 } : void 0, 16343 _ctx.$slots.append ? { 16344 name: "append", 16345 fn: vue.withCtx(() => [
16346 vue.renderSlot(_ctx.$slots, "append") 16347 ]) 16348 } : void 0, 16349 _ctx.$slots.prefix ? { 16350 name: "prefix", 16351 fn: vue.withCtx(() => [ 16352 vue.renderSlot(_ctx.$slots, "prefix") 16353 ]) 16354 } : void 0, 16355 _ctx.$slots.suffix ? { 16356 name: "suffix", 16357 fn: vue.withCtx(() => [ 16358 vue.renderSlot(_ctx.$slots, "suffix") 16359 ]) 16360 } : void 0 16361 ]), 1040, ["clearable", "disabled", "name", "model-value", "onKeydown"]) 16362 ], 14, _hoisted_1$$) 16363 ]), 16364 _: 3 16365 }, 8, ["visible", "placement", "popper-class", "teleported", "transition"]); 16366 }; 16367 } 16368 }); 16369 var Autocomplete = /* @__PURE__ */ _export_sfc(_sfc_main$21, [["__file", "autocomplete.vue"]]); 16370 16371 const ElAutocomplete = withInstall(Autocomplete); 16372 16373 const avatarProps = buildProps({ 16374 size: { 16375 type: [Number, String], 16376 values: componentSizes, 16377 default: "", 16378 validator: (val) => isNumber(val) 16379 }, 16380 shape: { 16381 type: String, 16382 values: ["circle", "square"], 16383 default: "circle" 16384 }, 16385 icon: { 16386 type: iconPropType 16387 }, 16388 src: { 16389 type: String, 16390 default: "" 16391 }, 16392 alt: String, 16393 srcSet: String, 16394 fit: { 16395 type: definePropType(String), 16396 default: "cover" 16397 } 16398 }); 16399 const avatarEmits = { 16400 error: (evt) => evt instanceof Event 16401 }; 16402 16403 const _hoisted_1$_ = ["src", "alt", "srcset"]; 16404 const __default__$1n = vue.defineComponent({ 16405 name: "ElAvatar" 16406 }); 16407 const _sfc_main$20 = /* @__PURE__ */ vue.defineComponent({ 16408 ...__default__$1n, 16409 props: avatarProps, 16410 emits: avatarEmits, 16411 setup(__props, { emit }) { 16412 const props = __props; 16413 const ns = useNamespace("avatar"); 16414 const hasLoadError = vue.ref(false); 16415 const avatarClass = vue.computed(() => { 16416 const { size, icon, shape } = props; 16417 const classList = [ns.b()]; 16418 if (isString$1(size)) 16419 classList.push(ns.m(size)); 16420 if (icon) 16421 classList.push(ns.m("icon")); 16422 if (shape) 16423 classList.push(ns.m(shape)); 16424 return classList; 16425 }); 16426 const sizeStyle = vue.computed(() => { 16427 const { size } = props; 16428 return isNumber(size) ? ns.cssVarBlock({ 16429 size: addUnit(size) || "" 16430 }) : void 0; 16431 }); 16432 const fitStyle = vue.computed(() => ({ 16433 objectFit: props.fit 16434 })); 16435 vue.watch(() => props.src, () => hasLoadError.value = false); 16436 function handleError(e) { 16437 hasLoadError.value = true; 16438 emit("error", e); 16439 } 16440 return (_ctx, _cache) => { 16441 return vue.openBlock(), vue.createElementBlock("span", { 16442 class: vue.normalizeClass(vue.unref(avatarClass)), 16443 style: vue.normalizeStyle(vue.unref(sizeStyle)) 16444 }, [ 16445 (_ctx.src || _ctx.srcSet) && !hasLoadError.value ? (vue.openBlock(), vue.createElementBlock("img", { 16446 key: 0, 16447 src: _ctx.src, 16448 alt: _ctx.alt, 16449 srcset: _ctx.srcSet, 16450 style: vue.normalizeStyle(vue.unref(fitStyle)), 16451 onError: handleError 16452 }, null, 44, _hoisted_1$_)) : _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, { 16453 default: vue.withCtx(() => [ 16454 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon))) 16455 ]), 16456 _: 1 16457 })) : vue.renderSlot(_ctx.$slots, "default", { key: 2 }) 16458 ], 6); 16459 }; 16460 } 16461 }); 16462 var Avatar = /* @__PURE__ */ _export_sfc(_sfc_main$20, [["__file", "avatar.vue"]]); 16463 16464 const ElAvatar = withInstall(Avatar); 16465 16466 const backtopProps = { 16467 visibilityHeight: { 16468 type: Number, 16469 default: 200 16470 }, 16471 target: { 16472 type: String, 16473 default: "" 16474 }, 16475 right: { 16476 type: Number, 16477 default: 40 16478 }, 16479 bottom: { 16480 type: Number, 16481 default: 40 16482 } 16483 }; 16484 const backtopEmits = { 16485 click: (evt) => evt instanceof MouseEvent 16486 }; 16487 16488 const useBackTop = (props, emit, componentName) => { 16489 const el = vue.shallowRef(); 16490 const container = vue.shallowRef(); 16491 const visible = vue.ref(false); 16492 const handleScroll = () => { 16493 if (el.value) 16494 visible.value = el.value.scrollTop >= props.visibilityHeight; 16495 }; 16496 const handleClick = (event) => { 16497 var _a; 16498 (_a = el.value) == null ? void 0 : _a.scrollTo({ top: 0, behavior: "smooth" }); 16499 emit("click", event); 16500 }; 16501 const handleScrollThrottled = useThrottleFn(handleScroll, 300, true); 16502 useEventListener(container, "scroll", handleScrollThrottled); 16503 vue.onMounted(() => { 16504 var _a; 16505 container.value = document; 16506 el.value = document.documentElement; 16507 if (props.target) { 16508 el.value = (_a = document.querySelector(props.target)) != null ? _a : void 0; 16509 if (!el.value) { 16510 throwError(componentName, `target does not exist: ${props.target}`); 16511 } 16512 container.value = el.value; 16513 } 16514 }); 16515 return { 16516 visible, 16517 handleClick 16518 }; 16519 }; 16520 16521 const COMPONENT_NAME$h = "ElBacktop"; 16522 const __default__$1m = vue.defineComponent({ 16523 name: COMPONENT_NAME$h 16524 });
16525 const _sfc_main$1$ = /* @__PURE__ */ vue.defineComponent({ 16526 ...__default__$1m, 16527 props: backtopProps, 16528 emits: backtopEmits, 16529 setup(__props, { emit }) { 16530 const props = __props; 16531 const ns = useNamespace("backtop"); 16532 const { handleClick, visible } = useBackTop(props, emit, COMPONENT_NAME$h); 16533 const backTopStyle = vue.computed(() => ({ 16534 right: `${props.right}px`, 16535 bottom: `${props.bottom}px` 16536 })); 16537 return (_ctx, _cache) => { 16538 return vue.openBlock(), vue.createBlock(vue.Transition, { 16539 name: `${vue.unref(ns).namespace.value}-fade-in` 16540 }, { 16541 default: vue.withCtx(() => [ 16542 vue.unref(visible) ? (vue.openBlock(), vue.createElementBlock("div", { 16543 key: 0, 16544 style: vue.normalizeStyle(vue.unref(backTopStyle)), 16545 class: vue.normalizeClass(vue.unref(ns).b()), 16546 onClick: _cache[0] || (_cache[0] = vue.withModifiers((...args) => vue.unref(handleClick) && vue.unref(handleClick)(...args), ["stop"])) 16547 }, [ 16548 vue.renderSlot(_ctx.$slots, "default", {}, () => [ 16549 vue.createVNode(vue.unref(ElIcon), { 16550 class: vue.normalizeClass(vue.unref(ns).e("icon")) 16551 }, { 16552 default: vue.withCtx(() => [ 16553 vue.createVNode(vue.unref(caret_top_default)) 16554 ]), 16555 _: 1 16556 }, 8, ["class"]) 16557 ]) 16558 ], 6)) : vue.createCommentVNode("v-if", true) 16559 ]), 16560 _: 3 16561 }, 8, ["name"]); 16562 }; 16563 } 16564 }); 16565 var Backtop = /* @__PURE__ */ _export_sfc(_sfc_main$1$, [["__file", "backtop.vue"]]); 16566 16567 const ElBacktop = withInstall(Backtop); 16568 16569 const badgeProps = buildProps({ 16570 value: { 16571 type: [String, Number], 16572 default: "" 16573 }, 16574 max: { 16575 type: Number, 16576 default: 99 16577 }, 16578 isDot: Boolean, 16579 hidden: Boolean, 16580 type: { 16581 type: String, 16582 values: ["primary", "success", "warning", "info", "danger"], 16583 default: "danger" 16584 } 16585 }); 16586 16587 const _hoisted_1$Z = ["textContent"]; 16588 const __default__$1l = vue.defineComponent({ 16589 name: "ElBadge" 16590 }); 16591 const _sfc_main$1_ = /* @__PURE__ */ vue.defineComponent({ 16592 ...__default__$1l, 16593 props: badgeProps, 16594 setup(__props, { expose }) { 16595 const props = __props; 16596 const ns = useNamespace("badge"); 16597 const content = vue.computed(() => { 16598 if (props.isDot) 16599 return ""; 16600 if (isNumber(props.value) && isNumber(props.max)) { 16601 return props.max < props.value ? `${props.max}+` : `${props.value}`; 16602 } 16603 return `${props.value}`; 16604 }); 16605 expose({ 16606 content 16607 }); 16608 return (_ctx, _cache) => { 16609 return vue.openBlock(), vue.createElementBlock("div", { 16610 class: vue.normalizeClass(vue.unref(ns).b()) 16611 }, [ 16612 vue.renderSlot(_ctx.$slots, "default"), 16613 vue.createVNode(vue.Transition, { 16614 name: `${vue.unref(ns).namespace.value}-zoom-in-center`, 16615 persisted: "" 16616 }, { 16617 default: vue.withCtx(() => [ 16618 vue.withDirectives(vue.createElementVNode("sup", { 16619 class: vue.normalizeClass([ 16620 vue.unref(ns).e("content"), 16621 vue.unref(ns).em("content", _ctx.type), 16622 vue.unref(ns).is("fixed", !!_ctx.$slots.default), 16623 vue.unref(ns).is("dot", _ctx.isDot) 16624 ]), 16625 textContent: vue.toDisplayString(vue.unref(content)) 16626 }, null, 10, _hoisted_1$Z), [ 16627 [vue.vShow, !_ctx.hidden && (vue.unref(content) || _ctx.isDot)] 16628 ]) 16629 ]), 16630 _: 1 16631 }, 8, ["name"]) 16632 ], 2); 16633 }; 16634 } 16635 });
16636 var Badge = /* @__PURE__ */ _export_sfc(_sfc_main$1_, [["__file", "badge.vue"]]); 16637 16638 const ElBadge = withInstall(Badge); 16639 16640 const breadcrumbKey = Symbol("breadcrumbKey"); 16641 16642 const breadcrumbProps = buildProps({ 16643 separator: { 16644 type: String, 16645 default: "/" 16646 }, 16647 separatorIcon: { 16648 type: iconPropType 16649 } 16650 }); 16651 16652 const __default__$1k = vue.defineComponent({ 16653 name: "ElBreadcrumb" 16654 }); 16655 const _sfc_main$1Z = /* @__PURE__ */ vue.defineComponent({ 16656 ...__default__$1k, 16657 props: breadcrumbProps, 16658 setup(__props) { 16659 const props = __props; 16660 const ns = useNamespace("breadcrumb"); 16661 const breadcrumb = vue.ref(); 16662 vue.provide(breadcrumbKey, props); 16663 vue.onMounted(() => { 16664 const items = breadcrumb.value.querySelectorAll(`.${ns.e("item")}`); 16665 if (items.length) { 16666 items[items.length - 1].setAttribute("aria-current", "page"); 16667 } 16668 }); 16669 return (_ctx, _cache) => { 16670 return vue.openBlock(), vue.createElementBlock("div", { 16671 ref_key: "breadcrumb", 16672 ref: breadcrumb, 16673 class: vue.normalizeClass(vue.unref(ns).b()), 16674 "aria-label": "Breadcrumb", 16675 role: "navigation" 16676 }, [ 16677 vue.renderSlot(_ctx.$slots, "default") 16678 ], 2); 16679 }; 16680 } 16681 }); 16682 var Breadcrumb = /* @__PURE__ */ _export_sfc(_sfc_main$1Z, [["__file", "breadcrumb.vue"]]); 16683 16684 const breadcrumbItemProps = buildProps({ 16685 to: { 16686 type: definePropType([String, Object]), 16687 default: "" 16688 }, 16689 replace: { 16690 type: Boolean, 16691 default: false 16692 } 16693 }); 16694 16695 const __default__$1j = vue.defineComponent({ 16696 name: "ElBreadcrumbItem" 16697 }); 16698 const _sfc_main$1Y = /* @__PURE__ */ vue.defineComponent({ 16699 ...__default__$1j, 16700 props: breadcrumbItemProps, 16701 setup(__props) { 16702 const props = __props; 16703 const instance = vue.getCurrentInstance(); 16704 const breadcrumbContext = vue.inject(breadcrumbKey, void 0); 16705 const ns = useNamespace("breadcrumb"); 16706 const { separator, separatorIcon } = vue.toRefs(breadcrumbContext); 16707 const router = instance.appContext.config.globalProperties.$router; 16708 const link = vue.ref(); 16709 const onClick = () => { 16710 if (!props.to || !router) 16711 return; 16712 props.replace ? router.replace(props.to) : router.push(props.to); 16713 }; 16714 return (_ctx, _cache) => { 16715 return vue.openBlock(), vue.createElementBlock("span", { 16716 class: vue.normalizeClass(vue.unref(ns).e("item")) 16717 }, [ 16718 vue.createElementVNode("span", { 16719 ref_key: "link", 16720 ref: link, 16721 class: vue.normalizeClass([vue.unref(ns).e("inner"), vue.unref(ns).is("link", !!_ctx.to)]), 16722 role: "link", 16723 onClick 16724 }, [ 16725 vue.renderSlot(_ctx.$slots, "default") 16726 ], 2), 16727 vue.unref(separatorIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 16728 key: 0, 16729 class: vue.normalizeClass(vue.unref(ns).e("separator")) 16730 }, { 16731 default: vue.withCtx(() => [ 16732 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(separatorIcon)))) 16733 ]), 16734 _: 1 16735 }, 8, ["class"])) : (vue.openBlock(), vue.createElementBlock("span", { 16736 key: 1, 16737 class: vue.normalizeClass(vue.unref(ns).e("separator")), 16738 role: "presentation" 16739 }, vue.toDisplayString(vue.unref(separator)), 3)) 16740 ], 2); 16741 }; 16742 } 16743 }); 16744 var BreadcrumbItem = /* @__PURE__ */ _export_sfc(_sfc_main$1Y, [["__file", "breadcrumb-item.vue"]]); 16745 16746 const ElBreadcrumb = withInstall(Breadcrumb, { 16747 BreadcrumbItem 16748 }); 16749 const ElBreadcrumbItem = withNoopInstall(BreadcrumbItem); 16750 16751 const buttonGroupContextKey = Symbol("buttonGroupContextKey"); 16752 16753 const useButton = (props, emit) => { 16754 useDeprecated({ 16755 from: "type.text", 16756 replacement: "link", 16757 version: "3.0.0", 16758 scope: "props", 16759 ref: "https://element-plus.org/en-US/component/button.html#button-attributes" 16760 }, vue.computed(() => props.type === "text")); 16761 const buttonGroupContext = vue.inject(buttonGroupContextKey, void 0); 16762 const globalConfig = useGlobalConfig("button"); 16763 const { form } = useFormItem(); 16764 const _size = useFormSize(vue.computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size)); 16765 const _disabled = useFormDisabled(); 16766 const _ref = vue.ref(); 16767 const slots = vue.useSlots();
16768 const _type = vue.computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || ""); 16769 const autoInsertSpace = vue.computed(() => { 16770 var _a, _b, _c; 16771 return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.autoInsertSpace) != null ? _c : false; 16772 }); 16773 const _props = vue.computed(() => { 16774 if (props.tag === "button") { 16775 return { 16776 ariaDisabled: _disabled.value || props.loading, 16777 disabled: _disabled.value || props.loading, 16778 autofocus: props.autofocus, 16779 type: props.nativeType 16780 }; 16781 } 16782 return {}; 16783 }); 16784 const shouldAddSpace = vue.computed(() => { 16785 var _a; 16786 const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots); 16787 if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) { 16788 const slot = defaultSlot[0]; 16789 if ((slot == null ? void 0 : slot.type) === vue.Text) { 16790 const text = slot.children; 16791 return /^\p{Unified_Ideograph}{2}$/u.test(text.trim()); 16792 } 16793 } 16794 return false; 16795 }); 16796 const handleClick = (evt) => { 16797 if (props.nativeType === "reset") { 16798 form == null ? void 0 : form.resetFields(); 16799 } 16800 emit("click", evt); 16801 }; 16802 return { 16803 _disabled, 16804 _size, 16805 _type, 16806 _ref, 16807 _props, 16808 shouldAddSpace, 16809 handleClick 16810 }; 16811 }; 16812 16813 const buttonTypes = [ 16814 "default", 16815 "primary", 16816 "success", 16817 "warning", 16818 "info", 16819 "danger", 16820 "text", 16821 "" 16822 ]; 16823 const buttonNativeTypes = ["button", "submit", "reset"]; 16824 const buttonProps = buildProps({ 16825 size: useSizeProp, 16826 disabled: Boolean, 16827 type: { 16828 type: String, 16829 values: buttonTypes, 16830 default: "" 16831 }, 16832 icon: { 16833 type: iconPropType 16834 }, 16835 nativeType: { 16836 type: String, 16837 values: buttonNativeTypes, 16838 default: "button" 16839 }, 16840 loading: Boolean, 16841 loadingIcon: { 16842 type: iconPropType, 16843 default: () => loading_default 16844 }, 16845 plain: Boolean, 16846 text: Boolean, 16847 link: Boolean, 16848 bg: Boolean, 16849 autofocus: Boolean, 16850 round: Boolean, 16851 circle: Boolean, 16852 color: String, 16853 dark: Boolean, 16854 autoInsertSpace: { 16855 type: Boolean, 16856 default: void 0 16857 }, 16858 tag: { 16859 type: definePropType([String, Object]), 16860 default: "button" 16861 } 16862 }); 16863 const buttonEmits = { 16864 click: (evt) => evt instanceof MouseEvent 16865 }; 16866 16867 function bound01$1(n, max) { 16868 if (isOnePointZero$1(n)) { 16869 n = "100%"; 16870 } 16871 var isPercent = isPercentage$1(n); 16872 n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n))); 16873 if (isPercent) { 16874 n = parseInt(String(n * max), 10) / 100; 16875 } 16876 if (Math.abs(n - max) < 1e-6) { 16877 return 1; 16878 } 16879 if (max === 360) { 16880 n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max)); 16881 } else { 16882 n = n % max / parseFloat(String(max)); 16883 } 16884 return n; 16885 } 16886 function clamp01(val) { 16887 return Math.min(1, Math.max(0, val)); 16888 } 16889 function isOnePointZero$1(n) { 16890 return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1; 16891 } 16892 function isPercentage$1(n) { 16893 return typeof n === "string" && n.indexOf("%") !== -1; 16894 } 16895 function boundAlpha(a) { 16896 a = parseFloat(a); 16897 if (isNaN(a) || a < 0 || a > 1) { 16898 a = 1; 16899 } 16900 return a; 16901 } 16902 function convertToPercentage(n) { 16903 if (n <= 1) { 16904 return "".concat(Number(n) * 100, "%"); 16905 } 16906 return n; 16907 } 16908 function pad2(c) { 16909 return c.length === 1 ? "0" + c : String(c); 16910 } 16911 16912 function rgbToRgb(r, g, b) { 16913 return { 16914 r: bound01$1(r, 255) * 255, 16915 g: bound01$1(g, 255) * 255, 16916 b: bound01$1(b, 255) * 255 16917 }; 16918 } 16919 function rgbToHsl(r, g, b) { 16920 r = bound01$1(r, 255); 16921 g = bound01$1(g, 255); 16922 b = bound01$1(b, 255); 16923 var max = Math.max(r, g, b); 16924 var min = Math.min(r, g, b); 16925 var h = 0; 16926 var s = 0; 16927 var l = (max + min) / 2; 16928 if (max === min) { 16929 s = 0; 16930 h = 0; 16931 } else { 16932 var d = max - min; 16933 s = l > 0.5 ? d / (2 - max - min) : d / (max + min); 16934 switch (max) { 16935 case r: 16936 h = (g - b) / d + (g < b ? 6 : 0); 16937 break; 16938 case g: 16939 h = (b - r) / d + 2; 16940 break; 16941 case b: 16942 h = (r - g) / d + 4; 16943 break; 16944 } 16945 h /= 6; 16946 } 16947 return { h, s, l }; 16948 } 16949 function hue2rgb(p, q, t) { 16950 if (t < 0) { 16951 t += 1; 16952 } 16953 if (t > 1) { 16954 t -= 1; 16955 } 16956 if (t < 1 / 6) { 16957 return p + (q - p) * (6 * t); 16958 } 16959 if (t < 1 / 2) { 16960 return q; 16961 } 16962 if (t < 2 / 3) { 16963 return p + (q - p) * (2 / 3 - t) * 6; 16964 } 16965 return p; 16966 } 16967 function hslToRgb(h, s, l) { 16968 var r; 16969 var g; 16970 var b; 16971 h = bound01$1(h, 360); 16972 s = bound01$1(s, 100); 16973 l = bound01$1(l, 100); 16974 if (s === 0) { 16975 g = l; 16976 b = l; 16977 r = l; 16978 } else { 16979 var q = l < 0.5 ? l * (1 + s) : l + s - l * s; 16980 var p = 2 * l - q; 16981 r = hue2rgb(p, q, h + 1 / 3); 16982 g = hue2rgb(p, q, h); 16983 b = hue2rgb(p, q, h - 1 / 3); 16984 } 16985 return { r: r * 255, g: g * 255, b: b * 255 }; 16986 } 16987 function rgbToHsv(r, g, b) { 16988 r = bound01$1(r, 255); 16989 g = bound01$1(g, 255); 16990 b = bound01$1(b, 255); 16991 var max = Math.max(r, g, b); 16992 var min = Math.min(r, g, b); 16993 var h = 0; 16994 var v = max; 16995 var d = max - min; 16996 var s = max === 0 ? 0 : d / max; 16997 if (max === min) { 16998 h = 0; 16999 } else { 17000 switch (max) { 17001 case r: 17002 h = (g - b) / d + (g < b ? 6 : 0); 17003 break; 17004 case g: 17005 h = (b - r) / d + 2; 17006 break; 17007 case b: 17008 h = (r - g) / d + 4; 17009 break; 17010 } 17011 h /= 6; 17012 } 17013 return { h, s, v }; 17014 } 17015 function hsvToRgb(h, s, v) { 17016 h = bound01$1(h, 360) * 6;
17017 s = bound01$1(s, 100); 17018 v = bound01$1(v, 100); 17019 var i = Math.floor(h); 17020 var f = h - i; 17021 var p = v * (1 - s); 17022 var q = v * (1 - f * s); 17023 var t = v * (1 - (1 - f) * s); 17024 var mod = i % 6; 17025 var r = [v, q, p, p, t, v][mod]; 17026 var g = [t, v, v, q, p, p][mod]; 17027 var b = [p, p, t, v, v, q][mod]; 17028 return { r: r * 255, g: g * 255, b: b * 255 }; 17029 } 17030 function rgbToHex(r, g, b, allow3Char) { 17031 var hex = [ 17032 pad2(Math.round(r).toString(16)), 17033 pad2(Math.round(g).toString(16)), 17034 pad2(Math.round(b).toString(16)) 17035 ]; 17036 if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) { 17037 return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); 17038 } 17039 return hex.join(""); 17040 } 17041 function rgbaToHex(r, g, b, a, allow4Char) { 17042 var hex = [ 17043 pad2(Math.round(r).toString(16)), 17044 pad2(Math.round(g).toString(16)), 17045 pad2(Math.round(b).toString(16)), 17046 pad2(convertDecimalToHex(a)) 17047 ]; 17048 if (allow4Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1)) && hex[3].startsWith(hex[3].charAt(1))) { 17049 return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); 17050 } 17051 return hex.join(""); 17052 } 17053 function convertDecimalToHex(d) { 17054 return Math.round(parseFloat(d) * 255).toString(16); 17055 } 17056 function convertHexToDecimal(h) { 17057 return parseIntFromHex(h) / 255; 17058 } 17059 function parseIntFromHex(val) { 17060 return parseInt(val, 16); 17061 } 17062 function numberInputToObject(color) { 17063 return { 17064 r: color >> 16, 17065 g: (color & 65280) >> 8, 17066 b: color & 255 17067 }; 17068 } 17069 17070 var names = { 17071 aliceblue: "#f0f8ff", 17072 antiquewhite: "#faebd7", 17073 aqua: "#00ffff", 17074 aquamarine: "#7fffd4", 17075 azure: "#f0ffff", 17076 beige: "#f5f5dc", 17077 bisque: "#ffe4c4", 17078 black: "#000000", 17079 blanchedalmond: "#ffebcd", 17080 blue: "#0000ff", 17081 blueviolet: "#8a2be2", 17082 brown: "#a52a2a", 17083 burlywood: "#deb887", 17084 cadetblue: "#5f9ea0", 17085 chartreuse: "#7fff00", 17086 chocolate: "#d2691e", 17087 coral: "#ff7f50", 17088 cornflowerblue: "#6495ed", 17089 cornsilk: "#fff8dc", 17090 crimson: "#dc143c", 17091 cyan: "#00ffff", 17092 darkblue: "#00008b", 17093 darkcyan: "#008b8b", 17094 darkgoldenrod: "#b8860b", 17095 darkgray: "#a9a9a9", 17096 darkgreen: "#006400", 17097 darkgrey: "#a9a9a9", 17098 darkkhaki: "#bdb76b", 17099 darkmagenta: "#8b008b", 17100 darkolivegreen: "#556b2f", 17101 darkorange: "#ff8c00", 17102 darkorchid: "#9932cc", 17103 darkred: "#8b0000", 17104 darksalmon: "#e9967a", 17105 darkseagreen: "#8fbc8f", 17106 darkslateblue: "#483d8b", 17107 darkslategray: "#2f4f4f", 17108 darkslategrey: "#2f4f4f", 17109 darkturquoise: "#00ced1", 17110 darkviolet: "#9400d3", 17111 deeppink: "#ff1493", 17112 deepskyblue: "#00bfff", 17113 dimgray: "#696969", 17114 dimgrey: "#696969", 17115 dodgerblue: "#1e90ff", 17116 firebrick: "#b22222", 17117 floralwhite: "#fffaf0", 17118 forestgreen: "#228b22", 17119 fuchsia: "#ff00ff", 17120 gainsboro: "#dcdcdc", 17121 ghostwhite: "#f8f8ff", 17122 goldenrod: "#daa520", 17123 gold: "#ffd700", 17124 gray: "#808080", 17125 green: "#008000", 17126 greenyellow: "#adff2f", 17127 grey: "#808080", 17128 honeydew: "#f0fff0", 17129 hotpink: "#ff69b4", 17130 indianred: "#cd5c5c", 17131 indigo: "#4b0082", 17132 ivory: "#fffff0", 17133 khaki: "#f0e68c", 17134 lavenderblush: "#fff0f5", 17135 lavender: "#e6e6fa", 17136 lawngreen: "#7cfc00", 17137 lemonchiffon: "#fffacd", 17138 lightblue: "#add8e6", 17139 lightcoral: "#f08080", 17140 lightcyan: "#e0ffff", 17141 lightgoldenrodyellow: "#fafad2", 17142 lightgray: "#d3d3d3", 17143 lightgreen: "#90ee90", 17144 lightgrey: "#d3d3d3", 17145 lightpink: "#ffb6c1", 17146 lightsalmon: "#ffa07a", 17147 lightseagreen: "#20b2aa", 17148 lightskyblue: "#87cefa", 17149 lightslategray: "#778899",
17150 lightslategrey: "#778899", 17151 lightsteelblue: "#b0c4de", 17152 lightyellow: "#ffffe0", 17153 lime: "#00ff00", 17154 limegreen: "#32cd32", 17155 linen: "#faf0e6", 17156 magenta: "#ff00ff", 17157 maroon: "#800000", 17158 mediumaquamarine: "#66cdaa", 17159 mediumblue: "#0000cd", 17160 mediumorchid: "#ba55d3", 17161 mediumpurple: "#9370db", 17162 mediumseagreen: "#3cb371", 17163 mediumslateblue: "#7b68ee", 17164 mediumspringgreen: "#00fa9a", 17165 mediumturquoise: "#48d1cc", 17166 mediumvioletred: "#c71585", 17167 midnightblue: "#191970", 17168 mintcream: "#f5fffa", 17169 mistyrose: "#ffe4e1", 17170 moccasin: "#ffe4b5", 17171 navajowhite: "#ffdead", 17172 navy: "#000080", 17173 oldlace: "#fdf5e6", 17174 olive: "#808000", 17175 olivedrab: "#6b8e23", 17176 orange: "#ffa500", 17177 orangered: "#ff4500", 17178 orchid: "#da70d6", 17179 palegoldenrod: "#eee8aa", 17180 palegreen: "#98fb98", 17181 paleturquoise: "#afeeee", 17182 palevioletred: "#db7093", 17183 papayawhip: "#ffefd5", 17184 peachpuff: "#ffdab9", 17185 peru: "#cd853f", 17186 pink: "#ffc0cb", 17187 plum: "#dda0dd", 17188 powderblue: "#b0e0e6", 17189 purple: "#800080", 17190 rebeccapurple: "#663399", 17191 red: "#ff0000", 17192 rosybrown: "#bc8f8f", 17193 royalblue: "#4169e1", 17194 saddlebrown: "#8b4513", 17195 salmon: "#fa8072", 17196 sandybrown: "#f4a460", 17197 seagreen: "#2e8b57", 17198 seashell: "#fff5ee", 17199 sienna: "#a0522d", 17200 silver: "#c0c0c0", 17201 skyblue: "#87ceeb", 17202 slateblue: "#6a5acd", 17203 slategray: "#708090", 17204 slategrey: "#708090", 17205 snow: "#fffafa", 17206 springgreen: "#00ff7f", 17207 steelblue: "#4682b4", 17208 tan: "#d2b48c", 17209 teal: "#008080", 17210 thistle: "#d8bfd8", 17211 tomato: "#ff6347", 17212 turquoise: "#40e0d0", 17213 violet: "#ee82ee", 17214 wheat: "#f5deb3", 17215 white: "#ffffff", 17216 whitesmoke: "#f5f5f5", 17217 yellow: "#ffff00", 17218 yellowgreen: "#9acd32" 17219 }; 17220 17221 function inputToRGB(color) { 17222 var rgb = { r: 0, g: 0, b: 0 }; 17223 var a = 1; 17224 var s = null; 17225 var v = null; 17226 var l = null; 17227 var ok = false; 17228 var format = false; 17229 if (typeof color === "string") { 17230 color = stringInputToObject(color); 17231 } 17232 if (typeof color === "object") { 17233 if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { 17234 rgb = rgbToRgb(color.r, color.g, color.b); 17235 ok = true; 17236 format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; 17237 } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { 17238 s = convertToPercentage(color.s); 17239 v = convertToPercentage(color.v); 17240 rgb = hsvToRgb(color.h, s, v); 17241 ok = true; 17242 format = "hsv"; 17243 } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { 17244 s = convertToPercentage(color.s); 17245 l = convertToPercentage(color.l); 17246 rgb = hslToRgb(color.h, s, l); 17247 ok = true; 17248 format = "hsl"; 17249 } 17250 if (Object.prototype.hasOwnProperty.call(color, "a")) { 17251 a = color.a; 17252 } 17253 } 17254 a = boundAlpha(a); 17255 return { 17256 ok, 17257 format: color.format || format, 17258 r: Math.min(255, Math.max(rgb.r, 0)), 17259 g: Math.min(255, Math.max(rgb.g, 0)), 17260 b: Math.min(255, Math.max(rgb.b, 0)), 17261 a 17262 }; 17263 } 17264 var CSS_INTEGER = "[-\\+]?\\d+%?"; 17265 var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; 17266 var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")"); 17267 var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?"); 17268 var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?"); 17269 var matchers = { 17270 CSS_UNIT: new RegExp(CSS_UNIT), 17271 rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), 17272 rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), 17273 hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), 17274 hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), 17275 hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), 17276 hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), 17277 hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, 17278 hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, 17279 hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, 17280 hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ 17281 }; 17282 function stringInputToObject(color) { 17283 color = color.trim().toLowerCase(); 17284 if (color.length === 0) { 17285 return false; 17286 } 17287 var named = false; 17288 if (names[color]) { 17289 color = names[color]; 17290 named = true; 17291 } else if (color === "transparent") { 17292 return { r: 0, g: 0, b: 0, a: 0, format: "name" }; 17293 } 17294 var match = matchers.rgb.exec(color); 17295 if (match) { 17296 return { r: match[1], g: match[2], b: match[3] }; 17297 } 17298 match = matchers.rgba.exec(color); 17299 if (match) { 17300 return { r: match[1], g: match[2], b: match[3], a: match[4] }; 17301 } 17302 match = matchers.hsl.exec(color); 17303 if (match) { 17304 return { h: match[1], s: match[2], l: match[3] }; 17305 } 17306 match = matchers.hsla.exec(color); 17307 if (match) { 17308 return { h: match[1], s: match[2], l: match[3], a: match[4] }; 17309 } 17310 match = matchers.hsv.exec(color); 17311 if (match) { 17312 return { h: match[1], s: match[2], v: match[3] }; 17313 } 17314 match = matchers.hsva.exec(color); 17315 if (match) { 17316 return { h: match[1], s: match[2], v: match[3], a: match[4] }; 17317 } 17318 match = matchers.hex8.exec(color); 17319 if (match) { 17320 return { 17321 r: parseIntFromHex(match[1]), 17322 g: parseIntFromHex(match[2]), 17323 b: parseIntFromHex(match[3]), 17324 a: convertHexToDecimal(match[4]), 17325 format: named ? "name" : "hex8" 17326 }; 17327 } 17328 match = matchers.hex6.exec(color); 17329 if (match) { 17330 return { 17331 r: parseIntFromHex(match[1]), 17332 g: parseIntFromHex(match[2]), 17333 b: parseIntFromHex(match[3]), 17334 format: named ? "name" : "hex" 17335 }; 17336 } 17337 match = matchers.hex4.exec(color); 17338 if (match) { 17339 return { 17340 r: parseIntFromHex(match[1] + match[1]), 17341 g: parseIntFromHex(match[2] + match[2]), 17342 b: parseIntFromHex(match[3] + match[3]), 17343 a: convertHexToDecimal(match[4] + match[4]), 17344 format: named ? "name" : "hex8" 17345 }; 17346 } 17347 match = matchers.hex3.exec(color); 17348 if (match) { 17349 return { 17350 r: parseIntFromHex(match[1] + match[1]), 17351 g: parseIntFromHex(match[2] + match[2]), 17352 b: parseIntFromHex(match[3] + match[3]), 17353 format: named ? "name" : "hex" 17354 }; 17355 } 17356 return false; 17357 } 17358 function isValidCSSUnit(color) { 17359 return Boolean(matchers.CSS_UNIT.exec(String(color))); 17360 } 17361 17362 var TinyColor = function() { 17363 function TinyColor2(color, opts) { 17364 if (color === void 0) { 17365 color = ""; 17366 } 17367 if (opts === void 0) { 17368 opts = {}; 17369 } 17370 var _a; 17371 if (color instanceof TinyColor2) { 17372 return color; 17373 } 17374 if (typeof color === "number") { 17375 color = numberInputToObject(color); 17376 } 17377 this.originalInput = color; 17378 var rgb = inputToRGB(color); 17379 this.originalInput = color; 17380 this.r = rgb.r; 17381 this.g = rgb.g; 17382 this.b = rgb.b; 17383 this.a = rgb.a; 17384 this.roundA = Math.round(100 * this.a) / 100; 17385 this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format; 17386 this.gradientType = opts.gradientType; 17387 if (this.r < 1) { 17388 this.r = Math.round(this.r); 17389 } 17390 if (this.g < 1) { 17391 this.g = Math.round(this.g); 17392 } 17393 if (this.b < 1) { 17394 this.b = Math.round(this.b); 17395 } 17396 this.isValid = rgb.ok; 17397 } 17398 TinyColor2.prototype.isDark = function() { 17399 return this.getBrightness() < 128; 17400 }; 17401 TinyColor2.prototype.isLight = function() { 17402 return !this.isDark(); 17403 }; 17404 TinyColor2.prototype.getBrightness = function() { 17405 var rgb = this.toRgb(); 17406 return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3; 17407 }; 17408 TinyColor2.prototype.getLuminance = function() { 17409 var rgb = this.toRgb(); 17410 var R; 17411 var G; 17412 var B; 17413 var RsRGB = rgb.r / 255; 17414 var GsRGB = rgb.g / 255; 17415 var BsRGB = rgb.b / 255; 17416 if (RsRGB <= 0.03928) { 17417 R = RsRGB / 12.92; 17418 } else { 17419 R = Math.pow((RsRGB + 0.055) / 1.055, 2.4); 17420 } 17421 if (GsRGB <= 0.03928) { 17422 G = GsRGB / 12.92; 17423 } else { 17424 G = Math.pow((GsRGB + 0.055) / 1.055, 2.4); 17425 } 17426 if (BsRGB <= 0.03928) { 17427 B = BsRGB / 12.92; 17428 } else { 17429 B = Math.pow((BsRGB + 0.055) / 1.055, 2.4); 17430 } 17431 return 0.2126 * R + 0.7152 * G + 0.0722 * B; 17432 }; 17433 TinyColor2.prototype.getAlpha = function() { 17434 return this.a; 17435 }; 17436 TinyColor2.prototype.setAlpha = function(alpha) { 17437 this.a = boundAlpha(alpha); 17438 this.roundA = Math.round(100 * this.a) / 100; 17439 return this; 17440 }; 17441 TinyColor2.prototype.toHsv = function() { 17442 var hsv = rgbToHsv(this.r, this.g, this.b); 17443 return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a }; 17444 }; 17445 TinyColor2.prototype.toHsvString = function() { 17446 var hsv = rgbToHsv(this.r, this.g, this.b); 17447 var h = Math.round(hsv.h * 360); 17448 var s = Math.round(hsv.s * 100); 17449 var v = Math.round(hsv.v * 100); 17450 return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")"); 17451 }; 17452 TinyColor2.prototype.toHsl = function() { 17453 var hsl = rgbToHsl(this.r, this.g, this.b); 17454 return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a }; 17455 }; 17456 TinyColor2.prototype.toHslString = function() { 17457 var hsl = rgbToHsl(this.r, this.g, this.b); 17458 var h = Math.round(hsl.h * 360); 17459 var s = Math.round(hsl.s * 100); 17460 var l = Math.round(hsl.l * 100); 17461 return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")"); 17462 }; 17463 TinyColor2.prototype.toHex = function(allow3Char) { 17464 if (allow3Char === void 0) { 17465 allow3Char = false; 17466 } 17467 return rgbToHex(this.r, this.g, this.b, allow3Char); 17468 }; 17469 TinyColor2.prototype.toHexString = function(allow3Char) { 17470 if (allow3Char === void 0) { 17471 allow3Char = false; 17472 } 17473 return "#" + this.toHex(allow3Char); 17474 }; 17475 TinyColor2.prototype.toHex8 = function(allow4Char) { 17476 if (allow4Char === void 0) { 17477 allow4Char = false; 17478 } 17479 return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char); 17480 }; 17481 TinyColor2.prototype.toHex8String = function(allow4Char) { 17482 if (allow4Char === void 0) { 17483 allow4Char = false; 17484 } 17485 return "#" + this.toHex8(allow4Char); 17486 }; 17487 TinyColor2.prototype.toRgb = function() { 17488 return { 17489 r: Math.round(this.r), 17490 g: Math.round(this.g), 17491 b: Math.round(this.b), 17492 a: this.a 17493 }; 17494 }; 17495 TinyColor2.prototype.toRgbString = function() { 17496 var r = Math.round(this.r); 17497 var g = Math.round(this.g); 17498 var b = Math.round(this.b); 17499 return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")"); 17500 }; 17501 TinyColor2.prototype.toPercentageRgb = function() { 17502 var fmt = function(x) { 17503 return "".concat(Math.round(bound01$1(x, 255) * 100), "%"); 17504 }; 17505 return { 17506 r: fmt(this.r), 17507 g: fmt(this.g), 17508 b: fmt(this.b), 17509 a: this.a 17510 }; 17511 }; 17512 TinyColor2.prototype.toPercentageRgbString = function() { 17513 var rnd = function(x) { 17514 return Math.round(bound01$1(x, 255) * 100); 17515 }; 17516 return this.a === 1 ? "rgb(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%)") : "rgba(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%, ").concat(this.roundA, ")"); 17517 }; 17518 TinyColor2.prototype.toName = function() { 17519 if (this.a === 0) { 17520 return "transparent"; 17521 } 17522 if (this.a < 1) { 17523 return false; 17524 } 17525 var hex = "#" + rgbToHex(this.r, this.g, this.b, false); 17526 for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) { 17527 var _b = _a[_i], key = _b[0], value = _b[1]; 17528 if (hex === value) { 17529 return key; 17530 } 17531 } 17532 return false; 17533 }; 17534 TinyColor2.prototype.toString = function(format) { 17535 var formatSet = Boolean(format); 17536 format = format !== null && format !== void 0 ? format : this.format; 17537 var formattedString = false; 17538 var hasAlpha = this.a < 1 && this.a >= 0; 17539 var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name"); 17540 if (needsAlphaFormat) { 17541 if (format === "name" && this.a === 0) { 17542 return this.toName(); 17543 } 17544 return this.toRgbString(); 17545 } 17546 if (format === "rgb") { 17547 formattedString = this.toRgbString(); 17548 } 17549 if (format === "prgb") { 17550 formattedString = this.toPercentageRgbString(); 17551 } 17552 if (format === "hex" || format === "hex6") { 17553 formattedString = this.toHexString(); 17554 } 17555 if (format === "hex3") { 17556 formattedString = this.toHexString(true); 17557 } 17558 if (format === "hex4") { 17559 formattedString = this.toHex8String(true); 17560 } 17561 if (format === "hex8") { 17562 formattedString = this.toHex8String(); 17563 } 17564 if (format === "name") { 17565 formattedString = this.toName(); 17566 } 17567 if (format === "hsl") { 17568 formattedString = this.toHslString(); 17569 } 17570 if (format === "hsv") { 17571 formattedString = this.toHsvString(); 17572 } 17573 return formattedString || this.toHexString(); 17574 }; 17575 TinyColor2.prototype.toNumber = function() { 17576 return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b); 17577 }; 17578 TinyColor2.prototype.clone = function() { 17579 return new TinyColor2(this.toString()); 17580 }; 17581 TinyColor2.prototype.lighten = function(amount) { 17582 if (amount === void 0) { 17583 amount = 10; 17584 } 17585 var hsl = this.toHsl(); 17586 hsl.l += amount / 100; 17587 hsl.l = clamp01(hsl.l); 17588 return new TinyColor2(hsl); 17589 }; 17590 TinyColor2.prototype.brighten = function(amount) { 17591 if (amount === void 0) { 17592 amount = 10; 17593 } 17594 var rgb = this.toRgb(); 17595 rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100)))); 17596 rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100)))); 17597 rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100)))); 17598 return new TinyColor2(rgb); 17599 }; 17600 TinyColor2.prototype.darken = function(amount) { 17601 if (amount === void 0) { 17602 amount = 10; 17603 } 17604 var hsl = this.toHsl(); 17605 hsl.l -= amount / 100; 17606 hsl.l = clamp01(hsl.l); 17607 return new TinyColor2(hsl); 17608 }; 17609 TinyColor2.prototype.tint = function(amount) { 17610 if (amount === void 0) { 17611
17611 amount = 10; 17612 } 17613 return this.mix("white", amount); 17614 }; 17615 TinyColor2.prototype.shade = function(amount) { 17616 if (amount === void 0) { 17617 amount = 10; 17618 } 17619 return this.mix("black", amount); 17620 }; 17621 TinyColor2.prototype.desaturate = function(amount) { 17622 if (amount === void 0) { 17623 amount = 10; 17624 } 17625 var hsl = this.toHsl(); 17626 hsl.s -= amount / 100; 17627 hsl.s = clamp01(hsl.s); 17628 return new TinyColor2(hsl); 17629 }; 17630 TinyColor2.prototype.saturate = function(amount) { 17631 if (amount === void 0) { 17632 amount = 10; 17633 } 17634 var hsl = this.toHsl(); 17635 hsl.s += amount / 100; 17636 hsl.s = clamp01(hsl.s); 17637 return new TinyColor2(hsl); 17638 }; 17639 TinyColor2.prototype.greyscale = function() { 17640 return this.desaturate(100); 17641 }; 17642 TinyColor2.prototype.spin = function(amount) { 17643 var hsl = this.toHsl(); 17644 var hue = (hsl.h + amount) % 360; 17645 hsl.h = hue < 0 ? 360 + hue : hue; 17646 return new TinyColor2(hsl); 17647 }; 17648 TinyColor2.prototype.mix = function(color, amount) { 17649 if (amount === void 0) { 17650 amount = 50; 17651 } 17652 var rgb1 = this.toRgb(); 17653 var rgb2 = new TinyColor2(color).toRgb(); 17654 var p = amount / 100; 17655 var rgba = { 17656 r: (rgb2.r - rgb1.r) * p + rgb1.r, 17657 g: (rgb2.g - rgb1.g) * p + rgb1.g, 17658 b: (rgb2.b - rgb1.b) * p + rgb1.b, 17659 a: (rgb2.a - rgb1.a) * p + rgb1.a 17660 }; 17661 return new TinyColor2(rgba); 17662 }; 17663 TinyColor2.prototype.analogous = function(results, slices) { 17664 if (results === void 0) { 17665 results = 6; 17666 } 17667 if (slices === void 0) { 17668 slices = 30; 17669 } 17670 var hsl = this.toHsl(); 17671 var part = 360 / slices; 17672 var ret = [this]; 17673 for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) { 17674 hsl.h = (hsl.h + part) % 360; 17675 ret.push(new TinyColor2(hsl)); 17676 } 17677 return ret; 17678 }; 17679 TinyColor2.prototype.complement = function() { 17680 var hsl = this.toHsl(); 17681 hsl.h = (hsl.h + 180) % 360; 17682 return new TinyColor2(hsl); 17683 }; 17684 TinyColor2.prototype.monochromatic = function(results) { 17685 if (results === void 0) { 17686 results = 6; 17687 } 17688 var hsv = this.toHsv(); 17689 var h = hsv.h; 17690 var s = hsv.s; 17691 var v = hsv.v; 17692 var res = []; 17693 var modification = 1 / results; 17694 while (results--) { 17695 res.push(new TinyColor2({ h, s, v })); 17696 v = (v + modification) % 1; 17697 } 17698 return res; 17699 }; 17700 TinyColor2.prototype.splitcomplement = function() { 17701 var hsl = this.toHsl(); 17702 var h = hsl.h; 17703 return [ 17704 this, 17705 new TinyColor2({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }), 17706 new TinyColor2({ h: (h + 216) % 360, s: hsl.s, l: hsl.l }) 17707 ]; 17708 }; 17709 TinyColor2.prototype.onBackground = function(background) { 17710 var fg = this.toRgb(); 17711 var bg = new TinyColor2(background).toRgb(); 17712 return new TinyColor2({ 17713 r: bg.r + (fg.r - bg.r) * fg.a, 17714 g: bg.g + (fg.g - bg.g) * fg.a, 17715 b: bg.b + (fg.b - bg.b) * fg.a 17716 }); 17717 }; 17718 TinyColor2.prototype.triad = function() { 17719 return this.polyad(3); 17720 }; 17721 TinyColor2.prototype.tetrad = function() { 17722 return this.polyad(4); 17723 }; 17724 TinyColor2.prototype.polyad = function(n) { 17725 var hsl = this.toHsl(); 17726 var h = hsl.h; 17727 var result = [this]; 17728 var increment = 360 / n; 17729 for (var i = 1; i < n; i++) { 17730 result.push(new TinyColor2({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l })); 17731 } 17732 return result; 17733 }; 17734 TinyColor2.prototype.equals = function(color) { 17735 return this.toRgbString() === new TinyColor2(color).toRgbString(); 17736 }; 17737 return TinyColor2; 17738 }(); 17739 17740 function darken(color, amount = 20) { 17741 return color.mix("#141414", amount).toString(); 17742 } 17743 function useButtonCustomStyle(props) { 17744 const _disabled = useFormDisabled(); 17745 const ns = useNamespace("button"); 17746 return vue.computed(() => { 17747 let styles = {}; 17748 const buttonColor = props.color; 17749 if (buttonColor) { 17750 const color = new TinyColor(buttonColor); 17751 const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20); 17752 if (props.plain) { 17753 styles = ns.cssVarBlock({ 17754 "bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(), 17755 "text-color": buttonColor, 17756 "border-color": props.dark ? darken(color, 50) : color.tint(50).toString(), 17757 "hover-text-color": `var(${ns.cssVarName("color-white")})`, 17758 "hover-bg-color": buttonColor, 17759 "hover-border-color": buttonColor, 17760 "active-bg-color": activeBgColor, 17761 "active-text-color": `var(${ns.cssVarName("color-white")})`, 17762 "active-border-color": activeBgColor 17763 }); 17764 if (_disabled.value) { 17765 styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString(); 17766 styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString(); 17767 styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString(); 17768 } 17769 } else { 17770 const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString(); 17771 const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`; 17772 styles = ns.cssVarBlock({ 17773 "bg-color": buttonColor, 17774 "text-color": textColor, 17775 "border-color": buttonColor, 17776 "hover-bg-color": hoverBgColor, 17777 "hover-text-color": textColor, 17778 "hover-border-color": hoverBgColor, 17779 "active-bg-color": activeBgColor, 17780 "active-border-color": activeBgColor 17781 }); 17782 if (_disabled.value) { 17783 const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString(); 17784 styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor; 17785 styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`; 17786 styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor; 17787 } 17788 } 17789 } 17790 return styles; 17791 }); 17792 } 17793 17794 const __default__$1i = vue.defineComponent({ 17795 name: "ElButton" 17796 });
17797 const _sfc_main$1X = /* @__PURE__ */ vue.defineComponent({ 17798 ...__default__$1i, 17799 props: buttonProps, 17800 emits: buttonEmits, 17801 setup(__props, { expose, emit }) { 17802 const props = __props; 17803 const buttonStyle = useButtonCustomStyle(props); 17804 const ns = useNamespace("button"); 17805 const { _ref, _size, _type, _disabled, _props, shouldAddSpace, handleClick } = useButton(props, emit); 17806 expose({ 17807 ref: _ref, 17808 size: _size, 17809 type: _type, 17810 disabled: _disabled, 17811 shouldAddSpace 17812 }); 17813 return (_ctx, _cache) => { 17814 return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), vue.mergeProps({ 17815 ref_key: "_ref", 17816 ref: _ref 17817 }, vue.unref(_props), { 17818 class: [ 17819 vue.unref(ns).b(), 17820 vue.unref(ns).m(vue.unref(_type)), 17821 vue.unref(ns).m(vue.unref(_size)), 17822 vue.unref(ns).is("disabled", vue.unref(_disabled)), 17823 vue.unref(ns).is("loading", _ctx.loading), 17824 vue.unref(ns).is("plain", _ctx.plain),
vendor: 11,313 bytes, lines 17825-18057
17825 vue.unref(ns).is("round", _ctx.round), 17826 vue.unref(ns).is("circle", _ctx.circle), 17827 vue.unref(ns).is("text", _ctx.text), 17828 vue.unref(ns).is("link", _ctx.link), 17829 vue.unref(ns).is("has-bg", _ctx.bg) 17830 ], 17831 style: vue.unref(buttonStyle), 17832 onClick: vue.unref(handleClick) 17833 }), { 17834 default: vue.withCtx(() => [ 17835 _ctx.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ 17836 _ctx.$slots.loading ? vue.renderSlot(_ctx.$slots, "loading", { key: 0 }) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 17837 key: 1, 17838 class: vue.normalizeClass(vue.unref(ns).is("loading")) 17839 }, { 17840 default: vue.withCtx(() => [ 17841 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.loadingIcon))) 17842 ]), 17843 _: 1 17844 }, 8, ["class"])) 17845 ], 64)) : _ctx.icon || _ctx.$slots.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, { 17846 default: vue.withCtx(() => [ 17847 _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon), { key: 0 })) : vue.renderSlot(_ctx.$slots, "icon", { key: 1 }) 17848 ]), 17849 _: 3 17850 })) : vue.createCommentVNode("v-if", true), 17851 _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", { 17852 key: 2, 17853 class: vue.normalizeClass({ [vue.unref(ns).em("text", "expand")]: vue.unref(shouldAddSpace) }) 17854 }, [ 17855 vue.renderSlot(_ctx.$slots, "default") 17856 ], 2)) : vue.createCommentVNode("v-if", true) 17857 ]), 17858 _: 3 17859 }, 16, ["class", "style", "onClick"]); 17860 }; 17861 } 17862 }); 17863 var Button = /* @__PURE__ */ _export_sfc(_sfc_main$1X, [["__file", "button.vue"]]); 17864 17865 const buttonGroupProps = { 17866 size: buttonProps.size, 17867 type: buttonProps.type 17868 }; 17869 17870 const __default__$1h = vue.defineComponent({ 17871 name: "ElButtonGroup" 17872 }); 17873 const _sfc_main$1W = /* @__PURE__ */ vue.defineComponent({ 17874 ...__default__$1h, 17875 props: buttonGroupProps, 17876 setup(__props) { 17877 const props = __props; 17878 vue.provide(buttonGroupContextKey, vue.reactive({ 17879 size: vue.toRef(props, "size"), 17880 type: vue.toRef(props, "type") 17881 })); 17882 const ns = useNamespace("button"); 17883 return (_ctx, _cache) => { 17884 return vue.openBlock(), vue.createElementBlock("div", { 17885 class: vue.normalizeClass(`${vue.unref(ns).b("group")}`) 17886 }, [ 17887 vue.renderSlot(_ctx.$slots, "default") 17888 ], 2); 17889 }; 17890 } 17891 }); 17892 var ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1W, [["__file", "button-group.vue"]]); 17893 17894 const ElButton = withInstall(Button, { 17895 ButtonGroup 17896 }); 17897 const ElButtonGroup$1 = withNoopInstall(ButtonGroup); 17898 17899 var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; 17900 17901 var dayjs_min = {exports: {}}; 17902 17903 (function(module, exports) { 17904 !function(t, e) { 17905 module.exports = e() ; 17906 }(commonjsGlobal, function() { 17907 var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", f = "month", h = "quarter", c = "year", d = "date", $ = "Invalid Date", l = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_") }, m = function(t2, e2, n2) { 17908 var r2 = String(t2); 17909 return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2; 17910 }, g = { s: m, z: function(t2) { 17911 var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60; 17912 return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0"); 17913 }, m: function t2(e2, n2) { 17914 if (e2.date() < n2.date()) 17915 return -t2(n2, e2); 17916 var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, f), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), f); 17917 return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0); 17918 }, a: function(t2) { 17919 return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2); 17920 }, p: function(t2) { 17921 return { M: f, y: c, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: h }[t2] || String(t2 || "").toLowerCase().replace(/s$/, ""); 17922 }, u: function(t2) { 17923 return t2 === void 0; 17924 } }, v = "en", D = {}; 17925 D[v] = M; 17926 var p = function(t2) { 17927 return t2 instanceof _; 17928 }, S = function t2(e2, n2, r2) { 17929 var i2; 17930 if (!e2) 17931 return v; 17932 if (typeof e2 == "string") { 17933 var s2 = e2.toLowerCase(); 17934 D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2); 17935 var u2 = e2.split("-"); 17936 if (!i2 && u2.length > 1) 17937 return t2(u2[0]); 17938 } else { 17939 var a2 = e2.name; 17940 D[a2] = e2, i2 = a2; 17941 } 17942 return !r2 && i2 && (v = i2), i2 || !r2 && v; 17943 }, w = function(t2, e2) { 17944 if (p(t2)) 17945 return t2.clone(); 17946 var n2 = typeof e2 == "object" ? e2 : {}; 17947 return n2.date = t2, n2.args = arguments, new _(n2); 17948 }, O = g; 17949 O.l = S, O.i = p, O.w = function(t2, e2) { 17950 return w(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset }); 17951 }; 17952 var _ = function() { 17953 function M2(t2) { 17954 this.$L = S(t2.locale, null, true), this.parse(t2); 17955 } 17956 var m2 = M2.prototype; 17957 return m2.parse = function(t2) { 17958 this.$d = function(t3) { 17959 var e2 = t3.date, n2 = t3.utc; 17960 if (e2 === null) 17961 return new Date(NaN); 17962 if (O.u(e2)) 17963 return new Date(); 17964 if (e2 instanceof Date) 17965 return new Date(e2); 17966 if (typeof e2 == "string" && !/Z$/i.test(e2)) { 17967 var r2 = e2.match(l); 17968 if (r2) { 17969 var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3); 17970 return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2); 17971 } 17972 } 17973 return new Date(e2); 17974 }(t2), this.$x = t2.x || {}, this.init(); 17975 }, m2.init = function() { 17976 var t2 = this.$d; 17977 this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds(); 17978 }, m2.$utils = function() { 17979 return O; 17980 }, m2.isValid = function() { 17981 return !(this.$d.toString() === $); 17982 }, m2.isSame = function(t2, e2) { 17983 var n2 = w(t2); 17984 return this.startOf(e2) <= n2 && n2 <= this.endOf(e2); 17985 }, m2.isAfter = function(t2, e2) { 17986 return w(t2) < this.startOf(e2); 17987 }, m2.isBefore = function(t2, e2) { 17988 return this.endOf(e2) < w(t2); 17989 }, m2.$g = function(t2, e2, n2) { 17990 return O.u(t2) ? this[e2] : this.set(n2, t2); 17991 }, m2.unix = function() { 17992 return Math.floor(this.valueOf() / 1e3); 17993 }, m2.valueOf = function() { 17994 return this.$d.getTime(); 17995 }, m2.startOf = function(t2, e2) { 17996 var n2 = this, r2 = !!O.u(e2) || e2, h2 = O.p(t2), $2 = function(t3, e3) { 17997 var i2 = O.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2); 17998 return r2 ? i2 : i2.endOf(a); 17999 }, l2 = function(t3, e3) { 18000 return O.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2); 18001 }, y2 = this.$W, M3 = this.$M, m3 = this.$D, g2 = "set" + (this.$u ? "UTC" : ""); 18002 switch (h2) { 18003 case c: 18004 return r2 ? $2(1, 0) : $2(31, 11); 18005 case f: 18006 return r2 ? $2(1, M3) : $2(0, M3 + 1); 18007 case o: 18008 var v2 = this.$locale().weekStart || 0, D2 = (y2 < v2 ? y2 + 7 : y2) - v2; 18009 return $2(r2 ? m3 - D2 : m3 + (6 - D2), M3); 18010 case a: 18011 case d: 18012 return l2(g2 + "Hours", 0); 18013 case u: 18014 return l2(g2 + "Minutes", 1); 18015 case s: 18016 return l2(g2 + "Seconds", 2); 18017 case i: 18018 return l2(g2 + "Milliseconds", 3); 18019 default: 18020 return this.clone(); 18021 } 18022 }, m2.endOf = function(t2) { 18023 return this.startOf(t2, false); 18024 }, m2.$set = function(t2, e2) { 18025 var n2, o2 = O.p(t2), h2 = "set" + (this.$u ? "UTC" : ""), $2 = (n2 = {}, n2[a] = h2 + "Date", n2[d] = h2 + "Date", n2[f] = h2 + "Month", n2[c] = h2 + "FullYear", n2[u] = h2 + "Hours", n2[s] = h2 + "Minutes", n2[i] = h2 + "Seconds", n2[r] = h2 + "Milliseconds", n2)[o2], l2 = o2 === a ? this.$D + (e2 - this.$W) : e2; 18026 if (o2 === f || o2 === c) { 18027 var y2 = this.clone().set(d, 1); 18028 y2.$d[$2](l2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d; 18029 } else 18030 $2 && this.$d[$2](l2); 18031 return this.init(), this; 18032 }, m2.set = function(t2, e2) { 18033 return this.clone().$set(t2, e2); 18034 }, m2.get = function(t2) { 18035 return this[O.p(t2)](); 18036 }, m2.add = function(r2, h2) { 18037 var d2, $2 = this; 18038 r2 = Number(r2); 18039 var l2 = O.p(h2), y2 = function(t2) { 18040 var e2 = w($2); 18041 return O.w(e2.date(e2.date() + Math.round(t2 * r2)), $2); 18042 }; 18043 if (l2 === f) 18044 return this.set(f, this.$M + r2); 18045 if (l2 === c) 18046 return this.set(c, this.$y + r2); 18047 if (l2 === a) 18048 return y2(1); 18049 if (l2 === o) 18050 return y2(7); 18051 var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[l2] || 1, m3 = this.$d.getTime() + r2 * M3; 18052 return O.w(m3, this); 18053 }, m2.subtract = function(t2, e2) { 18054 return this.add(-1 * t2, e2); 18055 }, m2.format = function(t2) { 18056 var e2 = this, n2 = this.$locale(); 18057 if (!this.isValid())
vendor: 12,280 bytes, lines 18058-18319
18058 return n2.invalidDate || $; 18059 var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = O.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, f2 = n2.months, h2 = function(t3, n3, i3, s3) { 18060 return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3); 18061 }, c2 = function(t3) { 18062 return O.s(s2 % 12 || 12, t3, "0"); 18063 }, d2 = n2.meridiem || function(t3, e3, n3) { 18064 var r3 = t3 < 12 ? "AM" : "PM"; 18065 return n3 ? r3.toLowerCase() : r3; 18066 }, l2 = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: a2 + 1, MM: O.s(a2 + 1, 2, "0"), MMM: h2(n2.monthsShort, a2, f2, 3), MMMM: h2(f2, a2), D: this.$D, DD: O.s(this.$D, 2, "0"), d: String(this.$W), dd: h2(n2.weekdaysMin, this.$W, o2, 2), ddd: h2(n2.weekdaysShort, this.$W, o2, 3), dddd: o2[this.$W], H: String(s2), HH: O.s(s2, 2, "0"), h: c2(1), hh: c2(2), a: d2(s2, u2, true), A: d2(s2, u2, false), m: String(u2), mm: O.s(u2, 2, "0"), s: String(this.$s), ss: O.s(this.$s, 2, "0"), SSS: O.s(this.$ms, 3, "0"), Z: i2 }; 18067 return r2.replace(y, function(t3, e3) { 18068 return e3 || l2[t3] || i2.replace(":", ""); 18069 }); 18070 }, m2.utcOffset = function() { 18071 return 15 * -Math.round(this.$d.getTimezoneOffset() / 15); 18072 }, m2.diff = function(r2, d2, $2) { 18073 var l2, y2 = O.p(d2), M3 = w(r2), m3 = (M3.utcOffset() - this.utcOffset()) * e, g2 = this - M3, v2 = O.m(this, M3); 18074 return v2 = (l2 = {}, l2[c] = v2 / 12, l2[f] = v2, l2[h] = v2 / 3, l2[o] = (g2 - m3) / 6048e5, l2[a] = (g2 - m3) / 864e5, l2[u] = g2 / n, l2[s] = g2 / e, l2[i] = g2 / t, l2)[y2] || g2, $2 ? v2 : O.a(v2); 18075 }, m2.daysInMonth = function() { 18076 return this.endOf(f).$D; 18077 }, m2.$locale = function() { 18078 return D[this.$L]; 18079 }, m2.locale = function(t2, e2) { 18080 if (!t2) 18081 return this.$L; 18082 var n2 = this.clone(), r2 = S(t2, e2, true); 18083 return r2 && (n2.$L = r2), n2; 18084 }, m2.clone = function() { 18085 return O.w(this.$d, this); 18086 }, m2.toDate = function() { 18087 return new Date(this.valueOf()); 18088 }, m2.toJSON = function() { 18089 return this.isValid() ? this.toISOString() : null; 18090 }, m2.toISOString = function() { 18091 return this.$d.toISOString(); 18092 }, m2.toString = function() { 18093 return this.$d.toUTCString(); 18094 }, M2; 18095 }(), T = _.prototype; 18096 return w.prototype = T, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", f], ["$y", c], ["$D", d]].forEach(function(t2) { 18097 T[t2[1]] = function(e2) { 18098 return this.$g(e2, t2[0], t2[1]); 18099 }; 18100 }), w.extend = function(t2, e2) { 18101 return t2.$i || (t2(e2, _, w), t2.$i = true), w; 18102 }, w.locale = S, w.isDayjs = p, w.unix = function(t2) { 18103 return w(1e3 * t2); 18104 }, w.en = D[v], w.Ls = D, w.p = {}, w; 18105 }); 18106 })(dayjs_min); 18107 var dayjs = dayjs_min.exports; 18108 18109 var customParseFormat$1 = {exports: {}}; 18110 18111 (function(module, exports) { 18112 !function(e, t) { 18113 module.exports = t() ; 18114 }(commonjsGlobal, function() { 18115 var e = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, t = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d\d/, r = /\d\d?/, i = /\d*[^-_:/,()\s\d]+/, o = {}, s = function(e2) { 18116 return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3); 18117 }; 18118 var a = function(e2) { 18119 return function(t2) { 18120 this[e2] = +t2; 18121 }; 18122 }, f = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) { 18123 (this.zone || (this.zone = {})).offset = function(e3) { 18124 if (!e3) 18125 return 0; 18126 if (e3 === "Z") 18127 return 0; 18128 var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0); 18129 return n2 === 0 ? 0 : t2[0] === "+" ? -n2 : n2; 18130 }(e2); 18131 }], h = function(e2) { 18132 var t2 = o[e2]; 18133 return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f)); 18134 }, u = function(e2, t2) { 18135 var n2, r2 = o.meridiem; 18136 if (r2) { 18137 for (var i2 = 1; i2 <= 24; i2 += 1) 18138 if (e2.indexOf(r2(i2, 0, t2)) > -1) { 18139 n2 = i2 > 12; 18140 break; 18141 } 18142 } else 18143 n2 = e2 === (t2 ? "pm" : "PM"); 18144 return n2; 18145 }, d = { A: [i, function(e2) { 18146 this.afternoon = u(e2, false); 18147 }], a: [i, function(e2) { 18148 this.afternoon = u(e2, true); 18149 }], S: [/\d/, function(e2) { 18150 this.milliseconds = 100 * +e2; 18151 }], SS: [n, function(e2) { 18152 this.milliseconds = 10 * +e2; 18153 }], SSS: [/\d{3}/, function(e2) { 18154 this.milliseconds = +e2; 18155 }], s: [r, a("seconds")], ss: [r, a("seconds")], m: [r, a("minutes")], mm: [r, a("minutes")], H: [r, a("hours")], h: [r, a("hours")], HH: [r, a("hours")], hh: [r, a("hours")], D: [r, a("day")], DD: [n, a("day")], Do: [i, function(e2) { 18156 var t2 = o.ordinal, n2 = e2.match(/\d+/); 18157 if (this.day = n2[0], t2) 18158 for (var r2 = 1; r2 <= 31; r2 += 1) 18159 t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2); 18160 }], M: [r, a("month")], MM: [n, a("month")], MMM: [i, function(e2) { 18161 var t2 = h("months"), n2 = (h("monthsShort") || t2.map(function(e3) { 18162 return e3.slice(0, 3); 18163 })).indexOf(e2) + 1; 18164 if (n2 < 1) 18165 throw new Error(); 18166 this.month = n2 % 12 || n2; 18167 }], MMMM: [i, function(e2) { 18168 var t2 = h("months").indexOf(e2) + 1; 18169 if (t2 < 1) 18170 throw new Error(); 18171 this.month = t2 % 12 || t2; 18172 }], Y: [/[+-]?\d+/, a("year")], YY: [n, function(e2) { 18173 this.year = s(e2); 18174 }], YYYY: [/\d{4}/, a("year")], Z: f, ZZ: f }; 18175 function c(n2) { 18176 var r2, i2; 18177 r2 = n2, i2 = o && o.formats; 18178 for (var s2 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) { 18179 var o2 = r3 && r3.toUpperCase(); 18180 return n3 || i2[r3] || e[r3] || i2[o2].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) { 18181 return t3 || n4.slice(1); 18182 }); 18183 })).match(t), a2 = s2.length, f2 = 0; f2 < a2; f2 += 1) { 18184 var h2 = s2[f2], u2 = d[h2], c2 = u2 && u2[0], l = u2 && u2[1]; 18185 s2[f2] = l ? { regex: c2, parser: l } : h2.replace(/^\[|\]$/g, ""); 18186 } 18187 return function(e2) { 18188 for (var t2 = {}, n3 = 0, r3 = 0; n3 < a2; n3 += 1) { 18189 var i3 = s2[n3]; 18190 if (typeof i3 == "string") 18191 r3 += i3.length; 18192 else { 18193 var o2 = i3.regex, f3 = i3.parser, h3 = e2.slice(r3), u3 = o2.exec(h3)[0]; 18194 f3.call(t2, u3), e2 = e2.replace(u3, ""); 18195 } 18196 } 18197 return function(e3) { 18198 var t3 = e3.afternoon; 18199 if (t3 !== void 0) { 18200 var n4 = e3.hours; 18201 t3 ? n4 < 12 && (e3.hours += 12) : n4 === 12 && (e3.hours = 0), delete e3.afternoon; 18202 } 18203 }(t2), t2; 18204 }; 18205 } 18206 return function(e2, t2, n2) { 18207 n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (s = e2.parseTwoDigitYear); 18208 var r2 = t2.prototype, i2 = r2.parse; 18209 r2.parse = function(e3) { 18210 var t3 = e3.date, r3 = e3.utc, s2 = e3.args; 18211 this.$u = r3; 18212 var a2 = s2[1]; 18213 if (typeof a2 == "string") { 18214 var f2 = s2[2] === true, h2 = s2[3] === true, u2 = f2 || h2, d2 = s2[2]; 18215 h2 && (d2 = s2[2]), o = this.$locale(), !f2 && d2 && (o = n2.Ls[d2]), this.$d = function(e4, t4, n3) { 18216 try { 18217 if (["x", "X"].indexOf(t4) > -1) 18218 return new Date((t4 === "X" ? 1e3 : 1) * e4); 18219 var r4 = c(t4)(e4), i3 = r4.year, o2 = r4.month, s3 = r4.day, a3 = r4.hours, f3 = r4.minutes, h3 = r4.seconds, u3 = r4.milliseconds, d3 = r4.zone, l2 = new Date(), m2 = s3 || (i3 || o2 ? 1 : l2.getDate()), M2 = i3 || l2.getFullYear(), Y = 0; 18220 i3 && !o2 || (Y = o2 > 0 ? o2 - 1 : l2.getMonth()); 18221 var p = a3 || 0, v = f3 || 0, D = h3 || 0, g = u3 || 0; 18222 return d3 ? new Date(Date.UTC(M2, Y, m2, p, v, D, g + 60 * d3.offset * 1e3)) : n3 ? new Date(Date.UTC(M2, Y, m2, p, v, D, g)) : new Date(M2, Y, m2, p, v, D, g); 18223 } catch (e5) { 18224 return new Date(""); 18225 } 18226 }(t3, a2, r3), this.init(), d2 && d2 !== true && (this.$L = this.locale(d2).$L), u2 && t3 != this.format(a2) && (this.$d = new Date("")), o = {}; 18227 } else if (a2 instanceof Array) 18228 for (var l = a2.length, m = 1; m <= l; m += 1) { 18229 s2[1] = a2[m - 1]; 18230 var M = n2.apply(this, s2); 18231 if (M.isValid()) { 18232 this.$d = M.$d, this.$L = M.$L, this.init(); 18233 break; 18234 } 18235 m === l && (this.$d = new Date("")); 18236 } 18237 else 18238 i2.call(this, e3); 18239 }; 18240 }; 18241 }); 18242 })(customParseFormat$1); 18243 var customParseFormat = customParseFormat$1.exports; 18244 18245 const timeUnits$1 = ["hours", "minutes", "seconds"]; 18246 const DEFAULT_FORMATS_TIME = "HH:mm:ss"; 18247 const DEFAULT_FORMATS_DATE = "YYYY-MM-DD"; 18248 const DEFAULT_FORMATS_DATEPICKER = { 18249 date: DEFAULT_FORMATS_DATE, 18250 dates: DEFAULT_FORMATS_DATE, 18251 week: "gggg[w]ww", 18252 year: "YYYY", 18253 month: "YYYY-MM", 18254 datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`, 18255 monthrange: "YYYY-MM", 18256 daterange: DEFAULT_FORMATS_DATE, 18257 datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}` 18258 }; 18259 18260 const buildTimeList = (value, bound) => { 18261 return [ 18262 value > 0 ? value - 1 : void 0, 18263 value, 18264 value < bound ? value + 1 : void 0 18265 ]; 18266 }; 18267 const rangeArr = (n) => Array.from(Array.from({ length: n }).keys()); 18268 const extractDateFormat = (format) => { 18269 return format.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim(); 18270 }; 18271 const extractTimeFormat = (format) => { 18272 return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim(); 18273 }; 18274 const dateEquals = function(a, b) { 18275 const aIsDate = isDate$1(a); 18276 const bIsDate = isDate$1(b); 18277 if (aIsDate && bIsDate) { 18278 return a.getTime() === b.getTime(); 18279 } 18280 if (!aIsDate && !bIsDate) { 18281 return a === b; 18282 } 18283 return false; 18284 }; 18285 const valueEquals = function(a, b) { 18286 const aIsArray = isArray$1(a); 18287 const bIsArray = isArray$1(b); 18288 if (aIsArray && bIsArray) { 18289 if (a.length !== b.length) { 18290 return false; 18291 } 18292 return a.every((item, index) => dateEquals(item, b[index])); 18293 } 18294 if (!aIsArray && !bIsArray) { 18295 return dateEquals(a, b); 18296 } 18297 return false; 18298 }; 18299 const parseDate = function(date, format, lang) { 18300 const day = isEmpty(format) || format === "x" ? dayjs(date).locale(lang) : dayjs(date, format).locale(lang); 18301 return day.isValid() ? day : void 0; 18302 }; 18303 const formatter = function(date, format, lang) { 18304 if (isEmpty(format)) 18305 return date; 18306 if (format === "x") 18307 return +date; 18308 return dayjs(date).locale(lang).format(format); 18309 }; 18310 const makeList = (total, method) => { 18311 var _a; 18312 const arr = []; 18313 const disabledArr = method == null ? void 0 : method(); 18314 for (let i = 0; i < total; i++) { 18315 arr.push((_a = disabledArr == null ? void 0 : disabledArr.includes(i)) != null ? _a : false); 18316 } 18317 return arr; 18318 }; 18319
18320 const disabledTimeListsProps = buildProps({ 18321 disabledHours: { 18322 type: definePropType(Function) 18323 }, 18324 disabledMinutes: { 18325 type: definePropType(Function) 18326 }, 18327 disabledSeconds: { 18328 type: definePropType(Function) 18329 } 18330 }); 18331 const timePanelSharedProps = buildProps({ 18332 visible: Boolean, 18333 actualVisible: { 18334 type: Boolean, 18335 default: void 0 18336 }, 18337 format: { 18338 type: String, 18339 default: "" 18340 } 18341 }); 18342 18343 const timePickerDefaultProps = buildProps({ 18344 id: { 18345 type: definePropType([Array, String]) 18346 }, 18347 name: { 18348 type: definePropType([Array, String]), 18349 default: "" 18350 }, 18351 popperClass: { 18352 type: String, 18353 default: "" 18354 }, 18355 format: String, 18356 valueFormat: String, 18357 type: { 18358 type: String, 18359 default: "" 18360 }, 18361 clearable: { 18362 type: Boolean, 18363 default: true 18364 }, 18365 clearIcon: { 18366 type: definePropType([String, Object]), 18367 default: circle_close_default 18368 }, 18369 editable: { 18370 type: Boolean, 18371 default: true 18372 }, 18373 prefixIcon: { 18374 type: definePropType([String, Object]), 18375 default: "" 18376 }, 18377 size: useSizeProp, 18378 readonly: { 18379 type: Boolean, 18380 default: false 18381 }, 18382 disabled: { 18383 type: Boolean, 18384 default: false 18385 }, 18386 placeholder: { 18387 type: String, 18388 default: "" 18389 }, 18390 popperOptions: { 18391 type: definePropType(Object), 18392 default: () => ({}) 18393 }, 18394 modelValue: { 18395 type: definePropType([Date, Array, String, Number]), 18396 default: "" 18397 }, 18398 rangeSeparator: { 18399 type: String, 18400 default: "-" 18401 }, 18402 startPlaceholder: String, 18403 endPlaceholder: String, 18404 defaultValue: { 18405 type: definePropType([Date, Array]) 18406 }, 18407 defaultTime: { 18408 type: definePropType([Date, Array]) 18409 }, 18410 isRange: { 18411 type: Boolean, 18412 default: false 18413 }, 18414 ...disabledTimeListsProps, 18415 disabledDate: { 18416 type: Function 18417 }, 18418 cellClassName: { 18419 type: Function 18420 }, 18421 shortcuts: { 18422 type: Array, 18423 default: () => [] 18424 }, 18425 arrowControl: { 18426 type: Boolean, 18427 default: false 18428 }, 18429 label: { 18430 type: String, 18431 default: void 0 18432 }, 18433 tabindex: { 18434 type: definePropType([String, Number]), 18435 default: 0 18436 }, 18437 validateEvent: { 18438 type: Boolean, 18439 default: true 18440 }, 18441 unlinkPanels: Boolean 18442 }); 18443 18444 const _hoisted_1$Y = ["id", "name", "placeholder", "value", "disabled", "readonly"]; 18445 const _hoisted_2$D = ["id", "name", "placeholder", "value", "disabled", "readonly"]; 18446 const __default__$1g = vue.defineComponent({ 18447 name: "Picker" 18448 }); 18449 const _sfc_main$1V = /* @__PURE__ */ vue.defineComponent({ 18450 ...__default__$1g, 18451 props: timePickerDefaultProps, 18452 emits: [ 18453 "update:modelValue", 18454 "change", 18455 "focus", 18456 "blur", 18457 "calendar-change", 18458 "panel-change", 18459 "visible-change", 18460 "keydown" 18461 ], 18462 setup(__props, { expose, emit }) { 18463 const props = __props; 18464 const { lang } = useLocale(); 18465 const nsDate = useNamespace("date"); 18466 const nsInput = useNamespace("input"); 18467 const nsRange = useNamespace("range"); 18468 const { form, formItem } = useFormItem(); 18469 const elPopperOptions = vue.inject("ElPopperOptions", {}); 18470 const refPopper = vue.ref(); 18471 const inputRef = vue.ref(); 18472 const pickerVisible = vue.ref(false); 18473 const pickerActualVisible = vue.ref(false); 18474 const valueOnOpen = vue.ref(null); 18475 let hasJustTabExitedInput = false; 18476 let ignoreFocusEvent = false; 18477 vue.watch(pickerVisible, (val) => { 18478 if (!val) { 18479 userInput.value = null; 18480 vue.nextTick(() => { 18481 emitChange(props.modelValue); 18482 }); 18483 } else { 18484 vue.nextTick(() => { 18485 if (val) { 18486 valueOnOpen.value = props.modelValue; 18487 } 18488 }); 18489 } 18490 }); 18491 const emitChange = (val, isClear) => { 18492 if (isClear || !valueEquals(val, valueOnOpen.value)) { 18493 emit("change", val); 18494 props.validateEvent && (formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn())); 18495 } 18496 }; 18497 const emitInput = (input) => { 18498 if (!valueEquals(props.modelValue, input)) { 18499 let formatted; 18500 if (isArray$1(input)) { 18501 formatted = input.map((item) => formatter(item, props.valueFormat, lang.value)); 18502 } else if (input) { 18503 formatted = formatter(input, props.valueFormat, lang.value); 18504 } 18505 emit("update:modelValue", input ? formatted : input, lang.value); 18506 } 18507 }; 18508 const emitKeydown = (e) => { 18509 emit("keydown", e); 18510 }; 18511 const refInput = vue.computed(() => { 18512 if (inputRef.value) { 18513 const _r = isRangeInput.value ? inputRef.value : inputRef.value.$el; 18514 return Array.from(_r.querySelectorAll("input")); 18515 } 18516 return []; 18517 }); 18518 const setSelectionRange = (start, end, pos) => { 18519 const _inputs = refInput.value; 18520 if (!_inputs.length) 18521 return; 18522 if (!pos || pos === "min") { 18523 _inputs[0].setSelectionRange(start, end); 18524 _inputs[0].focus(); 18525 } else if (pos === "max") { 18526 _inputs[1].setSelectionRange(start, end); 18527 _inputs[1].focus(); 18528 } 18529 }; 18530 const focusOnInputBox = () => { 18531 focus(true, true); 18532 vue.nextTick(() => { 18533 ignoreFocusEvent = false; 18534 }); 18535 }; 18536 const onPick = (date = "", visible = false) => { 18537 if (!visible) { 18538 ignoreFocusEvent = true; 18539 } 18540 pickerVisible.value = visible; 18541 let result; 18542 if (isArray$1(date)) { 18543 result = date.map((_) => _.toDate()); 18544 } else { 18545 result = date ? date.toDate() : date; 18546 } 18547 userInput.value = null; 18548 emitInput(result); 18549 }; 18550 const onBeforeShow = () => { 18551 pickerActualVisible.value = true; 18552 }; 18553 const onShow = () => { 18554 emit("visible-change", true); 18555 }; 18556 const onKeydownPopperContent = (event) => { 18557 if ((event == null ? void 0 : event.key) === EVENT_CODE.esc) { 18558 focus(true, true); 18559 } 18560 }; 18561 const onHide = () => { 18562 pickerActualVisible.value = false; 18563 pickerVisible.value = false; 18564 ignoreFocusEvent = false; 18565 emit("visible-change", false); 18566 }; 18567 const handleOpen = () => { 18568 pickerVisible.value = true; 18569 }; 18570 const handleClose = () => { 18571 pickerVisible.value = false; 18572 }; 18573 const focus = (focusStartInput = true, isIgnoreFocusEvent = false) => { 18574 ignoreFocusEvent = isIgnoreFocusEvent; 18575 const [leftInput, rightInput] = vue.unref(refInput); 18576 let input = leftInput; 18577 if (!focusStartInput && isRangeInput.value) { 18578 input = rightInput; 18579 } 18580 if (input) { 18581 input.focus(); 18582 } 18583 }; 18584 const handleFocusInput = (e) => { 18585 if (props.readonly || pickerDisabled.value || pickerVisible.value || ignoreFocusEvent) { 18586 return; 18587 } 18588 pickerVisible.value = true; 18589 emit("focus", e); 18590 }; 18591 let currentHandleBlurDeferCallback = void 0; 18592 const handleBlurInput = (e) => { 18593 const handleBlurDefer = async () => { 18594 setTimeout(() => { 18595 var _a; 18596 if (currentHandleBlurDeferCallback === handleBlurDefer) { 18597 if (!(((_a = refPopper.value) == null ? void 0 : _a.isFocusInsideContent()) && !hasJustTabExitedInput) && refInput.value.filter((in
18597put) => { 18598 return input.contains(document.activeElement); 18599 }).length === 0) { 18600 handleChange(); 18601 pickerVisible.value = false; 18602 emit("blur", e); 18603 props.validateEvent && (formItem == null ? void 0 : formItem.validate("blur").catch((err) => debugWarn())); 18604 } 18605 hasJustTabExitedInput = false; 18606 } 18607 }, 0); 18608 }; 18609 currentHandleBlurDeferCallback = handleBlurDefer; 18610 handleBlurDefer(); 18611 }; 18612 const pickerDisabled = vue.computed(() => { 18613 return props.disabled || (form == null ? void 0 : form.disabled); 18614 }); 18615 const parsedValue = vue.computed(() => { 18616 let dayOrDays; 18617 if (valueIsEmpty.value) { 18618 if (pickerOptions.value.getDefaultValue) { 18619 dayOrDays = pickerOptions.value.getDefaultValue(); 18620 } 18621 } else { 18622 if (isArray$1(props.modelValue)) { 18623 dayOrDays = props.modelValue.map((d) => parseDate(d, props.valueFormat, lang.value)); 18624 } else { 18625 dayOrDays = parseDate(props.modelValue, props.valueFormat, lang.value); 18626 } 18627 } 18628 if (pickerOptions.value.getRangeAvailableTime) { 18629 const availableResult = pickerOptions.value.getRangeAvailableTime(dayOrDays); 18630 if (!isEqual$1(availableResult, dayOrDays)) { 18631 dayOrDays = availableResult; 18632 emitInput(isArray$1(dayOrDays) ? dayOrDays.map((_) => _.toDate()) : dayOrDays.toDate()); 18633 } 18634 } 18635 if (isArray$1(dayOrDays) && dayOrDays.some((day) => !day)) { 18636 dayOrDays = []; 18637 } 18638 return dayOrDays; 18639 }); 18640 const displayValue = vue.computed(() => { 18641 if (!pickerOptions.value.panelReady) 18642 return ""; 18643 const formattedValue = formatDayjsToString(parsedValue.value); 18644 if (isArray$1(userInput.value)) { 18645 return [ 18646 userInput.value[0] || formattedValue && formattedValue[0] || "", 18647 userInput.value[1] || formattedValue && formattedValue[1] || "" 18648 ]; 18649 } else if (userInput.value !== null) { 18650 return userInput.value; 18651 } 18652 if (!isTimePicker.value && valueIsEmpty.value) 18653 return ""; 18654 if (!pickerVisible.value && valueIsEmpty.value) 18655 return ""; 18656 if (formattedValue) { 18657 return isDatesPicker.value ? formattedValue.join(", ") : formattedValue; 18658 } 18659 return ""; 18660 }); 18661 const isTimeLikePicker = vue.computed(() => props.type.includes("time")); 18662 const isTimePicker = vue.computed(() => props.type.startsWith("time")); 18663 const isDatesPicker = vue.computed(() => props.type === "dates"); 18664 const triggerIcon = vue.computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock_default : calendar_default)); 18665 const showClose = vue.ref(false); 18666 const onClearIconClick = (event) => { 18667 if (props.readonly || pickerDisabled.value) 18668 return; 18669 if (showClose.value) { 18670 event.stopPropagation(); 18671 focusOnInputBox(); 18672 emitInput(null); 18673 emitChange(null, true); 18674 showClose.value = false; 18675 pickerVisible.value = false; 18676 pickerOptions.value.handleClear && pickerOptions.value.handleClear(); 18677 } 18678 }; 18679 const valueIsEmpty = vue.computed(() => { 18680 const { modelValue } = props; 18681 return !modelValue || isArray$1(modelValue) && !modelValue.filter(Boolean).length; 18682 }); 18683 const onMouseDownInput = async (event) => { 18684 var _a; 18685 if (props.readonly || pickerDisabled.value) 18686 return; 18687 if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) { 18688 pickerVisible.value = true; 18689 } 18690 }; 18691 const onMouseEnter = () => { 18692 if (props.readonly || pickerDisabled.value) 18693 return; 18694 if (!valueIsEmpty.value && props.clearable) { 18695 showClose.value = true; 18696 } 18697 }; 18698 const onMouseLeave = () => { 18699 showClose.value = false; 18700 }; 18701 const onTouchStartInput = (event) => { 18702 var _a; 18703 if (props.readonly || pickerDisabled.value) 18704 return; 18705 if (((_a = event.touches[0].target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) { 18706 pickerVisible.value = true; 18707 } 18708 }; 18709 const isRangeInput = vue.computed(() => { 18710 return props.type.includes("range"); 18711 }); 18712 const pickerSize = useFormSize(); 18713 const popperEl = vue.computed(() => { 18714 var _a, _b; 18715 return (_b = (_a = vue.unref(refPopper)) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef; 18716 }); 18717 const actualInputRef = vue.computed(() => { 18718 var _a; 18719 if (vue.unref(isRangeInput)) { 18720 return vue.unref(inputRef); 18721 } 18722 return (_a = vue.unref(inputRef)) == null ? void 0 : _a.$el; 18723 }); 18724 onClickOutside(actualInputRef, (e) => { 18725 const unrefedPopperEl = vue.unref(popperEl); 18726 const inputEl = vue.unref(actualInputRef); 18727 if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || e.composedPath().includes(inputEl)) 18728 return; 18729 pickerVisible.value = false; 18730 }); 18731 const userInput = vue.ref(null); 18732 const handleChange = () => { 18733 if (userInput.value) { 18734 const value = parseUserInputToDayjs(displayValue.value); 18735 if (value) { 18736 if (isValidValue(value)) { 18737 emitInput(isArray$1(value) ? value.map((_) => _.toDate()) : value.toDate()); 18738 userInput.value = null; 18739 } 18740 } 18741 } 18742 if (userInput.value === "") { 18743 emitInput(null); 18744 emitChange(null); 18745 userInput.value = null; 18746 } 18747 }; 18748 const parseUserInputToDayjs = (value) => { 18749 if (!value) 18750 return null; 18751 return pickerOptions.value.parseUserInput(value); 18752 }; 18753 const formatDayjsToString = (value) => { 18754 if (!value) 18755 return null; 18756 return pickerOptions.value.formatToString(value); 18757 }; 18758 const isValidValue = (value) => { 18759 return pickerOptions.value.isValidValue(value); 18760 }; 18761 const handleKeydownInput = async (event) => { 18762 if (props.readonly || pickerDisabled.value) 18763 return; 18764 const { code } = event; 18765 emitKeydown(event); 18766 if (code === EVENT_CODE.esc) { 18767 if (pickerVisible.value === true) { 18768 pickerVisible.value = false; 18769 event.preventDefault(); 18770 event.stopPropagation(); 18771 } 18772 return; 18773 } 18774 if (code === EVENT_CODE.down) { 18775 if (pickerOptions.value.handleFocusPicker) { 18776 event.preventDefault(); 18777 event.stopPropagation(); 18778 } 18779 if (pickerVisible.value === false) { 18780 pickerVisible.value = true; 18781 await vue.nextTick(); 18782 } 18783 if (pickerOptions.value.handleFocusPicker) { 18784 pickerOptions.value.handleFocusPicker(); 18785 return; 18786 } 18787 } 18788 if (code === EVENT_CODE.tab) { 18789 hasJustTabExitedInput = true; 18790 return; 18791 } 18792 if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) { 18793 if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) { 18794 handleChange(); 18795 pickerVisible.value = false; 18796 } 18797 event.stopPropagation(); 18798 return; 18799 } 18800 if (userInput.value) { 18801 event.stopPropagation(); 18802 return; 18803 } 18804 if (pickerOptions.value.handleKeydownInput) { 18805 pickerOptions.value.handleKeydownInput(event); 18806 } 18807 }; 18808 const onUserInput = (e) => { 18809 userInput.value = e; 18810 if (!pickerVisible.value) { 18811 pickerVisible.value = true; 18812 } 18813 }; 18814 const handleStartInput = (event) => { 18815 const target = event.target; 18816 if (userInput.value) { 18817 userInput.value = [target.value, userInput.value[1]]; 18818 } else { 18819 userInput.value = [target.value, null]; 18820 } 18821 }; 18822 const handleEndInput = (event) => { 18823 const target = event.target; 18824 if (userInput.value) {
18825 userInput.value = [userInput.value[0], target.value]; 18826 } else { 18827 userInput.value = [null, target.value]; 18828 } 18829 }; 18830 const handleStartChange = () => { 18831 var _a; 18832 const values = userInput.value; 18833 const value = parseUserInputToDayjs(values && values[0]); 18834 const parsedVal = vue.unref(parsedValue); 18835 if (value && value.isValid()) { 18836 userInput.value = [ 18837 formatDayjsToString(value), 18838 ((_a = displayValue.value) == null ? void 0 : _a[1]) || null 18839 ]; 18840 const newValue = [value, parsedVal && (parsedVal[1] || null)]; 18841 if (isValidValue(newValue)) { 18842 emitInput(newValue); 18843 userInput.value = null; 18844 } 18845 } 18846 }; 18847 const handleEndChange = () => { 18848 var _a; 18849 const values = vue.unref(userInput); 18850 const value = parseUserInputToDayjs(values && values[1]); 18851 const parsedVal = vue.unref(parsedValue); 18852 if (value && value.isValid()) { 18853 userInput.value = [ 18854 ((_a = vue.unref(displayValue)) == null ? void 0 : _a[0]) || null, 18855 formatDayjsToString(value) 18856 ]; 18857 const newValue = [parsedVal && parsedVal[0], value]; 18858 if (isValidValue(newValue)) { 18859 emitInput(newValue); 18860 userInput.value = null; 18861 } 18862 } 18863 }; 18864 const pickerOptions = vue.ref({}); 18865 const onSetPickerOption = (e) => { 18866 pickerOptions.value[e[0]] = e[1]; 18867 pickerOptions.value.panelReady = true; 18868 }; 18869 const onCalendarChange = (e) => { 18870 emit("calendar-change", e); 18871 }; 18872 const onPanelChange = (value, mode, view) => { 18873 emit("panel-change", value, mode, view); 18874 }; 18875 vue.provide("EP_PICKER_BASE", { 18876 props 18877 }); 18878 expose({ 18879 focus, 18880 handleFocusInput, 18881 handleBlurInput, 18882 handleOpen, 18883 handleClose, 18884 onPick 18885 }); 18886 return (_ctx, _cache) => { 18887 return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({ 18888 ref_key: "refPopper", 18889 ref: refPopper, 18890 visible: pickerVisible.value, 18891 effect: "light", 18892 pure: "", 18893 trigger: "click" 18894 }, _ctx.$attrs, { 18895 role: "dialog", 18896 teleported: "", 18897 transition: `${vue.unref(nsDate).namespace.value}-zoom-in-top`, 18898 "popper-class": [`${vue.unref(nsDate).namespace.value}-picker__popper`, _ctx.popperClass], 18899 "popper-options": vue.unref(elPopperOptions), 18900 "fallback-placements": ["bottom", "top", "right", "left"], 18901 "gpu-acceleration": false, 18902 "stop-popper-mouse-event": false, 18903 "hide-after": 0, 18904 persistent: "", 18905 onBeforeShow, 18906 onShow, 18907 onHide 18908 }), { 18909 default: vue.withCtx(() => [ 18910 !vue.unref(isRangeInput) ? (vue.openBlock(), vue.createBlock(vue.unref(ElInput), { 18911 key: 0, 18912 id: _ctx.id, 18913 ref_key: "inputRef", 18914 ref: inputRef, 18915 "container-role": "combobox", 18916 "model-value": vue.unref(displayValue), 18917 name: _ctx.name, 18918 size: vue.unref(pickerSize), 18919 disabled: vue.unref(pickerDisabled), 18920 placeholder: _ctx.placeholder, 18921 class: vue.normalizeClass([vue.unref(nsDate).b("editor"), vue.unref(nsDate).bm("editor", _ctx.type), _ctx.$attrs.class]), 18922 style: vue.normalizeStyle(_ctx.$attrs.style), 18923 readonly: !_ctx.editable || _ctx.readonly || vue.unref(isDatesPicker) || _ctx.type === "week", 18924 label: _ctx.label, 18925 tabindex: _ctx.tabindex, 18926 "validate-event": false, 18927 onInput: onUserInput, 18928 onFocus: handleFocusInput, 18929 onBlur: handleBlurInput, 18930 onKeydown: handleKeydownInput, 18931 onChange: handleChange, 18932 onMousedown: onMouseDownInput, 18933 onMouseenter: onMouseEnter, 18934 onMouseleave: onMouseLeave, 18935 onTouchstart: onTouchStartInput, 18936 onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => { 18937 }, ["stop"])) 18938 }, { 18939 prefix: vue.withCtx(() => [ 18940 vue.unref(triggerIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 18941 key: 0, 18942 class: vue.normalizeClass(vue.unref(nsInput).e("icon")), 18943 onMousedown: vue.withModifiers(onMouseDownInput, ["prevent"]), 18944 onTouchstart: onTouchStartInput 18945 }, { 18946 default: vue.withCtx(() => [ 18947 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(triggerIcon)))) 18948 ]), 18949 _: 1 18950 }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true) 18951 ]), 18952 suffix: vue.withCtx(() => [ 18953 showClose.value && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 18954 key: 0, 18955 class: vue.normalizeClass(`${vue.unref(nsInput).e("icon")} clear-icon`), 18956 onClick: vue.withModifiers(onClearIconClick, ["stop"]) 18957 }, { 18958 default: vue.withCtx(() => [ 18959 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon))) 18960 ]), 18961 _: 1 18962 }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true) 18963 ]), 18964 _: 1 18965 }, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "label", "tabindex", "onKeydown"])) : (vue.openBlock(), vue.createElementBlock("div", { 18966 key: 1, 18967 ref_key: "inputRef", 18968 ref: inputRef, 18969 class: vue.normalizeClass([ 18970 vue.unref(nsDate).b("editor"), 18971 vue.unref(nsDate).bm("editor", _ctx.type), 18972 vue.unref(nsInput).e("wrapper"), 18973 vue.unref(nsDate).is("disabled", vue.unref(pickerDisabled)), 18974 vue.unref(nsDate).is("active", pickerVisible.value), 18975 vue.unref(nsRange).b("editor"), 18976 vue.unref(pickerSize) ? vue.unref(nsRange).bm("editor", vue.unref(pickerSize)) : "", 18977 _ctx.$attrs.class 18978 ]), 18979 style: vue.normalizeStyle(_ctx.$attrs.style), 18980 onClick: handleFocusInput, 18981 onMouseenter: onMouseEnter, 18982 onMouseleave: onMouseLeave, 18983 onTouchstart: onTouchStartInput, 18984 onKeydown: handleKeydownInput 18985 }, [ 18986 vue.unref(triggerIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 18987 key: 0, 18988 class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsRange).e("icon")]), 18989 onMousedown: vue.withModifiers(onMouseDownInput, ["prevent"]), 18990 onTouchstart: onTouchStartInput 18991 }, { 18992 default: vue.withCtx(() => [ 18993 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(triggerIcon)))) 18994 ]), 18995 _: 1 18996 }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true), 18997 vue.createElementVNode("input", { 18998 id: _ctx.id && _ctx.id[0], 18999 autocomplete: "off", 19000 name: _ctx.name && _ctx.name[0],
19001 placeholder: _ctx.startPlaceholder, 19002 value: vue.unref(displayValue) && vue.unref(displayValue)[0], 19003 disabled: vue.unref(pickerDisabled), 19004 readonly: !_ctx.editable || _ctx.readonly, 19005 class: vue.normalizeClass(vue.unref(nsRange).b("input")), 19006 onMousedown: onMouseDownInput, 19007 onInput: handleStartInput, 19008 onChange: handleStartChange, 19009 onFocus: handleFocusInput, 19010 onBlur: handleBlurInput 19011 }, null, 42, _hoisted_1$Y), 19012 vue.renderSlot(_ctx.$slots, "range-separator", {}, () => [ 19013 vue.createElementVNode("span", { 19014 class: vue.normalizeClass(vue.unref(nsRange).b("separator")) 19015 }, vue.toDisplayString(_ctx.rangeSeparator), 3) 19016 ]), 19017 vue.createElementVNode("input", { 19018 id: _ctx.id && _ctx.id[1], 19019 autocomplete: "off", 19020 name: _ctx.name && _ctx.name[1], 19021 placeholder: _ctx.endPlaceholder, 19022 value: vue.unref(displayValue) && vue.unref(displayValue)[1], 19023 disabled: vue.unref(pickerDisabled), 19024 readonly: !_ctx.editable || _ctx.readonly, 19025 class: vue.normalizeClass(vue.unref(nsRange).b("input")), 19026 onMousedown: onMouseDownInput, 19027 onFocus: handleFocusInput, 19028 onBlur: handleBlurInput, 19029 onInput: handleEndInput, 19030 onChange: handleEndChange 19031 }, null, 42, _hoisted_2$D), 19032 _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 19033 key: 1, 19034 class: vue.normalizeClass([ 19035 vue.unref(nsInput).e("icon"), 19036 vue.unref(nsRange).e("close-icon"), 19037 { 19038 [vue.unref(nsRange).e("close-icon--hidden")]: !showClose.value 19039 } 19040 ]), 19041 onClick: onClearIconClick 19042 }, { 19043 default: vue.withCtx(() => [ 19044 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon))) 19045 ]), 19046 _: 1 19047 }, 8, ["class"])) : vue.createCommentVNode("v-if", true) 19048 ], 38)) 19049 ]), 19050 content: vue.withCtx(() => [ 19051 vue.renderSlot(_ctx.$slots, "default", { 19052 visible: pickerVisible.value, 19053 actualVisible: pickerActualVisible.value, 19054 parsedValue: vue.unref(parsedValue), 19055 format: _ctx.format, 19056 unlinkPanels: _ctx.unlinkPanels, 19057 type: _ctx.type, 19058 defaultValue: _ctx.defaultValue, 19059 onPick, 19060 onSelectRange: setSelectionRange, 19061 onSetPickerOption, 19062 onCalendarChange, 19063 onPanelChange, 19064 onKeydown: onKeydownPopperContent, 19065 onMousedown: _cache[1] || (_cache[1] = vue.withModifiers(() => { 19066 }, ["stop"])) 19067 }) 19068 ]), 19069 _: 3 19070 }, 16, ["visible", "transition", "popper-class", "popper-options"]); 19071 }; 19072 } 19073 }); 19074 var CommonPicker = /* @__PURE__ */ _export_sfc(_sfc_main$1V, [["__file", "picker.vue"]]); 19075 19076 const panelTimePickerProps = buildProps({ 19077 ...timePanelSharedProps, 19078 datetimeRole: String, 19079 parsedValue: { 19080 type: definePropType(Object) 19081 } 19082 }); 19083 19084 const useTimePanel = ({ 19085 getAvailableHours, 19086 getAvailableMinutes, 19087 getAvailableSeconds 19088 }) => { 19089 const getAvailableTime = (date, role, first, compareDate) => { 19090 const availableTimeGetters = { 19091 hour: getAvailableHours, 19092 minute: getAvailableMinutes, 19093 second: getAvailableSeconds 19094 }; 19095 let result = date; 19096 ["hour", "minute", "second"].forEach((type) => {
19097 if (availableTimeGetters[type]) { 19098 let availableTimeSlots; 19099 const method = availableTimeGetters[type]; 19100 switch (type) { 19101 case "minute": { 19102 availableTimeSlots = method(result.hour(), role, compareDate); 19103 break; 19104 } 19105 case "second": { 19106 availableTimeSlots = method(result.hour(), result.minute(), role, compareDate); 19107 break; 19108 } 19109 default: { 19110 availableTimeSlots = method(role, compareDate); 19111 break; 19112 } 19113 } 19114 if ((availableTimeSlots == null ? void 0 : availableTimeSlots.length) && !availableTimeSlots.includes(result[type]())) { 19115 const pos = first ? 0 : availableTimeSlots.length - 1; 19116 result = result[type](availableTimeSlots[pos]); 19117 } 19118 } 19119 }); 19120 return result; 19121 }; 19122 const timePickerOptions = {}; 19123 const onSetOption = ([key, val]) => { 19124 timePickerOptions[key] = val; 19125 }; 19126 return { 19127 timePickerOptions, 19128 getAvailableTime, 19129 onSetOption 19130 }; 19131 }; 19132 19133 const makeAvailableArr = (disabledList) => { 19134 const trueOrNumber = (isDisabled, index) => isDisabled || index; 19135 const getNumber = (predicate) => predicate !== true; 19136 return disabledList.map(trueOrNumber).filter(getNumber); 19137 }; 19138 const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => { 19139 const getHoursList = (role, compare) => { 19140 return makeList(24, disabledHours && (() => disabledHours == null ? void 0 : disabledHours(role, compare))); 19141 }; 19142 const getMinutesList = (hour, role, compare) => { 19143 return makeList(60, disabledMinutes && (() => disabledMinutes == null ? void 0 : disabledMinutes(hour, role, compare))); 19144 }; 19145 const getSecondsList = (hour, minute, role, compare) => { 19146 return makeList(60, disabledSeconds && (() => disabledSeconds == null ? void 0 : disabledSeconds(hour, minute, role, compare))); 19147 }; 19148 return { 19149 getHoursList, 19150 getMinutesList, 19151 getSecondsList 19152 }; 19153 }; 19154 const buildAvailableTimeSlotGetter = (disabledHours, disabledMinutes, disabledSeconds) => { 19155 const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds); 19156 const getAvailableHours = (role, compare) => { 19157 return makeAvailableArr(getHoursList(role, compare)); 19158 }; 19159 const getAvailableMinutes = (hour, role, compare) => { 19160 return makeAvailableArr(getMinutesList(hour, role, compare)); 19161 }; 19162 const getAvailableSeconds = (hour, minute, role, compare) => { 19163 return makeAvailableArr(getSecondsList(hour, minute, role, compare)); 19164 }; 19165 return { 19166 getAvailableHours, 19167 getAvailableMinutes, 19168 getAvailableSeconds 19169 }; 19170 }; 19171 const useOldValue = (props) => { 19172 const oldValue = vue.ref(props.parsedValue); 19173 vue.watch(() => props.visible, (val) => { 19174 if (!val) { 19175 oldValue.value = props.parsedValue; 19176 } 19177 }); 19178 return oldValue; 19179 }; 19180 19181 const nodeList = /* @__PURE__ */ new Map(); 19182 let startClick; 19183 if (isClient) { 19184 document.addEventListener("mousedown", (e) => startClick = e); 19185 document.addEventListener("mouseup", (e) => { 19186 for (const handlers of nodeList.values()) { 19187 for (const { documentHandler } of handlers) { 19188 documentHandler(e, startClick); 19189 } 19190 } 19191 }); 19192 } 19193 function createDocumentHandler(el, binding) { 19194 let excludes = []; 19195 if (Array.isArray(binding.arg)) { 19196 excludes = binding.arg; 19197 } else if (isElement$1(binding.arg)) { 19198 excludes.push(binding.arg); 19199 } 19200 return function(mouseup, mousedown) { 19201 const popperRef = binding.instance.popperRef; 19202 const mouseUpTarget = mouseup.target; 19203 const mouseDownTarget = mousedown == null ? void 0 : mousedown.target; 19204 const isBound = !binding || !binding.instance; 19205 const isTargetExists = !mouseUpTarget || !mouseDownTarget; 19206 const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget); 19207 const isSelf = el === mouseUpTarget;
19208 const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget); 19209 const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget)); 19210 if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) { 19211 return; 19212 } 19213 binding.value(mouseup, mousedown); 19214 }; 19215 } 19216 const ClickOutside = { 19217 beforeMount(el, binding) { 19218 if (!nodeList.has(el)) { 19219 nodeList.set(el, []); 19220 } 19221 nodeList.get(el).push({ 19222 documentHandler: createDocumentHandler(el, binding), 19223 bindingFn: binding.value 19224 }); 19225 }, 19226 updated(el, binding) { 19227 if (!nodeList.has(el)) { 19228 nodeList.set(el, []); 19229 } 19230 const handlers = nodeList.get(el); 19231 const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue); 19232 const newHandler = { 19233 documentHandler: createDocumentHandler(el, binding), 19234 bindingFn: binding.value 19235 }; 19236 if (oldHandlerIndex >= 0) { 19237 handlers.splice(oldHandlerIndex, 1, newHandler); 19238 } else { 19239 handlers.push(newHandler); 19240 } 19241 }, 19242 unmounted(el) { 19243 nodeList.delete(el); 19244 } 19245 }; 19246 19247 const REPEAT_INTERVAL = 100; 19248 const REPEAT_DELAY = 600; 19249 const vRepeatClick = { 19250 beforeMount(el, binding) { 19251 const value = binding.value; 19252 const { interval = REPEAT_INTERVAL, delay = REPEAT_DELAY } = isFunction$1(value) ? {} : value; 19253 let intervalId; 19254 let delayId; 19255 const handler = () => isFunction$1(value) ? value() : value.handler(); 19256 const clear = () => { 19257 if (delayId) { 19258 clearTimeout(delayId); 19259 delayId = void 0; 19260 } 19261 if (intervalId) { 19262 clearInterval(intervalId); 19263 intervalId = void 0; 19264 } 19265 }; 19266 el.addEventListener("mousedown", (evt) => { 19267 if (evt.button !== 0) 19268 return; 19269 clear(); 19270 handler(); 19271 document.addEventListener("mouseup", () => clear(), { 19272 once: true 19273 }); 19274 delayId = setTimeout(() => { 19275 intervalId = setInterval(() => { 19276 handler(); 19277 }, interval); 19278 }, delay); 19279 }); 19280 } 19281 }; 19282 19283 const FOCUSABLE_CHILDREN = "_trap-focus-children"; 19284 const FOCUS_STACK = []; 19285 const FOCUS_HANDLER = (e) => { 19286 if (FOCUS_STACK.length === 0) 19287 return; 19288 const focusableElement = FOCUS_STACK[FOCUS_STACK.length - 1][FOCUSABLE_CHILDREN]; 19289 if (focusableElement.length > 0 && e.code === EVENT_CODE.tab) { 19290 if (focusableElement.length === 1) { 19291 e.preventDefault(); 19292 if (document.activeElement !== focusableElement[0]) { 19293 focusableElement[0].focus(); 19294 } 19295 return; 19296 } 19297 const goingBackward = e.shiftKey; 19298 const isFirst = e.target === focusableElement[0]; 19299 const isLast = e.target === focusableElement[focusableElement.length - 1]; 19300 if (isFirst && goingBackward) { 19301 e.preventDefault(); 19302 focusableElement[focusableElement.length - 1].focus(); 19303 } 19304 if (isLast && !goingBackward) { 19305 e.preventDefault(); 19306 focusableElement[0].focus(); 19307 } 19308 } 19309 }; 19310 const TrapFocus = { 19311 beforeMount(el) { 19312 el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el); 19313 FOCUS_STACK.push(el); 19314 if (FOCUS_STACK.length <= 1) { 19315 document.addEventListener("keydown", FOCUS_HANDLER); 19316 } 19317 }, 19318 updated(el) { 19319 vue.nextTick(() => { 19320 el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el); 19321 }); 19322 }, 19323 unmounted() { 19324 FOCUS_STACK.shift(); 19325 if (FOCUS_STACK.length === 0) { 19326 document.removeEventListener("keydown", FOCUS_HANDLER); 19327 } 19328 } 19329 }; 19330 19331 var v=!1,o,f,s,u,d,N,l,p,m,w,D,x,E,M,F;function a(){if(!v){v=!0;var e=navigator.userAgent,n=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Ice
vendor: 4,087 bytes, lines 19331-19378
19331weasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e),i=/(Mac OS X)|(Windows)|(Linux)/.exec(e);if(x=/\b(iPhone|iP[ao]d)/.exec(e),E=/\b(iP[ao]d)/.exec(e),w=/Android/i.exec(e),M=/FBAN\/\w+;/i.exec(e),F=/Mobile/i.exec(e),D=!!/Win64/.exec(e),n){o=n[1]?parseFloat(n[1]):n[5]?parseFloat(n[5]):NaN,o&&document&&document.documentMode&&(o=document.documentMode);var r=/(?:Trident\/(\d+.\d+))/.exec(e);N=r?parseFloat(r[1])+4:o,f=n[2]?parseFloat(n[2]):NaN,s=n[3]?parseFloat(n[3]):NaN,u=n[4]?parseFloat(n[4]):NaN,u?(n=/(?:Chrome\/(\d+\.\d+))/.exec(e),d=n&&n[1]?parseFloat(n[1]):NaN):d=NaN;}else o=f=s=d=u=NaN;if(i){if(i[1]){var t=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);l=t?parseFloat(t[1].replace("_",".")):!0;}else l=!1;p=!!i[2],m=!!i[3];}else l=p=m=!1;}}var _={ie:function(){return a()||o},ieCompatibilityMode:function(){return a()||N>o},ie64:function(){return _.ie()&&D},firefox:function(){return a()||f},opera:function(){return a()||s},webkit:function(){return a()||u},safari:function(){return _.webkit()},chrome:function(){return a()||d},windows:function(){return a()||p},osx:function(){return a()||l},linux:function(){return a()||m},iphone:function(){return a()||x},mobile:function(){return a()||x||E||w||F},nativeApp:function(){return a()||M},android:function(){return a()||w},ipad:function(){return a()||E}},A=_;var c=!!(typeof window<"u"&&window.document&&window.document.createElement),U={canUseDOM:c,canUseWorkers:typeof Worker<"u",canUseEventListeners:c&&!!(window.addEventListener||window.attachEvent),canUseViewport:c&&!!window.screen,isInWorker:!c},h=U;var X;h.canUseDOM&&(X=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);function S(e,n){if(!h.canUseDOM||n&&!("addEventListener"in document))return !1;var i="on"+e,r=i in document;if(!r){var t=document.createElement("div");t.setAttribute(i,"return;"),r=typeof t[i]=="function";}return !r&&X&&e==="wheel"&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var b=S;var O=10,I=40,P=800;function T(e){var n=0,i=0,r=0,t=0;return "detail"in e&&(i=e.detail),"wheelDelta"in e&&(i=-e.wheelDelta/120),"wheelDeltaY"in e&&(i=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(n=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(n=i,i=0),r=n*O,t=i*O,"deltaY"in e&&(t=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||t)&&e.deltaMode&&(e.deltaMode==1?(r*=I,t*=I):(r*=P,t*=P)),r&&!n&&(n=r<1?-1:1),t&&!i&&(i=t<1?-1:1),{spinX:n,spinY:i,pixelX:r,pixelY:t}}T.getEventType=function(){return A.firefox()?"DOMMouseScroll":b("wheel")?"wheel":"mousewheel"};var Y=T;/** 19332 * Checks if an event is supported in the current execution environment. 19333 * 19334 * NOTE: This will not work correctly for non-generic events such as `change`, 19335 * `reset`, `load`, `error`, and `select`. 19336 * 19337 * Borrows from Modernizr. 19338 * 19339 * @param {string} eventNameSuffix Event name, e.g. "click". 19340 * @param {?boolean} capture Check if the capture phase is supported. 19341 * @return {boolean} True if the event is supported. 19342 * @internal 19343 * @license Modernizr 3.0.0pre (Custom Build) | MIT 19344 */ 19345 19346 const mousewheel = function(element, callback) { 19347 if (element && element.addEventListener) { 19348 const fn = function(event) { 19349 const normalized = Y(event); 19350 callback && Reflect.apply(callback, this, [event, normalized]); 19351 }; 19352 element.addEventListener("wheel", fn, { passive: true }); 19353 } 19354 }; 19355 const Mousewheel = { 19356 beforeMount(el, binding) { 19357 mousewheel(el, binding.value); 19358 } 19359 }; 19360 19361 const basicTimeSpinnerProps = buildProps({ 19362 role: { 19363 type: String, 19364 required: true 19365 }, 19366 spinnerDate: { 19367 type: definePropType(Object), 19368 required: true 19369 }, 19370 showSeconds: { 19371 type: Boolean, 19372 default: true 19373 }, 19374 arrowControl: Boolean, 19375 amPmMode: { 19376 type: definePropType(String), 19377 default: "" 19378 },
19379 ...disabledTimeListsProps 19380 }); 19381 19382 const _hoisted_1$X = ["onClick"]; 19383 const _hoisted_2$C = ["onMouseenter"]; 19384 const _sfc_main$1U = /* @__PURE__ */ vue.defineComponent({ 19385 __name: "basic-time-spinner", 19386 props: basicTimeSpinnerProps, 19387 emits: ["change", "select-range", "set-option"], 19388 setup(__props, { emit }) { 19389 const props = __props; 19390 const ns = useNamespace("time"); 19391 const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds); 19392 let isScrolling = false; 19393 const currentScrollbar = vue.ref(); 19394 const listHoursRef = vue.ref(); 19395 const listMinutesRef = vue.ref(); 19396 const listSecondsRef = vue.ref(); 19397 const listRefsMap = { 19398 hours: listHoursRef, 19399 minutes: listMinutesRef, 19400 seconds: listSecondsRef 19401 }; 19402 const spinnerItems = vue.computed(() => { 19403 return props.showSeconds ? timeUnits$1 : timeUnits$1.slice(0, 2); 19404 }); 19405 const timePartials = vue.computed(() => { 19406 const { spinnerDate } = props; 19407 const hours = spinnerDate.hour(); 19408 const minutes = spinnerDate.minute(); 19409 const seconds = spinnerDate.second(); 19410 return { hours, minutes, seconds }; 19411 }); 19412 const timeList = vue.computed(() => { 19413 const { hours, minutes } = vue.unref(timePartials); 19414 return { 19415 hours: getHoursList(props.role), 19416 minutes: getMinutesList(hours, props.role), 19417 seconds: getSecondsList(hours, minutes, props.role) 19418 }; 19419 }); 19420 const arrowControlTimeList = vue.computed(() => { 19421 const { hours, minutes, seconds } = vue.unref(timePartials); 19422 return { 19423 hours: buildTimeList(hours, 23), 19424 minutes: buildTimeList(minutes, 59), 19425 seconds: buildTimeList(seconds, 59) 19426 }; 19427 }); 19428 const debouncedResetScroll = debounce((type) => { 19429 isScrolling = false; 19430 adjustCurrentSpinner(type); 19431 }, 200); 19432 const getAmPmFlag = (hour) => { 19433 const shouldShowAmPm = !!props.amPmMode; 19434 if (!shouldShowAmPm) 19435 return ""; 19436 const isCapital = props.amPmMode === "A"; 19437 let content = hour < 12 ? " am" : " pm"; 19438 if (isCapital) 19439 content = content.toUpperCase(); 19440 return content; 19441 }; 19442 const emitSelectRange = (type) => { 19443 let range; 19444 switch (type) { 19445 case "hours": 19446 range = [0, 2]; 19447 break; 19448 case "minutes": 19449 range = [3, 5]; 19450 break; 19451 case "seconds": 19452 range = [6, 8]; 19453 break; 19454 } 19455 const [left, right] = range; 19456 emit("select-range", left, right); 19457 currentScrollbar.value = type; 19458 }; 19459 const adjustCurrentSpinner = (type) => { 19460 adjustSpinner(type, vue.unref(timePartials)[type]); 19461 }; 19462 const adjustSpinners = () => { 19463 adjustCurrentSpinner("hours"); 19464 adjustCurrentSpinner("minutes"); 19465 adjustCurrentSpinner("seconds"); 19466 }; 19467 const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`); 19468 const adjustSpinner = (type, value) => { 19469 if (props.arrowControl) 19470 return; 19471 const scrollbar = vue.unref(listRefsMap[type]); 19472 if (scrollbar && scrollbar.$el) { 19473 getScrollbarElement(scrollbar.$el).scrollTop = Math.max(0, value * typeItemHeight(type)); 19474 } 19475 }; 19476 const typeItemHeight = (type) => { 19477 const scrollbar = vue.unref(listRefsMap[type]); 19478 return (scrollbar == null ? void 0 : scrollbar.$el.querySelector("li").offsetHeight) || 0; 19479 }; 19480 const onIncrement = () => { 19481 scrollDown(1); 19482 }; 19483 const onDecrement = () => { 19484 scrollDown(-1); 19485 }; 19486 const scrollDown = (step) => { 19487 if (!currentScrollbar.value) { 19488 emitSelectRange("hours"); 19489 } 19490 const label = currentScrollbar.value; 19491 const now = vue.unref(timePartials)[label]; 19492 const total = currentScrollbar.value === "hours" ? 24 : 60; 19493 const next = findNextUnDisabled(label, now, step, total); 19494 modifyDateField(label, next); 19495 adjustSpinner(label, next); 19496 vue.nextTick(() => emitSelectRange(label)); 19497 }; 19498 const findNextUnDisabled = (type, now, step, total) => { 19499 let next = (now + step + total) % total; 19500 const list = vue.unref(timeList)[type]; 19501 while (list[next] && next !== now) { 19502 next = (next + step + total) % total; 19503 } 19504 return next; 19505 }; 19506 const modifyDateField = (type, value) => { 19507 const list = vue.unref(timeList)[type]; 19508 const isDisabled = list[value]; 19509 if (isDisabled) 19510 return; 19511 const { hours, minutes, seconds } = vue.unref(timePartials); 19512 let changeTo; 19513 switch (type) { 19514 case "hours": 19515 changeTo = props.spinnerDate.hour(value).minute(minutes).second(seconds); 19516 break; 19517 case "minutes": 19518 changeTo = props.spinnerDate.hour(hours).minute(value).second(seconds); 19519 break; 19520 case "seconds": 19521 changeTo = props.spinnerDate.hour(hours).minute(minutes).second(value); 19522 break; 19523 } 19524 emit("change", changeTo); 19525 }; 19526 const handleClick = (type, { value, disabled }) => { 19527 if (!disabled) { 19528 modifyDateField(type, value); 19529 emitSelectRange(type); 19530 adjustSpinner(type, value); 19531 } 19532 }; 19533 const handleScroll = (type) => { 19534 isScrolling = true; 19535 debouncedResetScroll(type); 19536 const value = Math.min(Math.round((getScrollbarElement(vue.unref(listRefsMap[type]).$el).scrollTop - (scrollBarHeight(type) * 0.5 - 10) / typeItemHeight(type) + 3) / typeItemHeight(type)), type === "hours" ? 23 : 59); 19537 modifyDateField(type, value); 19538 }; 19539 const scrollBarHeight = (type) => { 19540 return vue.unref(listRefsMap[type]).$el.offsetHeight; 19541 }; 19542 const bindScrollEvent = () => { 19543 const bindFunction = (type) => { 19544 const scrollbar = vue.unref(listRefsMap[type]); 19545 if (scrollbar && scrollbar.$el) { 19546 getScrollbarElement(scrollbar.$el).onscroll = () => { 19547 handleScroll(type); 19548 }; 19549 } 19550 }; 19551 bindFunction("hours"); 19552 bindFunction("minutes"); 19553 bindFunction("seconds"); 19554 }; 19555 vue.onMounted(() => { 19556 vue.nextTick(() => { 19557 !props.arrowControl && bindScrollEvent(); 19558 adjustSpinners(); 19559 if (props.role === "start") 19560 emitSelectRange("hours"); 19561 }); 19562 }); 19563 const setRef = (scrollbar, type) => { 19564 listRefsMap[type].value = scrollbar; 19565 }; 19566 emit("set-option", [`${props.role}_scrollDown`, scrollDown]); 19567 emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]); 19568 vue.watch(() => props.spinnerDate, () => { 19569 if (isScrolling) 19570 return; 19571 adjustSpinners(); 19572 }); 19573 return (_ctx, _cache) => {
19574 return vue.openBlock(), vue.createElementBlock("div", { 19575 class: vue.normalizeClass([vue.unref(ns).b("spinner"), { "has-seconds": _ctx.showSeconds }]) 19576 }, [ 19577 !_ctx.arrowControl ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(vue.unref(spinnerItems), (item) => { 19578 return vue.openBlock(), vue.createBlock(vue.unref(ElScrollbar), { 19579 key: item, 19580 ref_for: true, 19581 ref: (scrollbar) => setRef(scrollbar, item), 19582 class: vue.normalizeClass(vue.unref(ns).be("spinner", "wrapper")), 19583 "wrap-style": "max-height: inherit;", 19584 "view-class": vue.unref(ns).be("spinner", "list"), 19585 noresize: "", 19586 tag: "ul", 19587 onMouseenter: ($event) => emitSelectRange(item), 19588 onMousemove: ($event) => adjustCurrentSpinner(item) 19589 }, { 19590 default: vue.withCtx(() => [ 19591 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(timeList)[item], (disabled, key) => { 19592 return vue.openBlock(), vue.createElementBlock("li", { 19593 key, 19594 class: vue.normalizeClass([ 19595 vue.unref(ns).be("spinner", "item"), 19596 vue.unref(ns).is("active", key === vue.unref(timePartials)[item]), 19597 vue.unref(ns).is("disabled", disabled) 19598 ]), 19599 onClick: ($event) => handleClick(item, { value: key, disabled }) 19600 }, [ 19601 item === "hours" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ 19602 vue.createTextVNode(vue.toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + vue.toDisplayString(getAmPmFlag(key)), 1) 19603 ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [ 19604 vue.createTextVNode(vue.toDisplayString(("0" + key).slice(-2)), 1) 19605 ], 64)) 19606 ], 10, _hoisted_1$X); 19607 }), 128)) 19608 ]), 19609 _: 2 19610 }, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]); 19611 }), 128)) : vue.createCommentVNode("v-if", true), 19612 _ctx.arrowControl ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(vue.unref(spinnerItems), (item) => { 19613 return vue.openBlock(), vue.createElementBlock("div", { 19614 key: item, 19615 class: vue.normalizeClass([vue.unref(ns).be("spinner", "wrapper"), vue.unref(ns).is("arrow")]), 19616 onMouseenter: ($event) => emitSelectRange(item) 19617 }, [ 19618 vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 19619 class: vue.normalizeClass(["arrow-up", vue.unref(ns).be("spinner", "arrow")]) 19620 }, { 19621 default: vue.withCtx(() => [ 19622 vue.createVNode(vue.unref(arrow_up_default)) 19623 ]), 19624 _: 1 19625 }, 8, ["class"])), [ 19626 [vue.unref(vRepeatClick), onDecrement] 19627 ]), 19628 vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 19629 class: vue.normalizeClass(["arrow-down", vue.unref(ns).be("spinner", "arrow")]) 19630 }, { 19631 default: vue.withCtx(() => [ 19632 vue.createVNode(vue.unref(arrow_down_default)) 19633 ]), 19634 _: 1 19635 }, 8, ["class"])), [ 19636 [vue.unref(vRepeatClick), onIncrement] 19637 ]), 19638 vue.createElementVNode("ul", { 19639 class: vue.normalizeClass(vue.unref(ns).be("spinner", "list")) 19640 }, [ 19641 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(arrowControlTimeList)[item], (time, key) => {
19642 return vue.openBlock(), vue.createElementBlock("li", { 19643 key, 19644 class: vue.normalizeClass([ 19645 vue.unref(ns).be("spinner", "item"), 19646 vue.unref(ns).is("active", time === vue.unref(timePartials)[item]), 19647 vue.unref(ns).is("disabled", vue.unref(timeList)[item][time]) 19648 ]) 19649 }, [ 19650 typeof time === "number" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ 19651 item === "hours" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ 19652 vue.createTextVNode(vue.toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + vue.toDisplayString(getAmPmFlag(time)), 1) 19653 ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [ 19654 vue.createTextVNode(vue.toDisplayString(("0" + time).slice(-2)), 1) 19655 ], 64)) 19656 ], 64)) : vue.createCommentVNode("v-if", true) 19657 ], 2); 19658 }), 128)) 19659 ], 2) 19660 ], 42, _hoisted_2$C); 19661 }), 128)) : vue.createCommentVNode("v-if", true) 19662 ], 2); 19663 }; 19664 } 19665 }); 19666 var TimeSpinner = /* @__PURE__ */ _export_sfc(_sfc_main$1U, [["__file", "basic-time-spinner.vue"]]); 19667 19668 const _sfc_main$1T = /* @__PURE__ */ vue.defineComponent({ 19669 __name: "panel-time-pick", 19670 props: panelTimePickerProps, 19671 emits: ["pick", "select-range", "set-picker-option"], 19672 setup(__props, { emit }) { 19673 const props = __props; 19674 const pickerBase = vue.inject("EP_PICKER_BASE"); 19675 const { 19676 arrowControl, 19677 disabledHours, 19678 disabledMinutes, 19679 disabledSeconds, 19680 defaultValue 19681 } = pickerBase.props; 19682 const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours, disabledMinutes, disabledSeconds); 19683 const ns = useNamespace("time"); 19684 const { t, lang } = useLocale(); 19685 const selectionRange = vue.ref([0, 2]); 19686 const oldValue = useOldValue(props); 19687 const transitionName = vue.computed(() => { 19688 return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : ""; 19689 }); 19690 const showSeconds = vue.computed(() => { 19691 return props.format.includes("ss"); 19692 }); 19693 const amPmMode = vue.computed(() => { 19694 if (props.format.includes("A")) 19695 return "A"; 19696 if (props.format.includes("a")) 19697 return "a"; 19698 return ""; 19699 }); 19700 const isValidValue = (_date) => { 19701 const parsedDate = dayjs(_date).locale(lang.value); 19702 const result = getRangeAvailableTime(parsedDate); 19703 return parsedDate.isSame(result); 19704 }; 19705 const handleCancel = () => { 19706 emit("pick", oldValue.value, false); 19707 }; 19708 const handleConfirm = (visible = false, first = false) => { 19709 if (first) 19710 return; 19711 emit("pick", props.parsedValue, visible); 19712 }; 19713 const handleChange = (_date) => { 19714 if (!props.visible) { 19715 return; 19716 } 19717 const result = getRangeAvailableTime(_date).millisecond(0); 19718 emit("pick", result, true); 19719 }; 19720 const setSelectionRange = (start, end) => { 19721 emit("select-range", start, end); 19722 selectionRange.value = [start, end]; 19723 }; 19724 const changeSelectionRange = (step) => { 19725 const list = [0, 3].concat(showSeconds.value ? [6] : []); 19726 const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []); 19727 const index = list.indexOf(selectionRange.value[0]); 19728 const next = (index + step + list.length) % list.length; 19729 timePickerOptions["start_emitSelectRange"](mapping[next]); 19730 }; 19731 const handleKeydown = (event) => { 19732 const code = event.code; 19733 const { left, right, up, down } = EVENT_CODE; 19734 if ([left, right].includes(code)) { 19735 const step = code === left ? -1 : 1; 19736 changeSelectionRange(step); 19737 event.preventDefault(); 19738 return; 19739 } 19740 if ([up, down].includes(code)) { 19741 const step = code === up ? -1 : 1; 19742 timePickerOptions["start_scrollDown"](step); 19743 event.preventDefault(); 19744 return; 19745 } 19746 }; 19747 const { timePickerOptions, onSetOption, getAvailableTime } = useTimePanel({ 19748 getAvailableHours, 19749 getAvailableMinutes, 19750 getAvailableSeconds 19751 }); 19752 const getRangeAvailableTime = (date) => {
19753 return getAvailableTime(date, props.datetimeRole || "", true); 19754 }; 19755 const parseUserInput = (value) => { 19756 if (!value) 19757 return null; 19758 return dayjs(value, props.format).locale(lang.value); 19759 }; 19760 const formatToString = (value) => { 19761 if (!value) 19762 return null; 19763 return value.format(props.format); 19764 }; 19765 const getDefaultValue = () => { 19766 return dayjs(defaultValue).locale(lang.value); 19767 }; 19768 emit("set-picker-option", ["isValidValue", isValidValue]); 19769 emit("set-picker-option", ["formatToString", formatToString]); 19770 emit("set-picker-option", ["parseUserInput", parseUserInput]); 19771 emit("set-picker-option", ["handleKeydownInput", handleKeydown]); 19772 emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]); 19773 emit("set-picker-option", ["getDefaultValue", getDefaultValue]); 19774 return (_ctx, _cache) => { 19775 return vue.openBlock(), vue.createBlock(vue.Transition, { name: vue.unref(transitionName) }, { 19776 default: vue.withCtx(() => [ 19777 _ctx.actualVisible || _ctx.visible ? (vue.openBlock(), vue.createElementBlock("div", { 19778 key: 0, 19779 class: vue.normalizeClass(vue.unref(ns).b("panel")) 19780 }, [ 19781 vue.createElementVNode("div", { 19782 class: vue.normalizeClass([vue.unref(ns).be("panel", "content"), { "has-seconds": vue.unref(showSeconds) }]) 19783 }, [ 19784 vue.createVNode(TimeSpinner, { 19785 ref: "spinner", 19786 role: _ctx.datetimeRole || "start", 19787 "arrow-control": vue.unref(arrowControl), 19788 "show-seconds": vue.unref(showSeconds), 19789 "am-pm-mode": vue.unref(amPmMode), 19790 "spinner-date": _ctx.parsedValue, 19791 "disabled-hours": vue.unref(disabledHours), 19792 "disabled-minutes": vue.unref(disabledMinutes), 19793 "disabled-seconds": vue.unref(disabledSeconds), 19794 onChange: handleChange, 19795 onSetOption: vue.unref(onSetOption), 19796 onSelectRange: setSelectionRange 19797 }, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onSetOption"]) 19798 ], 2), 19799 vue.createElementVNode("div", { 19800 class: vue.normalizeClass(vue.unref(ns).be("panel", "footer")) 19801 }, [ 19802 vue.createElementVNode("button", { 19803 type: "button", 19804 class: vue.normalizeClass([vue.unref(ns).be("panel", "btn"), "cancel"]), 19805 onClick: handleCancel 19806 }, vue.toDisplayString(vue.unref(t)("el.datepicker.cancel")), 3), 19807 vue.createElementVNode("button", { 19808 type: "button", 19809 class: vue.normalizeClass([vue.unref(ns).be("panel", "btn"), "confirm"]), 19810 onClick: _cache[0] || (_cache[0] = ($event) => handleConfirm()) 19811 }, vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 3) 19812 ], 2) 19813 ], 2)) : vue.createCommentVNode("v-if", true) 19814 ]), 19815 _: 1 19816 }, 8, ["name"]); 19817 }; 19818 } 19819 }); 19820 var TimePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1T, [["__file", "panel-time-pick.vue"]]); 19821 19822 const panelTimeRangeProps = buildProps({ 19823 ...timePanelSharedProps, 19824 parsedValue: { 19825 type: definePropType(Array) 19826 } 19827 }); 19828 19829 const _hoisted_1$W = ["disabled"]; 19830 const _sfc_main$1S = /* @__PURE__ */ vue.defineComponent({ 19831 __name: "panel-time-range", 19832 props: panelTimeRangeProps, 19833 emits: ["pick", "select-range", "set-picker-option"], 19834 setup(__props, { emit }) { 19835 const props = __props; 19836 const makeSelectRange = (start, end) => { 19837 const result = []; 19838 for (let i = start; i <= end; i++) { 19839 result.push(i); 19840 } 19841 return result; 19842 }; 19843 const { t, lang } = useLocale(); 19844 const nsTime = useNamespace("time"); 19845 const nsPicker = useNamespace("picker"); 19846 const pickerBase = vue.inject("EP_PICKER_BASE"); 19847 const { 19848 arrowControl, 19849 disabledHours, 19850 disabledMinutes, 19851 disabledSeconds, 19852 defaultValue 19853 } = pickerBase.props; 19854 const startTime = vue.computed(() => props.parsedValue[0]); 19855 const endTime = vue.computed(() => props.parsedValue[1]); 19856 const oldValue = useOldValue(props); 19857 const handleCancel = () => { 19858 emit("pick", oldValue.value, false); 19859 }; 19860 const showSeconds = vue.computed(() => { 19861 return props.format.includes("ss"); 19862 }); 19863 const amPmMode = vue.computed(() => { 19864 if (props.format.includes("A")) 19865 return "A"; 19866 if (props.format.includes("a")) 19867 return "a"; 19868 return ""; 19869 }); 19870 const handleConfirm = (visible = false) => { 19871 emit("pick", [startTime.value, endTime.value], visible); 19872 }; 19873 const handleMinChange = (date) => { 19874 handleChange(date.millisecond(0), endTime.value); 19875 }; 19876 const handleMaxChange = (date) => { 19877 handleChange(startTime.value, date.millisecond(0)); 19878 }; 19879 const isValidValue = (_date) => { 19880 const parsedDate = _date.map((_) => dayjs(_).locale(lang.value)); 19881 const result = getRangeAvailableTime(parsedDate); 19882 return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]); 19883 }; 19884 const handleChange = (start, end) => { 19885 emit("pick", [start, end], true); 19886 }; 19887 const btnConfirmDisabled = vue.computed(() => { 19888 return startTime.value > endTime.value; 19889 }); 19890 const selectionRange = vue.ref([0, 2]); 19891 const setMinSelectionRange = (start, end) => { 19892 emit("select-range", start, end, "min"); 19893 selectionRange.value = [start, end]; 19894 }; 19895 const offset = vue.computed(() => showSeconds.value ? 11 : 8);
19896 const setMaxSelectionRange = (start, end) => { 19897 emit("select-range", start, end, "max"); 19898 const _offset = vue.unref(offset); 19899 selectionRange.value = [start + _offset, end + _offset]; 19900 }; 19901 const changeSelectionRange = (step) => { 19902 const list = showSeconds.value ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11]; 19903 const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []); 19904 const index = list.indexOf(selectionRange.value[0]); 19905 const next = (index + step + list.length) % list.length; 19906 const half = list.length / 2; 19907 if (next < half) { 19908 timePickerOptions["start_emitSelectRange"](mapping[next]); 19909 } else { 19910 timePickerOptions["end_emitSelectRange"](mapping[next - half]); 19911 } 19912 }; 19913 const handleKeydown = (event) => { 19914 const code = event.code; 19915 const { left, right, up, down } = EVENT_CODE; 19916 if ([left, right].includes(code)) { 19917 const step = code === left ? -1 : 1; 19918 changeSelectionRange(step); 19919 event.preventDefault(); 19920 return; 19921 } 19922 if ([up, down].includes(code)) { 19923 const step = code === up ? -1 : 1; 19924 const role = selectionRange.value[0] < offset.value ? "start" : "end"; 19925 timePickerOptions[`${role}_scrollDown`](step); 19926 event.preventDefault(); 19927 return; 19928 } 19929 }; 19930 const disabledHours_ = (role, compare) => { 19931 const defaultDisable = disabledHours ? disabledHours(role) : []; 19932 const isStart = role === "start"; 19933 const compareDate = compare || (isStart ? endTime.value : startTime.value); 19934 const compareHour = compareDate.hour(); 19935 const nextDisable = isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1); 19936 return union(defaultDisable, nextDisable); 19937 }; 19938 const disabledMinutes_ = (hour, role, compare) => { 19939 const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : []; 19940 const isStart = role === "start"; 19941 const compareDate = compare || (isStart ? endTime.value : startTime.value); 19942 const compareHour = compareDate.hour(); 19943 if (hour !== compareHour) { 19944 return defaultDisable; 19945 } 19946 const compareMinute = compareDate.minute(); 19947 const nextDisable = isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1); 19948 return union(defaultDisable, nextDisable); 19949 }; 19950 const disabledSeconds_ = (hour, minute, role, compare) => { 19951 const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : []; 19952 const isStart = role === "start"; 19953 const compareDate = compare || (isStart ? endTime.value : startTime.value); 19954 const compareHour = compareDate.hour(); 19955 const compareMinute = compareDate.minute(); 19956 if (hour !== compareHour || minute !== compareMinute) { 19957 return defaultDisable; 19958 } 19959 const compareSecond = compareDate.second(); 19960 const nextDisable = isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1); 19961 return union(defaultDisable, nextDisable); 19962 }; 19963 const getRangeAvailableTime = ([start, end]) => { 19964 return [ 19965 getAvailableTime(start, "start", true, end), 19966 getAvailableTime(end, "end", false, start) 19967 ]; 19968 }; 19969 const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours_, disabledMinutes_, disabledSeconds_); 19970 const { 19971 timePickerOptions, 19972 getAvailableTime, 19973 onSetOption 19974 } = useTimePanel({ 19975 getAvailableHours, 19976 getAvailableMinutes, 19977 getAvailableSeconds 19978 }); 19979 const parseUserInput = (days) => { 19980 if (!days) 19981 return null; 19982 if (isArray$1(days)) { 19983 return days.map((d) => dayjs(d, props.format).locale(lang.value)); 19984 } 19985 return dayjs(days, props.format).locale(lang.value); 19986 }; 19987 const formatToString = (days) => { 19988 if (!days) 19989 return null; 19990 if (isArray$1(days)) { 19991 return days.map((d) => d.format(props.format)); 19992 } 19993 return days.format(props.format); 19994 }; 19995 const getDefaultValue = () => { 19996 if (isArray$1(defaultValue)) { 19997 return defaultValue.map((d) => dayjs(d).locale(lang.value)); 19998 } 19999 const defaultDay = dayjs(defaultValue).locale(lang.value); 20000 return [defaultDay, defaultDay.add(60, "m")]; 20001 }; 20002 emit("set-picker-option", ["formatToString", formatToString]); 20003 emit("set-picker-option", ["parseUserInput", parseUserInput]); 20004 emit("set-picker-option", ["isValidValue", isValidValue]); 20005 emit("set-picker-option", ["handleKeydownInput", handleKeydown]); 20006 emit("set-picker-option", ["getDefaultValue", getDefaultValue]); 20007 emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]); 20008 return (_ctx, _cache) => { 20009 return _ctx.actualVisible ? (vue.openBlock(), vue.createElementBlock("div", { 20010 key: 0, 20011 class: vue.normalizeClass([vue.unref(nsTime).b("range-picker"), vue.unref(nsPicker).b("panel")]) 20012 }, [ 20013 vue.createElementVNode("div", { 20014 class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "content")) 20015 }, [ 20016 vue.createElementVNode("div", { 20017 class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "cell")) 20018 }, [ 20019 vue.createElementVNode("div", { 20020 class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "header")) 20021 }, vue.toDisplayString(vue.unref(t)("el.datepicker.startTime")), 3), 20022 vue.createElementVNode("div", { 20023 class: vue.normalizeClass([ 20024 vue.unref(nsTime).be("range-picker", "body"), 20025 vue.unref(nsTime).be("panel", "content"), 20026 vue.unref(nsTime).is("arrow", vue.unref(arrowControl)), 20027 { "has-seconds": vue.unref(showSeconds) } 20028 ]) 20029 }, [ 20030 vue.createVNode(TimeSpinner, { 20031 ref: "minSpinner", 20032 role: "start", 20033 "show-seconds": vue.unref(showSeconds), 20034 "am-pm-mode": vue.unref(amPmMode), 20035 "arrow-control": vue.unref(arrowControl), 20036 "spinner-date": vue.unref(startTime), 20037 "disabled-hours": disabledHours_, 20038 "disabled-minutes": disabledMinutes_, 20039 "disabled-seconds": disabledSeconds_, 20040 onChange: handleMinChange, 20041 onSetOption: vue.unref(onSetOption), 20042 onSelectRange: setMinSelectionRange 20043 }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"]) 20044 ], 2) 20045 ], 2), 20046 vue.createElementVNode("div", { 20047 class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "cell")) 20048 }, [ 20049 vue.createElementVNode("div", { 20050 class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "header")) 20051 }, vue.toDisplayString(vue.unref(t)("el.datepicker.endTime")), 3), 20052 vue.createElementVNode("div", { 20053 class: vue.normalizeClass([ 20054 vue.unref(nsTime).be("range-picker", "body"), 20055 vue.unref(nsTime).be("panel", "content"), 20056 vue.unref(nsTime).is("arrow", vue.unref(arrowControl)), 20057 { "has-seconds": vue.unref(showSeconds) } 20058 ]) 20059 }, [ 20060 vue.createVNode(TimeSpinner, { 20061 ref: "maxSpinner", 20062 role: "end", 20063 "show-seconds": vue.unref(showSeconds), 20064 "am-pm-mode": vue.unref(amPmMode), 20065 "arrow-control": vue.unref(arrowControl), 20066 "spinner-date": vue.unref(endTime), 20067 "disabled-hours": disabledHours_, 20068 "disabled-minutes": disabledMinutes_, 20069 "disabled-seconds": disabledSeconds_, 20070 onChange: handleMaxChange, 20071 onSetOption: vue.unref(onSetOption), 20072 onSelectRange: setMaxSelectionRange 20073 }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"]) 20074 ], 2) 20075 ], 2) 20076 ], 2), 20077 vue.createElementVNode("div", { 20078 class: vue.normalizeClass(vue.unref(nsTime).be("panel", "footer")) 20079 }, [ 20080 vue.createElementVNode("button", { 20081 type: "button", 20082 class: vue.normalizeClass([vue.unref(nsTime).be("panel", "btn"), "cancel"]), 20083 onClick: _cache[0] || (_cache[0] = ($event) => handleCancel()) 20084 }, vue.toDisplayString(vue.unref(t)("el.datepicker.cancel")), 3), 20085 vue.createElementVNode("button", { 20086 type: "button", 20087 class: vue.normalizeClass([vue.unref(nsTime).be("panel", "btn"), "confirm"]), 20088 disabled: vue.unref(btnConfirmDisabled), 20089 onClick: _cache[1] || (_cache[1] = ($event) => handleConfirm()) 20090 }, vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 11, _hoisted_1$W) 20091 ], 2) 20092 ], 2)) : vue.createCommentVNode("v-if", true); 20093 }; 20094 } 20095 });
20096 var TimeRangePanel = /* @__PURE__ */ _export_sfc(_sfc_main$1S, [["__file", "panel-time-range.vue"]]); 20097 20098 dayjs.extend(customParseFormat); 20099 var TimePicker = vue.defineComponent({ 20100 name: "ElTimePicker", 20101 install: null, 20102 props: { 20103 ...timePickerDefaultProps, 20104 isRange: { 20105 type: Boolean, 20106 default: false 20107 } 20108 }, 20109 emits: ["update:modelValue"], 20110 setup(props, ctx) { 20111 const commonPicker = vue.ref(); 20112 const [type, Panel] = props.isRange ? ["timerange", TimeRangePanel] : ["time", TimePickPanel]; 20113 const modelUpdater = (value) => ctx.emit("update:modelValue", value); 20114 vue.provide("ElPopperOptions", props.popperOptions); 20115 ctx.expose({ 20116 focus: (e) => { 20117 var _a; 20118 (_a = commonPicker.value) == null ? void 0 : _a.handleFocusInput(e); 20119 }, 20120 blur: (e) => { 20121 var _a; 20122 (_a = commonPicker.value) == null ? void 0 : _a.handleBlurInput(e); 20123 }, 20124 handleOpen: () => { 20125 var _a; 20126 (_a = commonPicker.value) == null ? void 0 : _a.handleOpen(); 20127 }, 20128 handleClose: () => { 20129 var _a; 20130 (_a = commonPicker.value) == null ? void 0 : _a.handleClose(); 20131 } 20132 }); 20133 return () => { 20134 var _a; 20135 const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_TIME; 20136 return vue.createVNode(CommonPicker, vue.mergeProps(props, { 20137 "ref": commonPicker, 20138 "type": type, 20139 "format": format, 20140 "onUpdate:modelValue": modelUpdater 20141 }), { 20142 default: (props2) => vue.createVNode(Panel, props2, null) 20143 }); 20144 }; 20145 } 20146 }); 20147 20148 const _TimePicker = TimePicker; 20149 _TimePicker.install = (app) => { 20150 app.component(_TimePicker.name, _TimePicker); 20151 }; 20152 const ElTimePicker = _TimePicker; 20153 20154 const getPrevMonthLastDays = (date, count) => { 20155 const lastDay = date.subtract(1, "month").endOf("month").date(); 20156 return rangeArr(count).map((_, index) => lastDay - (count - index - 1)); 20157 }; 20158 const getMonthDays = (date) => { 20159 const days = date.daysInMonth(); 20160 return rangeArr(days).map((_, index) => index + 1); 20161 }; 20162 const toNestedArr = (days) => rangeArr(days.length / 7).map((index) => { 20163 const start = index * 7; 20164 return days.slice(start, start + 7); 20165 }); 20166 const dateTableProps = buildProps({ 20167 selectedDay: { 20168 type: definePropType(Object) 20169 }, 20170 range: { 20171 type: definePropType(Array) 20172 }, 20173 date: { 20174 type: definePropType(Object), 20175 required: true 20176 }, 20177 hideHeader: { 20178 type: Boolean 20179 } 20180 }); 20181 const dateTableEmits = { 20182 pick: (value) => isObject$1(value) 20183 }; 20184 20185 var localeData$1 = {exports: {}}; 20186 20187 (function(module, exports) { 20188 !function(n, e) { 20189 module.exports = e() ; 20190 }(commonjsGlobal, function() { 20191 return function(n, e, t) { 20192 var r = e.prototype, o = function(n2) { 20193 return n2 && (n2.indexOf ? n2 : n2.s); 20194 }, u = function(n2, e2, t2, r2, u2) { 20195 var i2 = n2.name ? n2 : n2.$locale(), a2 = o(i2[e2]), s2 = o(i2[t2]), f = a2 || s2.map(function(n3) { 20196 return n3.slice(0, r2); 20197 }); 20198 if (!u2) 20199 return f; 20200 var d = i2.weekStart; 20201 return f.map(function(n3, e3) { 20202 return f[(e3 + (d || 0)) % 7]; 20203 }); 20204 }, i = function() { 20205 return t.Ls[t.locale()]; 20206 }, a = function(n2, e2) { 20207 return n2.formats[e2] || function(n3) { 20208 return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n4, e3, t2) { 20209 return e3 || t2.slice(1); 20210 }); 20211 }(n2.formats[e2.toUpperCase()]); 20212 }, s = function() { 20213 var n2 = this; 20214 return { months: function(e2) { 20215 return e2 ? e2.format("MMMM") : u(n2, "months"); 20216 }, monthsShort: function(e2) { 20217 return e2 ? e2.format("MMM") : u(n2, "monthsShort", "months", 3); 20218 }, firstDayOfWeek: function() { 20219 return n2.$locale().weekStart || 0; 20220 }, weekdays: function(e2) { 20221 return e2 ? e2.format("dddd") : u(n2, "weekdays"); 20222 }, weekdaysMin: function(e2) { 20223 return e2 ? e2.format("dd") : u(n2, "weekdaysMin", "weekdays", 2); 20224 }, weekdaysShort: function(e2) { 20225 return e2 ? e2.format("ddd") : u(n2, "weekdaysShort", "weekdays", 3); 20226 }, longDateFormat: function(e2) { 20227 return a(n2.$locale(), e2); 20228 }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal }; 20229 }; 20230 r.localeData = function() { 20231 return s.bind(this)();
vendor: 4,524 bytes, lines 20232-20352
20232 }, t.localeData = function() { 20233 var n2 = i(); 20234 return { firstDayOfWeek: function() { 20235 return n2.weekStart || 0; 20236 }, weekdays: function() { 20237 return t.weekdays(); 20238 }, weekdaysShort: function() { 20239 return t.weekdaysShort(); 20240 }, weekdaysMin: function() { 20241 return t.weekdaysMin(); 20242 }, months: function() { 20243 return t.months(); 20244 }, monthsShort: function() { 20245 return t.monthsShort(); 20246 }, longDateFormat: function(e2) { 20247 return a(n2, e2); 20248 }, meridiem: n2.meridiem, ordinal: n2.ordinal }; 20249 }, t.months = function() { 20250 return u(i(), "months"); 20251 }, t.monthsShort = function() { 20252 return u(i(), "monthsShort", "months", 3); 20253 }, t.weekdays = function(n2) { 20254 return u(i(), "weekdays", null, null, n2); 20255 }, t.weekdaysShort = function(n2) { 20256 return u(i(), "weekdaysShort", "weekdays", 3, n2); 20257 }, t.weekdaysMin = function(n2) { 20258 return u(i(), "weekdaysMin", "weekdays", 2, n2); 20259 }; 20260 }; 20261 }); 20262 })(localeData$1); 20263 var localeData = localeData$1.exports; 20264 20265 const useDateTable = (props, emit) => { 20266 dayjs.extend(localeData); 20267 const firstDayOfWeek = dayjs.localeData().firstDayOfWeek(); 20268 const { t, lang } = useLocale(); 20269 const now = dayjs().locale(lang.value); 20270 const isInRange = vue.computed(() => !!props.range && !!props.range.length); 20271 const rows = vue.computed(() => { 20272 let days = []; 20273 if (isInRange.value) { 20274 const [start, end] = props.range; 20275 const currentMonthRange = rangeArr(end.date() - start.date() + 1).map((index) => ({ 20276 text: start.date() + index, 20277 type: "current" 20278 })); 20279 let remaining = currentMonthRange.length % 7; 20280 remaining = remaining === 0 ? 0 : 7 - remaining; 20281 const nextMonthRange = rangeArr(remaining).map((_, index) => ({ 20282 text: index + 1, 20283 type: "next" 20284 })); 20285 days = currentMonthRange.concat(nextMonthRange); 20286 } else { 20287 const firstDay = props.date.startOf("month").day(); 20288 const prevMonthDays = getPrevMonthLastDays(props.date, (firstDay - firstDayOfWeek + 7) % 7).map((day) => ({ 20289 text: day, 20290 type: "prev" 20291 })); 20292 const currentMonthDays = getMonthDays(props.date).map((day) => ({ 20293 text: day, 20294 type: "current" 20295 })); 20296 days = [...prevMonthDays, ...currentMonthDays]; 20297 const remaining = 7 - (days.length % 7 || 7); 20298 const nextMonthDays = rangeArr(remaining).map((_, index) => ({ 20299 text: index + 1, 20300 type: "next" 20301 })); 20302 days = days.concat(nextMonthDays); 20303 } 20304 return toNestedArr(days); 20305 }); 20306 const weekDays = vue.computed(() => { 20307 const start = firstDayOfWeek; 20308 if (start === 0) { 20309 return WEEK_DAYS.map((_) => t(`el.datepicker.weeks.${_}`)); 20310 } else { 20311 return WEEK_DAYS.slice(start).concat(WEEK_DAYS.slice(0, start)).map((_) => t(`el.datepicker.weeks.${_}`)); 20312 } 20313 }); 20314 const getFormattedDate = (day, type) => { 20315 switch (type) { 20316 case "prev": 20317 return props.date.startOf("month").subtract(1, "month").date(day); 20318 case "next": 20319 return props.date.startOf("month").add(1, "month").date(day); 20320 case "current": 20321 return props.date.date(day); 20322 } 20323 }; 20324 const handlePickDay = ({ text, type }) => { 20325 const date = getFormattedDate(text, type); 20326 emit("pick", date); 20327 }; 20328 const getSlotData = ({ text, type }) => { 20329 const day = getFormattedDate(text, type); 20330 return { 20331 isSelected: day.isSame(props.selectedDay), 20332 type: `${type}-month`, 20333 day: day.format("YYYY-MM-DD"), 20334 date: day.toDate() 20335 }; 20336 }; 20337 return { 20338 now, 20339 isInRange, 20340 rows, 20341 weekDays, 20342 getFormattedDate, 20343 handlePickDay, 20344 getSlotData 20345 }; 20346 }; 20347 20348 const _hoisted_1$V = { key: 0 }; 20349 const _hoisted_2$B = ["onClick"]; 20350 const __default__$1f = vue.defineComponent({ 20351 name: "DateTable" 20352 });
20353 const _sfc_main$1R = /* @__PURE__ */ vue.defineComponent({ 20354 ...__default__$1f, 20355 props: dateTableProps, 20356 emits: dateTableEmits, 20357 setup(__props, { expose, emit }) { 20358 const props = __props; 20359 const { 20360 isInRange, 20361 now, 20362 rows, 20363 weekDays, 20364 getFormattedDate, 20365 handlePickDay, 20366 getSlotData 20367 } = useDateTable(props, emit); 20368 const nsTable = useNamespace("calendar-table"); 20369 const nsDay = useNamespace("calendar-day"); 20370 const getCellClass = ({ text, type }) => { 20371 const classes = [type]; 20372 if (type === "current") { 20373 const date = getFormattedDate(text, type); 20374 if (date.isSame(props.selectedDay, "day")) { 20375 classes.push(nsDay.is("selected")); 20376 } 20377 if (date.isSame(now, "day")) { 20378 classes.push(nsDay.is("today")); 20379 } 20380 } 20381 return classes; 20382 }; 20383 expose({ 20384 getFormattedDate 20385 }); 20386 return (_ctx, _cache) => { 20387 return vue.openBlock(), vue.createElementBlock("table", { 20388 class: vue.normalizeClass([vue.unref(nsTable).b(), vue.unref(nsTable).is("range", vue.unref(isInRange))]), 20389 cellspacing: "0", 20390 cellpadding: "0" 20391 }, [ 20392 !_ctx.hideHeader ? (vue.openBlock(), vue.createElementBlock("thead", _hoisted_1$V, [ 20393 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(weekDays), (day) => { 20394 return vue.openBlock(), vue.createElementBlock("th", { key: day }, vue.toDisplayString(day), 1); 20395 }), 128)) 20396 ])) : vue.createCommentVNode("v-if", true), 20397 vue.createElementVNode("tbody", null, [ 20398 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, index) => { 20399 return vue.openBlock(), vue.createElementBlock("tr", { 20400 key: index, 20401 class: vue.normalizeClass({ 20402 [vue.unref(nsTable).e("row")]: true, 20403 [vue.unref(nsTable).em("row", "hide-border")]: index === 0 && _ctx.hideHeader 20404 }) 20405 }, [ 20406 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, key) => { 20407 return vue.openBlock(), vue.createElementBlock("td", { 20408 key, 20409 class: vue.normalizeClass(getCellClass(cell)), 20410 onClick: ($event) => vue.unref(handlePickDay)(cell) 20411 }, [ 20412 vue.createElementVNode("div", { 20413 class: vue.normalizeClass(vue.unref(nsDay).b()) 20414 }, [ 20415 vue.renderSlot(_ctx.$slots, "date-cell", { 20416 data: vue.unref(getSlotData)(cell) 20417 }, () => [ 20418 vue.createElementVNode("span", null, vue.toDisplayString(cell.text), 1) 20419 ]) 20420 ], 2) 20421 ], 10, _hoisted_2$B); 20422 }), 128)) 20423 ], 2); 20424 }), 128)) 20425 ]) 20426 ], 2); 20427 }; 20428 } 20429 }); 20430 var DateTable$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1R, [["__file", "date-table.vue"]]); 20431 20432 const adjacentMonth = (start, end) => { 20433 const firstMonthLastDay = start.endOf("month"); 20434 const lastMonthFirstDay = end.startOf("month"); 20435 const isSameWeek = firstMonthLastDay.isSame(lastMonthFirstDay, "week"); 20436 const lastMonthStartDay = isSameWeek ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay; 20437 return [ 20438 [start, firstMonthLastDay], 20439 [lastMonthStartDay.startOf("week"), end] 20440 ]; 20441 }; 20442 const threeConsecutiveMonth = (start, end) => { 20443 const firstMonthLastDay = start.endOf("month"); 20444 const secondMonthFirstDay = start.add(1, "month").startOf("month"); 20445 const secondMonthStartDay = firstMonthLastDay.isSame(secondMonthFirstDay, "week") ? secondMonthFirstDay.add(1, "week") : secondMonthFirstDay; 20446 const secondMonthLastDay = secondMonthStartDay.endOf("month"); 20447 const lastMonthFirstDay = end.startOf("month"); 20448 const lastMonthStartDay = secondMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay; 20449 return [ 20450 [start, firstMonthLastDay], 20451 [secondMonthStartDay.startOf("week"), secondMonthLastDay], 20452 [lastMonthStartDay.startOf("week"), end] 20453 ]; 20454 }; 20455 const useCalendar = (props, emit, componentName) => { 20456 const slots = vue.useSlots();
20457 const { lang } = useLocale(); 20458 const selectedDay = vue.ref(); 20459 const now = dayjs().locale(lang.value); 20460 const realSelectedDay = vue.computed({ 20461 get() { 20462 if (!props.modelValue) 20463 return selectedDay.value; 20464 return date.value; 20465 }, 20466 set(val) { 20467 if (!val) 20468 return; 20469 selectedDay.value = val; 20470 const result = val.toDate(); 20471 emit(INPUT_EVENT, result); 20472 emit(UPDATE_MODEL_EVENT, result); 20473 } 20474 }); 20475 const validatedRange = vue.computed(() => { 20476 if (!props.range) 20477 return []; 20478 const rangeArrDayjs = props.range.map((_) => dayjs(_).locale(lang.value)); 20479 const [startDayjs, endDayjs] = rangeArrDayjs; 20480 if (startDayjs.isAfter(endDayjs)) { 20481 return []; 20482 } 20483 if (startDayjs.isSame(endDayjs, "month")) { 20484 return calculateValidatedDateRange(startDayjs, endDayjs); 20485 } else { 20486 if (startDayjs.add(1, "month").month() !== endDayjs.month()) { 20487 return []; 20488 } 20489 return calculateValidatedDateRange(startDayjs, endDayjs); 20490 } 20491 }); 20492 const date = vue.computed(() => { 20493 if (!props.modelValue) { 20494 return realSelectedDay.value || (validatedRange.value.length ? validatedRange.value[0][0] : now); 20495 } else { 20496 return dayjs(props.modelValue).locale(lang.value); 20497 } 20498 }); 20499 const prevMonthDayjs = vue.computed(() => date.value.subtract(1, "month").date(1)); 20500 const nextMonthDayjs = vue.computed(() => date.value.add(1, "month").date(1)); 20501 const prevYearDayjs = vue.computed(() => date.value.subtract(1, "year").date(1)); 20502 const nextYearDayjs = vue.computed(() => date.value.add(1, "year").date(1)); 20503 const calculateValidatedDateRange = (startDayjs, endDayjs) => { 20504 const firstDay = startDayjs.startOf("week"); 20505 const lastDay = endDayjs.endOf("week"); 20506 const firstMonth = firstDay.get("month"); 20507 const lastMonth = lastDay.get("month"); 20508 if (firstMonth === lastMonth) { 20509 return [[firstDay, lastDay]]; 20510 } else if ((firstMonth + 1) % 12 === lastMonth) { 20511 return adjacentMonth(firstDay, lastDay); 20512 } else if (firstMonth + 2 === lastMonth || (firstMonth + 1) % 11 === lastMonth) { 20513 return threeConsecutiveMonth(firstDay, lastDay); 20514 } else { 20515 return []; 20516 } 20517 }; 20518 const pickDay = (day) => { 20519 realSelectedDay.value = day; 20520 }; 20521 const selectDate = (type) => { 20522 const dateMap = { 20523 "prev-month": prevMonthDayjs.value, 20524 "next-month": nextMonthDayjs.value, 20525 "prev-year": prevYearDayjs.value, 20526 "next-year": nextYearDayjs.value, 20527 today: now 20528 }; 20529 const day = dateMap[type]; 20530 if (!day.isSame(date.value, "day")) { 20531 pickDay(day); 20532 } 20533 }; 20534 useDeprecated({ 20535 from: '"dateCell"', 20536 replacement: '"date-cell"', 20537 scope: "ElCalendar", 20538 version: "2.3.0", 20539 ref: "https://element-plus.org/en-US/component/calendar.html#slots", 20540 type: "Slot" 20541 }, vue.computed(() => !!slots.dateCell)); 20542 return { 20543 calculateValidatedDateRange, 20544 date, 20545 realSelectedDay, 20546 pickDay, 20547 selectDate, 20548 validatedRange 20549 }; 20550 }; 20551 20552 const isValidRange$1 = (range) => isArray$1(range) && range.length === 2 && range.every((item) => isDate$1(item)); 20553 const calendarProps = buildProps({ 20554 modelValue: { 20555 type: Date 20556 }, 20557 range: { 20558 type: definePropType(Array), 20559 validator: isValidRange$1 20560 } 20561 }); 20562 const calendarEmits = { 20563 [UPDATE_MODEL_EVENT]: (value) => isDate$1(value), 20564 [INPUT_EVENT]: (value) => isDate$1(value) 20565 }; 20566 20567 const COMPONENT_NAME$g = "ElCalendar"; 20568 const __default__$1e = vue.defineComponent({ 20569 name: COMPONENT_NAME$g 20570 }); 20571 const _sfc_main$1Q = /* @__PURE__ */ vue.defineComponent({ 20572 ...__default__$1e, 20573 props: calendarProps, 20574 emits: calendarEmits, 20575 setup(__props, { expose, emit }) { 20576 const props = __props; 20577 const ns = useNamespace("calendar"); 20578 const { 20579 calculateValidatedDateRange, 20580 date, 20581 pickDay, 20582 realSelectedDay, 20583 selectDate, 20584 validatedRange 20585 } = useCalendar(props, emit); 20586 const { t } = useLocale(); 20587 const i18nDate = vue.computed(() => { 20588 const pickedMonth = `el.datepicker.month${date.value.format("M")}`; 20589 return `${date.value.year()} ${t("el.datepicker.year")} ${t(pickedMonth)}`; 20590 }); 20591 expose({ 20592 selectedDay: realSelectedDay, 20593 pickDay, 20594 selectDate, 20595 calculateValidatedDateRange 20596 }); 20597 return (_ctx, _cache) => {
20598 return vue.openBlock(), vue.createElementBlock("div", { 20599 class: vue.normalizeClass(vue.unref(ns).b()) 20600 }, [ 20601 vue.createElementVNode("div", { 20602 class: vue.normalizeClass(vue.unref(ns).e("header")) 20603 }, [ 20604 vue.renderSlot(_ctx.$slots, "header", { date: vue.unref(i18nDate) }, () => [ 20605 vue.createElementVNode("div", { 20606 class: vue.normalizeClass(vue.unref(ns).e("title")) 20607 }, vue.toDisplayString(vue.unref(i18nDate)), 3), 20608 vue.unref(validatedRange).length === 0 ? (vue.openBlock(), vue.createElementBlock("div", { 20609 key: 0, 20610 class: vue.normalizeClass(vue.unref(ns).e("button-group")) 20611 }, [ 20612 vue.createVNode(vue.unref(ElButtonGroup$1), null, { 20613 default: vue.withCtx(() => [ 20614 vue.createVNode(vue.unref(ElButton), { 20615 size: "small", 20616 onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(selectDate)("prev-month")) 20617 }, { 20618 default: vue.withCtx(() => [ 20619 vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.prevMonth")), 1) 20620 ]), 20621 _: 1 20622 }), 20623 vue.createVNode(vue.unref(ElButton), { 20624 size: "small", 20625 onClick: _cache[1] || (_cache[1] = ($event) => vue.unref(selectDate)("today")) 20626 }, { 20627 default: vue.withCtx(() => [ 20628 vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.today")), 1) 20629 ]), 20630 _: 1 20631 }), 20632 vue.createVNode(vue.unref(ElButton), { 20633 size: "small", 20634 onClick: _cache[2] || (_cache[2] = ($event) => vue.unref(selectDate)("next-month")) 20635 }, { 20636 default: vue.withCtx(() => [ 20637 vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.nextMonth")), 1) 20638 ]), 20639 _: 1 20640 }) 20641 ]), 20642 _: 1 20643 }) 20644 ], 2)) : vue.createCommentVNode("v-if", true) 20645 ]) 20646 ], 2), 20647 vue.unref(validatedRange).length === 0 ? (vue.openBlock(), vue.createElementBlock("div", { 20648 key: 0, 20649 class: vue.normalizeClass(vue.unref(ns).e("body")) 20650 }, [ 20651 vue.createVNode(DateTable$1, { 20652 date: vue.unref(date), 20653 "selected-day": vue.unref(realSelectedDay), 20654 onPick: vue.unref(pickDay) 20655 }, vue.createSlots({ _: 2 }, [ 20656 _ctx.$slots["date-cell"] || _ctx.$slots.dateCell ? { 20657 name: "date-cell", 20658 fn: vue.withCtx((data) => [ 20659 _ctx.$slots["date-cell"] ? vue.renderSlot(_ctx.$slots, "date-cell", vue.normalizeProps(vue.mergeProps({ key: 0 }, data))) : vue.renderSlot(_ctx.$slots, "dateCell", vue.normalizeProps(vue.mergeProps({ key: 1 }, data))) 20660 ]) 20661 } : void 0 20662 ]), 1032, ["date", "selected-day", "onPick"]) 20663 ], 2)) : (vue.openBlock(), vue.createElementBlock("div", { 20664 key: 1, 20665 class: vue.normalizeClass(vue.unref(ns).e("body")) 20666 }, [ 20667 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(validatedRange), (range_, index) => { 20668 return vue.openBlock(), vue.createBlock(DateTable$1, { 20669 key: index, 20670 date: range_[0], 20671 "selected-day": vue.unref(realSelectedDay), 20672 range: range_, 20673 "hide-header": index !== 0, 20674 onPick: vue.unref(pickDay) 20675 }, vue.createSlots({ _: 2 }, [ 20676 _ctx.$slots["date-cell"] || _ctx.$slots.dateCell ? { 20677 name: "date-cell", 20678 fn: vue.withCtx((data) => [
20679 _ctx.$slots["date-cell"] ? vue.renderSlot(_ctx.$slots, "date-cell", vue.normalizeProps(vue.mergeProps({ key: 0 }, data))) : vue.renderSlot(_ctx.$slots, "dateCell", vue.normalizeProps(vue.mergeProps({ key: 1 }, data))) 20680 ]) 20681 } : void 0 20682 ]), 1032, ["date", "selected-day", "range", "hide-header", "onPick"]); 20683 }), 128)) 20684 ], 2)) 20685 ], 2); 20686 }; 20687 } 20688 }); 20689 var Calendar = /* @__PURE__ */ _export_sfc(_sfc_main$1Q, [["__file", "calendar.vue"]]); 20690 20691 const ElCalendar = withInstall(Calendar); 20692 20693 const cardProps = buildProps({ 20694 header: { 20695 type: String, 20696 default: "" 20697 }, 20698 bodyStyle: { 20699 type: definePropType([String, Object, Array]), 20700 default: "" 20701 }, 20702 shadow: { 20703 type: String, 20704 values: ["always", "hover", "never"], 20705 default: "always" 20706 } 20707 }); 20708 20709 const __default__$1d = vue.defineComponent({ 20710 name: "ElCard" 20711 }); 20712 const _sfc_main$1P = /* @__PURE__ */ vue.defineComponent({ 20713 ...__default__$1d, 20714 props: cardProps, 20715 setup(__props) { 20716 const ns = useNamespace("card"); 20717 return (_ctx, _cache) => { 20718 return vue.openBlock(), vue.createElementBlock("div", { 20719 class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).is(`${_ctx.shadow}-shadow`)]) 20720 }, [ 20721 _ctx.$slots.header || _ctx.header ? (vue.openBlock(), vue.createElementBlock("div", { 20722 key: 0, 20723 class: vue.normalizeClass(vue.unref(ns).e("header")) 20724 }, [ 20725 vue.renderSlot(_ctx.$slots, "header", {}, () => [ 20726 vue.createTextVNode(vue.toDisplayString(_ctx.header), 1) 20727 ]) 20728 ], 2)) : vue.createCommentVNode("v-if", true), 20729 vue.createElementVNode("div", { 20730 class: vue.normalizeClass(vue.unref(ns).e("body")), 20731 style: vue.normalizeStyle(_ctx.bodyStyle) 20732 }, [ 20733 vue.renderSlot(_ctx.$slots, "default") 20734 ], 6) 20735 ], 2); 20736 }; 20737 } 20738 }); 20739 var Card = /* @__PURE__ */ _export_sfc(_sfc_main$1P, [["__file", "card.vue"]]); 20740 20741 const ElCard = withInstall(Card); 20742 20743 const carouselProps = buildProps({ 20744 initialIndex: { 20745 type: Number, 20746 default: 0 20747 }, 20748 height: { 20749 type: String, 20750 default: "" 20751 }, 20752 trigger: { 20753 type: String, 20754 values: ["hover", "click"], 20755 default: "hover" 20756 }, 20757 autoplay: { 20758 type: Boolean, 20759 default: true 20760 }, 20761 interval: { 20762 type: Number, 20763 default: 3e3 20764 }, 20765 indicatorPosition: { 20766 type: String, 20767 values: ["", "none", "outside"], 20768 default: "" 20769 }, 20770 arrow: { 20771 type: String, 20772 values: ["always", "hover", "never"], 20773 default: "hover" 20774 }, 20775 type: { 20776 type: String, 20777 values: ["", "card"], 20778 default: "" 20779 }, 20780 loop: { 20781 type: Boolean, 20782 default: true 20783 }, 20784 direction: { 20785 type: String, 20786 values: ["horizontal", "vertical"], 20787 default: "horizontal" 20788 }, 20789 pauseOnHover: { 20790 type: Boolean, 20791 default: true 20792 } 20793 }); 20794 const carouselEmits = { 20795 change: (current, prev) => [current, prev].every(isNumber) 20796 }; 20797 20798 const carouselContextKey = Symbol("carouselContextKey"); 20799 20800 const THROTTLE_TIME = 300; 20801 const useCarousel = (props, emit, componentName) => { 20802 const { 20803 children: items, 20804 addChild: addItem, 20805 removeChild: removeItem 20806 } = useOrderedChildren(vue.getCurrentInstance(), "ElCarouselItem"); 20807 const activeIndex = vue.ref(-1); 20808 const timer = vue.ref(null); 20809 const hover = vue.ref(false); 20810 const root = vue.ref(); 20811 const containerHeight = vue.ref(0);
20812 const arrowDisplay = vue.computed(() => props.arrow !== "never" && !vue.unref(isVertical)); 20813 const hasLabel = vue.computed(() => { 20814 return items.value.some((item) => item.props.label.toString().length > 0); 20815 }); 20816 const isCardType = vue.computed(() => props.type === "card"); 20817 const isVertical = vue.computed(() => props.direction === "vertical"); 20818 const containerStyle = vue.computed(() => { 20819 if (props.height !== "auto") { 20820 return { 20821 height: props.height 20822 }; 20823 } 20824 return { 20825 height: `${containerHeight.value}px`, 20826 overflow: "hidden" 20827 }; 20828 }); 20829 const throttledArrowClick = throttle((index) => { 20830 setActiveItem(index); 20831 }, THROTTLE_TIME, { trailing: true }); 20832 const throttledIndicatorHover = throttle((index) => { 20833 handleIndicatorHover(index); 20834 }, THROTTLE_TIME); 20835 function pauseTimer() { 20836 if (timer.value) { 20837 clearInterval(timer.value); 20838 timer.value = null; 20839 } 20840 } 20841 function startTimer() { 20842 if (props.interval <= 0 || !props.autoplay || timer.value) 20843 return; 20844 timer.value = setInterval(() => playSlides(), props.interval); 20845 } 20846 const playSlides = () => { 20847 if (activeIndex.value < items.value.length - 1) { 20848 activeIndex.value = activeIndex.value + 1; 20849 } else if (props.loop) { 20850 activeIndex.value = 0; 20851 } 20852 }; 20853 function setActiveItem(index) { 20854 if (isString$1(index)) { 20855 const filteredItems = items.value.filter((item) => item.props.name === index); 20856 if (filteredItems.length > 0) { 20857 index = items.value.indexOf(filteredItems[0]); 20858 } 20859 } 20860 index = Number(index); 20861 if (Number.isNaN(index) || index !== Math.floor(index)) { 20862 return; 20863 } 20864 const itemCount = items.value.length; 20865 const oldIndex = activeIndex.value; 20866 if (index < 0) { 20867 activeIndex.value = props.loop ? itemCount - 1 : 0; 20868 } else if (index >= itemCount) { 20869 activeIndex.value = props.loop ? 0 : itemCount - 1; 20870 } else { 20871 activeIndex.value = index; 20872 } 20873 if (oldIndex === activeIndex.value) { 20874 resetItemPosition(oldIndex); 20875 } 20876 resetTimer(); 20877 } 20878 function resetItemPosition(oldIndex) { 20879 items.value.forEach((item, index) => { 20880 item.translateItem(index, activeIndex.value, oldIndex); 20881 }); 20882 } 20883 function itemInStage(item, index) { 20884 var _a, _b, _c, _d; 20885 const _items = vue.unref(items); 20886 const itemCount = _items.length; 20887 if (itemCount === 0 || !item.states.inStage) 20888 return false; 20889 const nextItemIndex = index + 1; 20890 const prevItemIndex = index - 1; 20891 const lastItemIndex = itemCount - 1; 20892 const isLastItemActive = _items[lastItemIndex].states.active; 20893 const isFirstItemActive = _items[0].states.active; 20894 const isNextItemActive = (_b = (_a = _items[nextItemIndex]) == null ? void 0 : _a.states) == null ? void 0 : _b.active; 20895 const isPrevItemActive = (_d = (_c = _items[prevItemIndex]) == null ? void 0 : _c.states) == null ? void 0 : _d.active; 20896 if (index === lastItemIndex && isFirstItemActive || isNextItemActive) { 20897 return "left"; 20898 } else if (index === 0 && isLastItemActive || isPrevItemActive) { 20899 return "right"; 20900 } 20901 return false; 20902 } 20903 function handleMouseEnter() { 20904 hover.value = true; 20905 if (props.pauseOnHover) { 20906 pauseTimer(); 20907 } 20908 } 20909 function handleMouseLeave() { 20910 hover.value = false; 20911 startTimer(); 20912 } 20913 function handleButtonEnter(arrow) { 20914 if (vue.unref(isVertical)) 20915 return; 20916 items.value.forEach((item, index) => { 20917 if (arrow === itemInStage(item, index)) { 20918 item.states.hover = true; 20919 } 20920 }); 20921 } 20922 function handleButtonLeave() { 20923 if (vue.unref(isVertical)) 20924 return; 20925 items.value.forEach((item) => { 20926 item.states.hover = false; 20927 }); 20928 } 20929 function handleIndicatorClick(index) { 20930 activeIndex.value = index; 20931 } 20932 function handleIndicatorHover(index) { 20933 if (props.trigger === "hover" && index !== activeIndex.value) { 20934 activeIndex.value = index; 20935 } 20936 } 20937 function prev() {
20938 setActiveItem(activeIndex.value - 1); 20939 } 20940 function next() { 20941 setActiveItem(activeIndex.value + 1); 20942 } 20943 function resetTimer() { 20944 pauseTimer(); 20945 startTimer(); 20946 } 20947 function setContainerHeight(height) { 20948 if (props.height !== "auto") 20949 return; 20950 containerHeight.value = height; 20951 } 20952 vue.watch(() => activeIndex.value, (current, prev2) => { 20953 resetItemPosition(prev2); 20954 if (prev2 > -1) { 20955 emit("change", current, prev2); 20956 } 20957 }); 20958 vue.watch(() => props.autoplay, (autoplay) => { 20959 autoplay ? startTimer() : pauseTimer(); 20960 }); 20961 vue.watch(() => props.loop, () => { 20962 setActiveItem(activeIndex.value); 20963 }); 20964 vue.watch(() => props.interval, () => { 20965 resetTimer(); 20966 }); 20967 vue.watch(() => items.value, () => { 20968 if (items.value.length > 0) 20969 setActiveItem(props.initialIndex); 20970 }); 20971 const resizeObserver = vue.shallowRef(); 20972 vue.onMounted(() => { 20973 resizeObserver.value = useResizeObserver(root.value, () => { 20974 resetItemPosition(); 20975 }); 20976 startTimer(); 20977 }); 20978 vue.onBeforeUnmount(() => { 20979 pauseTimer(); 20980 if (root.value && resizeObserver.value) 20981 resizeObserver.value.stop(); 20982 }); 20983 vue.provide(carouselContextKey, { 20984 root, 20985 isCardType, 20986 isVertical, 20987 items, 20988 loop: props.loop, 20989 addItem, 20990 removeItem, 20991 setActiveItem, 20992 setContainerHeight 20993 }); 20994 return { 20995 root, 20996 activeIndex, 20997 arrowDisplay, 20998 hasLabel, 20999 hover, 21000 isCardType, 21001 items, 21002 isVertical, 21003 containerStyle, 21004 handleButtonEnter, 21005 handleButtonLeave, 21006 handleIndicatorClick, 21007 handleMouseEnter, 21008 handleMouseLeave, 21009 setActiveItem, 21010 prev, 21011 next, 21012 throttledArrowClick, 21013 throttledIndicatorHover 21014 }; 21015 }; 21016 21017 const _hoisted_1$U = ["onMouseenter", "onClick"]; 21018 const _hoisted_2$A = { key: 0 }; 21019 const COMPONENT_NAME$f = "ElCarousel"; 21020 const __default__$1c = vue.defineComponent({ 21021 name: COMPONENT_NAME$f 21022 }); 21023 const _sfc_main$1O = /* @__PURE__ */ vue.defineComponent({ 21024 ...__default__$1c, 21025 props: carouselProps, 21026 emits: carouselEmits, 21027 setup(__props, { expose, emit }) { 21028 const props = __props; 21029 const { 21030 root, 21031 activeIndex, 21032 arrowDisplay, 21033 hasLabel, 21034 hover, 21035 isCardType, 21036 items, 21037 isVertical, 21038 containerStyle, 21039 handleButtonEnter, 21040 handleButtonLeave, 21041 handleIndicatorClick, 21042 handleMouseEnter, 21043 handleMouseLeave,
21044 setActiveItem, 21045 prev, 21046 next, 21047 throttledArrowClick, 21048 throttledIndicatorHover 21049 } = useCarousel(props, emit); 21050 const ns = useNamespace("carousel"); 21051 const carouselClasses = vue.computed(() => { 21052 const classes = [ns.b(), ns.m(props.direction)]; 21053 if (vue.unref(isCardType)) { 21054 classes.push(ns.m("card")); 21055 } 21056 return classes; 21057 }); 21058 const indicatorsClasses = vue.computed(() => { 21059 const classes = [ns.e("indicators"), ns.em("indicators", props.direction)]; 21060 if (vue.unref(hasLabel)) { 21061 classes.push(ns.em("indicators", "labels")); 21062 } 21063 if (props.indicatorPosition === "outside") { 21064 classes.push(ns.em("indicators", "outside")); 21065 } 21066 if (vue.unref(isVertical)) { 21067 classes.push(ns.em("indicators", "right")); 21068 } 21069 return classes; 21070 }); 21071 expose({ 21072 setActiveItem, 21073 prev, 21074 next 21075 }); 21076 return (_ctx, _cache) => { 21077 return vue.openBlock(), vue.createElementBlock("div", { 21078 ref_key: "root", 21079 ref: root, 21080 class: vue.normalizeClass(vue.unref(carouselClasses)), 21081 onMouseenter: _cache[6] || (_cache[6] = vue.withModifiers((...args) => vue.unref(handleMouseEnter) && vue.unref(handleMouseEnter)(...args), ["stop"])), 21082 onMouseleave: _cache[7] || (_cache[7] = vue.withModifiers((...args) => vue.unref(handleMouseLeave) && vue.unref(handleMouseLeave)(...args), ["stop"])) 21083 }, [ 21084 vue.createElementVNode("div", { 21085 class: vue.normalizeClass(vue.unref(ns).e("container")), 21086 style: vue.normalizeStyle(vue.unref(containerStyle)) 21087 }, [ 21088 vue.unref(arrowDisplay) ? (vue.openBlock(), vue.createBlock(vue.Transition, { 21089 key: 0, 21090 name: "carousel-arrow-left", 21091 persisted: "" 21092 }, { 21093 default: vue.withCtx(() => [ 21094 vue.withDirectives(vue.createElementVNode("button", { 21095 type: "button", 21096 class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "left")]), 21097 onMouseenter: _cache[0] || (_cache[0] = ($event) => vue.unref(handleButtonEnter)("left")), 21098 onMouseleave: _cache[1] || (_cache[1] = (...args) => vue.unref(handleButtonLeave) && vue.unref(handleButtonLeave)(...args)), 21099 onClick: _cache[2] || (_cache[2] = vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) - 1), ["stop"])) 21100 }, [ 21101 vue.createVNode(vue.unref(ElIcon), null, { 21102 default: vue.withCtx(() => [ 21103 vue.createVNode(vue.unref(arrow_left_default)) 21104 ]), 21105 _: 1 21106 }) 21107 ], 34), [ 21108 [ 21109 vue.vShow, 21110 (_ctx.arrow === "always" || vue.unref(hover)) && (props.loop || vue.unref(activeIndex) > 0) 21111 ] 21112 ]) 21113 ]), 21114 _: 1 21115 })) : vue.createCommentVNode("v-if", true), 21116 vue.unref(arrowDisplay) ? (vue.openBlock(), vue.createBlock(vue.Transition, { 21117 key: 1, 21118 name: "carousel-arrow-right", 21119 persisted: "" 21120 }, { 21121 default: vue.withCtx(() => [ 21122 vue.withDirectives(vue.createElementVNode("button", { 21123 type: "button", 21124 class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "right")]), 21125 onMouseenter: _cache[3] || (_cache[3] = ($event) => vue.unref(handleButtonEnter)("right")), 21126 onMouseleave: _cache[4] || (_cache[4] = (...args) => vue.unref(handleButtonLeave) && vue.unref(handleButtonLeave)(...args)), 21127 onClick: _cache[5] || (_cache[5] = vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) + 1), ["stop"])) 21128 }, [ 21129 vue.createVNode(vue.unref(ElIcon), null, { 21130 default: vue.withCtx(() => [ 21131 vue.createVNode(vue.unref(arrow_right_default)) 21132 ]), 21133 _: 1 21134 }) 21135 ], 34), [ 21136 [ 21137 vue.vShow, 21138 (_ctx.arrow === "always" || vue.unref(hover)) && (props.loop || vue.unref(activeIndex) < vue.unref(items).length - 1) 21139 ] 21140 ]) 21141 ]), 21142 _: 1 21143 })) : vue.createCommentVNode("v-if", true),
21144 vue.renderSlot(_ctx.$slots, "default") 21145 ], 6), 21146 _ctx.indicatorPosition !== "none" ? (vue.openBlock(), vue.createElementBlock("ul", { 21147 key: 0, 21148 class: vue.normalizeClass(vue.unref(indicatorsClasses)) 21149 }, [ 21150 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(items), (item, index) => { 21151 return vue.openBlock(), vue.createElementBlock("li", { 21152 key: index, 21153 class: vue.normalizeClass([ 21154 vue.unref(ns).e("indicator"), 21155 vue.unref(ns).em("indicator", _ctx.direction), 21156 vue.unref(ns).is("active", index === vue.unref(activeIndex)) 21157 ]), 21158 onMouseenter: ($event) => vue.unref(throttledIndicatorHover)(index), 21159 onClick: vue.withModifiers(($event) => vue.unref(handleIndicatorClick)(index), ["stop"]) 21160 }, [ 21161 vue.createElementVNode("button", { 21162 class: vue.normalizeClass(vue.unref(ns).e("button")) 21163 }, [ 21164 vue.unref(hasLabel) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$A, vue.toDisplayString(item.props.label), 1)) : vue.createCommentVNode("v-if", true) 21165 ], 2) 21166 ], 42, _hoisted_1$U); 21167 }), 128)) 21168 ], 2)) : vue.createCommentVNode("v-if", true) 21169 ], 34); 21170 }; 21171 } 21172 }); 21173 var Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$1O, [["__file", "carousel.vue"]]); 21174 21175 const carouselItemProps = buildProps({ 21176 name: { type: String, default: "" }, 21177 label: { 21178 type: [String, Number], 21179 default: "" 21180 } 21181 }); 21182 21183 const useCarouselItem = (props, componentName) => { 21184 const carouselContext = vue.inject(carouselContextKey); 21185 const instance = vue.getCurrentInstance(); 21186 const CARD_SCALE = 0.83; 21187 const carouselItemRef = vue.ref(); 21188 const hover = vue.ref(false); 21189 const translate = vue.ref(0);
21190 const scale = vue.ref(1); 21191 const active = vue.ref(false); 21192 const ready = vue.ref(false); 21193 const inStage = vue.ref(false); 21194 const animating = vue.ref(false); 21195 const { isCardType, isVertical } = carouselContext; 21196 function processIndex(index, activeIndex, length) { 21197 const lastItemIndex = length - 1; 21198 const prevItemIndex = activeIndex - 1; 21199 const nextItemIndex = activeIndex + 1; 21200 const halfItemIndex = length / 2; 21201 if (activeIndex === 0 && index === lastItemIndex) { 21202 return -1; 21203 } else if (activeIndex === lastItemIndex && index === 0) { 21204 return length; 21205 } else if (index < prevItemIndex && activeIndex - index >= halfItemIndex) { 21206 return length + 1; 21207 } else if (index > nextItemIndex && index - activeIndex >= halfItemIndex) { 21208 return -2; 21209 } 21210 return index; 21211 } 21212 function calcCardTranslate(index, activeIndex) { 21213 var _a, _b; 21214 const parentWidth = vue.unref(isVertical) ? ((_a = carouselContext.root.value) == null ? void 0 : _a.offsetHeight) || 0 : ((_b = carouselContext.root.value) == null ? void 0 : _b.offsetWidth) || 0; 21215 if (inStage.value) { 21216 return parentWidth * ((2 - CARD_SCALE) * (index - activeIndex) + 1) / 4; 21217 } else if (index < activeIndex) { 21218 return -(1 + CARD_SCALE) * parentWidth / 4; 21219 } else { 21220 return (3 + CARD_SCALE) * parentWidth / 4; 21221 } 21222 } 21223 function calcTranslate(index, activeIndex, isVertical2) { 21224 const rootEl = carouselContext.root.value; 21225 if (!rootEl) 21226 return 0; 21227 const distance = (isVertical2 ? rootEl.offsetHeight : rootEl.offsetWidth) || 0; 21228 return distance * (index - activeIndex); 21229 } 21230 const translateItem = (index, activeIndex, oldIndex) => { 21231 var _a; 21232 const _isCardType = vue.unref(isCardType); 21233 const carouselItemLength = (_a = carouselContext.items.value.length) != null ? _a : Number.NaN; 21234 const isActive = index === activeIndex; 21235 if (!_isCardType && !isUndefined(oldIndex)) { 21236 animating.value = isActive || index === oldIndex; 21237 } 21238 if (!isActive && carouselItemLength > 2 && carouselContext.loop) { 21239 index = processIndex(index, activeIndex, carouselItemLength); 21240 } 21241 const _isVertical = vue.unref(isVertical); 21242 active.value = isActive; 21243 if (_isCardType) { 21244 inStage.value = Math.round(Math.abs(index - activeIndex)) <= 1; 21245 translate.value = calcCardTranslate(index, activeIndex); 21246 scale.value = vue.unref(active) ? 1 : CARD_SCALE; 21247 } else { 21248 translate.value = calcTranslate(index, activeIndex, _isVertical); 21249 } 21250 ready.value = true; 21251 if (isActive && carouselItemRef.value) { 21252 carouselContext.setContainerHeight(carouselItemRef.value.offsetHeight); 21253 } 21254 }; 21255 function handleItemClick() { 21256 if (carouselContext && vue.unref(isCardType)) { 21257 const index = carouselContext.items.value.findIndex(({ uid }) => uid === instance.uid); 21258 carouselContext.setActiveItem(index); 21259 } 21260 } 21261 vue.onMounted(() => { 21262 carouselContext.addItem({ 21263 props, 21264 states: vue.reactive({ 21265 hover, 21266 translate, 21267 scale, 21268 active, 21269 ready, 21270 inStage, 21271 animating 21272 }), 21273 uid: instance.uid, 21274 translateItem 21275 }); 21276 }); 21277 vue.onUnmounted(() => { 21278 carouselContext.removeItem(instance.uid); 21279 }); 21280 return { 21281 carouselItemRef, 21282 active, 21283 animating, 21284 hover, 21285 inStage, 21286 isVertical, 21287 translate, 21288 isCardType, 21289 scale, 21290 ready, 21291 handleItemClick 21292 }; 21293 }; 21294 21295 const __default__$1b = vue.defineComponent({ 21296 name: "ElCarouselItem" 21297 }); 21298 const _sfc_main$1N = /* @__PURE__ */ vue.defineComponent({ 21299 ...__default__$1b, 21300 props: carouselItemProps, 21301 setup(__props) { 21302 const props = __props; 21303 const ns = useNamespace("carousel"); 21304 const { 21305 carouselItemRef, 21306 active, 21307 animating, 21308 hover, 21309 inStage, 21310 isVertical, 21311 translate, 21312 isCardType, 21313 scale, 21314 ready,
21315 handleItemClick 21316 } = useCarouselItem(props); 21317 const itemStyle = vue.computed(() => { 21318 const translateType = `translate${vue.unref(isVertical) ? "Y" : "X"}`; 21319 const _translate = `${translateType}(${vue.unref(translate)}px)`; 21320 const _scale = `scale(${vue.unref(scale)})`; 21321 const transform = [_translate, _scale].join(" "); 21322 return { 21323 transform 21324 }; 21325 }); 21326 return (_ctx, _cache) => { 21327 return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", { 21328 ref_key: "carouselItemRef", 21329 ref: carouselItemRef, 21330 class: vue.normalizeClass([ 21331 vue.unref(ns).e("item"), 21332 vue.unref(ns).is("active", vue.unref(active)), 21333 vue.unref(ns).is("in-stage", vue.unref(inStage)), 21334 vue.unref(ns).is("hover", vue.unref(hover)), 21335 vue.unref(ns).is("animating", vue.unref(animating)), 21336 { 21337 [vue.unref(ns).em("item", "card")]: vue.unref(isCardType), 21338 [vue.unref(ns).em("item", "card-vertical")]: vue.unref(isCardType) && vue.unref(isVertical) 21339 } 21340 ]), 21341 style: vue.normalizeStyle(vue.unref(itemStyle)), 21342 onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(handleItemClick) && vue.unref(handleItemClick)(...args)) 21343 }, [ 21344 vue.unref(isCardType) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", { 21345 key: 0, 21346 class: vue.normalizeClass(vue.unref(ns).e("mask")) 21347 }, null, 2)), [ 21348 [vue.vShow, !vue.unref(active)] 21349 ]) : vue.createCommentVNode("v-if", true), 21350 vue.renderSlot(_ctx.$slots, "default") 21351 ], 6)), [ 21352 [vue.vShow, vue.unref(ready)] 21353 ]); 21354 }; 21355 } 21356 }); 21357 var CarouselItem = /* @__PURE__ */ _export_sfc(_sfc_main$1N, [["__file", "carousel-item.vue"]]); 21358 21359 const ElCarousel = withInstall(Carousel, { 21360 CarouselItem 21361 }); 21362 const ElCarouselItem = withNoopInstall(CarouselItem); 21363 21364 const checkboxProps = { 21365 modelValue: { 21366 type: [Number, String, Boolean], 21367 default: void 0 21368 }, 21369 label: { 21370 type: [String, Boolean, Number, Object] 21371 }, 21372 indeterminate: Boolean, 21373 disabled: Boolean, 21374 checked: Boolean, 21375 name: { 21376 type: String, 21377 default: void 0 21378 }, 21379 trueLabel: { 21380 type: [String, Number], 21381 default: void 0 21382 }, 21383 falseLabel: { 21384 type: [String, Number], 21385 default: void 0 21386 }, 21387 id: { 21388 type: String, 21389 default: void 0 21390 }, 21391 controls: { 21392 type: String, 21393 default: void 0 21394 }, 21395 border: Boolean, 21396 size: useSizeProp, 21397 tabindex: [String, Number], 21398 validateEvent: { 21399 type: Boolean, 21400 default: true 21401 } 21402 }; 21403 const checkboxEmits = { 21404 [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val), 21405 change: (val) => isString$1(val) || isNumber(val) || isBoolean(val) 21406 }; 21407 21408 const checkboxGroupContextKey = Symbol("checkboxGroupContextKey"); 21409 21410 const useCheckboxDisabled = ({ 21411 model, 21412 isChecked 21413 }) => { 21414 const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0); 21415 const isLimitDisabled = vue.computed(() => { 21416 var _a, _b; 21417 const max = (_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value; 21418 const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value; 21419 return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value; 21420 }); 21421 const isDisabled = useFormDisabled(vue.computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.disabled.value) || isLimitDisabled.value)); 21422 return { 21423 isDisabled, 21424 isLimitDisabled 21425 }; 21426 }; 21427 21428 const useCheckboxEvent = (props, { 21429 model, 21430 isLimitExceeded, 21431 hasOwnLabel, 21432 isDisabled, 21433 isLabeledByFormItem 21434 }) => { 21435 const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0); 21436 const { formItem } = useFormItem(); 21437 const { emit } = vue.getCurrentInstance(); 21438 function getLabeledValue(value) { 21439 var _a, _b; 21440 return value === props.trueLabel || value === true ? (_a = props.trueLabel) != null ? _a : true : (_b = props.falseLabel) != null ? _b : false; 21441 } 21442 function emitChangeEvent(checked, e) { 21443 emit("change", getLabeledValue(checked), e); 21444 } 21445 function handleChange(e) { 21446 if (isLimitExceeded.value) 21447 return; 21448 const target = e.target; 21449 emit("change", getLabeledValue(target.checked), e); 21450 } 21451 async function onClickRoot(e) { 21452 if (isLimitExceeded.value) 21453 return; 21454 if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) { 21455 const eventTargets = e.composedPath(); 21456 const hasLabel = eventTargets.some((item) => item.tagName === "LABEL"); 21457 if (!hasLabel) { 21458 model.value = getLabeledValue([false, props.falseLabel].includes(model.value)); 21459 await vue.nextTick(); 21460 emitChangeEvent(model.value, e); 21461 } 21462 } 21463 } 21464 const validateEvent = vue.computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent); 21465 vue.watch(() => props.modelValue, () => { 21466 if (validateEvent.value) { 21467 formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()); 21468 } 21469 }); 21470 return { 21471 handleChange, 21472 onClickRoot 21473 }; 21474 }; 21475
21476 const useCheckboxModel = (props) => { 21477 const selfModel = vue.ref(false); 21478 const { emit } = vue.getCurrentInstance(); 21479 const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0); 21480 const isGroup = vue.computed(() => isUndefined(checkboxGroup) === false); 21481 const isLimitExceeded = vue.ref(false); 21482 const model = vue.computed({ 21483 get() { 21484 var _a, _b; 21485 return isGroup.value ? (_a = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a.value : (_b = props.modelValue) != null ? _b : selfModel.value; 21486 }, 21487 set(val) { 21488 var _a, _b; 21489 if (isGroup.value && isArray$1(val)) { 21490 isLimitExceeded.value = ((_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value) !== void 0 && val.length > (checkboxGroup == null ? void 0 : checkboxGroup.max.value); 21491 isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val)); 21492 } else { 21493 emit(UPDATE_MODEL_EVENT, val); 21494 selfModel.value = val; 21495 } 21496 } 21497 }); 21498 return { 21499 model, 21500 isGroup, 21501 isLimitExceeded 21502 }; 21503 }; 21504 21505 const useCheckboxStatus = (props, slots, { model }) => { 21506 const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0); 21507 const isFocused = vue.ref(false); 21508 const isChecked = vue.computed(() => { 21509 const value = model.value; 21510 if (isBoolean(value)) { 21511 return value; 21512 } else if (isArray$1(value)) { 21513 if (isObject$1(props.label)) { 21514 return value.map(vue.toRaw).some((o) => isEqual$1(o, props.label)); 21515 } else { 21516 return value.map(vue.toRaw).includes(props.label); 21517 } 21518 } else if (value !== null && value !== void 0) { 21519 return value === props.trueLabel; 21520 } else { 21521 return !!value; 21522 } 21523 }); 21524 const checkboxButtonSize = useFormSize(vue.computed(() => { 21525 var _a; 21526 return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value; 21527 }), { 21528 prop: true 21529 }); 21530 const checkboxSize = useFormSize(vue.computed(() => { 21531 var _a; 21532 return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value; 21533 })); 21534 const hasOwnLabel = vue.computed(() => { 21535 return !!(slots.default || props.label); 21536 }); 21537 return { 21538 checkboxButtonSize, 21539 isChecked, 21540 isFocused, 21541 checkboxSize, 21542 hasOwnLabel 21543 }; 21544 }; 21545 21546 const setStoreValue = (props, { model }) => { 21547 function addToStore() { 21548 if (isArray$1(model.value) && !model.value.includes(props.label)) { 21549 model.value.push(props.label); 21550 } else { 21551 model.value = props.trueLabel || true; 21552 } 21553 } 21554 props.checked && addToStore(); 21555 }; 21556 const useCheckbox = (props, slots) => { 21557 const { formItem: elFormItem } = useFormItem(); 21558 const { model, isGroup, isLimitExceeded } = useCheckboxModel(props); 21559 const { 21560 isFocused, 21561 isChecked, 21562 checkboxButtonSize, 21563 checkboxSize, 21564 hasOwnLabel 21565 } = useCheckboxStatus(props, slots, { model }); 21566 const { isDisabled } = useCheckboxDisabled({ model, isChecked }); 21567 const { inputId, isLabeledByFormItem } = useFormItemInputId(props, { 21568 formItemContext: elFormItem, 21569 disableIdGeneration: hasOwnLabel, 21570 disableIdManagement: isGroup 21571 }); 21572 const { handleChange, onClickRoot } = useCheckboxEvent(props, { 21573 model, 21574 isLimitExceeded, 21575 hasOwnLabel, 21576 isDisabled, 21577 isLabeledByFormItem 21578 }); 21579 setStoreValue(props, { model }); 21580 return { 21581 inputId, 21582 isLabeledByFormItem, 21583 isChecked, 21584 isDisabled, 21585 isFocused, 21586 checkboxButtonSize, 21587 checkboxSize, 21588 hasOwnLabel, 21589 model, 21590 handleChange, 21591 onClickRoot 21592 }; 21593 }; 21594 21595 const _hoisted_1$T = ["tabindex", "role", "aria-checked"];
21596 const _hoisted_2$z = ["id", "aria-hidden", "name", "tabindex", "disabled", "true-value", "false-value"]; 21597 const _hoisted_3$j = ["id", "aria-hidden", "disabled", "value", "name", "tabindex"]; 21598 const __default__$1a = vue.defineComponent({ 21599 name: "ElCheckbox" 21600 }); 21601 const _sfc_main$1M = /* @__PURE__ */ vue.defineComponent({ 21602 ...__default__$1a, 21603 props: checkboxProps, 21604 emits: checkboxEmits, 21605 setup(__props) { 21606 const props = __props; 21607 const slots = vue.useSlots(); 21608 const { 21609 inputId, 21610 isLabeledByFormItem, 21611 isChecked, 21612 isDisabled, 21613 isFocused, 21614 checkboxSize, 21615 hasOwnLabel, 21616 model, 21617 handleChange, 21618 onClickRoot 21619 } = useCheckbox(props, slots); 21620 const ns = useNamespace("checkbox"); 21621 const compKls = vue.computed(() => { 21622 return [ 21623 ns.b(), 21624 ns.m(checkboxSize.value), 21625 ns.is("disabled", isDisabled.value), 21626 ns.is("bordered", props.border), 21627 ns.is("checked", isChecked.value) 21628 ]; 21629 }); 21630 const spanKls = vue.computed(() => { 21631 return [ 21632 ns.e("input"), 21633 ns.is("disabled", isDisabled.value), 21634 ns.is("checked", isChecked.value), 21635 ns.is("indeterminate", props.indeterminate), 21636 ns.is("focus", isFocused.value) 21637 ]; 21638 }); 21639 return (_ctx, _cache) => { 21640 return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(!vue.unref(hasOwnLabel) && vue.unref(isLabeledByFormItem) ? "span" : "label"), { 21641 class: vue.normalizeClass(vue.unref(compKls)), 21642 "aria-controls": _ctx.indeterminate ? _ctx.controls : null, 21643 onClick: vue.unref(onClickRoot) 21644 }, { 21645 default: vue.withCtx(() => [ 21646 vue.createElementVNode("span", { 21647 class: vue.normalizeClass(vue.unref(spanKls)), 21648 tabindex: _ctx.indeterminate ? 0 : void 0, 21649 role: _ctx.indeterminate ? "checkbox" : void 0, 21650 "aria-checked": _ctx.indeterminate ? "mixed" : void 0 21651 }, [ 21652 _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", { 21653 key: 0, 21654 id: vue.unref(inputId), 21655 "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(model) ? model.value = $event : null), 21656 class: vue.normalizeClass(vue.unref(ns).e("original")), 21657 type: "checkbox", 21658 "aria-hidden": _ctx.indeterminate ? "true" : "false", 21659 name: _ctx.name, 21660 tabindex: _ctx.tabindex, 21661 disabled: vue.unref(isDisabled), 21662 "true-value": _ctx.trueLabel, 21663 "false-value": _ctx.falseLabel, 21664 onChange: _cache[1] || (_cache[1] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)), 21665 onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true), 21666 onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false) 21667 }, null, 42, _hoisted_2$z)), [ 21668 [vue.vModelCheckbox, vue.unref(model)] 21669 ]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", { 21670 key: 1, 21671 id: vue.unref(inputId), 21672 "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vue.isRef(model) ? model.value = $event : null), 21673 class: vue.normalizeClass(vue.unref(ns).e("original")), 21674 type: "checkbox", 21675 "aria-hidden": _ctx.indeterminate ? "true" : "false", 21676 disabled: vue.unref(isDisabled), 21677 value: _ctx.label, 21678 name: _ctx.name, 21679 tabindex: _ctx.tabindex, 21680 onChange: _cache[5] || (_cache[5] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)), 21681 onFocus: _cache[6] || (_cache[6] = ($event) => isFocused.value = true), 21682 onBlur: _cache[7] || (_cache[7] = ($event) => isFocused.value = false) 21683 }, null, 42, _hoisted_3$j)), [ 21684 [vue.vModelCheckbox, vue.unref(model)] 21685 ]), 21686 vue.createElementVNode("span", { 21687 class: vue.normalizeClass(vue.unref(ns).e("inner")) 21688 }, null, 2) 21689 ], 10, _hoisted_1$T), 21690 vue.unref(hasOwnLabel) ? (vue.openBlock(), vue.createElementBlock("span", { 21691 key: 0, 21692 class: vue.normalizeClass(vue.unref(ns).e("label")) 21693 }, [
21694 vue.renderSlot(_ctx.$slots, "default"), 21695 !_ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ 21696 vue.createTextVNode(vue.toDisplayString(_ctx.label), 1) 21697 ], 64)) : vue.createCommentVNode("v-if", true) 21698 ], 2)) : vue.createCommentVNode("v-if", true) 21699 ]), 21700 _: 3 21701 }, 8, ["class", "aria-controls", "onClick"]); 21702 }; 21703 } 21704 }); 21705 var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$1M, [["__file", "checkbox.vue"]]); 21706 21707 const _hoisted_1$S = ["name", "tabindex", "disabled", "true-value", "false-value"]; 21708 const _hoisted_2$y = ["name", "tabindex", "disabled", "value"]; 21709 const __default__$19 = vue.defineComponent({ 21710 name: "ElCheckboxButton" 21711 }); 21712 const _sfc_main$1L = /* @__PURE__ */ vue.defineComponent({ 21713 ...__default__$19, 21714 props: checkboxProps, 21715 emits: checkboxEmits, 21716 setup(__props) { 21717 const props = __props; 21718 const slots = vue.useSlots(); 21719 const { 21720 isFocused, 21721 isChecked, 21722 isDisabled, 21723 checkboxButtonSize, 21724 model, 21725 handleChange 21726 } = useCheckbox(props, slots); 21727 const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0); 21728 const ns = useNamespace("checkbox"); 21729 const activeStyle = vue.computed(() => { 21730 var _a, _b, _c, _d; 21731 const fillValue = (_b = (_a = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a.value) != null ? _b : ""; 21732 return { 21733 backgroundColor: fillValue, 21734 borderColor: fillValue, 21735 color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "", 21736 boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0 21737 }; 21738 }); 21739 const labelKls = vue.computed(() => { 21740 return [ 21741 ns.b("button"), 21742 ns.bm("button", checkboxButtonSize.value), 21743 ns.is("disabled", isDisabled.value), 21744 ns.is("checked", isChecked.value), 21745 ns.is("focus", isFocused.value) 21746 ]; 21747 }); 21748 return (_ctx, _cache) => { 21749 return vue.openBlock(), vue.createElementBlock("label", { 21750 class: vue.normalizeClass(vue.unref(labelKls)) 21751 }, [ 21752 _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", { 21753 key: 0, 21754 "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(model) ? model.value = $event : null), 21755 class: vue.normalizeClass(vue.unref(ns).be("button", "original")), 21756 type: "checkbox", 21757 name: _ctx.name, 21758 tabindex: _ctx.tabindex, 21759 disabled: vue.unref(isDisabled), 21760 "true-value": _ctx.trueLabel, 21761 "false-value": _ctx.falseLabel, 21762 onChange: _cache[1] || (_cache[1] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)), 21763 onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true), 21764 onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false) 21765 }, null, 42, _hoisted_1$S)), [ 21766 [vue.vModelCheckbox, vue.unref(model)] 21767 ]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", { 21768 key: 1, 21769 "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vue.isRef(model) ? model.value = $event : null), 21770 class: vue.normalizeClass(vue.unref(ns).be("button", "original")), 21771 type: "checkbox", 21772 name: _ctx.name, 21773 tabindex: _ctx.tabindex, 21774 disabled: vue.unref(isDisabled), 21775 value: _ctx.label, 21776 onChange: _cache[5] || (_cache[5] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)), 21777 onFocus: _cache[6] || (_cache[6] = ($event) => isFocused.value = true), 21778 onBlur: _cache[7] || (_cache[7] = ($event) => isFocused.value = false) 21779 }, null, 42, _hoisted_2$y)), [ 21780 [vue.vModelCheckbox, vue.unref(model)] 21781 ]), 21782 _ctx.$slots.default || _ctx.label ? (vue.openBlock(), vue.createElementBlock("span", { 21783 key: 2, 21784 class: vue.normalizeClass(vue.unref(ns).be("button", "inner")), 21785 style: vue.normalizeStyle(vue.unref(isChecked) ? vue.unref(activeStyle) : void 0) 21786 }, [
21787 vue.renderSlot(_ctx.$slots, "default", {}, () => [ 21788 vue.createTextVNode(vue.toDisplayString(_ctx.label), 1) 21789 ]) 21790 ], 6)) : vue.createCommentVNode("v-if", true) 21791 ], 2); 21792 }; 21793 } 21794 }); 21795 var CheckboxButton = /* @__PURE__ */ _export_sfc(_sfc_main$1L, [["__file", "checkbox-button.vue"]]); 21796 21797 const checkboxGroupProps = buildProps({ 21798 modelValue: { 21799 type: definePropType(Array), 21800 default: () => [] 21801 }, 21802 disabled: Boolean, 21803 min: Number, 21804 max: Number, 21805 size: useSizeProp, 21806 label: String, 21807 fill: String, 21808 textColor: String, 21809 tag: { 21810 type: String, 21811 default: "div" 21812 }, 21813 validateEvent: { 21814 type: Boolean, 21815 default: true 21816 } 21817 }); 21818 const checkboxGroupEmits = { 21819 [UPDATE_MODEL_EVENT]: (val) => isArray$1(val), 21820 change: (val) => isArray$1(val) 21821 }; 21822 21823 const __default__$18 = vue.defineComponent({ 21824 name: "ElCheckboxGroup" 21825 }); 21826 const _sfc_main$1K = /* @__PURE__ */ vue.defineComponent({ 21827 ...__default__$18, 21828 props: checkboxGroupProps, 21829 emits: checkboxGroupEmits, 21830 setup(__props, { emit }) { 21831 const props = __props; 21832 const ns = useNamespace("checkbox"); 21833 const { formItem } = useFormItem(); 21834 const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, { 21835 formItemContext: formItem 21836 }); 21837 const changeEvent = async (value) => { 21838 emit(UPDATE_MODEL_EVENT, value); 21839 await vue.nextTick(); 21840 emit("change", value); 21841 }; 21842 const modelValue = vue.computed({ 21843 get() { 21844 return props.modelValue; 21845 }, 21846 set(val) { 21847 changeEvent(val); 21848 } 21849 }); 21850 vue.provide(checkboxGroupContextKey, { 21851 ...pick(vue.toRefs(props), [ 21852 "size", 21853 "min", 21854 "max", 21855 "disabled", 21856 "validateEvent", 21857 "fill", 21858 "textColor" 21859 ]), 21860 modelValue, 21861 changeEvent 21862 }); 21863 vue.watch(() => props.modelValue, () => { 21864 if (props.validateEvent) { 21865 formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()); 21866 } 21867 }); 21868 return (_ctx, _cache) => { 21869 var _a; 21870 return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), { 21871 id: vue.unref(groupId), 21872 class: vue.normalizeClass(vue.unref(ns).b("group")), 21873 role: "group", 21874 "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.label || "checkbox-group" : void 0, 21875 "aria-labelledby": vue.unref(isLabeledByFormItem) ? (_a = vue.unref(formItem)) == null ? void 0 : _a.labelId : void 0 21876 }, { 21877 default: vue.withCtx(() => [ 21878 vue.renderSlot(_ctx.$slots, "default") 21879 ]), 21880 _: 3 21881 }, 8, ["id", "class", "aria-label", "aria-labelledby"]); 21882 }; 21883 } 21884 }); 21885 var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1K, [["__file", "checkbox-group.vue"]]); 21886 21887 const ElCheckbox = withInstall(Checkbox, { 21888 CheckboxButton, 21889 CheckboxGroup 21890 }); 21891 const ElCheckboxButton = withNoopInstall(CheckboxButton); 21892 const ElCheckboxGroup$1 = withNoopInstall(CheckboxGroup); 21893 21894 const radioPropsBase = buildProps({ 21895 size: useSizeProp, 21896 disabled: Boolean, 21897 label: { 21898 type: [String, Number, Boolean], 21899 default: "" 21900 } 21901 }); 21902 const radioProps = buildProps({ 21903 ...radioPropsBase, 21904 modelValue: { 21905 type: [String, Number, Boolean], 21906 default: "" 21907 }, 21908 name: { 21909 type: String, 21910 default: "" 21911 }, 21912 border: Boolean 21913 }); 21914 const radioEmits = { 21915 [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val), 21916 [CHANGE_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val) 21917 }; 21918 21919 const radioGroupKey = Symbol("radioGroupKey"); 21920 21921 const useRadio = (props, emit) => { 21922 const radioRef = vue.ref(); 21923 const radioGroup = vue.inject(radioGroupKey, void 0); 21924 const isGroup = vue.computed(() => !!radioGroup); 21925 const modelValue = vue.computed({ 21926 get() { 21927 return isGroup.value ? radioGroup.modelValue : props.modelValue; 21928 }, 21929 set(val) { 21930 if (isGroup.value) { 21931 radioGroup.changeEvent(val); 21932 } else { 21933 emit && emit(UPDATE_MODEL_EVENT, val); 21934 } 21935 radioRef.value.checked = props.modelValue === props.label; 21936 } 21937 }); 21938 const size = useFormSize(vue.computed(() => radioGroup == null ? void 0 : radioGroup.size)); 21939 const disabled = useFormDisabled(vue.computed(() => radioGroup == null ? void 0 : radioGroup.disabled)); 21940 const focus = vue.ref(false); 21941 const tabIndex = vue.computed(() => { 21942 return disabled.value || isGroup.value && modelValue.value !== props.label ? -1 : 0; 21943 }); 21944 return { 21945 radioRef, 21946 isGroup, 21947 radioGroup, 21948 focus, 21949 size, 21950 disabled, 21951 tabIndex, 21952 modelValue 21953 }; 21954 }; 21955 21956 const _hoisted_1$R = ["value", "name", "disabled"]; 21957 const __default__$17 = vue.defineComponent({ 21958 name: "ElRadio" 21959 });
21960 const _sfc_main$1J = /* @__PURE__ */ vue.defineComponent({ 21961 ...__default__$17, 21962 props: radioProps, 21963 emits: radioEmits, 21964 setup(__props, { emit }) { 21965 const props = __props; 21966 const ns = useNamespace("radio"); 21967 const { radioRef, radioGroup, focus, size, disabled, modelValue } = useRadio(props, emit); 21968 function handleChange() { 21969 vue.nextTick(() => emit("change", modelValue.value)); 21970 } 21971 return (_ctx, _cache) => { 21972 var _a; 21973 return vue.openBlock(), vue.createElementBlock("label", { 21974 class: vue.normalizeClass([ 21975 vue.unref(ns).b(), 21976 vue.unref(ns).is("disabled", vue.unref(disabled)), 21977 vue.unref(ns).is("focus", vue.unref(focus)), 21978 vue.unref(ns).is("bordered", _ctx.border), 21979 vue.unref(ns).is("checked", vue.unref(modelValue) === _ctx.label), 21980 vue.unref(ns).m(vue.unref(size)) 21981 ]) 21982 }, [ 21983 vue.createElementVNode("span", { 21984 class: vue.normalizeClass([ 21985 vue.unref(ns).e("input"), 21986 vue.unref(ns).is("disabled", vue.unref(disabled)), 21987 vue.unref(ns).is("checked", vue.unref(modelValue) === _ctx.label) 21988 ]) 21989 }, [ 21990 vue.withDirectives(vue.createElementVNode("input", { 21991 ref_key: "radioRef", 21992 ref: radioRef, 21993 "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(modelValue) ? modelValue.value = $event : null), 21994 class: vue.normalizeClass(vue.unref(ns).e("original")), 21995 value: _ctx.label, 21996 name: _ctx.name || ((_a = vue.unref(radioGroup)) == null ? void 0 : _a.name), 21997 disabled: vue.unref(disabled), 21998 type: "radio", 21999 onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true), 22000 onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false), 22001 onChange: handleChange 22002 }, null, 42, _hoisted_1$R), [ 22003 [vue.vModelRadio, vue.unref(modelValue)] 22004 ]), 22005 vue.createElementVNode("span", { 22006 class: vue.normalizeClass(vue.unref(ns).e("inner")) 22007 }, null, 2) 22008 ], 2), 22009 vue.createElementVNode("span", { 22010 class: vue.normalizeClass(vue.unref(ns).e("label")), 22011 onKeydown: _cache[3] || (_cache[3] = vue.withModifiers(() => { 22012 }, ["stop"])) 22013 }, [ 22014 vue.renderSlot(_ctx.$slots, "default", {}, () => [ 22015 vue.createTextVNode(vue.toDisplayString(_ctx.label), 1) 22016 ]) 22017 ], 34) 22018 ], 2); 22019 }; 22020 } 22021 }); 22022 var Radio = /* @__PURE__ */ _export_sfc(_sfc_main$1J, [["__file", "radio.vue"]]); 22023 22024 const radioButtonProps = buildProps({ 22025 ...radioPropsBase, 22026 name: { 22027 type: String, 22028 default: "" 22029 } 22030 }); 22031 22032 const _hoisted_1$Q = ["value", "name", "disabled"]; 22033 const __default__$16 = vue.defineComponent({ 22034 name: "ElRadioButton" 22035 }); 22036 const _sfc_main$1I = /* @__PURE__ */ vue.defineComponent({ 22037 ...__default__$16, 22038 props: radioButtonProps, 22039 setup(__props) { 22040 const props = __props; 22041 const ns = useNamespace("radio"); 22042 const { radioRef, focus, size, disabled, modelValue, radioGroup } = useRadio(props); 22043 const activeStyle = vue.computed(() => { 22044 return { 22045 backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "", 22046 borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "", 22047 boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "", 22048 color: (radioGroup == null ? void 0 : radioGroup.textColor) || "" 22049 }; 22050 }); 22051 return (_ctx, _cache) => { 22052 var _a; 22053 return vue.openBlock(), vue.createElementBlock("label", { 22054 class: vue.normalizeClass([ 22055 vue.unref(ns).b("button"), 22056 vue.unref(ns).is("active", vue.unref(modelValue) === _ctx.label), 22057 vue.unref(ns).is("disabled", vue.unref(disabled)), 22058 vue.unref(ns).is("focus", vue.unref(focus)), 22059 vue.unref(ns).bm("button", vue.unref(size)) 22060 ]) 22061 }, [ 22062 vue.withDirectives(vue.createElementVNode("input", { 22063 ref_key: "radioRef", 22064 ref: radioRef, 22065 "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(modelValue) ? modelValue.value = $event : null), 22066 class: vue.normalizeClass(vue.unref(ns).be("button", "original-radio")), 22067 value: _ctx.label, 22068 type: "radio", 22069 name: _ctx.name || ((_a = vue.unref(radioGroup)) == null ? void 0 : _a.name), 22070 disabled: vue.unref(disabled), 22071 onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true), 22072 onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false) 22073 }, null, 42, _hoisted_1$Q), [ 22074 [vue.vModelRadio, vue.unref(modelValue)] 22075 ]), 22076 vue.createElementVNode("span", { 22077 class: vue.normalizeClass(vue.unref(ns).be("button", "inner")), 22078 style: vue.normalizeStyle(vue.unref(modelValue) === _ctx.label ? vue.unref(activeStyle) : {}), 22079 onKeydown: _cache[3] || (_cache[3] = vue.withModifiers(() => { 22080 }, ["stop"])) 22081 }, [
22082 vue.renderSlot(_ctx.$slots, "default", {}, () => [ 22083 vue.createTextVNode(vue.toDisplayString(_ctx.label), 1) 22084 ]) 22085 ], 38) 22086 ], 2); 22087 }; 22088 } 22089 }); 22090 var RadioButton = /* @__PURE__ */ _export_sfc(_sfc_main$1I, [["__file", "radio-button.vue"]]); 22091 22092 const radioGroupProps = buildProps({ 22093 id: { 22094 type: String, 22095 default: void 0 22096 }, 22097 size: useSizeProp, 22098 disabled: Boolean, 22099 modelValue: { 22100 type: [String, Number, Boolean], 22101 default: "" 22102 }, 22103 fill: { 22104 type: String, 22105 default: "" 22106 }, 22107 label: { 22108 type: String, 22109 default: void 0 22110 }, 22111 textColor: { 22112 type: String, 22113 default: "" 22114 }, 22115 name: { 22116 type: String, 22117 default: void 0 22118 }, 22119 validateEvent: { 22120 type: Boolean, 22121 default: true 22122 } 22123 }); 22124 const radioGroupEmits = radioEmits; 22125 22126 const _hoisted_1$P = ["id", "aria-label", "aria-labelledby"]; 22127 const __default__$15 = vue.defineComponent({ 22128 name: "ElRadioGroup" 22129 }); 22130 const _sfc_main$1H = /* @__PURE__ */ vue.defineComponent({ 22131 ...__default__$15, 22132 props: radioGroupProps, 22133 emits: radioGroupEmits, 22134 setup(__props, { emit }) { 22135 const props = __props; 22136 const ns = useNamespace("radio"); 22137 const radioId = useId(); 22138 const radioGroupRef = vue.ref(); 22139 const { formItem } = useFormItem(); 22140 const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, { 22141 formItemContext: formItem 22142 }); 22143 const changeEvent = (value) => { 22144 emit(UPDATE_MODEL_EVENT, value); 22145 vue.nextTick(() => emit("change", value)); 22146 }; 22147 vue.onMounted(() => { 22148 const radios = radioGroupRef.value.querySelectorAll("[type=radio]"); 22149 const firstLabel = radios[0]; 22150 if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) { 22151 firstLabel.tabIndex = 0; 22152 } 22153 }); 22154 const name = vue.computed(() => { 22155 return props.name || radioId.value; 22156 }); 22157 vue.provide(radioGroupKey, vue.reactive({ 22158 ...vue.toRefs(props), 22159 changeEvent, 22160 name 22161 })); 22162 vue.watch(() => props.modelValue, () => { 22163 if (props.validateEvent) { 22164 formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()); 22165 } 22166 }); 22167 return (_ctx, _cache) => { 22168 return vue.openBlock(), vue.createElementBlock("div", { 22169 id: vue.unref(groupId), 22170 ref_key: "radioGroupRef", 22171 ref: radioGroupRef, 22172 class: vue.normalizeClass(vue.unref(ns).b("group")), 22173 role: "radiogroup", 22174 "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.label || "radio-group" : void 0, 22175 "aria-labelledby": vue.unref(isLabeledByFormItem) ? vue.unref(formItem).labelId : void 0 22176 }, [ 22177 vue.renderSlot(_ctx.$slots, "default") 22178 ], 10, _hoisted_1$P); 22179 }; 22180 } 22181 }); 22182 var RadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1H, [["__file", "radio-group.vue"]]); 22183 22184 const ElRadio = withInstall(Radio, { 22185 RadioButton, 22186 RadioGroup 22187 }); 22188 const ElRadioGroup = withNoopInstall(RadioGroup); 22189 const ElRadioButton = withNoopInstall(RadioButton); 22190 22191 var NodeContent$1 = vue.defineComponent({ 22192 name: "NodeContent", 22193 setup() { 22194 const ns = useNamespace("cascader-node"); 22195 return { 22196 ns 22197 }; 22198 }, 22199 render() { 22200 const { ns } = this; 22201 const { node, panel } = this.$parent; 22202 const { data, label } = node; 22203 const { renderLabelFn } = panel; 22204 return vue.h("span", { class: ns.e("label") }, renderLabelFn ? renderLabelFn({ node, data }) : label); 22205 } 22206 }); 22207 22208 const CASCADER_PANEL_INJECTION_KEY = Symbol(); 22209 22210 const _sfc_main$1G = vue.defineComponent({ 22211 name: "ElCascaderNode", 22212 components: { 22213 ElCheckbox, 22214 ElRadio, 22215 NodeContent: NodeContent$1, 22216 ElIcon, 22217 Check: check_default, 22218 Loading: loading_default, 22219 ArrowRight: arrow_right_default 22220 }, 22221 props: { 22222 node: { 22223 type: Object, 22224 required: true 22225 }, 22226 menuId: String 22227 }, 22228 emits: ["expand"], 22229 setup(props, { emit }) { 22230 const panel = vue.inject(CASCADER_PANEL_INJECTION_KEY); 22231 const ns = useNamespace("cascader-node"); 22232 const isHoverMenu = vue.computed(() => panel.isHoverMenu); 22233 const multiple = vue.computed(() => panel.config.multiple); 22234 const checkStrictly = vue.computed(() => panel.config.checkStrictly); 22235 const checkedNodeId = vue.computed(() => { 22236 var _a; 22237 return (_a = panel.checkedNodes[0]) == null ? void 0 : _a.uid; 22238 }); 22239 const isDisabled = vue.computed(() => props.node.isDisabled); 22240 const isLeaf = vue.computed(() => props.node.isLeaf); 22241 const expandable = vue.computed(() => checkStrictly.value && !isLeaf.value || !isDisabled.value); 22242 const inExpandingPath = vue.computed(() => isInPath(panel.expandingNode)); 22243 const inCheckedPath = vue.computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath)); 22244 const isInPath = (node) => { 22245 var _a; 22246 const { level, uid } = props.node; 22247 return ((_a = node == null ? void 0 : node.pathNodes[level - 1]) == null ? void 0 : _a.uid) === uid; 22248 }; 22249 const doExpand = () => { 22250 if (inExpandingPath.value) 22251 return; 22252 panel.expandNode(props.node); 22253 };
22254 const doCheck = (checked) => { 22255 const { node } = props; 22256 if (checked === node.checked) 22257 return; 22258 panel.handleCheckChange(node, checked); 22259 }; 22260 const doLoad = () => { 22261 panel.lazyLoad(props.node, () => { 22262 if (!isLeaf.value) 22263 doExpand(); 22264 }); 22265 }; 22266 const handleHoverExpand = (e) => { 22267 if (!isHoverMenu.value) 22268 return; 22269 handleExpand(); 22270 !isLeaf.value && emit("expand", e); 22271 }; 22272 const handleExpand = () => { 22273 const { node } = props; 22274 if (!expandable.value || node.loading) 22275 return; 22276 node.loaded ? doExpand() : doLoad(); 22277 }; 22278 const handleClick = () => { 22279 if (isHoverMenu.value && !isLeaf.value) 22280 return; 22281 if (isLeaf.value && !isDisabled.value && !checkStrictly.value && !multiple.value) { 22282 handleCheck(true); 22283 } else { 22284 handleExpand(); 22285 } 22286 }; 22287 const handleSelectCheck = (checked) => { 22288 if (checkStrictly.value) { 22289 doCheck(checked); 22290 if (props.node.loaded) { 22291 doExpand(); 22292 } 22293 } else { 22294 handleCheck(checked); 22295 } 22296 }; 22297 const handleCheck = (checked) => { 22298 if (!props.node.loaded) { 22299 doLoad(); 22300 } else { 22301 doCheck(checked); 22302 !checkStrictly.value && doExpand(); 22303 } 22304 }; 22305 return { 22306 panel, 22307 isHoverMenu, 22308 multiple, 22309 checkStrictly, 22310 checkedNodeId, 22311 isDisabled, 22312 isLeaf, 22313 expandable, 22314 inExpandingPath, 22315 inCheckedPath, 22316 ns, 22317 handleHoverExpand, 22318 handleExpand, 22319 handleClick, 22320 handleCheck, 22321 handleSelectCheck 22322 }; 22323 } 22324 }); 22325 const _hoisted_1$O = ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex"]; 22326 const _hoisted_2$x = /* @__PURE__ */ vue.createElementVNode("span", null, null, -1); 22327 function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) { 22328 const _component_el_checkbox = vue.resolveComponent("el-checkbox"); 22329 const _component_el_radio = vue.resolveComponent("el-radio"); 22330 const _component_check = vue.resolveComponent("check"); 22331 const _component_el_icon = vue.resolveComponent("el-icon"); 22332 const _component_node_content = vue.resolveComponent("node-content"); 22333 const _component_loading = vue.resolveComponent("loading"); 22334 const _component_arrow_right = vue.resolveComponent("arrow-right"); 22335 return vue.openBlock(), vue.createElementBlock("li", { 22336 id: `${_ctx.menuId}-${_ctx.node.uid}`, 22337 role: "menuitem", 22338 "aria-haspopup": !_ctx.isLeaf, 22339 "aria-owns": _ctx.isLeaf ? null : _ctx.menuId, 22340 "aria-expanded": _ctx.inExpandingPath, 22341 tabindex: _ctx.expandable ? -1 : void 0, 22342 class: vue.normalizeClass([ 22343 _ctx.ns.b(), 22344 _ctx.ns.is("selectable", _ctx.checkStrictly), 22345 _ctx.ns.is("active", _ctx.node.checked), 22346 _ctx.ns.is("disabled", !_ctx.expandable), 22347 _ctx.inExpandingPath && "in-active-path", 22348 _ctx.inCheckedPath && "in-checked-path" 22349 ]), 22350 onMouseenter: _cache[2] || (_cache[2] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)), 22351 onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)), 22352 onClick: _cache[4] || (_cache[4] = (...args) => _ctx.handleClick && _ctx.handleClick(...args)) 22353 }, [ 22354 vue.createCommentVNode(" prefix "), 22355 _ctx.multiple ? (vue.openBlock(), vue.createBlock(_component_el_checkbox, { 22356 key: 0, 22357 "model-value": _ctx.node.checked, 22358 indeterminate: _ctx.node.indeterminate, 22359 disabled: _ctx.isDisabled, 22360 onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => { 22361 }, ["stop"])), 22362 "onUpdate:modelValue": _ctx.handleSelectCheck 22363 }, null, 8, ["model-value", "indeterminate", "disabled", "onUpdate:modelValue"])) : _
22363ctx.checkStrictly ? (vue.openBlock(), vue.createBlock(_component_el_radio, { 22364 key: 1, 22365 "model-value": _ctx.checkedNodeId, 22366 label: _ctx.node.uid, 22367 disabled: _ctx.isDisabled, 22368 "onUpdate:modelValue": _ctx.handleSelectCheck, 22369 onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => { 22370 }, ["stop"])) 22371 }, { 22372 default: vue.withCtx(() => [ 22373 vue.createCommentVNode("\n Add an empty element to avoid render label,\n do not use empty fragment here for https://github.com/vuejs/vue-next/pull/2485\n "), 22374 _hoisted_2$x 22375 ]), 22376 _: 1 22377 }, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])) : _ctx.isLeaf && _ctx.node.checked ? (vue.openBlock(), vue.createBlock(_component_el_icon, { 22378 key: 2, 22379 class: vue.normalizeClass(_ctx.ns.e("prefix")) 22380 }, { 22381 default: vue.withCtx(() => [ 22382 vue.createVNode(_component_check) 22383 ]), 22384 _: 1 22385 }, 8, ["class"])) : vue.createCommentVNode("v-if", true), 22386 vue.createCommentVNode(" content "), 22387 vue.createVNode(_component_node_content), 22388 vue.createCommentVNode(" postfix "), 22389 !_ctx.isLeaf ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [ 22390 _ctx.node.loading ? (vue.openBlock(), vue.createBlock(_component_el_icon, { 22391 key: 0, 22392 class: vue.normalizeClass([_ctx.ns.is("loading"), _ctx.ns.e("postfix")]) 22393 }, { 22394 default: vue.withCtx(() => [ 22395 vue.createVNode(_component_loading) 22396 ]), 22397 _: 1 22398 }, 8, ["class"])) : (vue.openBlock(), vue.createBlock(_component_el_icon, { 22399 key: 1, 22400 class: vue.normalizeClass(["arrow-right", _ctx.ns.e("postfix")]) 22401 }, { 22402 default: vue.withCtx(() => [ 22403 vue.createVNode(_component_arrow_right) 22404 ]), 22405 _: 1 22406 }, 8, ["class"])) 22407 ], 64)) : vue.createCommentVNode("v-if", true) 22408 ], 42, _hoisted_1$O); 22409 } 22410 var ElCascaderNode = /* @__PURE__ */ _export_sfc(_sfc_main$1G, [["render", _sfc_render$u], ["__file", "node.vue"]]); 22411 22412 const _sfc_main$1F = vue.defineComponent({ 22413 name: "ElCascaderMenu", 22414 components: { 22415 Loading: loading_default, 22416 ElIcon, 22417 ElScrollbar, 22418 ElCascaderNode 22419 }, 22420 props: { 22421 nodes: { 22422 type: Array, 22423 required: true 22424 }, 22425 index: { 22426 type: Number, 22427 required: true 22428 } 22429 }, 22430 setup(props) { 22431 const instance = vue.getCurrentInstance(); 22432 const ns = useNamespace("cascader-menu"); 22433 const { t } = useLocale(); 22434 const id = generateId(); 22435 let activeNode = null; 22436 let hoverTimer = null; 22437 const panel = vue.inject(CASCADER_PANEL_INJECTION_KEY); 22438 const hoverZone = vue.ref(null); 22439 const isEmpty = vue.computed(() => !props.nodes.length); 22440 const isLoading = vue.computed(() => !panel.initialLoaded); 22441 const menuId = vue.computed(() => `cascader-menu-${id}-${props.index}`); 22442 const handleExpand = (e) => { 22443 activeNode = e.target; 22444 }; 22445 const handleMouseMove = (e) => { 22446 if (!panel.isHoverMenu || !activeNode || !hoverZone.value) 22447 return; 22448 if (activeNode.contains(e.target)) { 22449 clearHoverTimer(); 22450 const el = instance.vnode.el; 22451 const { left } = el.getBoundingClientRect(); 22452 const { offsetWidth, offsetHeight } = el; 22453 const startX = e.clientX - left; 22454 const top = activeNode.offsetTop; 22455 const bottom = top + activeNode.offsetHeight; 22456 hoverZone.value.innerHTML = ` 22457 <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top} L${offsetWidth} 0 V${top} Z" /> 22458 <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom} L${offsetWidth} ${offsetHeight} V${bottom} Z" /> 22459 `; 22460 } else if (!hoverTimer) { 22461 hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold); 22462 } 22463 }; 22464 const clearHoverTimer = () => { 22465 if (!hoverTimer) 22466 return; 22467 clearTimeout(hoverTimer); 22468 hoverTimer = null; 22469 }; 22470 const clearHoverZone = () => { 22471 if (!hoverZone.value) 22472 return; 22473 hoverZone.value.innerHTML = ""; 22474 clearHoverTimer(); 22475 }; 22476 return { 22477 ns, 22478 panel, 22479 hoverZone, 22480 isEmpty, 22481 isLoading, 22482 menuId, 22483 t, 22484 handleExpand, 22485 handleMouseMove, 22486 clearHoverZone 22487 }; 22488 } 22489 });
22490 function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) { 22491 const _component_el_cascader_node = vue.resolveComponent("el-cascader-node"); 22492 const _component_loading = vue.resolveComponent("loading"); 22493 const _component_el_icon = vue.resolveComponent("el-icon"); 22494 const _component_el_scrollbar = vue.resolveComponent("el-scrollbar"); 22495 return vue.openBlock(), vue.createBlock(_component_el_scrollbar, { 22496 key: _ctx.menuId, 22497 tag: "ul", 22498 role: "menu", 22499 class: vue.normalizeClass(_ctx.ns.b()), 22500 "wrap-class": _ctx.ns.e("wrap"), 22501 "view-class": [_ctx.ns.e("list"), _ctx.ns.is("empty", _ctx.isEmpty)], 22502 onMousemove: _ctx.handleMouseMove, 22503 onMouseleave: _ctx.clearHoverZone 22504 }, { 22505 default: vue.withCtx(() => { 22506 var _a; 22507 return [ 22508 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.nodes, (node) => { 22509 return vue.openBlock(), vue.createBlock(_component_el_cascader_node, { 22510 key: node.uid, 22511 node, 22512 "menu-id": _ctx.menuId, 22513 onExpand: _ctx.handleExpand 22514 }, null, 8, ["node", "menu-id", "onExpand"]); 22515 }), 128)), 22516 _ctx.isLoading ? (vue.openBlock(), vue.createElementBlock("div", { 22517 key: 0, 22518 class: vue.normalizeClass(_ctx.ns.e("empty-text")) 22519 }, [ 22520 vue.createVNode(_component_el_icon, { 22521 size: "14", 22522 class: vue.normalizeClass(_ctx.ns.is("loading")) 22523 }, { 22524 default: vue.withCtx(() => [ 22525 vue.createVNode(_component_loading) 22526 ]), 22527 _: 1 22528 }, 8, ["class"]), 22529 vue.createTextVNode(" " + vue.toDisplayString(_ctx.t("el.cascader.loading")), 1) 22530 ], 2)) : _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", { 22531 key: 1, 22532 class: vue.normalizeClass(_ctx.ns.e("empty-text")) 22533 }, vue.toDisplayString(_ctx.t("el.cascader.noData")), 3)) : ((_a = _ctx.panel) == null ? void 0 : _a.isHoverMenu) ? (vue.openBlock(), vue.createElementBlock("svg", { 22534 key: 2, 22535 ref: "hoverZone", 22536 class: vue.normalizeClass(_ctx.ns.e("hover-zone")) 22537 }, null, 2)) : vue.createCommentVNode("v-if", true) 22538 ]; 22539 }), 22540 _: 1 22541 }, 8, ["class", "wrap-class", "view-class", "onMousemove", "onMouseleave"]); 22542 } 22543 var ElCascaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1F, [["render", _sfc_render$t], ["__file", "menu.vue"]]); 22544 22545 let uid = 0; 22546 const calculatePathNodes = (node) => { 22547 const nodes = [node]; 22548 let { parent } = node; 22549 while (parent) { 22550 nodes.unshift(parent); 22551 parent = parent.parent; 22552 } 22553 return nodes; 22554 }; 22555 class Node$2 { 22556 constructor(data, config, parent, root = false) { 22557 this.data = data; 22558 this.config = config; 22559 this.parent = parent; 22560 this.root = root; 22561 this.uid = uid++; 22562 this.checked = false; 22563 this.indeterminate = false; 22564 this.loading = false; 22565 const { value: valueKey, label: labelKey, children: childrenKey } = config; 22566 const childrenData = data[childrenKey]; 22567 const pathNodes = calculatePathNodes(this); 22568 this.level = root ? 0 : parent ? parent.level + 1 : 1; 22569 this.value = data[valueKey]; 22570 this.label = data[labelKey]; 22571 this.pathNodes = pathNodes; 22572 this.pathValues = pathNodes.map((node) => node.value); 22573 this.pathLabels = pathNodes.map((node) => node.label); 22574 this.childrenData = childrenData; 22575 this.children = (childrenData || []).map((child) => new Node$2(child, config, this)); 22576 this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData); 22577 } 22578 get isDisabled() { 22579 const { data, parent, config } = this; 22580 const { disabled, checkStrictly } = config; 22581 const isDisabled = isFunction$1(disabled) ? disabled(data, this) : !!data[disabled];
22582 return isDisabled || !checkStrictly && (parent == null ? void 0 : parent.isDisabled); 22583 } 22584 get isLeaf() { 22585 const { data, config, childrenData, loaded } = this; 22586 const { lazy, leaf } = config; 22587 const isLeaf = isFunction$1(leaf) ? leaf(data, this) : data[leaf]; 22588 return isUndefined(isLeaf) ? lazy && !loaded ? false : !(Array.isArray(childrenData) && childrenData.length) : !!isLeaf; 22589 } 22590 get valueByOption() { 22591 return this.config.emitPath ? this.pathValues : this.value; 22592 } 22593 appendChild(childData) { 22594 const { childrenData, children } = this; 22595 const node = new Node$2(childData, this.config, this); 22596 if (Array.isArray(childrenData)) { 22597 childrenData.push(childData); 22598 } else { 22599 this.childrenData = [childData]; 22600 } 22601 children.push(node); 22602 return node; 22603 } 22604 calcText(allLevels, separator) { 22605 const text = allLevels ? this.pathLabels.join(separator) : this.label; 22606 this.text = text; 22607 return text; 22608 } 22609 broadcast(event, ...args) { 22610 const handlerName = `onParent${capitalize(event)}`; 22611 this.children.forEach((child) => { 22612 if (child) { 22613 child.broadcast(event, ...args); 22614 child[handlerName] && child[handlerName](...args); 22615 } 22616 }); 22617 } 22618 emit(event, ...args) { 22619 const { parent } = this; 22620 const handlerName = `onChild${capitalize(event)}`; 22621 if (parent) { 22622 parent[handlerName] && parent[handlerName](...args); 22623 parent.emit(event, ...args); 22624 } 22625 } 22626 onParentCheck(checked) { 22627 if (!this.isDisabled) { 22628 this.setCheckState(checked); 22629 } 22630 } 22631 onChildCheck() { 22632 const { children } = this; 22633 const validChildren = children.filter((child) => !child.isDisabled); 22634 const checked = validChildren.length ? validChildren.every((child) => child.checked) : false; 22635 this.setCheckState(checked); 22636 } 22637 setCheckState(checked) { 22638 const totalNum = this.children.length; 22639 const checkedNum = this.children.reduce((c, p) => { 22640 const num = p.checked ? 1 : p.indeterminate ? 0.5 : 0; 22641 return c + num; 22642 }, 0); 22643 this.checked = this.loaded && this.children.filter((child) => !child.isDisabled).every((child) => child.loaded && child.checked) && checked; 22644 this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0; 22645 } 22646 doCheck(checked) { 22647 if (this.checked === checked) 22648 return; 22649 const { checkStrictly, multiple } = this.config; 22650 if (checkStrictly || !multiple) { 22651 this.checked = checked; 22652 } else { 22653 this.broadcast("check", checked); 22654 this.setCheckState(checked); 22655 this.emit("check"); 22656 } 22657 } 22658 } 22659 var Node$3 = Node$2; 22660 22661 const flatNodes = (nodes, leafOnly) => { 22662 return nodes.reduce((res, node) => { 22663 if (node.isLeaf) { 22664 res.push(node); 22665 } else { 22666 !leafOnly && res.push(node); 22667 res = res.concat(flatNodes(node.children, leafOnly)); 22668 } 22669 return res; 22670 }, []); 22671 }; 22672 class Store { 22673 constructor(data, config) { 22674 this.config = config; 22675 const nodes = (data || []).map((nodeData) => new Node$3(nodeData, this.config)); 22676 this.nodes = nodes; 22677 this.allNodes = flatNodes(nodes, false); 22678 this.leafNodes = flatNodes(nodes, true); 22679 } 22680 getNodes() { 22681 return this.nodes; 22682 } 22683 getFlattedNodes(leafOnly) { 22684 return leafOnly ? this.leafNodes : this.allNodes; 22685 } 22686 appendNode(nodeData, parentNode) { 22687 const node = parentNode ? parentNode.appendChild(nodeData) : new Node$3(nodeData, this.config); 22688 if (!parentNode) 22689 this.nodes.push(node); 22690 this.allNodes.push(node); 22691 node.isLeaf && this.leafNodes.push(node); 22692 } 22693 appendNodes(nodeDataList, parentNode) { 22694 nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode)); 22695 } 22696 getNodeByValue(value, leafOnly = false) { 22697 if (!value && value !== 0) 22698 return null; 22699 const node = this.getFlattedNodes(leafOnly).find((node2) => isEqual$1(node2.value, value) || isEqual$1(node2.pathValues, value)); 22700 return node || null; 22701 } 22702 getSameNode(node) { 22703 if (!node) 22704 return null; 22705 const node_ = this.getFlattedNodes(false).find(({ value, level }) => isEqual$1(node.value, value) && node.level === level); 22706 return node_ || null; 22707 } 22708 } 22709 22710 const CommonProps = buildProps({ 22711 modelValue: { 22712 type: definePropType([Number, String, Array]) 22713 }, 22714 options: { 22715 type: definePropType(Array), 22716 default: () => [] 22717 }, 22718 props: { 22719 type: definePropType(Object), 22720 default: () => ({}) 22721 } 22722 });
22723 const DefaultProps = { 22724 expandTrigger: "click", 22725 multiple: false, 22726 checkStrictly: false, 22727 emitPath: true, 22728 lazy: false, 22729 lazyLoad: NOOP, 22730 value: "value", 22731 label: "label", 22732 children: "children", 22733 leaf: "leaf", 22734 disabled: "disabled", 22735 hoverThreshold: 500 22736 }; 22737 const useCascaderConfig = (props) => { 22738 return vue.computed(() => ({ 22739 ...DefaultProps, 22740 ...props.props 22741 })); 22742 }; 22743 22744 const getMenuIndex = (el) => { 22745 if (!el) 22746 return 0; 22747 const pieces = el.id.split("-"); 22748 return Number(pieces[pieces.length - 2]); 22749 }; 22750 const checkNode = (el) => { 22751 if (!el) 22752 return; 22753 const input = el.querySelector("input"); 22754 if (input) { 22755 input.click(); 22756 } else if (isLeaf(el)) { 22757 el.click(); 22758 } 22759 }; 22760 const sortByOriginalOrder = (oldNodes, newNodes) => { 22761 const newNodesCopy = newNodes.slice(0); 22762 const newIds = newNodesCopy.map((node) => node.uid); 22763 const res = oldNodes.reduce((acc, item) => { 22764 const index = newIds.indexOf(item.uid); 22765 if (index > -1) { 22766 acc.push(item); 22767 newNodesCopy.splice(index, 1); 22768 newIds.splice(index, 1); 22769 } 22770 return acc; 22771 }, []); 22772 res.push(...newNodesCopy); 22773 return res; 22774 }; 22775 22776 const _sfc_main$1E = vue.defineComponent({ 22777 name: "ElCascaderPanel", 22778 components: { 22779 ElCascaderMenu 22780 }, 22781 props: { 22782 ...CommonProps, 22783 border: { 22784 type: Boolean, 22785 default: true 22786 }, 22787 renderLabel: Function 22788 }, 22789 emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, "close", "expand-change"], 22790 setup(props, { emit, slots }) { 22791 let manualChecked = false; 22792 const ns = useNamespace("cascader"); 22793 const config = useCascaderConfig(props); 22794 let store = null; 22795 const initialLoaded = vue.ref(true); 22796 const menuList = vue.ref([]); 22797 const checkedValue = vue.ref(null); 22798 const menus = vue.ref([]); 22799 const expandingNode = vue.ref(null); 22800 const checkedNodes = vue.ref([]); 22801 const isHoverMenu = vue.computed(() => config.value.expandTrigger === "hover"); 22802 const renderLabelFn = vue.computed(() => props.renderLabel || slots.default); 22803 const initStore = () => { 22804 const { options } = props; 22805 const cfg = config.value; 22806 manualChecked = false; 22807 store = new Store(options, cfg); 22808 menus.value = [store.getNodes()]; 22809 if (cfg.lazy && isEmpty(props.options)) { 22810 initialLoaded.value = false; 22811 lazyLoad(void 0, (list) => { 22812 if (list) { 22813 store = new Store(list, cfg); 22814 menus.value = [store.getNodes()]; 22815 } 22816 initialLoaded.value = true; 22817 syncCheckedValue(false, true); 22818 }); 22819 } else { 22820 syncCheckedValue(false, true); 22821 } 22822 }; 22823 const lazyLoad = (node, cb) => { 22824 const cfg = config.value; 22825 node = node || new Node$3({}, cfg, void 0, true); 22826 node.loading = true; 22827 const resolve = (dataList) => { 22828 const _node = node; 22829 const parent = _node.root ? null : _node; 22830 dataList && (store == null ? void 0 : store.appendNodes(dataList, parent)); 22831 _node.loading = false; 22832 _node.loaded = true; 22833 _node.childrenData = _node.childrenData || []; 22834 cb && cb(dataList); 22835 }; 22836 cfg.lazyLoad(node, resolve); 22837 }; 22838 const expandNode = (node, silent) => { 22839 var _a; 22840 const { level } = node; 22841 const newMenus = menus.value.slice(0, level); 22842 let newExpandingNode; 22843 if (node.isLeaf) { 22844 newExpandingNode = node.pathNodes[level - 2]; 22845 } else { 22846 newExpandingNode = node; 22847 newMenus.push(node.children); 22848 } 22849 if (((_a = expandingNode.value) == null ? void 0 : _a.uid) !== (newExpandingNode == null ? void 0 : newExpandingNode.uid)) { 22850 expandingNode.value = node; 22851 menus.value = newMenus;
22852 !silent && emit("expand-change", (node == null ? void 0 : node.pathValues) || []); 22853 } 22854 }; 22855 const handleCheckChange = (node, checked, emitClose = true) => { 22856 const { checkStrictly, multiple } = config.value; 22857 const oldNode = checkedNodes.value[0]; 22858 manualChecked = true; 22859 !multiple && (oldNode == null ? void 0 : oldNode.doCheck(false)); 22860 node.doCheck(checked); 22861 calculateCheckedValue(); 22862 emitClose && !multiple && !checkStrictly && emit("close"); 22863 !emitClose && !multiple && !checkStrictly && expandParentNode(node); 22864 }; 22865 const expandParentNode = (node) => { 22866 if (!node) 22867 return; 22868 node = node.parent; 22869 expandParentNode(node); 22870 node && expandNode(node); 22871 }; 22872 const getFlattedNodes = (leafOnly) => { 22873 return store == null ? void 0 : store.getFlattedNodes(leafOnly); 22874 }; 22875 const getCheckedNodes = (leafOnly) => { 22876 var _a; 22877 return (_a = getFlattedNodes(leafOnly)) == null ? void 0 : _a.filter((node) => node.checked !== false); 22878 }; 22879 const clearCheckedNodes = () => { 22880 checkedNodes.value.forEach((node) => node.doCheck(false)); 22881 calculateCheckedValue(); 22882 menus.value = menus.value.slice(0, 1); 22883 expandingNode.value = null; 22884 emit("expand-change", []); 22885 }; 22886 const calculateCheckedValue = () => { 22887 var _a; 22888 const { checkStrictly, multiple } = config.value; 22889 const oldNodes = checkedNodes.value; 22890 const newNodes = getCheckedNodes(!checkStrictly); 22891 const nodes = sortByOriginalOrder(oldNodes, newNodes); 22892 const values = nodes.map((node) => node.valueByOption); 22893 checkedNodes.value = nodes; 22894 checkedValue.value = multiple ? values : (_a = values[0]) != null ? _a : null; 22895 }; 22896 const syncCheckedValue = (loaded = false, forced = false) => { 22897 const { modelValue } = props; 22898 const { lazy, multiple, checkStrictly } = config.value; 22899 const leafOnly = !checkStrictly; 22900 if (!initialLoaded.value || manualChecked || !forced && isEqual$1(modelValue, checkedValue.value)) 22901 return; 22902 if (lazy && !loaded) { 22903 const values = unique(flattenDeep(castArray(modelValue))); 22904 const nodes = values.map((val) => store == null ? void 0 : store.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading); 22905 if (nodes.length) { 22906 nodes.forEach((node) => { 22907 lazyLoad(node, () => syncCheckedValue(false, forced)); 22908 }); 22909 } else { 22910 syncCheckedValue(true, forced); 22911 } 22912 } else { 22913 const values = multiple ? castArray(modelValue) : [modelValue]; 22914 const nodes = unique(values.map((val) => store == null ? void 0 : store.getNodeByValue(val, leafOnly))); 22915 syncMenuState(nodes, forced); 22916 checkedValue.value = cloneDeep(modelValue); 22917 } 22918 }; 22919 const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => { 22920 const { checkStrictly } = config.value; 22921 const oldNodes = checkedNodes.value; 22922 const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf)); 22923 const oldExpandingNode = store == null ? void 0 : store.getSameNode(expandingNode.value); 22924 const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0]; 22925 if (newExpandingNode) { 22926 newExpandingNode.pathNodes.forEach((node) => expandNode(node, true)); 22927 } else { 22928 expandingNode.value = null; 22929 } 22930 oldNodes.forEach((node) => node.doCheck(false)); 22931 newNodes.forEach((node) => node.doCheck(true)); 22932 checkedNodes.value = newNodes; 22933 vue.nextTick(scrollToExpandingNode); 22934 }; 22935 const scrollToExpandingNode = () => { 22936 if (!isClient) 22937 return; 22938 menuList.value.forEach((menu) => { 22939 const menuElement = menu == null ? void 0 : menu.$el; 22940 if (menuElement) { 22941 const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`); 22942 const activeNode = menuElement.querySelector(`.${ns.b("node")}.${ns.is("active")}`) || menuElement.querySelector(`.${ns.b("node")}.in-active-path`); 22943 scrollIntoView(container, activeNode); 22944 } 22945 }); 22946 }; 22947 const handleKeyDown = (e) => { 22948 const target = e.target; 22949 const { code } = e; 22950 switch (code) { 22951 case EVENT_CODE.up: 22952 case EVENT_CODE.down: { 22953 e.preventDefault(); 22954 const distance = code === EVENT_CODE.up ? -1 : 1; 22955 focusNode(getSibling(target, distance, `.${ns.b("node")}[tabindex="-1"]`)); 22956 break; 22957 } 22958 case EVENT_CODE.left: { 22959 e.preventDefault(); 22960 const preMenu = menuList.value[getMenuIndex(target) - 1]; 22961 const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`); 22962 focusNode(expandedNode); 22963 break; 22964 } 22965 case EVENT_CODE.right: { 22966 e.preventDefault(); 22967 const nextMenu = menuList.value[getMenuIndex(target) + 1]; 22968 const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`); 22969 focusNode(firstNode); 22970 break; 22971 }
22972 case EVENT_CODE.enter: 22973 checkNode(target); 22974 break; 22975 } 22976 }; 22977 vue.provide(CASCADER_PANEL_INJECTION_KEY, vue.reactive({ 22978 config, 22979 expandingNode, 22980 checkedNodes, 22981 isHoverMenu, 22982 initialLoaded, 22983 renderLabelFn, 22984 lazyLoad, 22985 expandNode, 22986 handleCheckChange 22987 })); 22988 vue.watch([config, () => props.options], initStore, { 22989 deep: true, 22990 immediate: true 22991 }); 22992 vue.watch(() => props.modelValue, () => { 22993 manualChecked = false; 22994 syncCheckedValue(); 22995 }, { 22996 deep: true 22997 }); 22998 vue.watch(() => checkedValue.value, (val) => { 22999 if (!isEqual$1(val, props.modelValue)) { 23000 emit(UPDATE_MODEL_EVENT, val); 23001 emit(CHANGE_EVENT, val); 23002 } 23003 }); 23004 vue.onBeforeUpdate(() => menuList.value = []); 23005 vue.onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue()); 23006 return { 23007 ns, 23008 menuList, 23009 menus, 23010 checkedNodes, 23011 handleKeyDown, 23012 handleCheckChange, 23013 getFlattedNodes, 23014 getCheckedNodes, 23015 clearCheckedNodes, 23016 calculateCheckedValue, 23017 scrollToExpandingNode 23018 }; 23019 } 23020 }); 23021 function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) { 23022 const _component_el_cascader_menu = vue.resolveComponent("el-cascader-menu"); 23023 return vue.openBlock(), vue.createElementBlock("div", { 23024 class: vue.normalizeClass([_ctx.ns.b("panel"), _ctx.ns.is("bordered", _ctx.border)]), 23025 onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args)) 23026 }, [ 23027 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menus, (menu, index) => { 23028 return vue.openBlock(), vue.createBlock(_component_el_cascader_menu, { 23029 key: index, 23030 ref_for: true, 23031 ref: (item) => _ctx.menuList[index] = item, 23032 index, 23033 nodes: [...menu] 23034 }, null, 8, ["index", "nodes"]); 23035 }), 128)) 23036 ], 34); 23037 } 23038 var CascaderPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1E, [["render", _sfc_render$s], ["__file", "index.vue"]]); 23039 23040 CascaderPanel.install = (app) => { 23041 app.component(CascaderPanel.name, CascaderPanel); 23042 }; 23043 const _CascaderPanel = CascaderPanel; 23044 const ElCascaderPanel = _CascaderPanel; 23045 23046 const tagProps = buildProps({ 23047 type: { 23048 type: String, 23049 values: ["success", "info", "warning", "danger", ""], 23050 default: "" 23051 }, 23052 closable: Boolean, 23053 disableTransitions: Boolean, 23054 hit: Boolean, 23055 color: { 23056 type: String, 23057 default: "" 23058 }, 23059 size: { 23060 type: String, 23061 values: componentSizes, 23062 default: "" 23063 }, 23064 effect: { 23065 type: String, 23066 values: ["dark", "light", "plain"], 23067 default: "light" 23068 }, 23069 round: Boolean 23070 }); 23071 const tagEmits = { 23072 close: (evt) => evt instanceof MouseEvent, 23073 click: (evt) => evt instanceof MouseEvent 23074 }; 23075 23076 const __default__$14 = vue.defineComponent({ 23077 name: "ElTag" 23078 }); 23079 const _sfc_main$1D = /* @__PURE__ */ vue.defineComponent({ 23080 ...__default__$14, 23081 props: tagProps, 23082 emits: tagEmits, 23083 setup(__props, { emit }) { 23084 const props = __props; 23085 const tagSize = useFormSize(); 23086 const ns = useNamespace("tag"); 23087 const containerKls = vue.computed(() => { 23088 const { type, hit, effect, closable, round } = props; 23089 return [ 23090 ns.b(), 23091 ns.is("closable", closable), 23092 ns.m(type), 23093 ns.m(tagSize.value), 23094 ns.m(effect), 23095 ns.is("hit", hit), 23096 ns.is("round", round) 23097 ]; 23098 }); 23099 const handleClose = (event) => { 23100 emit("close", event); 23101 }; 23102 const handleClick = (event) => { 23103 emit("click", event); 23104 }; 23105 return (_ctx, _cache) => { 23106 return _ctx.disableTransitions ? (vue.openBlock(), vue.createElementBlock("span", { 23107 key: 0, 23108 class: vue.normalizeClass(vue.unref(containerKls)), 23109 style: vue.normalizeStyle({ backgroundColor: _ctx.color }), 23110 onClick: handleClick 23111 }, [ 23112 vue.createElementVNode("span", { 23113 class: vue.normalizeClass(vue.unref(ns).e("content")) 23114 }, [
23115 vue.renderSlot(_ctx.$slots, "default") 23116 ], 2), 23117 _ctx.closable ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 23118 key: 0, 23119 class: vue.normalizeClass(vue.unref(ns).e("close")), 23120 onClick: vue.withModifiers(handleClose, ["stop"]) 23121 }, { 23122 default: vue.withCtx(() => [ 23123 vue.createVNode(vue.unref(close_default)) 23124 ]), 23125 _: 1 23126 }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true) 23127 ], 6)) : (vue.openBlock(), vue.createBlock(vue.Transition, { 23128 key: 1, 23129 name: `${vue.unref(ns).namespace.value}-zoom-in-center`, 23130 appear: "" 23131 }, { 23132 default: vue.withCtx(() => [ 23133 vue.createElementVNode("span", { 23134 class: vue.normalizeClass(vue.unref(containerKls)), 23135 style: vue.normalizeStyle({ backgroundColor: _ctx.color }), 23136 onClick: handleClick 23137 }, [ 23138 vue.createElementVNode("span", { 23139 class: vue.normalizeClass(vue.unref(ns).e("content")) 23140 }, [ 23141 vue.renderSlot(_ctx.$slots, "default") 23142 ], 2), 23143 _ctx.closable ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 23144 key: 0, 23145 class: vue.normalizeClass(vue.unref(ns).e("close")), 23146 onClick: vue.withModifiers(handleClose, ["stop"]) 23147 }, { 23148 default: vue.withCtx(() => [ 23149 vue.createVNode(vue.unref(close_default)) 23150 ]), 23151 _: 1 23152 }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true) 23153 ], 6) 23154 ]), 23155 _: 3 23156 }, 8, ["name"])); 23157 }; 23158 } 23159 }); 23160 var Tag = /* @__PURE__ */ _export_sfc(_sfc_main$1D, [["__file", "tag.vue"]]); 23161 23162 const ElTag = withInstall(Tag); 23163 23164 const cascaderProps = buildProps({ 23165 ...CommonProps, 23166 size: useSizeProp, 23167 placeholder: String, 23168 disabled: Boolean, 23169 clearable: Boolean, 23170 filterable: Boolean, 23171 filterMethod: { 23172 type: definePropType(Function), 23173 default: (node, keyword) => node.text.includes(keyword) 23174 }, 23175 separator: { 23176 type: String, 23177 default: " / " 23178 }, 23179 showAllLevels: { 23180 type: Boolean, 23181 default: true 23182 }, 23183 collapseTags: Boolean, 23184 collapseTagsTooltip: { 23185 type: Boolean, 23186 default: false 23187 }, 23188 debounce: { 23189 type: Number, 23190 default: 300 23191 }, 23192 beforeFilter: { 23193 type: definePropType(Function), 23194 default: () => true 23195 }, 23196 popperClass: { 23197 type: String, 23198 default: "" 23199 }, 23200 teleported: useTooltipContentProps.teleported, 23201 tagType: { ...tagProps.type, default: "info" }, 23202 validateEvent: { 23203 type: Boolean, 23204 default: true 23205 } 23206 }); 23207 const cascaderEmits = { 23208 [UPDATE_MODEL_EVENT]: (val) => !!val || val === null, 23209 [CHANGE_EVENT]: (val) => !!val || val === null, 23210 focus: (evt) => evt instanceof FocusEvent, 23211 blur: (evt) => evt instanceof FocusEvent, 23212 visibleChange: (val) => isBoolean(val), 23213 expandChange: (val) => !!val, 23214 removeTag: (val) => !!val 23215 }; 23216 23217 const _hoisted_1$N = { key: 0 }; 23218 const _hoisted_2$w = ["placeholder", "onKeydown"]; 23219 const _hoisted_3$i = ["onClick"]; 23220 const COMPONENT_NAME$e = "ElCascader"; 23221 const __default__$13 = vue.defineComponent({ 23222 name: COMPONENT_NAME$e 23223 }); 23224 const _sfc_main$1C = /* @__PURE__ */ vue.defineComponent({ 23225 ...__default__$13, 23226 props: cascaderProps, 23227 emits: cascaderEmits, 23228 setup(__props, { expose, emit }) { 23229 const props = __props; 23230 const popperOptions = { 23231 modifiers: [ 23232 { 23233 name: "arrowPosition", 23234 enabled: true, 23235 phase: "main", 23236 fn: ({ state }) => { 23237 const { modifiersData, placement } = state; 23238 if (["right", "left", "bottom", "top"].includes(placement)) 23239 return; 23240 modifiersData.arrow.x = 35; 23241 }, 23242 requires: ["arrow"] 23243 } 23244 ] 23245 }; 23246 const attrs = vue.useAttrs(); 23247 let inputInitialHeight = 0; 23248 let pressDeleteCount = 0; 23249 const nsCascader = useNamespace("cascader"); 23250 const nsInput = useNamespace("input"); 23251 const { t } = useLocale(); 23252 const { form, formItem } = useFormItem(); 23253 const tooltipRef = vue.ref(null); 23254 const input = vue.ref(null); 23255 const tagWrapper = vue.ref(null); 23256 const cascaderPanelRef = vue.ref(null); 23257 const suggestionPanel = vue.ref(null); 23258 const popperVisible = vue.ref(false); 23259 const inputHover = vue.ref(false); 23260 const filtering = vue.ref(false); 23261 const filterFocus = vue.ref(false); 23262 const inputValue = vue.ref(""); 23263 const searchInputValue = vue.ref(""); 23264 const presentTags = vue.ref([]);
23265 const allPresentTags = vue.ref([]); 23266 const suggestions = vue.ref([]); 23267 const isOnComposition = vue.ref(false); 23268 const cascaderStyle = vue.computed(() => { 23269 return attrs.style; 23270 }); 23271 const isDisabled = vue.computed(() => props.disabled || (form == null ? void 0 : form.disabled)); 23272 const inputPlaceholder = vue.computed(() => props.placeholder || t("el.cascader.placeholder")); 23273 const currentPlaceholder = vue.computed(() => searchInputValue.value || presentTags.value.length > 0 || isOnComposition.value ? "" : inputPlaceholder.value); 23274 const realSize = useFormSize(); 23275 const tagSize = vue.computed(() => ["small"].includes(realSize.value) ? "small" : "default"); 23276 const multiple = vue.computed(() => !!props.props.multiple); 23277 const readonly = vue.computed(() => !props.filterable || multiple.value); 23278 const searchKeyword = vue.computed(() => multiple.value ? searchInputValue.value : inputValue.value); 23279 const checkedNodes = vue.computed(() => { 23280 var _a; 23281 return ((_a = cascaderPanelRef.value) == null ? void 0 : _a.checkedNodes) || []; 23282 }); 23283 const clearBtnVisible = vue.computed(() => { 23284 if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value) 23285 return false; 23286 return !!checkedNodes.value.length; 23287 }); 23288 const presentText = vue.computed(() => { 23289 const { showAllLevels, separator } = props; 23290 const nodes = checkedNodes.value; 23291 return nodes.length ? multiple.value ? "" : nodes[0].calcText(showAllLevels, separator) : ""; 23292 }); 23293 const checkedValue = vue.computed({ 23294 get() { 23295 return cloneDeep(props.modelValue); 23296 }, 23297 set(val) { 23298 emit(UPDATE_MODEL_EVENT, val); 23299 emit(CHANGE_EVENT, val); 23300 if (props.validateEvent) { 23301 formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()); 23302 } 23303 } 23304 }); 23305 const cascaderKls = vue.computed(() => { 23306 return [ 23307 nsCascader.b(), 23308 nsCascader.m(realSize.value), 23309 nsCascader.is("disabled", isDisabled.value), 23310 attrs.class 23311 ]; 23312 }); 23313 const cascaderIconKls = vue.computed(() => { 23314 return [ 23315 nsInput.e("icon"), 23316 "icon-arrow-down", 23317 nsCascader.is("reverse", popperVisible.value) 23318 ]; 23319 }); 23320 const inputClass = vue.computed(() => { 23321 return nsCascader.is("focus", popperVisible.value || filterFocus.value); 23322 }); 23323 const contentRef = vue.computed(() => { 23324 var _a, _b; 23325 return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef; 23326 }); 23327 const togglePopperVisible = (visible) => { 23328 var _a, _b, _c; 23329 if (isDisabled.value) 23330 return; 23331 visible = visible != null ? visible : !popperVisible.value; 23332 if (visible !== popperVisible.value) { 23333 popperVisible.value = visible; 23334 (_b = (_a = input.value) == null ? void 0 : _a.input) == null ? void 0 : _b.setAttribute("aria-expanded", `${visible}`); 23335 if (visible) { 23336 updatePopperPosition(); 23337 vue.nextTick((_c = cascaderPanelRef.value) == null ? void 0 : _c.scrollToExpandingNode); 23338 } else if (props.filterable) { 23339 syncPresentTextValue(); 23340 } 23341 emit("visibleChange", visible); 23342 } 23343 }; 23344 const updatePopperPosition = () => { 23345 vue.nextTick(() => { 23346 var _a; 23347 (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper(); 23348 }); 23349 }; 23350 const hideSuggestionPanel = () => { 23351 filtering.value = false; 23352 }; 23353 const genTag = (node) => { 23354 const { showAllLevels, separator } = props; 23355 return { 23356 node, 23357 key: node.uid, 23358 text: node.calcText(showAllLevels, separator), 23359 hitState: false, 23360 closable: !isDisabled.value && !node.isDisabled, 23361 isCollapseTag: false 23362 }; 23363 }; 23364 const deleteTag = (tag) => { 23365 var _a; 23366 const node = tag.node; 23367 node.doCheck(false); 23368 (_a = cascaderPanelRef.value) == null ? void 0 : _a.calculateCheckedValue(); 23369 emit("removeTag", node.valueByOption); 23370 }; 23371 const calculatePresentTags = () => { 23372 if (!multiple.value) 23373 return; 23374 const nodes = checkedNodes.value; 23375 const tags = []; 23376 const allTags = [];
23377 nodes.forEach((node) => allTags.push(genTag(node))); 23378 allPresentTags.value = allTags; 23379 if (nodes.length) { 23380 const [first, ...rest] = nodes; 23381 const restCount = rest.length; 23382 tags.push(genTag(first)); 23383 if (restCount) { 23384 if (props.collapseTags) { 23385 tags.push({ 23386 key: -1, 23387 text: `+ ${restCount}`, 23388 closable: false, 23389 isCollapseTag: true 23390 }); 23391 } else { 23392 rest.forEach((node) => tags.push(genTag(node))); 23393 } 23394 } 23395 } 23396 presentTags.value = tags; 23397 }; 23398 const calculateSuggestions = () => { 23399 var _a, _b; 23400 const { filterMethod, showAllLevels, separator } = props; 23401 const res = (_b = (_a = cascaderPanelRef.value) == null ? void 0 : _a.getFlattedNodes(!props.props.checkStrictly)) == null ? void 0 : _b.filter((node) => { 23402 if (node.isDisabled) 23403 return false; 23404 node.calcText(showAllLevels, separator); 23405 return filterMethod(node, searchKeyword.value); 23406 }); 23407 if (multiple.value) { 23408 presentTags.value.forEach((tag) => { 23409 tag.hitState = false; 23410 }); 23411 allPresentTags.value.forEach((tag) => { 23412 tag.hitState = false; 23413 }); 23414 } 23415 filtering.value = true; 23416 suggestions.value = res; 23417 updatePopperPosition(); 23418 }; 23419 const focusFirstNode = () => { 23420 var _a; 23421 let firstNode; 23422 if (filtering.value && suggestionPanel.value) { 23423 firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`); 23424 } else { 23425 firstNode = (_a = cascaderPanelRef.value) == null ? void 0 : _a.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`); 23426 } 23427 if (firstNode) { 23428 firstNode.focus(); 23429 !filtering.value && firstNode.click(); 23430 } 23431 }; 23432 const updateStyle = () => { 23433 var _a, _b; 23434 const inputInner = (_a = input.value) == null ? void 0 : _a.input; 23435 const tagWrapperEl = tagWrapper.value; 23436 const suggestionPanelEl = (_b = suggestionPanel.value) == null ? void 0 : _b.$el; 23437 if (!isClient || !inputInner) 23438 return; 23439 if (suggestionPanelEl) { 23440 const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`); 23441 suggestionList.style.minWidth = `${inputInner.offsetWidth}px`; 23442 } 23443 if (tagWrapperEl) { 23444 const { offsetHeight } = tagWrapperEl; 23445 const height = presentTags.value.length > 0 ? `${Math.max(offsetHeight + 6, inputInitialHeight)}px` : `${inputInitialHeight}px`; 23446 inputInner.style.height = height; 23447 updatePopperPosition(); 23448 } 23449 }; 23450 const getCheckedNodes = (leafOnly) => { 23451 var _a; 23452 return (_a = cascaderPanelRef.value) == null ? void 0 : _a.getCheckedNodes(leafOnly); 23453 }; 23454 const handleExpandChange = (value) => { 23455 updatePopperPosition(); 23456 emit("expandChange", value); 23457 }; 23458 const handleComposition = (event) => { 23459 var _a; 23460 const text = (_a = event.target) == null ? void 0 : _a.value; 23461 if (event.type === "compositionend") { 23462 isOnComposition.value = false; 23463 vue.nextTick(() => handleInput(text)); 23464 } else { 23465 const lastCharacter = text[text.length - 1] || ""; 23466 isOnComposition.value = !isKorean(lastCharacter); 23467 } 23468 }; 23469 const handleKeyDown = (e) => { 23470 if (isOnComposition.value) 23471 return; 23472 switch (e.code) { 23473 case EVENT_CODE.enter: 23474 togglePopperVisible(); 23475 break; 23476 case EVENT_CODE.down: 23477 togglePopperVisible(true); 23478 vue.nextTick(focusFirstNode); 23479 e.preventDefault(); 23480 break; 23481 case EVENT_CODE.esc: 23482 if (popperVisible.value === true) { 23483 e.preventDefault(); 23484 e.stopPropagation(); 23485 togglePopperVisible(false); 23486 } 23487 break; 23488 case EVENT_CODE.tab: 23489 togglePopperVisible(false); 23490 break; 23491 } 23492 }; 23493 const handleClear = () => { 23494 var _a; 23495 (_a = cascaderPanelRef.value) == null ? void 0 : _a.clearCheckedNodes(); 23496 if (!popperVisible.value && props.filterable) { 23497 syncPresentTextValue(); 23498 } 23499 togglePopperVisible(false); 23500 }; 23501 const syncPresentTextValue = () => { 23502 const { value } = presentText; 23503 inputValue.value = value; 23504 searchInputValue.value = value; 23505 }; 23506 const handleSuggestionClick = (node) => { 23507 var _a, _b; 23508 const { checked } = node; 23509 if (multiple.value) { 23510 (_a = cascaderPanelRef.value) == null ? void 0 : _a.handleCheckChange(node, !checked, false); 23511 } else { 23512 !checked && ((_b = cascaderPanelRef.value) == null ? void 0 : _b.handleCheckChange(node, true, false)); 23513 togglePopperVisible(false); 23514 } 23515 }; 23516 const handleSuggestionKeyDown = (e) => { 23517 const target = e.target; 23518 const { code } = e; 23519 switch (code) { 23520 case EVENT_CODE.up: 23521 case EVENT_CODE.down: { 23522 const distance = code === EVENT_CODE.up ? -1 : 1; 23523 focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`)); 23524 break; 23525 }
23526 case EVENT_CODE.enter: 23527 target.click(); 23528 break; 23529 } 23530 }; 23531 const handleDelete = () => { 23532 const tags = presentTags.value; 23533 const lastTag = tags[tags.length - 1]; 23534 pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1; 23535 if (!lastTag || !pressDeleteCount || props.collapseTags && tags.length > 1) 23536 return; 23537 if (lastTag.hitState) { 23538 deleteTag(lastTag); 23539 } else { 23540 lastTag.hitState = true; 23541 } 23542 }; 23543 const handleFocus = (e) => { 23544 const el = e.target; 23545 const name = nsCascader.e("search-input"); 23546 if (el.className === name) { 23547 filterFocus.value = true; 23548 } 23549 emit("focus", e); 23550 }; 23551 const handleBlur = (e) => { 23552 filterFocus.value = false; 23553 emit("blur", e); 23554 }; 23555 const handleFilter = debounce(() => { 23556 const { value } = searchKeyword; 23557 if (!value) 23558 return; 23559 const passed = props.beforeFilter(value); 23560 if (isPromise(passed)) { 23561 passed.then(calculateSuggestions).catch(() => { 23562 }); 23563 } else if (passed !== false) { 23564 calculateSuggestions(); 23565 } else { 23566 hideSuggestionPanel(); 23567 } 23568 }, props.debounce); 23569 const handleInput = (val, e) => { 23570 !popperVisible.value && togglePopperVisible(true); 23571 if (e == null ? void 0 : e.isComposing) 23572 return; 23573 val ? handleFilter() : hideSuggestionPanel(); 23574 }; 23575 vue.watch(filtering, updatePopperPosition); 23576 vue.watch([checkedNodes, isDisabled], calculatePresentTags); 23577 vue.watch(presentTags, () => { 23578 vue.nextTick(() => updateStyle()); 23579 }); 23580 vue.watch(presentText, syncPresentTextValue, { immediate: true }); 23581 vue.onMounted(() => { 23582 const inputInner = input.value.input; 23583 const inputInnerHeight = Number.parseFloat(useCssVar(nsInput.cssVarName("input-height"), inputInner).value) - 2; 23584 inputInitialHeight = inputInner.offsetHeight || inputInnerHeight; 23585 useResizeObserver(inputInner, updateStyle); 23586 }); 23587 expose({ 23588 getCheckedNodes, 23589 cascaderPanelRef, 23590 togglePopperVisible, 23591 contentRef 23592 }); 23593 return (_ctx, _cache) => { 23594 return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), { 23595 ref_key: "tooltipRef", 23596 ref: tooltipRef, 23597 visible: popperVisible.value, 23598 teleported: _ctx.teleported, 23599 "popper-class": [vue.unref(nsCascader).e("dropdown"), _ctx.popperClass], 23600 "popper-options": popperOptions, 23601 "fallback-placements": [ 23602 "bottom-start", 23603 "bottom", 23604 "top-start", 23605 "top", 23606 "right", 23607 "left" 23608 ], 23609 "stop-popper-mouse-event": false, 23610 "gpu-acceleration": false, 23611 placement: "bottom-start", 23612 transition: `${vue.unref(nsCascader).namespace.value}-zoom-in-top`, 23613 effect: "light", 23614 pure: "", 23615 persistent: "", 23616 onHide: hideSuggestionPanel 23617 }, { 23618 default: vue.withCtx(() => [ 23619 vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", { 23620 class: vue.normalizeClass(vue.unref(cascaderKls)), 23621 style: vue.normalizeStyle(vue.unref(cascaderStyle)), 23622 onClick: _cache[5] || (_cache[5] = () => togglePopperVisible(vue.unref(readonly) ? void 0 : true)), 23623 onKeydown: handleKeyDown, 23624 onMouseenter: _cache[6] || (_cache[6] = ($event) => inputHover.value = true), 23625 onMouseleave: _cache[7] || (_cache[7] = ($event) => inputHover.value = false) 23626 }, [ 23627 vue.createVNode(vue.unref(ElInput), { 23628 ref_key: "input", 23629 ref: input, 23630 modelValue: inputValue.value, 23631 "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => inputValue.value = $event), 23632 placeholder: vue.unref(currentPlaceholder), 23633 readonly: vue.unref(readonly), 23634 disabled: vue.unref(isDisabled), 23635 "validate-event": false, 23636 size: vue.unref(realSize), 23637 class: vue.normalizeClass(vue.unref(inputClass)), 23638 tabindex: vue.unref(multiple) && _ctx.filterable && !vue.unref(isDisabled) ? -1 : void 0, 23639 onCompositionstart: handleComposition, 23640 onCompositionupdate: handleComposition, 23641 onCompositionend: handleComposition, 23642 onFocus: handleFocus, 23643 onBlur: handleBlur, 23644 onInput: handleInput 23645 }, { 23646 suffix: vue.withCtx(() => [ 23647 vue.unref(clearBtnVisible) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 23648 key: "clear", 23649 class: vue.normalizeClass([vue.unref(nsInput).e("icon"), "icon-circle-close"]), 23650 onClick: vue.withModifiers(handleClear, ["stop"]) 23651 }, { 23652 default: vue.withCtx(() => [ 23653 vue.createVNode(vue.unref(circle_close_default)) 23654 ]), 23655 _: 1 23656 }, 8, ["class", "onClick"])) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 23657 key: "arrow-down", 23658 class: vue.normalizeClass(vue.unref(cascaderIconKls)), 23659 onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => togglePopperVisible(), ["stop"])) 23660 }, { 23661 default: vue.withCtx(() => [ 23662 vue.createVNode(vue.unref(arrow_down_default)) 23663 ]), 23664 _: 1 23665 }, 8, ["class"])) 23666 ]), 23667 _: 1 23668 }, 8, ["modelValue", "placeholder", "readonly", "disabled", "size", "class", "tabindex"]), 23669 vue.unref(multiple) ? (vue.openBlock(), vue.createElementBlock("div", { 23670 key: 0, 23671 ref_key: "tagWrapper", 23672 ref: tagWrapper, 23673 class: vue.normalizeClass(vue.unref(nsCascader).e("tags")) 23674 }, [ 23675 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(presentTags.value, (tag) => {
23676 return vue.openBlock(), vue.createBlock(vue.unref(ElTag), { 23677 key: tag.key, 23678 type: _ctx.tagType, 23679 size: vue.unref(tagSize), 23680 hit: tag.hitState, 23681 closable: tag.closable, 23682 "disable-transitions": "", 23683 onClose: ($event) => deleteTag(tag) 23684 }, { 23685 default: vue.withCtx(() => [ 23686 tag.isCollapseTag === false ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$N, vue.toDisplayString(tag.text), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), { 23687 key: 1, 23688 disabled: popperVisible.value || !_ctx.collapseTagsTooltip, 23689 "fallback-placements": ["bottom", "top", "right", "left"], 23690 placement: "bottom", 23691 effect: "light" 23692 }, { 23693 default: vue.withCtx(() => [ 23694 vue.createElementVNode("span", null, vue.toDisplayString(tag.text), 1) 23695 ]), 23696 content: vue.withCtx(() => [ 23697 vue.createElementVNode("div", { 23698 class: vue.normalizeClass(vue.unref(nsCascader).e("collapse-tags")) 23699 }, [ 23700 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(allPresentTags.value.slice(1), (tag2, idx) => { 23701 return vue.openBlock(), vue.createElementBlock("div", { 23702 key: idx, 23703 class: vue.normalizeClass(vue.unref(nsCascader).e("collapse-tag")) 23704 }, [ 23705 (vue.openBlock(), vue.createBlock(vue.unref(ElTag), { 23706 key: tag2.key, 23707 class: "in-tooltip", 23708 type: _ctx.tagType, 23709 size: vue.unref(tagSize), 23710 hit: tag2.hitState, 23711 closable: tag2.closable, 23712 "disable-transitions": "", 23713 onClose: ($event) => deleteTag(tag2) 23714 }, { 23715 default: vue.withCtx(() => [ 23716 vue.createElementVNode("span", null, vue.toDisplayString(tag2.text), 1) 23717 ]), 23718 _: 2 23719 }, 1032, ["type", "size", "hit", "closable", "onClose"])) 23720 ], 2); 23721 }), 128)) 23722 ], 2) 23723 ]), 23724 _: 2 23725 }, 1032, ["disabled"])) 23726 ]), 23727 _: 2 23728 }, 1032, ["type", "size", "hit", "closable", "onClose"]); 23729 }), 128)), 23730 _ctx.filterable && !vue.unref(isDisabled) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", { 23731 key: 0, 23732 "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => searchInputValue.value = $event), 23733 type: "text", 23734 class: vue.normalizeClass(vue.unref(nsCascader).e("search-input")), 23735 placeholder: vue.unref(presentText) ? "" : vue.unref(inputPlaceholder), 23736 onInput: _cache[3] || (_cache[3] = (e) => handleInput(searchInputValue.value, e)), 23737 onClick: _cache[4] || (_cache[4] = vue.withModifiers(($event) => togglePopperVisible(true), ["stop"])), 23738 onKeydown: vue.withKeys(handleDelete, ["delete"]), 23739 onCompositionstart: handleComposition, 23740 onCompositionupdate: handleComposition, 23741 onCompositionend: handleComposition, 23742 onFocus: handleFocus, 23743 onBlur: handleBlur 23744 }, null, 42, _hoisted_2$w)), [ 23745 [vue.vModelText, searchInputValue.value] 23746 ]) : vue.createCommentVNode("v-if", true) 23747 ], 2)) : vue.createCommentVNode("v-if", true) 23748 ], 38)), [ 23749 [vue.unref(ClickOutside), () => togglePopperVisible(false), vue.unref(contentRef)] 23750 ]) 23751 ]), 23752 content: vue.withCtx(() => [ 23753 vue.withDirectives(vue.createVNode(vue.unref(_CascaderPanel), { 23754 ref_key: "cascaderPanelRef", 23755 ref: cascaderPanelRef, 23756 modelValue: vue.unref(checkedValue), 23757 "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => vue.isRef(checkedValue) ? checkedValue.value = $event : null), 23758 options: _ctx.options, 23759 props: props.props, 23760 border: false, 23761 "render-label": _ctx.$slots.default, 23762 onExpandChange: handleExpandChange, 23763 onClose: _cache[9] || (_cache[9] = ($event) => _ctx.$nextTick(() => togglePopperVisible(false))) 23764 }, null, 8, ["modelValue", "options", "props", "render-label"]), [ 23765 [vue.vShow, !filtering.value] 23766 ]), 23767 _ctx.filterable ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElScrollbar), { 23768 key: 0, 23769 ref_key: "suggestionPanel", 23770 ref: suggestionPanel, 23771 tag: "ul", 23772 class: vue.normalizeClass(vue.unref(nsCascader).e("suggestion-panel")), 23773 "view-class": vue.unref(nsCascader).e("suggestion-list"), 23774 onKeydown: handleSuggestionKeyDown 23775 }, { 23776 default: vue.withCtx(() => [ 23777 suggestions.value.length ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(suggestions.value, (item) => {
23778 return vue.openBlock(), vue.createElementBlock("li", { 23779 key: item.uid, 23780 class: vue.normalizeClass([ 23781 vue.unref(nsCascader).e("suggestion-item"), 23782 vue.unref(nsCascader).is("checked", item.checked) 23783 ]), 23784 tabindex: -1, 23785 onClick: ($event) => handleSuggestionClick(item) 23786 }, [ 23787 vue.createElementVNode("span", null, vue.toDisplayString(item.text), 1), 23788 item.checked ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, { 23789 default: vue.withCtx(() => [ 23790 vue.createVNode(vue.unref(check_default)) 23791 ]), 23792 _: 1 23793 })) : vue.createCommentVNode("v-if", true) 23794 ], 10, _hoisted_3$i); 23795 }), 128)) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [ 23796 vue.createElementVNode("li", { 23797 class: vue.normalizeClass(vue.unref(nsCascader).e("empty-text")) 23798 }, vue.toDisplayString(vue.unref(t)("el.cascader.noMatch")), 3) 23799 ]) 23800 ]), 23801 _: 3 23802 }, 8, ["class", "view-class"])), [ 23803 [vue.vShow, filtering.value] 23804 ]) : vue.createCommentVNode("v-if", true) 23805 ]), 23806 _: 3 23807 }, 8, ["visible", "teleported", "popper-class", "transition"]); 23808 }; 23809 } 23810 }); 23811 var Cascader = /* @__PURE__ */ _export_sfc(_sfc_main$1C, [["__file", "cascader.vue"]]); 23812 23813 Cascader.install = (app) => { 23814 app.component(Cascader.name, Cascader); 23815 }; 23816 const _Cascader = Cascader; 23817 const ElCascader = _Cascader; 23818 23819 const checkTagProps = buildProps({ 23820 checked: { 23821 type: Boolean, 23822 default: false 23823 } 23824 }); 23825 const checkTagEmits = { 23826 "update:checked": (value) => isBoolean(value), 23827 [CHANGE_EVENT]: (value) => isBoolean(value) 23828 }; 23829 23830 const __default__$12 = vue.defineComponent({ 23831 name: "ElCheckTag" 23832 }); 23833 const _sfc_main$1B = /* @__PURE__ */ vue.defineComponent({ 23834 ...__default__$12, 23835 props: checkTagProps, 23836 emits: checkTagEmits, 23837 setup(__props, { emit }) { 23838 const props = __props; 23839 const ns = useNamespace("check-tag"); 23840 const containerKls = vue.computed(() => [ns.b(), ns.is("checked", props.checked)]); 23841 const handleChange = () => { 23842 const checked = !props.checked; 23843 emit(CHANGE_EVENT, checked); 23844 emit("update:checked", checked); 23845 }; 23846 return (_ctx, _cache) => { 23847 return vue.openBlock(), vue.createElementBlock("span", { 23848 class: vue.normalizeClass(vue.unref(containerKls)), 23849 onClick: handleChange 23850 }, [ 23851 vue.renderSlot(_ctx.$slots, "default") 23852 ], 2); 23853 }; 23854 } 23855 }); 23856 var CheckTag = /* @__PURE__ */ _export_sfc(_sfc_main$1B, [["__file", "check-tag.vue"]]); 23857 23858 const ElCheckTag = withInstall(CheckTag); 23859 23860 const rowContextKey = Symbol("rowContextKey"); 23861 23862 const RowJustify = [ 23863 "start", 23864 "center", 23865 "end", 23866 "space-around", 23867 "space-between", 23868 "space-evenly" 23869 ]; 23870 const RowAlign = ["top", "middle", "bottom"]; 23871 const rowProps = buildProps({ 23872 tag: { 23873 type: String, 23874 default: "div" 23875 }, 23876 gutter: { 23877 type: Number, 23878 default: 0 23879 }, 23880 justify: { 23881 type: String, 23882 values: RowJustify, 23883 default: "start" 23884 }, 23885 align: { 23886 type: String, 23887 values: RowAlign, 23888 default: "top" 23889 } 23890 }); 23891 23892 const __default__$11 = vue.defineComponent({ 23893 name: "ElRow" 23894 }); 23895 const _sfc_main$1A = /* @__PURE__ */ vue.defineComponent({ 23896 ...__default__$11, 23897 props: rowProps, 23898 setup(__props) { 23899 const props = __props; 23900 const ns = useNamespace("row"); 23901 const gutter = vue.computed(() => props.gutter); 23902 vue.provide(rowContextKey, { 23903 gutter 23904 }); 23905 const style = vue.computed(() => { 23906 const styles = {}; 23907 if (!props.gutter) { 23908 return styles; 23909 } 23910 styles.marginRight = styles.marginLeft = `-${props.gutter / 2}px`; 23911 return styles; 23912 }); 23913 const rowKls = vue.computed(() => [ 23914 ns.b(), 23915 ns.is(`justify-${props.justify}`, props.justify !== "start"), 23916 ns.is(`align-${props.align}`, props.align !== "top") 23917 ]); 23918 return (_ctx, _cache) => {
23919 return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), { 23920 class: vue.normalizeClass(vue.unref(rowKls)), 23921 style: vue.normalizeStyle(vue.unref(style)) 23922 }, { 23923 default: vue.withCtx(() => [ 23924 vue.renderSlot(_ctx.$slots, "default") 23925 ]), 23926 _: 3 23927 }, 8, ["class", "style"]); 23928 }; 23929 } 23930 }); 23931 var Row$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1A, [["__file", "row.vue"]]); 23932 23933 const ElRow = withInstall(Row$1); 23934 23935 const colProps = buildProps({ 23936 tag: { 23937 type: String, 23938 default: "div" 23939 }, 23940 span: { 23941 type: Number, 23942 default: 24 23943 }, 23944 offset: { 23945 type: Number, 23946 default: 0 23947 }, 23948 pull: { 23949 type: Number, 23950 default: 0 23951 }, 23952 push: { 23953 type: Number, 23954 default: 0 23955 }, 23956 xs: { 23957 type: definePropType([Number, Object]), 23958 default: () => mutable({}) 23959 }, 23960 sm: { 23961 type: definePropType([Number, Object]), 23962 default: () => mutable({}) 23963 }, 23964 md: { 23965 type: definePropType([Number, Object]), 23966 default: () => mutable({}) 23967 }, 23968 lg: { 23969 type: definePropType([Number, Object]), 23970 default: () => mutable({}) 23971 }, 23972 xl: { 23973 type: definePropType([Number, Object]), 23974 default: () => mutable({}) 23975 } 23976 }); 23977 23978 const __default__$10 = vue.defineComponent({ 23979 name: "ElCol" 23980 }); 23981 const _sfc_main$1z = /* @__PURE__ */ vue.defineComponent({ 23982 ...__default__$10, 23983 props: colProps, 23984 setup(__props) { 23985 const props = __props; 23986 const { gutter } = vue.inject(rowContextKey, { gutter: vue.computed(() => 0) }); 23987 const ns = useNamespace("col"); 23988 const style = vue.computed(() => { 23989 const styles = {}; 23990 if (gutter.value) { 23991 styles.paddingLeft = styles.paddingRight = `${gutter.value / 2}px`; 23992 } 23993 return styles; 23994 }); 23995 const colKls = vue.computed(() => { 23996 const classes = []; 23997 const pos = ["span", "offset", "pull", "push"]; 23998 pos.forEach((prop) => { 23999 const size = props[prop]; 24000 if (isNumber(size)) { 24001 if (prop === "span") 24002 classes.push(ns.b(`${props[prop]}`)); 24003 else if (size > 0) 24004 classes.push(ns.b(`${prop}-${props[prop]}`)); 24005 } 24006 }); 24007 const sizes = ["xs", "sm", "md", "lg", "xl"];
24008 sizes.forEach((size) => { 24009 if (isNumber(props[size])) { 24010 classes.push(ns.b(`${size}-${props[size]}`)); 24011 } else if (isObject$1(props[size])) { 24012 Object.entries(props[size]).forEach(([prop, sizeProp]) => { 24013 classes.push(prop !== "span" ? ns.b(`${size}-${prop}-${sizeProp}`) : ns.b(`${size}-${sizeProp}`)); 24014 }); 24015 } 24016 }); 24017 if (gutter.value) { 24018 classes.push(ns.is("guttered")); 24019 } 24020 return [ns.b(), classes]; 24021 }); 24022 return (_ctx, _cache) => { 24023 return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), { 24024 class: vue.normalizeClass(vue.unref(colKls)), 24025 style: vue.normalizeStyle(vue.unref(style)) 24026 }, { 24027 default: vue.withCtx(() => [ 24028 vue.renderSlot(_ctx.$slots, "default") 24029 ]), 24030 _: 3 24031 }, 8, ["class", "style"]); 24032 }; 24033 } 24034 }); 24035 var Col = /* @__PURE__ */ _export_sfc(_sfc_main$1z, [["__file", "col.vue"]]); 24036 24037 const ElCol = withInstall(Col); 24038 24039 const emitChangeFn = (value) => typeof isNumber(value); 24040 const collapseProps = buildProps({ 24041 accordion: Boolean, 24042 modelValue: { 24043 type: definePropType([Array, String, Number]), 24044 default: () => mutable([]) 24045 } 24046 }); 24047 const collapseEmits = { 24048 [UPDATE_MODEL_EVENT]: emitChangeFn, 24049 [CHANGE_EVENT]: emitChangeFn 24050 }; 24051 24052 const collapseContextKey = Symbol("collapseContextKey"); 24053 24054 const useCollapse = (props, emit) => { 24055 const activeNames = vue.ref(castArray$1(props.modelValue)); 24056 const setActiveNames = (_activeNames) => { 24057 activeNames.value = _activeNames; 24058 const value = props.accordion ? activeNames.value[0] : activeNames.value; 24059 emit(UPDATE_MODEL_EVENT, value); 24060 emit(CHANGE_EVENT, value); 24061 }; 24062 const handleItemClick = (name) => { 24063 if (props.accordion) {
24064 setActiveNames([activeNames.value[0] === name ? "" : name]); 24065 } else { 24066 const _activeNames = [...activeNames.value]; 24067 const index = _activeNames.indexOf(name); 24068 if (index > -1) { 24069 _activeNames.splice(index, 1); 24070 } else { 24071 _activeNames.push(name); 24072 } 24073 setActiveNames(_activeNames); 24074 } 24075 }; 24076 vue.watch(() => props.modelValue, () => activeNames.value = castArray$1(props.modelValue), { deep: true }); 24077 vue.provide(collapseContextKey, { 24078 activeNames, 24079 handleItemClick 24080 }); 24081 return { 24082 activeNames, 24083 setActiveNames 24084 }; 24085 }; 24086 const useCollapseDOM = () => { 24087 const ns = useNamespace("collapse"); 24088 const rootKls = vue.computed(() => ns.b()); 24089 return { 24090 rootKls 24091 }; 24092 }; 24093 24094 const __default__$$ = vue.defineComponent({ 24095 name: "ElCollapse" 24096 }); 24097 const _sfc_main$1y = /* @__PURE__ */ vue.defineComponent({ 24098 ...__default__$$, 24099 props: collapseProps, 24100 emits: collapseEmits, 24101 setup(__props, { expose, emit }) { 24102 const props = __props; 24103 const { activeNames, setActiveNames } = useCollapse(props, emit); 24104 const { rootKls } = useCollapseDOM(); 24105 expose({ 24106 activeNames,
24107 setActiveNames 24108 }); 24109 return (_ctx, _cache) => { 24110 return vue.openBlock(), vue.createElementBlock("div", { 24111 class: vue.normalizeClass(vue.unref(rootKls)), 24112 role: "tablist", 24113 "aria-multiselectable": "true" 24114 }, [ 24115 vue.renderSlot(_ctx.$slots, "default") 24116 ], 2); 24117 }; 24118 } 24119 }); 24120 var Collapse = /* @__PURE__ */ _export_sfc(_sfc_main$1y, [["__file", "collapse.vue"]]); 24121 24122 const __default__$_ = vue.defineComponent({ 24123 name: "ElCollapseTransition" 24124 }); 24125 const _sfc_main$1x = /* @__PURE__ */ vue.defineComponent({ 24126 ...__default__$_, 24127 setup(__props) { 24128 const ns = useNamespace("collapse-transition"); 24129 const on = { 24130 beforeEnter(el) { 24131 if (!el.dataset) 24132 el.dataset = {}; 24133 el.dataset.oldPaddingTop = el.style.paddingTop; 24134 el.dataset.oldPaddingBottom = el.style.paddingBottom; 24135 el.style.maxHeight = 0; 24136 el.style.paddingTop = 0; 24137 el.style.paddingBottom = 0; 24138 }, 24139 enter(el) { 24140 el.dataset.oldOverflow = el.style.overflow; 24141 if (el.scrollHeight !== 0) { 24142 el.style.maxHeight = `${el.scrollHeight}px`; 24143 el.style.paddingTop = el.dataset.oldPaddingTop; 24144 el.style.paddingBottom = el.dataset.oldPaddingBottom; 24145 } else { 24146 el.style.maxHeight = 0; 24147 el.style.paddingTop = el.dataset.oldPaddingTop; 24148 el.style.paddingBottom = el.dataset.oldPaddingBottom; 24149 } 24150 el.style.overflow = "hidden"; 24151 }, 24152 afterEnter(el) { 24153 el.style.maxHeight = ""; 24154 el.style.overflow = el.dataset.oldOverflow; 24155 }, 24156 beforeLeave(el) { 24157 if (!el.dataset) 24158 el.dataset = {}; 24159 el.dataset.oldPaddingTop = el.style.paddingTop; 24160 el.dataset.oldPaddingBottom = el.style.paddingBottom; 24161 el.dataset.oldOverflow = el.style.overflow; 24162 el.style.maxHeight = `${el.scrollHeight}px`; 24163 el.style.overflow = "hidden"; 24164 }, 24165 leave(el) { 24166 if (el.scrollHeight !== 0) { 24167 el.style.maxHeight = 0; 24168 el.style.paddingTop = 0; 24169 el.style.paddingBottom = 0; 24170 } 24171 }, 24172 afterLeave(el) { 24173 el.style.maxHeight = ""; 24174 el.style.overflow = el.dataset.oldOverflow; 24175 el.style.paddingTop = el.dataset.oldPaddingTop; 24176 el.style.paddingBottom = el.dataset.oldPaddingBottom; 24177 } 24178 }; 24179 return (_ctx, _cache) => { 24180 return vue.openBlock(), vue.createBlock(vue.Transition, vue.mergeProps({ 24181 name: vue.unref(ns).b() 24182 }, vue.toHandlers(on)), { 24183 default: vue.withCtx(() => [ 24184 vue.renderSlot(_ctx.$slots, "default") 24185 ]), 24186 _: 3 24187 }, 16, ["name"]); 24188 }; 24189 } 24190 }); 24191 var CollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$1x, [["__file", "collapse-transition.vue"]]); 24192 24193 CollapseTransition.install = (app) => { 24194 app.component(CollapseTransition.name, CollapseTransition); 24195 }; 24196 const _CollapseTransition = CollapseTransition; 24197 const ElCollapseTransition = _CollapseTransition; 24198 24199 const collapseItemProps = buildProps({ 24200 title: { 24201 type: String, 24202 default: "" 24203 }, 24204 name: { 24205 type: definePropType([String, Number]), 24206 default: () => generateId() 24207 }, 24208 disabled: Boolean 24209 }); 24210 24211 const useCollapseItem = (props) => { 24212 const collapse = vue.inject(collapseContextKey); 24213 const focusing = vue.ref(false); 24214 const isClick = vue.ref(false); 24215 const id = vue.ref(generateId()); 24216 const isActive = vue.computed(() => collapse == null ? void 0 : collapse.activeNames.value.includes(props.name)); 24217 const handleFocus = () => { 24218 setTimeout(() => { 24219 if (!isClick.value) { 24220 focusing.value = true; 24221 } else { 24222 isClick.value = false; 24223 } 24224 }, 50); 24225 }; 24226 const handleHeaderClick = () => { 24227 if (props.disabled) 24228 return;
24229 collapse == null ? void 0 : collapse.handleItemClick(props.name); 24230 focusing.value = false; 24231 isClick.value = true; 24232 }; 24233 const handleEnterClick = () => { 24234 collapse == null ? void 0 : collapse.handleItemClick(props.name); 24235 }; 24236 return { 24237 focusing, 24238 id, 24239 isActive, 24240 handleFocus, 24241 handleHeaderClick, 24242 handleEnterClick 24243 }; 24244 }; 24245 const useCollapseItemDOM = (props, { focusing, isActive, id }) => { 24246 const ns = useNamespace("collapse"); 24247 const rootKls = vue.computed(() => [ 24248 ns.b("item"), 24249 ns.is("active", vue.unref(isActive)), 24250 ns.is("disabled", props.disabled) 24251 ]); 24252 const headKls = vue.computed(() => [ 24253 ns.be("item", "header"), 24254 ns.is("active", vue.unref(isActive)), 24255 { focusing: vue.unref(focusing) && !props.disabled } 24256 ]); 24257 const arrowKls = vue.computed(() => [ 24258 ns.be("item", "arrow"), 24259 ns.is("active", vue.unref(isActive)) 24260 ]); 24261 const itemWrapperKls = vue.computed(() => ns.be("item", "wrap")); 24262 const itemContentKls = vue.computed(() => ns.be("item", "content")); 24263 const scopedContentId = vue.computed(() => ns.b(`content-${vue.unref(id)}`)); 24264 const scopedHeadId = vue.computed(() => ns.b(`head-${vue.unref(id)}`)); 24265 return { 24266 arrowKls, 24267 headKls, 24268 rootKls, 24269 itemWrapperKls, 24270 itemContentKls, 24271 scopedContentId, 24272 scopedHeadId 24273 }; 24274 }; 24275 24276 const _hoisted_1$M = ["aria-expanded", "aria-controls", "aria-describedby"]; 24277 const _hoisted_2$v = ["id", "tabindex"]; 24278 const _hoisted_3$h = ["id", "aria-hidden", "aria-labelledby"]; 24279 const __default__$Z = vue.defineComponent({ 24280 name: "ElCollapseItem" 24281 }); 24282 const _sfc_main$1w = /* @__PURE__ */ vue.defineComponent({ 24283 ...__default__$Z, 24284 props: collapseItemProps, 24285 setup(__props, { expose }) { 24286 const props = __props; 24287 const { 24288 focusing, 24289 id, 24290 isActive, 24291 handleFocus, 24292 handleHeaderClick, 24293 handleEnterClick 24294 } = useCollapseItem(props); 24295 const { 24296 arrowKls, 24297 headKls, 24298 rootKls, 24299 itemWrapperKls, 24300 itemContentKls, 24301 scopedContentId, 24302 scopedHeadId 24303 } = useCollapseItemDOM(props, { focusing, isActive, id }); 24304 expose({ 24305 isActive 24306 }); 24307 return (_ctx, _cache) => { 24308 return vue.openBlock(), vue.createElementBlock("div", { 24309 class: vue.normalizeClass(vue.unref(rootKls)) 24310 }, [ 24311 vue.createElementVNode("div", { 24312 role: "tab", 24313 "aria-expanded": vue.unref(isActive), 24314 "aria-controls": vue.unref(scopedContentId), 24315 "aria-describedby": vue.unref(scopedContentId) 24316 }, [ 24317 vue.createElementVNode("div", { 24318 id: vue.unref(scopedHeadId), 24319 class: vue.normalizeClass(vue.unref(headKls)), 24320 role: "button", 24321 tabindex: _ctx.disabled ? -1 : 0, 24322 onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(handleHeaderClick) && vue.unref(handleHeaderClick)(...args)), 24323 onKeypress: _cache[1] || (_cache[1] = vue.withKeys(vue.withModifiers((...args) => vue.unref(handleEnterClick) && vue.unref(handleEnterClick)(...args), ["stop", "prevent"]), ["space", "enter"])), 24324 onFocus: _cache[2] || (_cache[2] = (...args) => vue.unref(handleFocus) && vue.unref(handleFocus)(...args)), 24325 onBlur: _cache[3] || (_cache[3] = ($event) => focusing.value = false) 24326 }, [ 24327 vue.renderSlot(_ctx.$slots, "title", {}, () => [ 24328 vue.createTextVNode(vue.toDisplayString(_ctx.title), 1) 24329 ]), 24330 vue.createVNode(vue.unref(ElIcon), { 24331 class: vue.normalizeClass(vue.unref(arrowKls)) 24332 }, { 24333 default: vue.withCtx(() => [ 24334 vue.createVNode(vue.unref(arrow_right_default)) 24335 ]), 24336 _: 1 24337 }, 8, ["class"]) 24338 ], 42, _hoisted_2$v) 24339 ], 8, _hoisted_1$M), 24340 vue.createVNode(vue.unref(_CollapseTransition), null, { 24341 default: vue.withCtx(() => [ 24342 vue.withDirectives(vue.createElementVNode("div", { 24343 id: vue.unref(scopedContentId), 24344 class: vue.normalizeClass(vue.unref(itemWrapperKls)), 24345 role: "tabpanel", 24346 "aria-hidden": !vue.unref(isActive), 24347 "aria-labelledby": vue.unref(scopedHeadId) 24348 }, [ 24349 vue.createElementVNode("div", { 24350 class: vue.normalizeClass(vue.unref(itemContentKls)) 24351 }, [
24352 vue.renderSlot(_ctx.$slots, "default") 24353 ], 2) 24354 ], 10, _hoisted_3$h), [ 24355 [vue.vShow, vue.unref(isActive)] 24356 ]) 24357 ]), 24358 _: 3 24359 }) 24360 ], 2); 24361 }; 24362 } 24363 }); 24364 var CollapseItem = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__file", "collapse-item.vue"]]); 24365 24366 const ElCollapse = withInstall(Collapse, { 24367 CollapseItem 24368 }); 24369 const ElCollapseItem = withNoopInstall(CollapseItem); 24370 24371 const alphaSliderProps = buildProps({ 24372 color: { 24373 type: definePropType(Object), 24374 required: true 24375 }, 24376 vertical: { 24377 type: Boolean, 24378 default: false 24379 } 24380 }); 24381 24382 let isDragging = false; 24383 function draggable(element, options) { 24384 if (!isClient) 24385 return; 24386 const moveFn = function(event) { 24387 var _a; 24388 (_a = options.drag) == null ? void 0 : _a.call(options, event); 24389 }; 24390 const upFn = function(event) { 24391 var _a; 24392 document.removeEventListener("mousemove", moveFn); 24393 document.removeEventListener("mouseup", upFn); 24394 document.removeEventListener("touchmove", moveFn); 24395 document.removeEventListener("touchend", upFn); 24396 document.onselectstart = null; 24397 document.ondragstart = null; 24398 isDragging = false; 24399 (_a = options.end) == null ? void 0 : _a.call(options, event); 24400 }; 24401 const downFn = function(event) { 24402 var _a; 24403 if (isDragging) 24404 return; 24405 event.preventDefault(); 24406 document.onselectstart = () => false; 24407 document.ondragstart = () => false; 24408 document.addEventListener("mousemove", moveFn); 24409 document.addEventListener("mouseup", upFn); 24410 document.addEventListener("touchmove", moveFn); 24411 document.addEventListener("touchend", upFn); 24412 isDragging = true; 24413 (_a = options.start) == null ? void 0 : _a.call(options, event); 24414 }; 24415 element.addEventListener("mousedown", downFn); 24416 element.addEventListener("touchstart", downFn); 24417 } 24418 24419 const useAlphaSlider = (props) => { 24420 const instance = vue.getCurrentInstance(); 24421 const thumb = vue.shallowRef(); 24422 const bar = vue.shallowRef(); 24423 function handleClick(event) { 24424 const target = event.target; 24425 if (target !== thumb.value) { 24426 handleDrag(event); 24427 } 24428 } 24429 function handleDrag(event) { 24430 if (!bar.value || !thumb.value) 24431 return; 24432 const el = instance.vnode.el; 24433 const rect = el.getBoundingClientRect(); 24434 const { clientX, clientY } = getClientXY(event); 24435 if (!props.vertical) { 24436 let left = clientX - rect.left; 24437 left = Math.max(thumb.value.offsetWidth / 2, left); 24438 left = Math.min(left, rect.width - thumb.value.offsetWidth / 2); 24439 props.color.set("alpha", Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 100)); 24440 } else { 24441 let top = clientY - rect.top; 24442 top = Math.max(thumb.value.offsetHeight / 2, top); 24443 top = Math.min(top, rect.height - thumb.value.offsetHeight / 2); 24444 props.color.set("alpha", Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 100)); 24445 } 24446 } 24447 return { 24448 thumb, 24449 bar, 24450 handleDrag, 24451 handleClick 24452 }; 24453 }; 24454 const useAlphaSliderDOM = (props, { 24455 bar, 24456 thumb, 24457 handleDrag 24458 }) => { 24459 const instance = vue.getCurrentInstance(); 24460 const ns = useNamespace("color-alpha-slider"); 24461 const thumbLeft = vue.ref(0);
24462 const thumbTop = vue.ref(0); 24463 const background = vue.ref(); 24464 function getThumbLeft() { 24465 if (!thumb.value) 24466 return 0; 24467 if (props.vertical) 24468 return 0; 24469 const el = instance.vnode.el; 24470 const alpha = props.color.get("alpha"); 24471 if (!el) 24472 return 0; 24473 return Math.round(alpha * (el.offsetWidth - thumb.value.offsetWidth / 2) / 100); 24474 } 24475 function getThumbTop() { 24476 if (!thumb.value) 24477 return 0; 24478 const el = instance.vnode.el; 24479 if (!props.vertical) 24480 return 0; 24481 const alpha = props.color.get("alpha"); 24482 if (!el) 24483 return 0; 24484 return Math.round(alpha * (el.offsetHeight - thumb.value.offsetHeight / 2) / 100); 24485 } 24486 function getBackground() { 24487 if (props.color && props.color.value) { 24488 const { r, g, b } = props.color.toRgb(); 24489 return `linear-gradient(to right, rgba(${r}, ${g}, ${b}, 0) 0%, rgba(${r}, ${g}, ${b}, 1) 100%)`; 24490 } 24491 return ""; 24492 } 24493 function update() { 24494 thumbLeft.value = getThumbLeft(); 24495 thumbTop.value = getThumbTop(); 24496 background.value = getBackground(); 24497 } 24498 vue.onMounted(() => { 24499 if (!bar.value || !thumb.value) 24500 return; 24501 const dragConfig = { 24502 drag: (event) => { 24503 handleDrag(event); 24504 }, 24505 end: (event) => { 24506 handleDrag(event); 24507 } 24508 }; 24509 draggable(bar.value, dragConfig); 24510 draggable(thumb.value, dragConfig); 24511 update(); 24512 }); 24513 vue.watch(() => props.color.get("alpha"), () => update()); 24514 vue.watch(() => props.color.value, () => update()); 24515 const rootKls = vue.computed(() => [ns.b(), ns.is("vertical", props.vertical)]); 24516 const barKls = vue.computed(() => ns.e("bar")); 24517 const thumbKls = vue.computed(() => ns.e("thumb")); 24518 const barStyle = vue.computed(() => ({ background: background.value })); 24519 const thumbStyle = vue.computed(() => ({ 24520 left: addUnit(thumbLeft.value), 24521 top: addUnit(thumbTop.value) 24522 })); 24523 return { rootKls, barKls, barStyle, thumbKls, thumbStyle, update }; 24524 }; 24525 24526 const COMPONENT_NAME$d = "ElColorAlphaSlider"; 24527 const __default__$Y = vue.defineComponent({ 24528 name: COMPONENT_NAME$d 24529 }); 24530 const _sfc_main$1v = /* @__PURE__ */ vue.defineComponent({ 24531 ...__default__$Y, 24532 props: alphaSliderProps, 24533 setup(__props, { expose }) { 24534 const props = __props; 24535 const { bar, thumb, handleDrag, handleClick } = useAlphaSlider(props); 24536 const { rootKls, barKls, barStyle, thumbKls, thumbStyle, update } = useAlphaSliderDOM(props, { 24537 bar, 24538 thumb, 24539 handleDrag 24540 }); 24541 expose({ 24542 update, 24543 bar, 24544 thumb 24545 }); 24546 return (_ctx, _cache) => { 24547 return vue.openBlock(), vue.createElementBlock("div", { 24548 class: vue.normalizeClass(vue.unref(rootKls)) 24549 }, [ 24550 vue.createElementVNode("div", { 24551 ref_key: "bar", 24552 ref: bar, 24553 class: vue.normalizeClass(vue.unref(barKls)), 24554 style: vue.normalizeStyle(vue.unref(barStyle)), 24555 onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(handleClick) && vue.unref(handleClick)(...args)) 24556 }, null, 6), 24557 vue.createElementVNode("div", { 24558 ref_key: "thumb", 24559 ref: thumb, 24560 class: vue.normalizeClass(vue.unref(thumbKls)), 24561 style: vue.normalizeStyle(vue.unref(thumbStyle)) 24562 }, null, 6) 24563 ], 2); 24564 }; 24565 } 24566 }); 24567 var AlphaSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1v, [["__file", "alpha-slider.vue"]]); 24568 24569 const _sfc_main$1u = vue.defineComponent({ 24570 name: "ElColorHueSlider", 24571 props: { 24572 color: { 24573 type: Object, 24574 required: true 24575 }, 24576 vertical: Boolean 24577 }, 24578 setup(props) { 24579 const ns = useNamespace("color-hue-slider"); 24580 const instance = vue.getCurrentInstance(); 24581 const thumb = vue.ref(); 24582 const bar = vue.ref(); 24583 const thumbLeft = vue.ref(0);
24584 const thumbTop = vue.ref(0); 24585 const hueValue = vue.computed(() => { 24586 return props.color.get("hue"); 24587 }); 24588 vue.watch(() => hueValue.value, () => { 24589 update(); 24590 }); 24591 function handleClick(event) { 24592 const target = event.target; 24593 if (target !== thumb.value) { 24594 handleDrag(event); 24595 } 24596 } 24597 function handleDrag(event) { 24598 if (!bar.value || !thumb.value) 24599 return; 24600 const el = instance.vnode.el; 24601 const rect = el.getBoundingClientRect(); 24602 const { clientX, clientY } = getClientXY(event); 24603 let hue; 24604 if (!props.vertical) { 24605 let left = clientX - rect.left; 24606 left = Math.min(left, rect.width - thumb.value.offsetWidth / 2); 24607 left = Math.max(thumb.value.offsetWidth / 2, left); 24608 hue = Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 360); 24609 } else { 24610 let top = clientY - rect.top; 24611 top = Math.min(top, rect.height - thumb.value.offsetHeight / 2); 24612 top = Math.max(thumb.value.offsetHeight / 2, top); 24613 hue = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 360); 24614 } 24615 props.color.set("hue", hue); 24616 } 24617 function getThumbLeft() { 24618 if (!thumb.value) 24619 return 0; 24620 const el = instance.vnode.el; 24621 if (props.vertical) 24622 return 0; 24623 const hue = props.color.get("hue"); 24624 if (!el) 24625 return 0; 24626 return Math.round(hue * (el.offsetWidth - thumb.value.offsetWidth / 2) / 360); 24627 } 24628 function getThumbTop() { 24629 if (!thumb.value) 24630 return 0; 24631 const el = instance.vnode.el; 24632 if (!props.vertical) 24633 return 0; 24634 const hue = props.color.get("hue"); 24635 if (!el) 24636 return 0; 24637 return Math.round(hue * (el.offsetHeight - thumb.value.offsetHeight / 2) / 360); 24638 } 24639 function update() { 24640 thumbLeft.value = getThumbLeft(); 24641 thumbTop.value = getThumbTop(); 24642 } 24643 vue.onMounted(() => { 24644 if (!bar.value || !thumb.value) 24645 return; 24646 const dragConfig = { 24647 drag: (event) => { 24648 handleDrag(event); 24649 }, 24650 end: (event) => { 24651 handleDrag(event); 24652 } 24653 }; 24654 draggable(bar.value, dragConfig); 24655 draggable(thumb.value, dragConfig); 24656 update(); 24657 }); 24658 return { 24659 bar, 24660 thumb, 24661 thumbLeft, 24662 thumbTop, 24663 hueValue, 24664 handleClick, 24665 update, 24666 ns 24667 }; 24668 } 24669 }); 24670 function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) { 24671 return vue.openBlock(), vue.createElementBlock("div", { 24672 class: vue.normalizeClass([_ctx.ns.b(), _ctx.ns.is("vertical", _ctx.vertical)]) 24673 }, [ 24674 vue.createElementVNode("div", { 24675 ref: "bar", 24676 class: vue.normalizeClass(_ctx.ns.e("bar")), 24677 onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args)) 24678 }, null, 2), 24679 vue.createElementVNode("div", { 24680 ref: "thumb", 24681 class: vue.normalizeClass(_ctx.ns.e("thumb")), 24682 style: vue.normalizeStyle({ 24683 left: _ctx.thumbLeft + "px", 24684 top: _ctx.thumbTop + "px" 24685 }) 24686 }, null, 6) 24687 ], 2); 24688 } 24689 var HueSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1u, [["render", _sfc_render$r], ["__file", "hue-slider.vue"]]); 24690 24691 const colorPickerProps = buildProps({ 24692 modelValue: String, 24693 id: String, 24694 showAlpha: Boolean, 24695 colorFormat: String, 24696 disabled: Boolean, 24697 size: useSizeProp, 24698 popperClass: { 24699 type: String, 24700 default: "" 24701 }, 24702 label: { 24703 type: String, 24704 default: void 0 24705 }, 24706 tabindex: { 24707 type: [String, Number], 24708 default: 0 24709 }, 24710 predefine: { 24711 type: definePropType(Array) 24712 }, 24713 validateEvent: { 24714 type: Boolean, 24715 default: true 24716 } 24717 });
24718 const colorPickerEmits = { 24719 [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNil(val), 24720 [CHANGE_EVENT]: (val) => isString$1(val) || isNil(val), 24721 activeChange: (val) => isString$1(val) || isNil(val) 24722 }; 24723 const colorPickerContextKey = Symbol("colorPickerContextKey"); 24724 24725 const hsv2hsl = function(hue, sat, val) { 24726 return [ 24727 hue, 24728 sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue) || 0, 24729 hue / 2 24730 ]; 24731 }; 24732 const isOnePointZero = function(n) { 24733 return typeof n === "string" && n.includes(".") && Number.parseFloat(n) === 1; 24734 }; 24735 const isPercentage = function(n) { 24736 return typeof n === "string" && n.includes("%"); 24737 }; 24738 const bound01 = function(value, max) { 24739 if (isOnePointZero(value)) 24740 value = "100%"; 24741 const processPercent = isPercentage(value); 24742 value = Math.min(max, Math.max(0, Number.parseFloat(`${value}`))); 24743 if (processPercent) { 24744 value = Number.parseInt(`${value * max}`, 10) / 100; 24745 } 24746 if (Math.abs(value - max) < 1e-6) { 24747 return 1; 24748 } 24749 return value % max / Number.parseFloat(max); 24750 }; 24751 const INT_HEX_MAP = { 24752 10: "A", 24753 11: "B", 24754 12: "C", 24755 13: "D", 24756 14: "E", 24757 15: "F" 24758 }; 24759 const hexOne = (value) => { 24760 value = Math.min(Math.round(value), 255); 24761 const high = Math.floor(value / 16); 24762 const low = value % 16; 24763 return `${INT_HEX_MAP[high] || high}${INT_HEX_MAP[low] || low}`; 24764 }; 24765 const toHex = function({ r, g, b }) { 24766 if (Number.isNaN(+r) || Number.isNaN(+g) || Number.isNaN(+b)) 24767 return ""; 24768 return `#${hexOne(r)}${hexOne(g)}${hexOne(b)}`; 24769 }; 24770 const HEX_INT_MAP = { 24771 A: 10, 24772 B: 11, 24773 C: 12, 24774 D: 13, 24775 E: 14, 24776 F: 15 24777 }; 24778 const parseHexChannel = function(hex) { 24779 if (hex.length === 2) { 24780 return (HEX_INT_MAP[hex[0].toUpperCase()] || +hex[0]) * 16 + (HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]); 24781 } 24782 return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]; 24783 }; 24784 const hsl2hsv = function(hue, sat, light) { 24785 sat = sat / 100; 24786 light = light / 100; 24787 let smin = sat; 24788 const lmin = Math.max(light, 0.01); 24789 light *= 2; 24790 sat *= light <= 1 ? light : 2 - light; 24791 smin *= lmin <= 1 ? lmin : 2 - lmin; 24792 const v = (light + sat) / 2; 24793 const sv = light === 0 ? 2 * smin / (lmin + smin) : 2 * sat / (light + sat); 24794 return { 24795 h: hue, 24796 s: sv * 100, 24797 v: v * 100 24798 }; 24799 }; 24800 const rgb2hsv = (r, g, b) => { 24801 r = bound01(r, 255); 24802 g = bound01(g, 255); 24803 b = bound01(b, 255); 24804 const max = Math.max(r, g, b); 24805 const min = Math.min(r, g, b); 24806 let h; 24807 const v = max; 24808 const d = max - min; 24809 const s = max === 0 ? 0 : d / max; 24810 if (max === min) { 24811 h = 0; 24812 } else { 24813 switch (max) { 24814 case r: { 24815 h = (g - b) / d + (g < b ? 6 : 0); 24816 break; 24817 } 24818 case g: { 24819 h = (b - r) / d + 2; 24820 break; 24821 } 24822 case b: { 24823 h = (r - g) / d + 4; 24824 break; 24825 } 24826 } 24827 h /= 6; 24828 } 24829 return { h: h * 360, s: s * 100, v: v * 100 }; 24830 }; 24831 const hsv2rgb = function(h, s, v) { 24832 h = bound01(h, 360) * 6; 24833 s = bound01(s, 100); 24834 v = bound01(v, 100); 24835 const i = Math.floor(h); 24836 const f = h - i; 24837 const p = v * (1 - s); 24838 const q = v * (1 - f * s); 24839 const t = v * (1 - (1 - f) * s); 24840 const mod = i % 6; 24841 const r = [v, q, p, p, t, v][mod]; 24842 const g = [t, v, v, q, p, p][mod]; 24843 const b = [p, p, t, v, v, q][mod]; 24844 return { 24845 r: Math.round(r * 255), 24846 g: Math.round(g * 255), 24847 b: Math.round(b * 255) 24848 }; 24849 }; 24850 class Color { 24851 constructor(options = {}) { 24852 this._hue = 0; 24853 this._saturation = 100; 24854 this._value = 100; 24855 this._alpha = 100;
24856 this.enableAlpha = false; 24857 this.format = "hex"; 24858 this.value = ""; 24859 for (const option in options) { 24860 if (hasOwn(options, option)) { 24861 this[option] = options[option]; 24862 } 24863 } 24864 if (options.value) { 24865 this.fromString(options.value); 24866 } else { 24867 this.doOnChange(); 24868 } 24869 } 24870 set(prop, value) { 24871 if (arguments.length === 1 && typeof prop === "object") { 24872 for (const p in prop) { 24873 if (hasOwn(prop, p)) { 24874 this.set(p, prop[p]); 24875 } 24876 } 24877 return; 24878 } 24879 this[`_${prop}`] = value; 24880 this.doOnChange(); 24881 } 24882 get(prop) { 24883 if (prop === "alpha") { 24884 return Math.floor(this[`_${prop}`]); 24885 } 24886 return this[`_${prop}`]; 24887 } 24888 toRgb() { 24889 return hsv2rgb(this._hue, this._saturation, this._value); 24890 } 24891 fromString(value) { 24892 if (!value) { 24893 this._hue = 0; 24894 this._saturation = 100; 24895 this._value = 100; 24896 this.doOnChange(); 24897 return; 24898 } 24899 const fromHSV = (h, s, v) => { 24900 this._hue = Math.max(0, Math.min(360, h)); 24901 this._saturation = Math.max(0, Math.min(100, s)); 24902 this._value = Math.max(0, Math.min(100, v)); 24903 this.doOnChange(); 24904 }; 24905 if (value.includes("hsl")) { 24906 const parts = value.replace(/hsla|hsl|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index) => index > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10)); 24907 if (parts.length === 4) { 24908 this._alpha = Number.parseFloat(parts[3]) * 100; 24909 } else if (parts.length === 3) { 24910 this._alpha = 100; 24911 } 24912 if (parts.length >= 3) { 24913 const { h, s, v } = hsl2hsv(parts[0], parts[1], parts[2]); 24914 fromHSV(h, s, v); 24915 } 24916 } else if (value.includes("hsv")) { 24917 const parts = value.replace(/hsva|hsv|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index) => index > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10)); 24918 if (parts.length === 4) { 24919 this._alpha = Number.parseFloat(parts[3]) * 100; 24920 } else if (parts.length === 3) { 24921 this._alpha = 100; 24922 } 24923 if (parts.length >= 3) { 24924 fromHSV(parts[0], parts[1], parts[2]); 24925 } 24926 } else if (value.includes("rgb")) { 24927 const parts = value.replace(/rgba|rgb|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index) => index > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10)); 24928 if (parts.length === 4) { 24929 this._alpha = Number.parseFloat(parts[3]) * 100; 24930 } else if (parts.length === 3) { 24931 this._alpha = 100; 24932 } 24933 if (parts.length >= 3) { 24934 const { h, s, v } = rgb2hsv(parts[0], parts[1], parts[2]); 24935 fromHSV(h, s, v); 24936 } 24937 } else if (value.includes("#")) { 24938 const hex = value.replace("#", "").trim(); 24939 if (!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$|^[0-9a-fA-F]{8}$/.test(hex)) 24940 return; 24941 let r, g, b; 24942 if (hex.length === 3) { 24943 r = parseHexChannel(hex[0] + hex[0]); 24944 g = parseHexChannel(hex[1] + hex[1]); 24945 b = parseHexChannel(hex[2] + hex[2]); 24946 } else if (hex.length === 6 || hex.length === 8) { 24947 r = parseHexChannel(hex.slice(0, 2)); 24948 g = parseHexChannel(hex.slice(2, 4)); 24949 b = parseHexChannel(hex.slice(4, 6)); 24950 } 24951 if (hex.length === 8) { 24952 this._alpha = parseHexChannel(hex.slice(6)) / 255 * 100; 24953 } else if (hex.length === 3 || hex.length === 6) { 24954 this._alpha = 100; 24955 } 24956 const { h, s, v } = rgb2hsv(r, g, b); 24957 fromHSV(h, s, v); 24958 } 24959 } 24960 compare(color) { 24961 return Math.abs(color._hue - this._hue) < 2 && Math.abs(color._saturation - this._saturation) < 1 && Math.abs(color._value - this._value) < 1 && Math.abs(color._alpha - this._alpha) < 1; 24962 } 24963 doOnChange() { 24964 const { _hue, _saturation, _value, _alpha, format } = this;
24965 if (this.enableAlpha) { 24966 switch (format) { 24967 case "hsl": { 24968 const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100); 24969 this.value = `hsla(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%, ${this.get("alpha") / 100})`; 24970 break; 24971 } 24972 case "hsv": { 24973 this.value = `hsva(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%, ${this.get("alpha") / 100})`; 24974 break; 24975 } 24976 case "hex": { 24977 this.value = `${toHex(hsv2rgb(_hue, _saturation, _value))}${hexOne(_alpha * 255 / 100)}`; 24978 break; 24979 } 24980 default: { 24981 const { r, g, b } = hsv2rgb(_hue, _saturation, _value); 24982 this.value = `rgba(${r}, ${g}, ${b}, ${this.get("alpha") / 100})`; 24983 } 24984 } 24985 } else { 24986 switch (format) { 24987 case "hsl": { 24988 const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100); 24989 this.value = `hsl(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%)`; 24990 break; 24991 } 24992 case "hsv": { 24993 this.value = `hsv(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%)`; 24994 break; 24995 } 24996 case "rgb": { 24997 const { r, g, b } = hsv2rgb(_hue, _saturation, _value); 24998 this.value = `rgb(${r}, ${g}, ${b})`; 24999 break; 25000 } 25001 default: { 25002 this.value = toHex(hsv2rgb(_hue, _saturation, _value)); 25003 } 25004 } 25005 } 25006 } 25007 } 25008 25009 const _sfc_main$1t = vue.defineComponent({ 25010 props: { 25011 colors: { 25012 type: Array, 25013 required: true 25014 }, 25015 color: { 25016 type: Object, 25017 required: true 25018 } 25019 }, 25020 setup(props) { 25021 const ns = useNamespace("color-predefine"); 25022 const { currentColor } = vue.inject(colorPickerContextKey); 25023 const rgbaColors = vue.ref(parseColors(props.colors, props.color)); 25024 vue.watch(() => currentColor.value, (val) => { 25025 const color = new Color(); 25026 color.fromString(val); 25027 rgbaColors.value.forEach((item) => { 25028 item.selected = color.compare(item); 25029 }); 25030 }); 25031 vue.watchEffect(() => { 25032 rgbaColors.value = parseColors(props.colors, props.color); 25033 }); 25034 function handleSelect(index) { 25035 props.color.fromString(props.colors[index]); 25036 } 25037 function parseColors(colors, color) { 25038 return colors.map((value) => { 25039 const c = new Color(); 25040 c.enableAlpha = true; 25041 c.format = "rgba"; 25042 c.fromString(value); 25043 c.selected = c.value === color.value; 25044 return c; 25045 }); 25046 } 25047 return { 25048 rgbaColors, 25049 handleSelect, 25050 ns 25051 }; 25052 } 25053 }); 25054 const _hoisted_1$L = ["onClick"]; 25055 function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) { 25056 return vue.openBlock(), vue.createElementBlock("div", { 25057 class: vue.normalizeClass(_ctx.ns.b()) 25058 }, [ 25059 vue.createElementVNode("div", { 25060 class: vue.normalizeClass(_ctx.ns.e("colors")) 25061 }, [ 25062 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.rgbaColors, (item, index) => { 25063 return vue.openBlock(), vue.createElementBlock("div", { 25064 key: _ctx.colors[index], 25065 class: vue.normalizeClass([ 25066 _ctx.ns.e("color-selector"), 25067 _ctx.ns.is("alpha", item._alpha < 100), 25068 { selected: item.selected } 25069 ]), 25070 onClick: ($event) => _ctx.handleSelect(index) 25071 }, [ 25072 vue.createElementVNode("div", { 25073 style: vue.normalizeStyle({ backgroundColor: item.value }) 25074 }, null, 4) 25075 ], 10, _hoisted_1$L); 25076 }), 128)) 25077 ], 2) 25078 ], 2); 25079 } 25080 var Predefine = /* @__PURE__ */ _export_sfc(_sfc_main$1t, [["render", _sfc_render$q], ["__file", "predefine.vue"]]); 25081 25082 const _sfc_main$1s = vue.defineComponent({ 25083 name: "ElSlPanel", 25084 props: { 25085 color: { 25086 type: Object, 25087 required: true 25088 } 25089 }, 25090 setup(props) { 25091 const ns = useNamespace("color-svpanel"); 25092 const instance = vue.getCurrentInstance(); 25093 const cursorTop = vue.ref(0);
25094 const cursorLeft = vue.ref(0); 25095 const background = vue.ref("hsl(0, 100%, 50%)"); 25096 const colorValue = vue.computed(() => { 25097 const hue = props.color.get("hue"); 25098 const value = props.color.get("value"); 25099 return { hue, value }; 25100 }); 25101 function update() { 25102 const saturation = props.color.get("saturation"); 25103 const value = props.color.get("value"); 25104 const el = instance.vnode.el; 25105 const { clientWidth: width, clientHeight: height } = el; 25106 cursorLeft.value = saturation * width / 100; 25107 cursorTop.value = (100 - value) * height / 100; 25108 background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`; 25109 } 25110 function handleDrag(event) { 25111 const el = instance.vnode.el; 25112 const rect = el.getBoundingClientRect(); 25113 const { clientX, clientY } = getClientXY(event); 25114 let left = clientX - rect.left; 25115 let top = clientY - rect.top; 25116 left = Math.max(0, left); 25117 left = Math.min(left, rect.width); 25118 top = Math.max(0, top); 25119 top = Math.min(top, rect.height); 25120 cursorLeft.value = left; 25121 cursorTop.value = top; 25122 props.color.set({ 25123 saturation: left / rect.width * 100, 25124 value: 100 - top / rect.height * 100 25125 }); 25126 } 25127 vue.watch(() => colorValue.value, () => { 25128 update(); 25129 }); 25130 vue.onMounted(() => { 25131 draggable(instance.vnode.el, { 25132 drag: (event) => { 25133 handleDrag(event); 25134 }, 25135 end: (event) => { 25136 handleDrag(event); 25137 } 25138 }); 25139 update(); 25140 }); 25141 return { 25142 cursorTop, 25143 cursorLeft, 25144 background, 25145 colorValue, 25146 handleDrag, 25147 update, 25148 ns 25149 }; 25150 } 25151 }); 25152 const _hoisted_1$K = /* @__PURE__ */ vue.createElementVNode("div", null, null, -1); 25153 const _hoisted_2$u = [ 25154 _hoisted_1$K 25155 ]; 25156 function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) { 25157 return vue.openBlock(), vue.createElementBlock("div", { 25158 class: vue.normalizeClass(_ctx.ns.b()), 25159 style: vue.normalizeStyle({ 25160 backgroundColor: _ctx.background 25161 }) 25162 }, [ 25163 vue.createElementVNode("div", { 25164 class: vue.normalizeClass(_ctx.ns.e("white")) 25165 }, null, 2), 25166 vue.createElementVNode("div", { 25167 class: vue.normalizeClass(_ctx.ns.e("black")) 25168 }, null, 2), 25169 vue.createElementVNode("div", { 25170 class: vue.normalizeClass(_ctx.ns.e("cursor")), 25171 style: vue.normalizeStyle({ 25172 top: _ctx.cursorTop + "px", 25173 left: _ctx.cursorLeft + "px" 25174 }) 25175 }, _hoisted_2$u, 6) 25176 ], 6); 25177 } 25178 var SvPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1s, [["render", _sfc_render$p], ["__file", "sv-panel.vue"]]); 25179 25180 const _hoisted_1$J = ["id", "aria-label", "aria-labelledby", "aria-description", "tabindex", "onKeydown"]; 25181 const __default__$X = vue.defineComponent({ 25182 name: "ElColorPicker" 25183 }); 25184 const _sfc_main$1r = /* @__PURE__ */ vue.defineComponent({ 25185 ...__default__$X, 25186 props: colorPickerProps, 25187 emits: colorPickerEmits, 25188 setup(__props, { expose, emit }) { 25189 const props = __props; 25190 const { t } = useLocale(); 25191 const ns = useNamespace("color"); 25192 const { formItem } = useFormItem(); 25193 const colorSize = useFormSize(); 25194 const colorDisabled = useFormDisabled(); 25195 const { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, { 25196 formItemContext: formItem 25197 }); 25198 const hue = vue.ref(); 25199 const sv = vue.ref(); 25200 const alpha = vue.ref(); 25201 const popper = vue.ref(); 25202 let shouldActiveChange = true; 25203 const color = vue.reactive(new Color({ 25204 enableAlpha: props.showAlpha, 25205 format: props.colorFormat || "", 25206 value: props.modelValue 25207 })); 25208 const showPicker = vue.ref(false); 25209 const showPanelColor = vue.ref(false); 25210 const customInput = vue.ref(""); 25211 const displayedColor = vue.computed(() => { 25212 if (!props.modelValue && !showPanelColor.value) { 25213 return "transparent"; 25214 }
25215 return displayedRgb(color, props.showAlpha); 25216 }); 25217 const currentColor = vue.computed(() => { 25218 return !props.modelValue && !showPanelColor.value ? "" : color.value; 25219 }); 25220 const buttonAriaLabel = vue.computed(() => { 25221 return !isLabeledByFormItem.value ? props.label || t("el.colorpicker.defaultLabel") : void 0; 25222 }); 25223 const buttonAriaLabelledby = vue.computed(() => { 25224 return isLabeledByFormItem.value ? formItem == null ? void 0 : formItem.labelId : void 0; 25225 }); 25226 const btnKls = vue.computed(() => { 25227 return [ 25228 ns.b("picker"), 25229 ns.is("disabled", colorDisabled.value), 25230 ns.bm("picker", colorSize.value) 25231 ]; 25232 }); 25233 function displayedRgb(color2, showAlpha) { 25234 if (!(color2 instanceof Color)) { 25235 throw new TypeError("color should be instance of _color Class"); 25236 } 25237 const { r, g, b } = color2.toRgb(); 25238 return showAlpha ? `rgba(${r}, ${g}, ${b}, ${color2.get("alpha") / 100})` : `rgb(${r}, ${g}, ${b})`; 25239 } 25240 function setShowPicker(value) { 25241 showPicker.value = value; 25242 } 25243 const debounceSetShowPicker = debounce(setShowPicker, 100); 25244 function show() { 25245 if (colorDisabled.value) 25246 return; 25247 setShowPicker(true); 25248 } 25249 function hide() { 25250 debounceSetShowPicker(false); 25251 resetColor(); 25252 } 25253 function resetColor() { 25254 vue.nextTick(() => { 25255 if (props.modelValue) { 25256 color.fromString(props.modelValue); 25257 } else { 25258 color.value = ""; 25259 vue.nextTick(() => { 25260 showPanelColor.value = false; 25261 }); 25262 } 25263 }); 25264 } 25265 function handleTrigger() { 25266 if (colorDisabled.value) 25267 return; 25268 debounceSetShowPicker(!showPicker.value); 25269 } 25270 function handleConfirm() { 25271 color.fromString(customInput.value); 25272 } 25273 function confirmValue() { 25274 const value = color.value; 25275 emit(UPDATE_MODEL_EVENT, value); 25276 emit("change", value); 25277 if (props.validateEvent) { 25278 formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()); 25279 } 25280 debounceSetShowPicker(false); 25281 vue.nextTick(() => { 25282 const newColor = new Color({ 25283 enableAlpha: props.showAlpha, 25284 format: props.colorFormat || "", 25285 value: props.modelValue 25286 }); 25287 if (!color.compare(newColor)) { 25288 resetColor(); 25289 } 25290 }); 25291 } 25292 function clear() { 25293 debounceSetShowPicker(false); 25294 emit(UPDATE_MODEL_EVENT, null); 25295 emit("change", null); 25296 if (props.modelValue !== null && props.validateEvent) { 25297 formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()); 25298 } 25299 resetColor(); 25300 } 25301 vue.onMounted(() => { 25302 if (props.modelValue) { 25303 customInput.value = currentColor.value; 25304 } 25305 }); 25306 vue.watch(() => props.modelValue, (newVal) => { 25307 if (!newVal) { 25308 showPanelColor.value = false; 25309 } else if (newVal && newVal !== color.value) { 25310 shouldActiveChange = false; 25311 color.fromString(newVal); 25312 } 25313 }); 25314 vue.watch(() => currentColor.value, (val) => { 25315 customInput.value = val; 25316 shouldActiveChange && emit("activeChange", val); 25317 shouldActiveChange = true; 25318 }); 25319 vue.watch(() => color.value, () => { 25320 if (!props.modelValue && !showPanelColor.value) { 25321 showPanelColor.value = true; 25322 } 25323 }); 25324 vue.watch(() => showPicker.value, () => { 25325 vue.nextTick(() => { 25326 var _a, _b, _c; 25327 (_a = hue.value) == null ? void 0 : _a.update();
25328 (_b = sv.value) == null ? void 0 : _b.update(); 25329 (_c = alpha.value) == null ? void 0 : _c.update(); 25330 }); 25331 }); 25332 vue.provide(colorPickerContextKey, { 25333 currentColor 25334 }); 25335 expose({ 25336 color, 25337 show, 25338 hide 25339 }); 25340 return (_ctx, _cache) => { 25341 return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), { 25342 ref_key: "popper", 25343 ref: popper, 25344 visible: showPicker.value, 25345 "show-arrow": false, 25346 "fallback-placements": ["bottom", "top", "right", "left"], 25347 offset: 0, 25348 "gpu-acceleration": false, 25349 "popper-class": [vue.unref(ns).be("picker", "panel"), vue.unref(ns).b("dropdown"), _ctx.popperClass], 25350 "stop-popper-mouse-event": false, 25351 effect: "light", 25352 trigger: "click", 25353 transition: `${vue.unref(ns).namespace.value}-zoom-in-top`, 25354 persistent: "" 25355 }, { 25356 content: vue.withCtx(() => [ 25357 vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", null, [ 25358 vue.createElementVNode("div", { 25359 class: vue.normalizeClass(vue.unref(ns).be("dropdown", "main-wrapper")) 25360 }, [ 25361 vue.createVNode(HueSlider, { 25362 ref_key: "hue", 25363 ref: hue, 25364 class: "hue-slider", 25365 color: vue.unref(color), 25366 vertical: "" 25367 }, null, 8, ["color"]), 25368 vue.createVNode(SvPanel, { 25369 ref: "svPanel", 25370 color: vue.unref(color) 25371 }, null, 8, ["color"]) 25372 ], 2), 25373 _ctx.showAlpha ? (vue.openBlock(), vue.createBlock(AlphaSlider, { 25374 key: 0, 25375 ref_key: "alpha", 25376 ref: alpha, 25377 color: vue.unref(color) 25378 }, null, 8, ["color"])) : vue.createCommentVNode("v-if", true), 25379 _ctx.predefine ? (vue.openBlock(), vue.createBlock(Predefine, { 25380 key: 1, 25381 ref: "predefine", 25382 color: vue.unref(color), 25383 colors: _ctx.predefine 25384 }, null, 8, ["color", "colors"])) : vue.createCommentVNode("v-if", true), 25385 vue.createElementVNode("div", { 25386 class: vue.normalizeClass(vue.unref(ns).be("dropdown", "btns")) 25387 }, [ 25388 vue.createElementVNode("span", { 25389 class: vue.normalizeClass(vue.unref(ns).be("dropdown", "value")) 25390 }, [ 25391 vue.createVNode(vue.unref(ElInput), { 25392 modelValue: customInput.value, 25393 "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => customInput.value = $event), 25394 "validate-event": false, 25395 size: "small", 25396 onKeyup: vue.withKeys(handleConfirm, ["enter"]), 25397 onBlur: handleConfirm 25398 }, null, 8, ["modelValue", "onKeyup"]) 25399 ], 2), 25400 vue.createVNode(vue.unref(ElButton), { 25401 class: vue.normalizeClass(vue.unref(ns).be("dropdown", "link-btn")), 25402 text: "", 25403 size: "small", 25404 onClick: clear 25405 }, { 25406 default: vue.withCtx(() => [ 25407 vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.colorpicker.clear")), 1) 25408 ]), 25409 _: 1 25410 }, 8, ["class"]), 25411 vue.createVNode(vue.unref(ElButton), { 25412 plain: "", 25413 size: "small", 25414 class: vue.normalizeClass(vue.unref(ns).be("dropdown", "btn")), 25415 onClick: confirmValue 25416 }, { 25417 default: vue.withCtx(() => [ 25418 vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.colorpicker.confirm")), 1
25418) 25419 ]), 25420 _: 1 25421 }, 8, ["class"]) 25422 ], 2) 25423 ])), [ 25424 [vue.unref(ClickOutside), hide] 25425 ]) 25426 ]), 25427 default: vue.withCtx(() => [ 25428 vue.createElementVNode("div", { 25429 id: vue.unref(buttonId), 25430 class: vue.normalizeClass(vue.unref(btnKls)), 25431 role: "button", 25432 "aria-label": vue.unref(buttonAriaLabel), 25433 "aria-labelledby": vue.unref(buttonAriaLabelledby), 25434 "aria-description": vue.unref(t)("el.colorpicker.description", { color: _ctx.modelValue || "" }), 25435 tabindex: _ctx.tabindex, 25436 onKeydown: vue.withKeys(handleTrigger, ["enter"]) 25437 }, [ 25438 vue.unref(colorDisabled) ? (vue.openBlock(), vue.createElementBlock("div", { 25439 key: 0, 25440 class: vue.normalizeClass(vue.unref(ns).be("picker", "mask")) 25441 }, null, 2)) : vue.createCommentVNode("v-if", true), 25442 vue.createElementVNode("div", { 25443 class: vue.normalizeClass(vue.unref(ns).be("picker", "trigger")), 25444 onClick: handleTrigger 25445 }, [ 25446 vue.createElementVNode("span", { 25447 class: vue.normalizeClass([vue.unref(ns).be("picker", "color"), vue.unref(ns).is("alpha", _ctx.showAlpha)]) 25448 }, [ 25449 vue.createElementVNode("span", { 25450 class: vue.normalizeClass(vue.unref(ns).be("picker", "color-inner")), 25451 style: vue.normalizeStyle({ 25452 backgroundColor: vue.unref(displayedColor) 25453 }) 25454 }, [ 25455 vue.withDirectives(vue.createVNode(vue.unref(ElIcon), { 25456 class: vue.normalizeClass([vue.unref(ns).be("picker", "icon"), vue.unref(ns).is("icon-arrow-down")]) 25457 }, { 25458 default: vue.withCtx(() => [ 25459 vue.createVNode(vue.unref(arrow_down_default)) 25460 ]), 25461 _: 1 25462 }, 8, ["class"]), [ 25463 [vue.vShow, _ctx.modelValue || showPanelColor.value] 25464 ]), 25465 !_ctx.modelValue && !showPanelColor.value ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 25466 key: 0, 25467 class: vue.normalizeClass([vue.unref(ns).be("picker", "empty"), vue.unref(ns).is("icon-close")]) 25468 }, { 25469 default: vue.withCtx(() => [ 25470 vue.createVNode(vue.unref(close_default)) 25471 ]), 25472 _: 1 25473 }, 8, ["class"])) : vue.createCommentVNode("v-if", true) 25474 ], 6) 25475 ], 2) 25476 ], 2) 25477 ], 42, _hoisted_1$J) 25478 ]), 25479 _: 1 25480 }, 8, ["visible", "popper-class", "transition"]); 25481 }; 25482 } 25483 }); 25484 var ColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$1r, [["__file", "color-picker.vue"]]); 25485 25486 const ElColorPicker = withInstall(ColorPicker); 25487 25488 const __default__$W = vue.defineComponent({ 25489 name: "ElContainer" 25490 }); 25491 const _sfc_main$1q = /* @__PURE__ */ vue.defineComponent({ 25492 ...__default__$W, 25493 props: { 25494 direction: { 25495 type: String 25496 } 25497 }, 25498 setup(__props) { 25499 const props = __props; 25500 const slots = vue.useSlots(); 25501 const ns = useNamespace("container"); 25502 const isVertical = vue.computed(() => { 25503 if (props.direction === "vertical") { 25504 return true; 25505 } else if (props.direction === "horizontal") { 25506 return false; 25507 } 25508 if (slots && slots.default) { 25509 const vNodes = slots.default(); 25510 return vNodes.some((vNode) => {
25511 const tag = vNode.type.name; 25512 return tag === "ElHeader" || tag === "ElFooter"; 25513 }); 25514 } else { 25515 return false; 25516 } 25517 }); 25518 return (_ctx, _cache) => { 25519 return vue.openBlock(), vue.createElementBlock("section", { 25520 class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).is("vertical", vue.unref(isVertical))]) 25521 }, [ 25522 vue.renderSlot(_ctx.$slots, "default") 25523 ], 2); 25524 }; 25525 } 25526 }); 25527 var Container = /* @__PURE__ */ _export_sfc(_sfc_main$1q, [["__file", "container.vue"]]); 25528 25529 const __default__$V = vue.defineComponent({ 25530 name: "ElAside" 25531 }); 25532 const _sfc_main$1p = /* @__PURE__ */ vue.defineComponent({ 25533 ...__default__$V, 25534 props: { 25535 width: { 25536 type: String, 25537 default: null 25538 } 25539 }, 25540 setup(__props) { 25541 const props = __props; 25542 const ns = useNamespace("aside"); 25543 const style = vue.computed(() => props.width ? ns.cssVarBlock({ width: props.width }) : {}); 25544 return (_ctx, _cache) => { 25545 return vue.openBlock(), vue.createElementBlock("aside", { 25546 class: vue.normalizeClass(vue.unref(ns).b()), 25547 style: vue.normalizeStyle(vue.unref(style)) 25548 }, [ 25549 vue.renderSlot(_ctx.$slots, "default") 25550 ], 6); 25551 }; 25552 } 25553 }); 25554 var Aside = /* @__PURE__ */ _export_sfc(_sfc_main$1p, [["__file", "aside.vue"]]); 25555 25556 const __default__$U = vue.defineComponent({ 25557 name: "ElFooter" 25558 }); 25559 const _sfc_main$1o = /* @__PURE__ */ vue.defineComponent({ 25560 ...__default__$U, 25561 props: { 25562 height: { 25563 type: String, 25564 default: null 25565 } 25566 }, 25567 setup(__props) { 25568 const props = __props; 25569 const ns = useNamespace("footer"); 25570 const style = vue.computed(() => props.height ? ns.cssVarBlock({ height: props.height }) : {}); 25571 return (_ctx, _cache) => { 25572 return vue.openBlock(), vue.createElementBlock("footer", { 25573 class: vue.normalizeClass(vue.unref(ns).b()), 25574 style: vue.normalizeStyle(vue.unref(style)) 25575 }, [ 25576 vue.renderSlot(_ctx.$slots, "default") 25577 ], 6); 25578 }; 25579 } 25580 }); 25581 var Footer$2 = /* @__PURE__ */ _export_sfc(_sfc_main$1o, [["__file", "footer.vue"]]); 25582 25583 const __default__$T = vue.defineComponent({ 25584 name: "ElHeader" 25585 }); 25586 const _sfc_main$1n = /* @__PURE__ */ vue.defineComponent({ 25587 ...__default__$T, 25588 props: { 25589 height: { 25590 type: String, 25591 default: null 25592 } 25593 }, 25594 setup(__props) { 25595 const props = __props; 25596 const ns = useNamespace("header"); 25597 const style = vue.computed(() => { 25598 return props.height ? ns.cssVarBlock({ 25599 height: props.height 25600 }) : {}; 25601 }); 25602 return (_ctx, _cache) => { 25603 return vue.openBlock(), vue.createElementBlock("header", { 25604 class: vue.normalizeClass(vue.unref(ns).b()), 25605 style: vue.normalizeStyle(vue.unref(style)) 25606 }, [ 25607 vue.renderSlot(_ctx.$slots, "default") 25608 ], 6); 25609 }; 25610 } 25611 }); 25612 var Header$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1n, [["__file", "header.vue"]]); 25613 25614 const __default__$S = vue.defineComponent({ 25615 name: "ElMain" 25616 }); 25617 const _sfc_main$1m = /* @__PURE__ */ vue.defineComponent({ 25618 ...__default__$S, 25619 setup(__props) { 25620 const ns = useNamespace("main"); 25621 return (_ctx, _cache) => { 25622 return vue.openBlock(), vue.createElementBlock("main", { 25623 class: vue.normalizeClass(vue.unref(ns).b()) 25624 }, [ 25625 vue.renderSlot(_ctx.$slots, "default") 25626 ], 2); 25627 }; 25628 } 25629 }); 25630 var Main = /* @__PURE__ */ _export_sfc(_sfc_main$1m, [["__file", "main.vue"]]); 25631 25632 const ElContainer = withInstall(Container, { 25633 Aside, 25634 Footer: Footer$2, 25635 Header: Header$1, 25636 Main 25637 });
25638 const ElAside = withNoopInstall(Aside); 25639 const ElFooter = withNoopInstall(Footer$2); 25640 const ElHeader = withNoopInstall(Header$1); 25641 const ElMain = withNoopInstall(Main); 25642 25643 var advancedFormat$1 = {exports: {}}; 25644 25645 (function(module, exports) { 25646 !function(e, t) { 25647 module.exports = t() ; 25648 }(commonjsGlobal, function() { 25649 return function(e, t, r) { 25650 var n = t.prototype, s = n.format; 25651 r.en.ordinal = function(e2) { 25652 var t2 = ["th", "st", "nd", "rd"], r2 = e2 % 100; 25653 return "[" + e2 + (t2[(r2 - 20) % 10] || t2[r2] || t2[0]) + "]"; 25654 }, n.format = function(e2) { 25655 var t2 = this, r2 = this.$locale(); 25656 if (!this.isValid()) 25657 return s.bind(this)(e2); 25658 var n2 = this.$utils(), a = (e2 || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function(e3) { 25659 switch (e3) { 25660 case "Q": 25661 return Math.ceil((t2.$M + 1) / 3); 25662 case "Do": 25663 return r2.ordinal(t2.$D); 25664 case "gggg": 25665 return t2.weekYear(); 25666 case "GGGG": 25667 return t2.isoWeekYear(); 25668 case "wo": 25669 return r2.ordinal(t2.week(), "W"); 25670 case "w": 25671 case "ww": 25672 return n2.s(t2.week(), e3 === "w" ? 1 : 2, "0"); 25673 case "W": 25674 case "WW": 25675 return n2.s(t2.isoWeek(), e3 === "W" ? 1 : 2, "0"); 25676 case "k": 25677 case "kk": 25678 return n2.s(String(t2.$H === 0 ? 24 : t2.$H), e3 === "k" ? 1 : 2, "0"); 25679 case "X": 25680 return Math.floor(t2.$d.getTime() / 1e3); 25681 case "x": 25682 return t2.$d.getTime(); 25683 case "z": 25684 return "[" + t2.offsetName() + "]"; 25685 case "zzz": 25686 return "[" + t2.offsetName("long") + "]"; 25687 default: 25688 return e3; 25689 } 25690 }); 25691 return s.bind(this)(a); 25692 }; 25693 }; 25694 }); 25695 })(advancedFormat$1); 25696 var advancedFormat = advancedFormat$1.exports; 25697 25698 var weekOfYear$1 = {exports: {}}; 25699 25700 (function(module, exports) { 25701 !function(e, t) { 25702 module.exports = t() ; 25703 }(commonjsGlobal, function() { 25704 var e = "week", t = "year"; 25705 return function(i, n, r) { 25706 var f = n.prototype; 25707 f.week = function(i2) { 25708 if (i2 === void 0 && (i2 = null), i2 !== null) 25709 return this.add(7 * (i2 - this.week()), "day"); 25710 var n2 = this.$locale().yearStart || 1; 25711 if (this.month() === 11 && this.date() > 25) { 25712 var f2 = r(this).startOf(t).add(1, t).date(n2), s = r(this).endOf(e); 25713 if (f2.isBefore(s)) 25714 return 1; 25715 } 25716 var a = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o = this.diff(a, e, true); 25717 return o < 0 ? r(this).startOf("week").week() : Math.ceil(o); 25718 }, f.weeks = function(e2) { 25719 return e2 === void 0 && (e2 = null), this.week(e2); 25720 }; 25721 }; 25722 }); 25723 })(weekOfYear$1); 25724 var weekOfYear = weekOfYear$1.exports; 25725 25726 var weekYear$1 = {exports: {}}; 25727 25728 (function(module, exports) { 25729 !function(e, t) { 25730 module.exports = t() ; 25731 }(commonjsGlobal, function() { 25732 return function(e, t) { 25733 t.prototype.weekYear = function() { 25734 var e2 = this.month(), t2 = this.week(), n = this.year(); 25735 return t2 === 1 && e2 === 11 ? n + 1 : e2 === 0 && t2 >= 52 ? n - 1 : n; 25736 }; 25737 }; 25738 }); 25739 })(weekYear$1); 25740 var weekYear = weekYear$1.exports; 25741 25742 var dayOfYear$1 = {exports: {}}; 25743 25744 (function(module, exports) { 25745 !function(e, t) { 25746 module.exports = t() ; 25747 }(commonjsGlobal, function() { 25748 return function(e, t, n) { 25749 t.prototype.dayOfYear = function(e2) { 25750 var t2 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1; 25751 return e2 == null ? t2 : this.add(e2 - t2, "day"); 25752 }; 25753 }; 25754 }); 25755 })(dayOfYear$1); 25756 var dayOfYear = dayOfYear$1.exports; 25757 25758 var isSameOrAfter$1 = {exports: {}}; 25759
25760 (function(module, exports) { 25761 !function(e, t) { 25762 module.exports = t() ; 25763 }(commonjsGlobal, function() { 25764 return function(e, t) { 25765 t.prototype.isSameOrAfter = function(e2, t2) { 25766 return this.isSame(e2, t2) || this.isAfter(e2, t2); 25767 }; 25768 }; 25769 }); 25770 })(isSameOrAfter$1); 25771 var isSameOrAfter = isSameOrAfter$1.exports; 25772 25773 var isSameOrBefore$1 = {exports: {}}; 25774 25775 (function(module, exports) { 25776 !function(e, i) { 25777 module.exports = i() ; 25778 }(commonjsGlobal, function() { 25779 return function(e, i) { 25780 i.prototype.isSameOrBefore = function(e2, i2) { 25781 return this.isSame(e2, i2) || this.isBefore(e2, i2); 25782 }; 25783 }; 25784 }); 25785 })(isSameOrBefore$1); 25786 var isSameOrBefore = isSameOrBefore$1.exports; 25787 25788 const ROOT_PICKER_INJECTION_KEY = Symbol(); 25789 25790 const datePickerProps = buildProps({ 25791 ...timePickerDefaultProps, 25792 type: { 25793 type: definePropType(String), 25794 default: "date" 25795 } 25796 }); 25797 25798 const selectionModes = ["date", "dates", "year", "month", "week", "range"]; 25799 const datePickerSharedProps = buildProps({ 25800 disabledDate: { 25801 type: definePropType(Function) 25802 }, 25803 date: { 25804 type: definePropType(Object), 25805 required: true 25806 }, 25807 minDate: { 25808 type: definePropType(Object) 25809 }, 25810 maxDate: { 25811 type: definePropType(Object) 25812 }, 25813 parsedValue: { 25814 type: definePropType([Object, Array]) 25815 }, 25816 rangeState: { 25817 type: definePropType(Object), 25818 default: () => ({ 25819 endDate: null, 25820 selecting: false 25821 }) 25822 } 25823 }); 25824 const panelSharedProps = buildProps({ 25825 type: { 25826 type: definePropType(String), 25827 required: true, 25828 values: datePickTypes 25829 } 25830 }); 25831 const panelRangeSharedProps = buildProps({ 25832 unlinkPanels: Boolean, 25833 parsedValue: { 25834 type: definePropType(Array) 25835 } 25836 }); 25837 const selectionModeWithDefault = (mode) => { 25838 return { 25839 type: String, 25840 values: selectionModes, 25841 default: mode 25842 }; 25843 }; 25844 25845 const panelDatePickProps = buildProps({ 25846 ...panelSharedProps, 25847 parsedValue: { 25848 type: definePropType([Object, Array]) 25849 }, 25850 visible: { 25851 type: Boolean 25852 }, 25853 format: { 25854 type: String, 25855 default: "" 25856 } 25857 }); 25858 25859 const basicDateTableProps = buildProps({ 25860 ...datePickerSharedProps, 25861 cellClassName: { 25862 type: definePropType(Function) 25863 }, 25864 showWeekNumber: Boolean, 25865 selectionMode: selectionModeWithDefault("date") 25866 }); 25867 25868 const isValidRange = (range) => { 25869 if (!isArray$1(range)) 25870 return false; 25871 const [left, right] = range; 25872 return dayjs.isDayjs(left) && dayjs.isDayjs(right) && left.isSameOrBefore(right); 25873 }; 25874 const getDefaultValue = (defaultValue, { lang, unit, unlinkPanels }) => { 25875 let start; 25876 if (isArray$1(defaultValue)) { 25877 let [left, right] = defaultValue.map((d) => dayjs(d).locale(lang)); 25878 if (!unlinkPanels) { 25879 right = left.add(1, unit); 25880 } 25881 return [left, right]; 25882 } else if (defaultValue) { 25883 start = dayjs(defaultValue); 25884 } else { 25885 start = dayjs(); 25886 } 25887 start = start.locale(lang); 25888 return [start, start.add(1, unit)]; 25889 }; 25890 const buildPickerTable = (dimension, rows, { 25891 columnIndexOffset, 25892 startDate, 25893 nextEndDate, 25894 now, 25895 unit, 25896 relativeDateGetter, 25897 setCellMetadata, 25898 setRowMetadata 25899 }) => { 25900 for (let rowIndex = 0; rowIndex < dimension.row; rowIndex++) { 25901 const row = rows[rowIndex]; 25902 for (let columnIndex = 0; columnIndex < dimension.column; columnIndex++) { 25903 let cell = row[columnIndex + columnIndexOffset]; 25904 if (!cell) { 25905 cell = { 25906 row: rowIndex, 25907 column: columnIndex, 25908 type: "normal", 25909 inRange: false, 25910 start: false, 25911 end: false 25912 }; 25913 } 25914 const index = rowIndex * dimension.column + columnIndex; 25915 const nextStartDate = relativeDateGetter(index); 25916 cell.dayjs = nextStartDate; 25917 cell.date = nextStartDate.toDate(); 25918 cell.timestamp = nextStartDate.valueOf(); 25919 cell.type = "normal"; 25920 cell.inRange = !!(startDate && nextStartDate.isSameOrAfter(startDate, unit) && nextEndDate && nextStartDate.isSameOrBefore(nextEndDate, unit)) || !!(startDate && nextStartDate.isSameOrBefore(startDate, unit) && nextEndDate && nextStartDate.isSameOrAfter(nextEndDate, unit)); 25921 if (startDate == null ? void 0 : startDate.isSameOrAfter(nextEndDate)) { 25922 cell.start = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit); 25923 cell.end = startDate && nextStartDate.isSame(startDate, unit); 25924 } else { 25925 cell.start = !!startDate && nextStartDate.isSame(startDate, unit); 25926 cell.end = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit); 25927 } 25928 const isToday = nextStartDate.isSame(now, unit); 25929 if (isToday) { 25930 cell.type = "today"; 25931 } 25932 setCellMetadata == null ? void 0 : setCellMetadata(cell, { rowIndex, columnIndex }); 25933 row[columnIndex + columnIndexOffset] = cell; 25934 } 25935 setRowMetadata == null ? void 0 : setRowMetadata(row);
25936 } 25937 }; 25938 25939 const basicCellProps = buildProps({ 25940 cell: { 25941 type: definePropType(Object) 25942 } 25943 }); 25944 25945 var ElDatePickerCell = vue.defineComponent({ 25946 name: "ElDatePickerCell", 25947 props: basicCellProps, 25948 setup(props) { 25949 const ns = useNamespace("date-table-cell"); 25950 const { 25951 slots 25952 } = vue.inject(ROOT_PICKER_INJECTION_KEY); 25953 return () => { 25954 const { 25955 cell 25956 } = props; 25957 if (slots.default) { 25958 const list = slots.default(cell).filter((item) => { 25959 return item.patchFlag !== -2 && item.type.toString() !== "Symbol(Comment)"; 25960 }); 25961 if (list.length) { 25962 return list; 25963 } 25964 } 25965 return vue.createVNode("div", { 25966 "class": ns.b() 25967 }, [vue.createVNode("span", { 25968 "class": ns.e("text") 25969 }, [cell == null ? void 0 : cell.text])]); 25970 }; 25971 } 25972 }); 25973 25974 const _hoisted_1$I = ["aria-label", "onMousedown"]; 25975 const _hoisted_2$t = { 25976 key: 0, 25977 scope: "col" 25978 }; 25979 const _hoisted_3$g = ["aria-label"]; 25980 const _hoisted_4$b = ["aria-current", "aria-selected", "tabindex"]; 25981 const _sfc_main$1l = /* @__PURE__ */ vue.defineComponent({ 25982 __name: "basic-date-table", 25983 props: basicDateTableProps, 25984 emits: ["changerange", "pick", "select"], 25985 setup(__props, { expose, emit }) { 25986 const props = __props; 25987 const ns = useNamespace("date-table"); 25988 const { t, lang } = useLocale(); 25989 const tbodyRef = vue.ref(); 25990 const currentCellRef = vue.ref(); 25991 const lastRow = vue.ref(); 25992 const lastColumn = vue.ref(); 25993 const tableRows = vue.ref([[], [], [], [], [], []]); 25994 let focusWithClick = false; 25995 const firstDayOfWeek = props.date.$locale().weekStart || 7; 25996 const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_) => _.toLowerCase()); 25997 const offsetDay = vue.computed(() => { 25998 return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek; 25999 }); 26000 const startDate = vue.computed(() => { 26001 const startDayOfMonth = props.date.startOf("month"); 26002 return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day"); 26003 }); 26004 const WEEKS = vue.computed(() => { 26005 return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7); 26006 }); 26007 const hasCurrent = vue.computed(() => { 26008 return flatten(rows.value).some((row) => { 26009 return row.isCurrent; 26010 }); 26011 }); 26012 const days = vue.computed(() => { 26013 const startOfMonth = props.date.startOf("month"); 26014 const startOfMonthDay = startOfMonth.day() || 7; 26015 const dateCountOfMonth = startOfMonth.daysInMonth(); 26016 const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth(); 26017 return { 26018 startOfMonthDay, 26019 dateCountOfMonth, 26020 dateCountOfLastMonth 26021 }; 26022 }); 26023 const selectedDate = vue.computed(() => { 26024 return props.selectionMode === "dates" ? castArray(props.parsedValue) : []; 26025 }); 26026 const setDateText = (cell, { 26027 count, 26028 rowIndex, 26029 columnIndex 26030 }) => { 26031 const { startOfMonthDay, dateCountOfMonth, dateCountOfLastMonth } = vue.unref(days); 26032 const offset = vue.unref(offsetDay); 26033 if (rowIndex >= 0 && rowIndex <= 1) { 26034 const numberOfDaysFromPreviousMonth = startOfMonthDay + offset < 0 ? 7 + startOfMonthDay + offset : startOfMonthDay + offset; 26035 if (columnIndex + rowIndex * 7 >= numberOfDaysFromPreviousMonth) { 26036 cell.text = count; 26037 return true; 26038 } else { 26039 cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - columnIndex % 7) + 1 + rowIndex * 7; 26040 cell.type = "prev-month"; 26041 } 26042 } else { 26043 if (count <= dateCountOfMonth) { 26044 cell.text = count; 26045 } else { 26046 cell.text = count - dateCountOfMonth; 26047 cell.type = "next-month"; 26048 } 26049 return true; 26050 } 26051 return false; 26052 }; 26053 const setCellMetadata = (cell, { 26054 columnIndex, 26055 rowIndex 26056 }, count) => { 26057 const { disabledDate, cellClassName } = props; 26058 const _selectedDate = vue.unref(selectedDate); 26059 const shouldIncrement = setDateText(cell, { count, rowIndex, columnIndex }); 26060 const cellDate = cell.dayjs.toDate(); 26061 cell.selected = _selectedDate.find((d) => d.valueOf() === cell.dayjs.valueOf()); 26062 cell.isSelected = !!cell.selected; 26063 cell.isCurrent = isCurrent(cell); 26064 cell.disabled = disabledDate == null ? void 0 : disabledDate(cellDate); 26065 cell.customClass = cellClassName == null ? void 0 : cellClassName(cellDate); 26066 return shouldIncrement; 26067 }; 26068 const setRowMetadata = (row) => { 26069 if (props.selectionMode === "week") { 26070 const [start, end] = props.showWeekNumber ? [1, 7] : [0, 6]; 26071 const isActive = isWeekActive(row[start + 1]); 26072 row[start].inRange = isActive; 26073 row[start].start = isActive; 26074 row[end].inRange = isActive; 26075 row[end].end = isActive; 26076 } 26077 }; 26078 const rows = vue.computed(() => { 26079 const { minDate, maxDate, rangeState, showWeekNumber } = props; 26080 const offset = offsetDay.value; 26081 const rows_ = tableRows.value; 26082 const dateUnit = "day"; 26083 let count = 1; 26084 if (showWeekNumber) { 26085 for (let rowIndex = 0; rowIndex < 6; rowIndex++) { 26086 if (!rows_[rowIndex][0]) { 26087 rows_[rowIndex][0] = { 26088 type: "week", 26089 text: startDate.value.add(rowIndex * 7 + 1, dateUnit).week() 26090 }; 26091 } 26092 } 26093 } 26094 buildPickerTable({ row: 6, column: 7 }, rows_, { 26095 startDate: minDate, 26096 columnIndexOffset: showWeekNumber ? 1 : 0, 26097 nextEndDate: rangeState.endDate || maxDate || rangeState.selecting && minDate || null, 26098 now: dayjs().locale(vue.unref(lang)).startOf(dateUnit), 26099 unit: dateUnit, 26100 relativeDateGetter: (idx) => startDate.value.add(idx - offset, dateUnit), 26101 setCellMetadata: (...args) => { 26102 if (setCellMetadata(...args, count)) { 26103 count += 1; 26104 } 26105 }, 26106 setRowMetadata 26107 }); 26108 return rows_; 26109 }); 26110 vue.watch(() => props.date, async () => { 26111 var _a, _b; 26112 if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) { 26113 await vue.nextTick(); 26114 (_b = currentCellRef.value) == null ? void 0 : _b.focus(); 26115 } 26116 }); 26117 const focus = async () => { 26118 var _a; 26119 (_a = currentCellRef.value) == null ? void 0 : _a.focus(); 26120 }; 26121 const isNormalDay = (type = "") => { 26122 return ["normal", "today"].includes(type); 26123 }; 26124 const isCurrent = (cell) => { 26125 return props.selectionMode === "date" && isNormalDay(cell.type) && cellMatchesDate(cell, props.parsedValue); 26126 }; 26127 const cellMatchesDate = (cell, date) => { 26128 if (!date) 26129 return false; 26130 return dayjs(date).locale(lang.value).isSame(props.date.date(Number(cell.text)), "day"); 26131 }; 26132 const getCellClasses = (cell) => { 26133 const classes = []; 26134 if (isNormalDay(cell.type) && !cell.disabled) { 26135 classes.push("available"); 26136 if (cell.type === "today") { 26137 classes.push("today"); 26138 } 26139 } else { 26140 classes.push(cell.type); 26141 } 26142 if (isCurrent(cell)) { 26143 classes.push("current"); 26144 } 26145 if (cell.inRange && (isNormalDay(cell.type) || props.selectionMode === "week")) { 26146 classes.push("in-range"); 26147 if (cell.start) { 26148 classes.push("start-date"); 26149 } 26150 if (cell.end) { 26151 classes.push("end-date"); 26152 } 26153 } 26154 if (cell.disabled) { 26155 classes.push("disabled"); 26156 } 26157 if (cell.selected) { 26158 classes.push("selected"); 26159 } 26160 if (cell.customClass) { 26161 classes.push(cell.customClass); 26162 } 26163 return classes.join(" "); 26164 }; 26165 const getDateOfCell = (row, column) => { 26166 const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - offsetDay.value; 26167 return startDate.value.add(offsetFromStart, "day"); 26168 }; 26169 const handleMouseMove = (event) => { 26170 var _a; 26171 if (!props.rangeState.selecting) 26172 return; 26173 let target = event.target; 26174 if (target.tagName === "SPAN") { 26175 target = (_a = target.parentNode) == null ? void 0 : _a.parentNode; 26176 } 26177 if (target.tagName === "DIV") { 26178 target = target.parentNode; 26179 } 26180 if (target.tagName !== "TD") 26181 return;
26182 const row = target.parentNode.rowIndex - 1; 26183 const column = target.cellIndex; 26184 if (rows.value[row][column].disabled) 26185 return; 26186 if (row !== lastRow.value || column !== lastColumn.value) { 26187 lastRow.value = row; 26188 lastColumn.value = column; 26189 emit("changerange", { 26190 selecting: true, 26191 endDate: getDateOfCell(row, column) 26192 }); 26193 } 26194 }; 26195 const isSelectedCell = (cell) => { 26196 return !hasCurrent.value && (cell == null ? void 0 : cell.text) === 1 && cell.type === "normal" || cell.isCurrent; 26197 }; 26198 const handleFocus = (event) => { 26199 if (focusWithClick || hasCurrent.value || props.selectionMode !== "date") 26200 return; 26201 handlePickDate(event, true); 26202 }; 26203 const handleMouseDown = (event) => { 26204 const target = event.target.closest("td"); 26205 if (!target) 26206 return; 26207 focusWithClick = true; 26208 }; 26209 const handleMouseUp = (event) => { 26210 const target = event.target.closest("td"); 26211 if (!target) 26212 return; 26213 focusWithClick = false; 26214 }; 26215 const handlePickDate = (event, isKeyboardMovement = false) => { 26216 const target = event.target.closest("td"); 26217 if (!target) 26218 return; 26219 const row = target.parentNode.rowIndex - 1; 26220 const column = target.cellIndex; 26221 const cell = rows.value[row][column]; 26222 if (cell.disabled || cell.type === "week") 26223 return; 26224 const newDate = getDateOfCell(row, column); 26225 if (props.selectionMode === "range") { 26226 if (!props.rangeState.selecting || !props.minDate) { 26227 emit("pick", { minDate: newDate, maxDate: null }); 26228 emit("select", true); 26229 } else { 26230 if (newDate >= props.minDate) { 26231 emit("pick", { minDate: props.minDate, maxDate: newDate }); 26232 } else { 26233 emit("pick", { minDate: newDate, maxDate: props.minDate }); 26234 } 26235 emit("select", false); 26236 } 26237 } else if (props.selectionMode === "date") { 26238 emit("pick", newDate, isKeyboardMovement); 26239 } else if (props.selectionMode === "week") { 26240 const weekNumber = newDate.week(); 26241 const value = `${newDate.year()}w${weekNumber}`; 26242 emit("pick", { 26243 year: newDate.year(), 26244 week: weekNumber, 26245 value, 26246 date: newDate.startOf("week") 26247 }); 26248 } else if (props.selectionMode === "dates") { 26249 const newValue = cell.selected ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.valueOf()) !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]); 26250 emit("pick", newValue); 26251 } 26252 }; 26253 const isWeekActive = (cell) => { 26254 if (props.selectionMode !== "week") 26255 return false; 26256 let newDate = props.date.startOf("day"); 26257 if (cell.type === "prev-month") { 26258 newDate = newDate.subtract(1, "month"); 26259 } 26260 if (cell.type === "next-month") { 26261 newDate = newDate.add(1, "month"); 26262 } 26263 newDate = newDate.date(Number.parseInt(cell.text, 10)); 26264 if (props.parsedValue && !Array.isArray(props.parsedValue)) { 26265 const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1; 26266 const weekDate = props.parsedValue.subtract(dayOffset, "day"); 26267 return weekDate.isSame(newDate, "day"); 26268 } 26269 return false; 26270 }; 26271 expose({ 26272 focus 26273 }); 26274 return (_ctx, _cache) => { 26275 return vue.openBlock(), vue.createElementBlock("table", { 26276 role: "grid", 26277 "aria-label": vue.unref(t)("el.datepicker.dateTablePrompt"), 26278 cellspacing: "0", 26279 cellpadding: "0", 26280 class: vue.normalizeClass([vue.unref(ns).b(), { "is-week-mode": _ctx.selectionMode === "week" }]), 26281 onClick: handlePickDate, 26282 onMousemove: handleMouseMove, 26283 onMousedown: vue.withModifiers(handleMouseDown, ["prevent"]), 26284 onMouseup: handleMouseUp 26285 }, [ 26286 vue.createElementVNode("tbody", { 26287 ref_key: "tbodyRef", 26288 ref: tbodyRef 26289 }, [ 26290 vue.createElementVNode("tr", null, [ 26291 _ctx.showWeekNumber ? (vue.openBlock(), vue.createElementBlock("th", _hoisted_2$t, vue.toDisplayString(vue.unref(t)("el.datepicker.week")), 1)) : vue.createCommentVNode("v-if", true), 26292 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(WEEKS), (week, key) => {
26293 return vue.openBlock(), vue.createElementBlock("th", { 26294 key, 26295 scope: "col", 26296 "aria-label": vue.unref(t)("el.datepicker.weeksFull." + week) 26297 }, vue.toDisplayString(vue.unref(t)("el.datepicker.weeks." + week)), 9, _hoisted_3$g); 26298 }), 128)) 26299 ]), 26300 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, rowKey) => { 26301 return vue.openBlock(), vue.createElementBlock("tr", { 26302 key: rowKey, 26303 class: vue.normalizeClass([vue.unref(ns).e("row"), { current: isWeekActive(row[1]) }]) 26304 }, [ 26305 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, columnKey) => { 26306 return vue.openBlock(), vue.createElementBlock("td", { 26307 key: `${rowKey}.${columnKey}`, 26308 ref_for: true, 26309 ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el), 26310 class: vue.normalizeClass(getCellClasses(cell)), 26311 "aria-current": cell.isCurrent ? "date" : void 0, 26312 "aria-selected": cell.isCurrent, 26313 tabindex: isSelectedCell(cell) ? 0 : -1, 26314 onFocus: handleFocus 26315 }, [ 26316 vue.createVNode(vue.unref(ElDatePickerCell), { cell }, null, 8, ["cell"]) 26317 ], 42, _hoisted_4$b); 26318 }), 128)) 26319 ], 2); 26320 }), 128)) 26321 ], 512) 26322 ], 42, _hoisted_1$I); 26323 }; 26324 } 26325 }); 26326 var DateTable = /* @__PURE__ */ _export_sfc(_sfc_main$1l, [["__file", "basic-date-table.vue"]]); 26327 26328 const basicMonthTableProps = buildProps({ 26329 ...datePickerSharedProps, 26330 selectionMode: selectionModeWithDefault("month") 26331 }); 26332 26333 const _hoisted_1$H = ["aria-label"]; 26334 const _hoisted_2$s = ["aria-selected", "aria-label", "tabindex", "onKeydown"]; 26335 const _hoisted_3$f = { class: "cell" }; 26336 const _sfc_main$1k = /* @__PURE__ */ vue.defineComponent({ 26337 __name: "basic-month-table", 26338 props: basicMonthTableProps, 26339 emits: ["changerange", "pick", "select"], 26340 setup(__props, { expose, emit }) { 26341 const props = __props; 26342 const datesInMonth = (year, month, lang2) => { 26343 const firstDay = dayjs().locale(lang2).startOf("month").month(month).year(year); 26344 const numOfDays = firstDay.daysInMonth(); 26345 return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate()); 26346 }; 26347 const ns = useNamespace("month-table"); 26348 const { t, lang } = useLocale(); 26349 const tbodyRef = vue.ref(); 26350 const currentCellRef = vue.ref(); 26351 const months = vue.ref(props.date.locale("en").localeData().monthsShort().map((_) => _.toLowerCase())); 26352 const tableRows = vue.ref([ 26353 [], 26354 [], 26355 [] 26356 ]); 26357 const lastRow = vue.ref(); 26358 const lastColumn = vue.ref(); 26359 const rows = vue.computed(() => { 26360 var _a, _b; 26361 const rows2 = tableRows.value; 26362 const now = dayjs().locale(lang.value).startOf("month"); 26363 for (let i = 0; i < 3; i++) { 26364 const row = rows2[i]; 26365 for (let j = 0; j < 4; j++) { 26366 const cell = row[j] || (row[j] = { 26367 row: i, 26368 column: j, 26369 type: "normal", 26370 inRange: false, 26371 start: false, 26372 end: false, 26373 text: -1, 26374 disabled: false 26375 }); 26376 cell.type = "normal"; 26377 const index = i * 4 + j; 26378 const calTime = props.date.startOf("year").month(index); 26379 const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null; 26380 cell.inRange = !!(props.minDate && calTime.isSameOrAfter(props.minDate, "month") && calEndDate && calTime.isSameOrBefore(calEndDate, "month")) || !!(props.minDate && calTime.isSameOrBefore(props.minDate, "month") && calEndDate && calTime.isSameOrAfter(calEndDate, "month")); 26381 if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) { 26382 cell.start = !!(calEndDate && calTime.isSame(calEndDate, "month")); 26383 cell.end = props.minDate && calTime.isSame(props.minDate, "month"); 26384 } else { 26385 cell.start = !!(props.minDate && calTime.isSame(props.minDate, "month")); 26386 cell.end = !!(calEndDate && calTime.isSame(calEndDate, "month")); 26387 } 26388 const isToday = now.isSame(calTime); 26389 if (isToday) { 26390 cell.type = "today"; 26391 } 26392 cell.text = index; 26393 cell.disabled = ((_b = props.disabledDate) == null ? void 0 : _b.call(props, calTime.toDate())) || false; 26394 } 26395 } 26396 return rows2; 26397 }); 26398 const focus = () => { 26399 var _a; 26400 (_a = currentCellRef.value) == null ? void 0 : _a.focus(); 26401 }; 26402 const getCellStyle = (cell) => { 26403 const style = {}; 26404 const year = props.date.year(); 26405 const today = new Date();
26406 const month = cell.text; 26407 style.disabled = props.disabledDate ? datesInMonth(year, month, lang.value).every(props.disabledDate) : false; 26408 style.current = castArray(props.parsedValue).findIndex((date) => dayjs.isDayjs(date) && date.year() === year && date.month() === month) >= 0; 26409 style.today = today.getFullYear() === year && today.getMonth() === month; 26410 if (cell.inRange) { 26411 style["in-range"] = true; 26412 if (cell.start) { 26413 style["start-date"] = true; 26414 } 26415 if (cell.end) { 26416 style["end-date"] = true; 26417 } 26418 } 26419 return style; 26420 }; 26421 const isSelectedCell = (cell) => { 26422 const year = props.date.year(); 26423 const month = cell.text; 26424 return castArray(props.date).findIndex((date) => date.year() === year && date.month() === month) >= 0; 26425 }; 26426 const handleMouseMove = (event) => { 26427 var _a; 26428 if (!props.rangeState.selecting) 26429 return; 26430 let target = event.target; 26431 if (target.tagName === "A") { 26432 target = (_a = target.parentNode) == null ? void 0 : _a.parentNode; 26433 } 26434 if (target.tagName === "DIV") { 26435 target = target.parentNode; 26436 } 26437 if (target.tagName !== "TD") 26438 return; 26439 const row = target.parentNode.rowIndex; 26440 const column = target.cellIndex; 26441 if (rows.value[row][column].disabled) 26442 return; 26443 if (row !== lastRow.value || column !== lastColumn.value) { 26444 lastRow.value = row; 26445 lastColumn.value = column; 26446 emit("changerange", { 26447 selecting: true, 26448 endDate: props.date.startOf("year").month(row * 4 + column) 26449 }); 26450 } 26451 }; 26452 const handleMonthTableClick = (event) => { 26453 var _a; 26454 const target = (_a = event.target) == null ? void 0 : _a.closest("td"); 26455 if ((target == null ? void 0 : target.tagName) !== "TD") 26456 return; 26457 if (hasClass(target, "disabled")) 26458 return; 26459 const column = target.cellIndex; 26460 const row = target.parentNode.rowIndex;
26461 const month = row * 4 + column; 26462 const newDate = props.date.startOf("year").month(month); 26463 if (props.selectionMode === "range") { 26464 if (!props.rangeState.selecting) { 26465 emit("pick", { minDate: newDate, maxDate: null }); 26466 emit("select", true); 26467 } else { 26468 if (props.minDate && newDate >= props.minDate) { 26469 emit("pick", { minDate: props.minDate, maxDate: newDate }); 26470 } else { 26471 emit("pick", { minDate: newDate, maxDate: props.minDate }); 26472 } 26473 emit("select", false); 26474 } 26475 } else { 26476 emit("pick", month); 26477 } 26478 }; 26479 vue.watch(() => props.date, async () => { 26480 var _a, _b; 26481 if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) { 26482 await vue.nextTick(); 26483 (_b = currentCellRef.value) == null ? void 0 : _b.focus(); 26484 } 26485 }); 26486 expose({ 26487 focus 26488 }); 26489 return (_ctx, _cache) => { 26490 return vue.openBlock(), vue.createElementBlock("table", { 26491 role: "grid", 26492 "aria-label": vue.unref(t)("el.datepicker.monthTablePrompt"), 26493 class: vue.normalizeClass(vue.unref(ns).b()), 26494 onClick: handleMonthTableClick, 26495 onMousemove: handleMouseMove 26496 }, [ 26497 vue.createElementVNode("tbody", { 26498 ref_key: "tbodyRef", 26499 ref: tbodyRef 26500 }, [ 26501 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, key) => { 26502 return vue.openBlock(), vue.createElementBlock("tr", { key }, [ 26503 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, key_) => { 26504 return vue.openBlock(), vue.createElementBlock("td", { 26505 key: key_, 26506 ref_for: true, 26507 ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el), 26508 class: vue.normalizeClass(getCellStyle(cell)), 26509 "aria-selected": `${isSelectedCell(cell)}`, 26510 "aria-label": vue.unref(t)(`el.datepicker.month${+cell.text + 1}`), 26511 tabindex: isSelectedCell(cell) ? 0 : -1, 26512 onKeydown: [ 26513 vue.withKeys(vue.withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["space"]), 26514 vue.withKeys(vue.withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["enter"]) 26515 ] 26516 }, [ 26517 vue.createElementVNode("div", null, [ 26518 vue.createElementVNode("span", _hoisted_3$f, vue.toDisplayString(vue.unref(t)("el.datepicker.months." + months.value[cell.text])), 1) 26519 ]) 26520 ], 42, _hoisted_2$s); 26521 }), 128)) 26522 ]); 26523 }), 128)) 26524 ], 512) 26525 ], 42, _hoisted_1$H); 26526 }; 26527 } 26528 }); 26529 var MonthTable = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["__file", "basic-month-table.vue"]]); 26530 26531 const { date, disabledDate, parsedValue } = datePickerSharedProps; 26532 const basicYearTableProps = buildProps({ 26533 date, 26534 disabledDate, 26535 parsedValue 26536 }); 26537 26538 const _hoisted_1$G = ["aria-label"]; 26539 const _hoisted_2$r = ["aria-selected", "tabindex", "onKeydown"]; 26540 const _hoisted_3$e = { class: "cell" }; 26541 const _hoisted_4$a = { key: 1 }; 26542 const _sfc_main$1j = /* @__PURE__ */ vue.defineComponent({ 26543 __name: "basic-year-table", 26544 props: basicYearTableProps, 26545 emits: ["pick"], 26546 setup(__props, { expose, emit }) { 26547 const props = __props; 26548 const datesInYear = (year, lang2) => { 26549 const firstDay = dayjs(String(year)).locale(lang2).startOf("year"); 26550 const lastDay = firstDay.endOf("year"); 26551 const numOfDays = lastDay.dayOfYear(); 26552 return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate()); 26553 }; 26554 const ns = useNamespace("year-table"); 26555 const { t, lang } = useLocale(); 26556 const tbodyRef = vue.ref(); 26557 const currentCellRef = vue.ref(); 26558 const startYear = vue.computed(() => { 26559 return Math.floor(props.date.year() / 10) * 10; 26560 }); 26561 const focus = () => { 26562 var _a; 26563 (_a = currentCellRef.value) == null ? void 0 : _a.focus(); 26564 }; 26565 const getCellKls = (year) => {
26566 const kls = {}; 26567 const today = dayjs().locale(lang.value); 26568 kls.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false; 26569 kls.current = castArray(props.parsedValue).findIndex((d) => d.year() === year) >= 0; 26570 kls.today = today.year() === year; 26571 return kls; 26572 }; 26573 const isSelectedCell = (year) => { 26574 return year === startYear.value && props.date.year() < startYear.value && props.date.year() > startYear.value + 9 || castArray(props.date).findIndex((date) => date.year() === year) >= 0; 26575 }; 26576 const handleYearTableClick = (event) => { 26577 const clickTarget = event.target; 26578 const target = clickTarget.closest("td"); 26579 if (target && target.textContent) { 26580 if (hasClass(target, "disabled")) 26581 return; 26582 const year = target.textContent || target.innerText; 26583 emit("pick", Number(year)); 26584 } 26585 }; 26586 vue.watch(() => props.date, async () => { 26587 var _a, _b; 26588 if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) { 26589 await vue.nextTick(); 26590 (_b = currentCellRef.value) == null ? void 0 : _b.focus(); 26591 } 26592 }); 26593 expose({ 26594 focus 26595 }); 26596 return (_ctx, _cache) => { 26597 return vue.openBlock(), vue.createElementBlock("table", { 26598 role: "grid", 26599 "aria-label": vue.unref(t)("el.datepicker.yearTablePrompt"), 26600 class: vue.normalizeClass(vue.unref(ns).b()), 26601 onClick: handleYearTableClick 26602 }, [ 26603 vue.createElementVNode("tbody", { 26604 ref_key: "tbodyRef", 26605 ref: tbodyRef 26606 }, [ 26607 (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(3, (_, i) => { 26608 return vue.createElementVNode("tr", { key: i }, [ 26609 (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(4, (__, j) => { 26610 return vue.openBlock(), vue.createElementBlock(vue.Fragment, { 26611 key: i + "_" + j 26612 }, [ 26613 i * 4 + j < 10 ? (vue.openBlock(), vue.createElementBlock("td", { 26614 key: 0, 26615 ref_for: true, 26616 ref: (el) => isSelectedCell(vue.unref(startYear) + i * 4 + j) && (currentCellRef.value = el), 26617 class: vue.normalizeClass(["available", getCellKls(vue.unref(startYear) + i * 4 + j)]), 26618 "aria-selected": `${isSelectedCell(vue.unref(startYear) + i * 4 + j)}`, 26619 tabindex: isSelectedCell(vue.unref(startYear) + i * 4 + j) ? 0 : -1, 26620 onKeydown: [ 26621 vue.withKeys(vue.withModifiers(handleYearTableClick, ["prevent", "stop"]), ["space"]), 26622 vue.withKeys(vue.withModifiers(handleYearTableClick, ["prevent", "stop"]), ["enter"]) 26623 ] 26624 }, [ 26625 vue.createElementVNode("span", _hoisted_3$e, vue.toDisplayString(vue.unref(startYear) + i * 4 + j), 1) 26626 ], 42, _hoisted_2$r)) : (vue.openBlock(), vue.createElementBlock("td", _hoisted_4$a)) 26627 ], 64); 26628 }), 64)) 26629 ]); 26630 }), 64)) 26631 ], 512) 26632 ], 10, _hoisted_1$G); 26633 }; 26634 } 26635 }); 26636 var YearTable = /* @__PURE__ */ _export_sfc(_sfc_main$1j, [["__file", "basic-year-table.vue"]]); 26637 26638 const _hoisted_1$F = ["onClick"]; 26639 const _hoisted_2$q = ["aria-label"]; 26640 const _hoisted_3$d = ["aria-label"]; 26641 const _hoisted_4$9 = ["aria-label"]; 26642 const _hoisted_5$7 = ["aria-label"]; 26643 const _sfc_main$1i = /* @__PURE__ */ vue.defineComponent({ 26644 __name: "panel-date-pick", 26645 props: panelDatePickProps, 26646 emits: ["pick", "set-picker-option", "panel-change"], 26647 setup(__props, { emit: contextEmit }) { 26648 const props = __props; 26649 const timeWithinRange = (_, __, ___) => true; 26650 const ppNs = useNamespace("picker-panel"); 26651 const dpNs = useNamespace("date-picker"); 26652 const attrs = vue.useAttrs(); 26653 const slots = vue.useSlots();
26654 const { t, lang } = useLocale(); 26655 const pickerBase = vue.inject("EP_PICKER_BASE"); 26656 const popper = vue.inject(TOOLTIP_INJECTION_KEY); 26657 const { shortcuts, disabledDate, cellClassName, defaultTime, arrowControl } = pickerBase.props; 26658 const defaultValue = vue.toRef(pickerBase.props, "defaultValue"); 26659 const currentViewRef = vue.ref(); 26660 const innerDate = vue.ref(dayjs().locale(lang.value)); 26661 const isChangeToNow = vue.ref(false); 26662 const defaultTimeD = vue.computed(() => { 26663 return dayjs(defaultTime).locale(lang.value); 26664 }); 26665 const month = vue.computed(() => { 26666 return innerDate.value.month(); 26667 }); 26668 const year = vue.computed(() => { 26669 return innerDate.value.year(); 26670 }); 26671 const selectableRange = vue.ref([]); 26672 const userInputDate = vue.ref(null); 26673 const userInputTime = vue.ref(null); 26674 const checkDateWithinRange = (date) => { 26675 return selectableRange.value.length > 0 ? timeWithinRange(date, selectableRange.value, props.format || "HH:mm:ss") : true; 26676 }; 26677 const formatEmit = (emitDayjs) => { 26678 if (defaultTime && !visibleTime.value && !isChangeToNow.value) { 26679 return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date()); 26680 } 26681 if (showTime.value) 26682 return emitDayjs.millisecond(0); 26683 return emitDayjs.startOf("day"); 26684 }; 26685 const emit = (value, ...args) => { 26686 if (!value) { 26687 contextEmit("pick", value, ...args); 26688 } else if (isArray$1(value)) { 26689 const dates = value.map(formatEmit); 26690 contextEmit("pick", dates, ...args); 26691 } else { 26692 contextEmit("pick", formatEmit(value), ...args); 26693 } 26694 userInputDate.value = null; 26695 userInputTime.value = null; 26696 isChangeToNow.value = false; 26697 }; 26698 const handleDatePick = (value, keepOpen) => { 26699 if (selectionMode.value === "date") { 26700 value = value; 26701 let newDate = props.parsedValue ? props.parsedValue.year(value.year()).month(value.month()).date(value.date()) : value; 26702 if (!checkDateWithinRange(newDate)) { 26703 newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date()); 26704 } 26705 innerDate.value = newDate; 26706 emit(newDate, showTime.value || keepOpen); 26707 } else if (selectionMode.value === "week") { 26708 emit(value.date); 26709 } else if (selectionMode.value === "dates") { 26710 emit(value, true); 26711 } 26712 }; 26713 const moveByMonth = (forward) => { 26714 const action = forward ? "add" : "subtract"; 26715 innerDate.value = innerDate.value[action](1, "month"); 26716 handlePanelChange("month"); 26717 }; 26718 const moveByYear = (forward) => { 26719 const currentDate = innerDate.value; 26720 const action = forward ? "add" : "subtract"; 26721 innerDate.value = currentView.value === "year" ? currentDate[action](10, "year") : currentDate[action](1, "year"); 26722 handlePanelChange("year"); 26723 }; 26724 const currentView = vue.ref("date"); 26725 const yearLabel = vue.computed(() => { 26726 const yearTranslation = t("el.datepicker.year"); 26727 if (currentView.value === "year") { 26728 const startYear = Math.floor(year.value / 10) * 10; 26729 if (yearTranslation) { 26730 return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`; 26731 } 26732 return `${startYear} - ${startYear + 9}`; 26733 } 26734 return `${year.value} ${yearTranslation}`; 26735 }); 26736 const handleShortcutClick = (shortcut) => { 26737 const shortcutValue = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value; 26738 if (shortcutValue) { 26739 emit(dayjs(shortcutValue).locale(lang.value)); 26740 return; 26741 } 26742 if (shortcut.onClick) { 26743 shortcut.onClick({ 26744 attrs, 26745 slots, 26746 emit: contextEmit 26747 }); 26748 } 26749 }; 26750 const selectionMode = vue.computed(() => { 26751 const { type }
26751 = props; 26752 if (["week", "month", "year", "dates"].includes(type)) 26753 return type; 26754 return "date"; 26755 }); 26756 const keyboardMode = vue.computed(() => { 26757 return selectionMode.value === "date" ? currentView.value : selectionMode.value; 26758 }); 26759 const hasShortcuts = vue.computed(() => !!shortcuts.length); 26760 const handleMonthPick = async (month2) => { 26761 innerDate.value = innerDate.value.startOf("month").month(month2); 26762 if (selectionMode.value === "month") { 26763 emit(innerDate.value, false); 26764 } else { 26765 currentView.value = "date"; 26766 if (["month", "year", "date", "week"].includes(selectionMode.value)) { 26767 emit(innerDate.value, true); 26768 await vue.nextTick(); 26769 handleFocusPicker(); 26770 } 26771 } 26772 handlePanelChange("month"); 26773 }; 26774 const handleYearPick = async (year2) => { 26775 if (selectionMode.value === "year") { 26776 innerDate.value = innerDate.value.startOf("year").year(year2); 26777 emit(innerDate.value, false); 26778 } else { 26779 innerDate.value = innerDate.value.year(year2); 26780 currentView.value = "month"; 26781 if (["month", "year", "date", "week"].includes(selectionMode.value)) { 26782 emit(innerDate.value, true); 26783 await vue.nextTick(); 26784 handleFocusPicker(); 26785 } 26786 } 26787 handlePanelChange("year"); 26788 }; 26789 const showPicker = async (view) => { 26790 currentView.value = view; 26791 await vue.nextTick(); 26792 handleFocusPicker(); 26793 }; 26794 const showTime = vue.computed(() => props.type === "datetime" || props.type === "datetimerange"); 26795 const footerVisible = vue.computed(() => { 26796 return showTime.value || selectionMode.value === "dates"; 26797 }); 26798 const onConfirm = () => { 26799 if (selectionMode.value === "dates") { 26800 emit(props.parsedValue); 26801 } else { 26802 let result = props.parsedValue; 26803 if (!result) { 26804 const defaultTimeD2 = dayjs(defaultTime).locale(lang.value); 26805 const defaultValueD = getDefaultValue(); 26806 result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date()); 26807 } 26808 innerDate.value = result; 26809 emit(result); 26810 } 26811 }; 26812 const changeToNow = () => { 26813 const now = dayjs().locale(lang.value); 26814 const nowDate = now.toDate(); 26815 isChangeToNow.value = true; 26816 if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) { 26817 innerDate.value = dayjs().locale(lang.value); 26818 emit(innerDate.value); 26819 } 26820 }; 26821 const timeFormat = vue.computed(() => { 26822 return extractTimeFormat(props.format); 26823 }); 26824 const dateFormat = vue.computed(() => { 26825 return extractDateFormat(props.format); 26826 }); 26827 const visibleTime = vue.computed(() => { 26828 if (userInputTime.value) 26829 return userInputTime.value; 26830 if (!props.parsedValue && !defaultValue.value) 26831 return; 26832 return (props.parsedValue || innerDate.value).format(timeFormat.value); 26833 }); 26834 const visibleDate = vue.computed(() => { 26835 if (userInputDate.value) 26836 return userInputDate.value; 26837 if (!props.parsedValue && !defaultValue.value) 26838 return; 26839 return (props.parsedValue || innerDate.value).format(dateFormat.value); 26840 }); 26841 const timePickerVisible = vue.ref(false); 26842 const onTimePickerInputFocus = () => { 26843 timePickerVisible.value = true; 26844 }; 26845 const handleTimePickClose = () => { 26846 timePickerVisible.value = false; 26847 }; 26848 const getUnits = (date) => { 26849 return { 26850 hour: date.hour(), 26851 minute: date.minute(), 26852 second: date.second(), 26853 year: date.year(), 26854 month: date.month(), 26855 date: date.date() 26856 }; 26857 }; 26858 const handleTimePick = (value, visible, first) => { 26859 const { hour, minute, second } = getUnits(value); 26860 const newDate = props.parsedValue ? props.parsedValue.hour(hour).minute(minute).second(second) : value; 26861 innerDate.value = newDate; 26862 emit(innerDate.value, true); 26863 if (!first) { 26864 timePickerVisible.value = visible; 26865 } 26866 }; 26867 const handleVisibleTimeChange = (value) => { 26868 const newDate = dayjs(value, timeFormat.value).locale(lang.value); 26869 if (newDate.isValid() && checkDateWithinRange(newDate)) { 26870 const { year: year2, month: month2, date } = getUnits(innerDate.value); 26871 innerDate.value = newDate.year(year2).month(month2).date(date); 26872 userInputTime.value = null; 26873 timePickerVisible.value = false; 26874 emit(innerDate.value, true); 26875 } 26876 }; 26877 const handleVisibleDateChange = (value) => { 26878 const newDate = dayjs(value, dateFormat.value).locale(lang.value); 26879 if (newDate.isValid()) { 26880 if (disabledDate && disabledDate(newDate.toDate())) { 26881 return; 26882 } 26883 const { hour, minute, second } = getUnits(innerDate.value); 26884 innerDate.value = newDate.hour(hour).minute(minute).second(second); 26885 userInputDate.value = null; 26886 emit(innerDate.value, true); 26887 } 26888 }; 26889 const isValidValue = (date) => { 26890 return dayjs.isDayjs(date) && date.isValid() && (disabledDate ? !disabledDate(date.toDate()) : true); 26891 }; 26892 const formatToString = (value) => { 26893 if (selectionMode.value === "dates") { 26894 return value.map((_) => _.format(props.format)); 26895 } 26896 return value.format(props.format); 26897 }; 26898 const parseUserInput = (value) => { 26899 return dayjs(value, props.format).locale(lang.value); 26900 }; 26901 const getDefaultValue = () => { 26902 const parseDate = dayjs(defaultValue.value).locale(lang.value); 26903 if (!defaultValue.value) { 26904 const defaultTimeDValue = defaultTimeD.value; 26905 return dayjs().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value); 26906 } 26907 return parseDate; 26908 }; 26909 const handleFocusPicker = async () => { 26910 var _a; 26911 if (["week", "month", "year", "date"].includes(selectionMode.value)) { 26912 (_a = currentViewRef.value) == null ? void 0 : _a.focus(); 26913 if (selectionMode.value === "week") { 26914 handleKeyControl(EVENT_CODE.down); 26915 } 26916 } 26917 }; 26918 const handleKeydownTable = (event) => { 26919 const { code } = event; 26920 const validCode = [ 26921 EVENT_CODE.up, 26922 EVENT_CODE.down, 26923 EVENT_CODE.left, 26924 EVENT_CODE.right, 26925 EVENT_CODE.home, 26926 EVENT_CODE.end, 26927 EVENT_CODE.pageUp, 26928 EVENT_CODE.pageDown 26929 ]; 26930 if (validCode.includes(code)) { 26931 handleKeyControl(code); 26932 event.stopPropagation(); 26933 event.preventDefault(); 26934 } 26935 if ([EVENT_CODE.enter, EVENT_CODE.space, EVENT_CODE.numpadEnter].includes(code) && userInputDate.value === null && userInputTime.value === null) { 26936 event.preventDefault(); 26937 emit(innerDate.value, false); 26938 } 26939 }; 26940 const handleKeyControl = (code) => { 26941 var _a; 26942 const { up, down, left, right, home, end, pageUp, pageDown } = EVENT_CODE; 26943 const mapping = { 26944 year: { 26945 [up]: -4, 26946 [down]: 4, 26947 [left]: -1, 26948 [right]: 1, 26949 offset: (date, step) => date.setFullYear(date.getFullYear() + step) 26950 }, 26951 month: { 26952 [up]: -4, 26953 [down]: 4, 26954 [left]: -1, 26955 [right]: 1, 26956 offset: (date, step) => date.setMonth(date.getMonth() + step) 26957 }, 26958 week: { 26959 [up]: -1, 26960 [down]: 1, 26961 [left]: -1, 26962 [right]: 1, 26963 offset: (date, step) => date.setDate(date.getDate() + step * 7) 26964 }, 26965 date: { 26966 [up]: -7, 26967 [down]: 7, 26968 [left]: -1, 26969 [right]: 1, 26970 [home]: (date) => -date.getDay(), 26971 [end]: (date) => -date.getDay() + 6, 26972 [pageUp]: (date) => -new Date(date.getFullYear(), date.getMonth(), 0).getDate(), 26973 [pageDown]: (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(), 26974 offset: (date, step) => date.setDate(date.getDate() + step) 26975 } 26976 }; 26977 const newDate = innerDate.value.toDate(); 26978 while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) { 26979 const map = mapping[keyboardMode.value]; 26980 if (!map) 26981 return; 26982 map.offset(newDate, isFunction$1(map[code]) ? map[code](newDate) : (_a = map[code]) != null ? _a : 0); 26983 if (disabledDate && disabledDate(newDate)) { 26984 break; 26985 } 26986 const result = dayjs(newDate).locale(lang.value); 26987 innerDate.value = result; 26988 contextEmit("pick", result, true); 26989 break; 26990 } 26991 }; 26992 const handlePanelChange = (mode) => { 26993 contextEmit("panel-change", innerDate.value.toDate(), mode, currentView.value); 26994 }; 26995 vue.watch(() => selectionMode.value, (val) => { 26996 if (["month", "year"].includes(val)) { 26997 currentView.value = val; 26998 return; 26999 } 27000 currentView.value = "date"; 27001 }, { immediate: true });
27002 vue.watch(() => currentView.value, () => { 27003 popper == null ? void 0 : popper.updatePopper(); 27004 }); 27005 vue.watch(() => defaultValue.value, (val) => { 27006 if (val) { 27007 innerDate.value = getDefaultValue(); 27008 } 27009 }, { immediate: true }); 27010 vue.watch(() => props.parsedValue, (val) => { 27011 if (val) { 27012 if (selectionMode.value === "dates") 27013 return; 27014 if (Array.isArray(val)) 27015 return; 27016 innerDate.value = val; 27017 } else { 27018 innerDate.value = getDefaultValue(); 27019 } 27020 }, { immediate: true }); 27021 contextEmit("set-picker-option", ["isValidValue", isValidValue]); 27022 contextEmit("set-picker-option", ["formatToString", formatToString]); 27023 contextEmit("set-picker-option", ["parseUserInput", parseUserInput]); 27024 contextEmit("set-picker-option", ["handleFocusPicker", handleFocusPicker]); 27025 return (_ctx, _cache) => { 27026 return vue.openBlock(), vue.createElementBlock("div", { 27027 class: vue.normalizeClass([ 27028 vue.unref(ppNs).b(), 27029 vue.unref(dpNs).b(), 27030 { 27031 "has-sidebar": _ctx.$slots.sidebar || vue.unref(hasShortcuts), 27032 "has-time": vue.unref(showTime) 27033 } 27034 ]) 27035 }, [ 27036 vue.createElementVNode("div", { 27037 class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper")) 27038 }, [ 27039 vue.renderSlot(_ctx.$slots, "sidebar", { 27040 class: vue.normalizeClass(vue.unref(ppNs).e("sidebar")) 27041 }), 27042 vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", { 27043 key: 0, 27044 class: vue.normalizeClass(vue.unref(ppNs).e("sidebar")) 27045 }, [ 27046 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => { 27047 return vue.openBlock(), vue.createElementBlock("button", { 27048 key, 27049 type: "button", 27050 class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")), 27051 onClick: ($event) => handleShortcutClick(shortcut) 27052 }, vue.toDisplayString(shortcut.text), 11, _hoisted_1$F); 27053 }), 128)) 27054 ], 2)) : vue.createCommentVNode("v-if", true), 27055 vue.createElementVNode("div", { 27056 class: vue.normalizeClass(vue.unref(ppNs).e("body")) 27057 }, [ 27058 vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", { 27059 key: 0, 27060 class: vue.normalizeClass(vue.unref(dpNs).e("time-header")) 27061 }, [ 27062 vue.createElementVNode("span", { 27063 class: vue.normalizeClass(vue.unref(dpNs).e("editor-wrap")) 27064 }, [ 27065 vue.createVNode(vue.unref(ElInput), { 27066 placeholder: vue.unref(t)("el.datepicker.selectDate"), 27067 "model-value": vue.unref(visibleDate), 27068 size: "small", 27069 "validate-event": false, 27070 onInput: _cache[0] || (_cache[0] = (val) => userInputDate.value = val), 27071 onChange: handleVisibleDateChange 27072 }, null, 8, ["placeholder", "model-value"]) 27073 ], 2), 27074 vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", { 27075 class: vue.normalizeClass(vue.unref(dpNs).e("editor-wrap")) 27076 }, [ 27077 vue.createVNode(vue.unref(ElInput), { 27078 placeholder: vue.unref(t)("el.datepicker.selectTime"), 27079 "model-value": vue.unref(visibleTime), 27080 size: "small", 27081 "validate-event": false, 27082 onFocus: onTimePickerInputFocus, 27083 onInput: _cache[1] || (_cache[1] = (val) => userInputTime.value = val), 27084 onChange: handleVisibleTimeChange 27085 }, null, 8, ["placeholder", "model-value"]), 27086 vue.createVNode(vue.unref(TimePickPanel), { 27087 visible: timePickerVisible.value, 27088 format: vue.unref(timeFormat), 27089 "time-arrow-control": vue.unref(arrowControl), 27090 "parsed-value": innerDate.value, 27091 onPick: handleTimePick 27092 }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value"]) 27093 ], 2)), [ 27094 [vue.unref(ClickOutside), handleTimePickClose] 27095 ]) 27096 ], 2)) : vue.createCommentVNode("v-if", true), 27097 vue.withDirectives(vue.createElementVNode("div", { 27098 class: vue.normalizeClass([ 27099 vue.unref(dpNs).e("header"), 27100 (currentView.value === "year" || currentView.value === "month") && vue.unref(dpNs).e("header--bordered") 27101 ]) 27102 }, [ 27103 vue.createElementVNode("span", { 27104 class: vue.normalizeClass(vue.unref(dpNs).e("prev-btn")) 27105 }, [ 27106 vue.createElementVNode("button", { 27107 type: "button", 27108 "aria-label": vue.unref(t)(`el.datepicker.prevYear`), 27109 class: vue.normalizeClass(["d-arrow-left", vue.unref(ppNs).e("icon-btn")]), 27110 onClick: _cache[2] || (_cache[2] = ($event) => moveByYear(false)) 27111 }, [ 27112 vue.createVNode(vue.unref(ElIcon), null, { 27113 default: vue.withCtx(() => [ 27114 vue.createVNode(vue.unref(d_arrow_left_default)) 27115 ]), 27116 _: 1 27117 }) 27118 ], 10, _hoisted_2$q), 27119 vue.withDirectives(vue.createElementVNode("button", { 27120 type: "button", 27121 "aria-label": vue.unref(t)(`el.datepicker.prevMonth`), 27122 class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-left"]), 27123 onClick: _cache[3] || (_cache[3] = ($event) => moveByMonth(false)) 27124 }, [ 27125 vue.createVNode(vue.unref(ElIcon), null, { 27126 default: vue.withCtx(() => [ 27127 vue.createVNode(vue.unref(arrow_left_default)) 27128 ]), 27129 _: 1 27130 }) 27131 ], 10, _hoisted_3$d), [ 27132 [vue.vShow, currentView.value === "date"] 27133 ]) 27134 ], 2), 27135 vue.createElementVNode("span", { 27136 role: "button", 27137 class: vue.normalizeClass(vue.unref(dpNs).e("header-label")), 27138 "aria-live": "polite", 27139 tabindex: "0", 27140 onKeydown: _cache[4] || (_cache[4] = vue.withKeys(($event) => showPicker("year"), ["enter"])), 27141 onClick: _cache[5] || (_cache[5] = ($event) => showPicker("year")) 27142 }, vue.toDisplayString(vue.unref(yearLabel)), 35), 27143 vue.withDirectives(vue.createElementVNode("span", { 27144 role: "button", 27145 "aria-live": "polite", 27146 tabindex: "0", 27147 class: vue.normalizeClass([ 27148 vue.unref(dpNs).e("header-label"), 27149 { active: currentView.value === "month" } 27150 ]), 27151 onKeydown: _cache[6] || (_cache[6] = vue.withKeys(($event) => showPicker("month"), ["enter"])), 27152 onClick: _cache[7] || (_cache[7] = ($event) => showPicker("month")) 27153 }, vue.toDisplayString(vue.unref(t)(`el.datepicker.month${vue.unref(month) + 1}`)), 35), [ 27154 [vue.vShow, currentView.value === "date"] 27155 ]), 27156 vue.createElementVNode("span", { 27157 class: vue.normalizeClass(vue.unref(dpNs).e("next-btn")) 27158 }, [ 27159 vue.withDirectives(vue.createElementVNode("button", { 27160 type: "button", 27161 "aria-label": vue.unref(t)(`el.datepicker.nextMonth`), 27162 class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-right"]), 27163 onClick: _cache[8] || (_cache[8] = ($event) => moveByMonth(true)) 27164 }, [ 27165 vue.createVNode(vue.unref(ElIcon), null, { 27166 default: vue.withCtx(() => [ 27167 vue.createVNode(vue.unref(arrow_right_default)) 27168 ]), 27169 _: 1 27170 }) 27171 ], 10, _hoisted_4$9), [ 27172 [vue.vShow, currentView.value === "date"] 27173 ]), 27174 vue.createElementVNode("button", { 27175 type: "button", 27176 "aria-label": vue.unref(t)(`el.datepicker.nextYear`), 27177 class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]), 27178 onClick: _cache[9] || (_cache[9] = ($event) => moveByYear(true)) 27179 }, [ 27180 vue.createVNode(vue.unref(ElIcon), null, { 27181 default: vue.withCtx(() => [ 27182 vue.createVNode(vue.unref(d_arrow_right_default)) 27183 ]), 27184 _: 1 27185 }) 27186 ], 10, _hoisted_5$7) 27187 ], 2) 27188 ], 2), [ 27189 [vue.vShow, currentView.value !== "time"] 27190 ]), 27191 vue.createElementVNode("div", { 27192 class: vue.normalizeClass(vue.unref(ppNs).e("content")), 27193 onKeydown: handleKeydownTable 27194 }, [ 27195 currentView.value === "date" ? (vue.openBlock(), vue.createBlock(DateTable, { 27196 key: 0, 27197 ref_key: "currentViewRef", 27198 ref: currentViewRef, 27199 "selection-mode": vue.unref(selectionMode), 27200 date: innerDate.value, 27201 "parsed-value": _ctx.parsedValue, 27202 "disabled-date": vue.unref(disabledDate), 27203 "cell-class-name": vue.unref(cellClassName), 27204 onPick: handleDatePick 27205 }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "cell-class-name"])) : vue.createCommentVNode("v-if", true), 27206 currentView.value === "year" ? (vue.openBlock(), vue.createBlock(YearTable, { 27207 key: 1, 27208 ref_key: "currentViewRef", 27209 ref: currentViewRef, 27210 date: innerDate.value, 27211 "disabled-date": vue.unref(disabledDate), 27212 "parsed-value": _ctx.parsedValue, 27213 onPick: handleYearPick 27214 }, null, 8, ["date", "disabled-date", "parsed-value"])) : vue.createCommentVNode("v-if", true), 27215 currentView.value === "month" ? (vue.openBlock(), vue.createBlock(MonthTable, { 27216 key: 2, 27217 ref_key: "currentViewRef", 27218 ref: currentViewRef, 27219 date: innerDate.value, 27220 "parsed-value": _ctx.parsedValue, 27221 "disabled-date": vue.unref(disabledDate), 27222 onPick: handleMonthPick 27223 }, null, 8, ["date", "parsed-value", "disabled-date"])) : vue.createCommentVNode("v-if", true) 27224 ], 34) 27225 ], 2) 27226 ], 2), 27227 vue.withDirectives(vue.createElementVNode("div", { 27228 class: vue.normalizeClass(vue.unref(ppNs).e("footer")) 27229 }, [ 27230 vue.withDirectives(vue.createVNode(vue.unref(ElButton), { 27231 text: "", 27232 size: "small", 27233 class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")), 27234 onClick: changeToNow 27235 }, { 27236 default: vue.withCtx(() => [ 27237 vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.now")), 1) 27238 ]), 27239 _: 1 27240 }, 8, ["class"]), [ 27241 [vue.vShow, vue.unref(selectionMode) !== "dates"] 27242 ]), 27243 vue.createVNode(vue.unref(ElButton), { 27244 plain: "", 27245 size: "small", 27246 class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")), 27247 onClick: onConfirm 27248 }, { 27249 default: vue.withCtx(() => [ 27250 vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 1
27250) 27251 ]), 27252 _: 1 27253 }, 8, ["class"]) 27254 ], 2), [ 27255 [vue.vShow, vue.unref(footerVisible) && currentView.value === "date"] 27256 ]) 27257 ], 2); 27258 }; 27259 } 27260 }); 27261 var DatePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1i, [["__file", "panel-date-pick.vue"]]); 27262 27263 const panelDateRangeProps = buildProps({ 27264 ...panelSharedProps, 27265 ...panelRangeSharedProps 27266 }); 27267 27268 const useShortcut = (lang) => { 27269 const { emit } = vue.getCurrentInstance(); 27270 const attrs = vue.useAttrs(); 27271 const slots = vue.useSlots(); 27272 const handleShortcutClick = (shortcut) => { 27273 const shortcutValues = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value; 27274 if (shortcutValues) { 27275 emit("pick", [ 27276 dayjs(shortcutValues[0]).locale(lang.value), 27277 dayjs(shortcutValues[1]).locale(lang.value) 27278 ]); 27279 return; 27280 } 27281 if (shortcut.onClick) { 27282 shortcut.onClick({ 27283 attrs, 27284 slots, 27285 emit 27286 }); 27287 } 27288 }; 27289 return handleShortcutClick; 27290 }; 27291 27292 const useRangePicker = (props, { 27293 defaultValue, 27294 leftDate, 27295 rightDate, 27296 unit, 27297 onParsedValueChanged 27298 }) => { 27299 const { emit } = vue.getCurrentInstance(); 27300 const { pickerNs } = vue.inject(ROOT_PICKER_INJECTION_KEY); 27301 const drpNs = useNamespace("date-range-picker"); 27302 const { t, lang } = useLocale(); 27303 const handleShortcutClick = useShortcut(lang); 27304 const minDate = vue.ref(); 27305 const maxDate = vue.ref(); 27306 const rangeState = vue.ref({ 27307 endDate: null, 27308 selecting: false 27309 }); 27310 const handleChangeRange = (val) => { 27311 rangeState.value = val; 27312 }; 27313 const handleRangeConfirm = (visible = false) => { 27314 const _minDate = vue.unref(minDate); 27315 const _maxDate = vue.unref(maxDate); 27316 if (isValidRange([_minDate, _maxDate])) { 27317 emit("pick", [_minDate, _maxDate], visible); 27318 } 27319 }; 27320 const onSelect = (selecting) => { 27321 rangeState.value.selecting = selecting; 27322 if (!selecting) { 27323 rangeState.value.endDate = null; 27324 } 27325 }; 27326 const restoreDefault = () => { 27327 const [start, end] = getDefaultValue(vue.unref(defaultValue), { 27328 lang: vue.unref(lang), 27329 unit, 27330 unlinkPanels: props.unlinkPanels 27331 }); 27332 minDate.value = void 0; 27333 maxDate.value = void 0; 27334 leftDate.value = start; 27335 rightDate.value = end; 27336 }; 27337 vue.watch(defaultValue, (val) => { 27338 if (val) { 27339 restoreDefault(); 27340 } 27341 }, { immediate: true }); 27342 vue.watch(() => props.parsedValue, (parsedValue) => { 27343 if (isArray$1(parsedValue) && parsedValue.length === 2) { 27344 const [start, end] = parsedValue; 27345 minDate.value = start; 27346 leftDate.value = start; 27347 maxDate.value = end; 27348 onParsedValueChanged(vue.unref(minDate), vue.unref(maxDate)); 27349 } else { 27350 restoreDefault(); 27351 } 27352 }, { immediate: true }); 27353 return { 27354 minDate, 27355 maxDate, 27356 rangeState, 27357 lang, 27358 ppNs: pickerNs, 27359 drpNs, 27360 handleChangeRange, 27361 handleRangeConfirm, 27362 handleShortcutClick, 27363 onSelect, 27364 t 27365 }; 27366 }; 27367 27368 const _hoisted_1$E = ["onClick"]; 27369 const _hoisted_2$p = ["disabled"]; 27370 const _hoisted_3$c = ["disabled"]; 27371 const _hoisted_4$8 = ["disabled"]; 27372 const _hoisted_5$6 = ["disabled"]; 27373 const unit$1 = "month"; 27374 const _sfc_main$1h = /* @__PURE__ */ vue.defineComponent({ 27375 __name: "panel-date-range", 27376 props: panelDateRangeProps, 27377 emits: [ 27378 "pick", 27379 "set-picker-option", 27380 "calendar-change", 27381 "panel-change" 27382 ], 27383 setup(__props, { emit }) { 27384 const props = __props; 27385 const pickerBase = vue.inject("EP_PICKER_BASE"); 27386 const { 27387 disabledDate, 27388 cellClassName, 27389 format, 27390 defaultTime, 27391 arrowControl, 27392 clearable 27393 } = pickerBase.props; 27394 const shortcuts = vue.toRef(pickerBase.props, "shortcuts"); 27395 const defaultValue = vue.toRef(pickerBase.props, "defaultValue"); 27396 const { lang } = useLocale(); 27397 const leftDate = vue.ref(dayjs().locale(lang.value)); 27398 const rightDate = vue.ref(dayjs().locale(lang.value).add(1, unit$1)); 27399 const { 27400 minDate, 27401 maxDate, 27402 rangeState, 27403 ppNs, 27404 drpNs, 27405 handleChangeRange, 27406 handleRangeConfirm, 27407 handleShortcutClick, 27408 onSelect, 27409 t 27410 } = useRangePicker(props, { 27411 defaultValue, 27412 leftDate, 27413 rightDate, 27414 unit: unit$1, 27415 onParsedValueChanged 27416 }); 27417 const dateUserInput = vue.ref({ 27418 min: null, 27419 max: null 27420 }); 27421 const timeUserInput = vue.ref({ 27422 min: null, 27423 max: null 27424 }); 27425 const leftLabel = vue.computed(() => { 27426 return `${leftDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${leftDate.value.month() + 1}`)}`; 27427 }); 27428 const rightLabel = vue.computed(() => { 27429 return `${rightDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${rightDate.value.month() + 1}`)}`; 27430 }); 27431 const leftYear = vue.computed(() => { 27432 return leftDate.value.year(); 27433 }); 27434 const leftMonth = vue.computed(() => { 27435 return leftDate.value.month(); 27436 }); 27437 const rightYear = vue.computed(() => { 27438 return rightDate.value.year(); 27439 }); 27440 const rightMonth = vue.computed(() => { 27441 return rightDate.value.month(); 27442 }); 27443 const hasShortcuts = vue.computed(() => !!shortcuts.value.length); 27444 const minVisibleDate = vue.computed(() => { 27445 if (dateUserInput.value.min !== null) 27446 return dateUserInput.value.min; 27447 if (minDate.value) 27448 return minDate.value.format(dateFormat.value); 27449 return ""; 27450 }); 27451 const maxVisibleDate = vue.computed(() => { 27452 if (dateUserInput.value.max !== null) 27453 return dateUserInput.value.max; 27454 if (maxDate.value || minDate.value) 27455 return (maxDate.value || minDate.value).format(dateFormat.value); 27456 return ""; 27457 }); 27458 const minVisibleTime = vue.computed(() => { 27459 if (timeUserInput.value.min !== null) 27460 return timeUserInput.value.min; 27461 if (minDate.value) 27462 return minDate.value.format(timeFormat.value); 27463 return ""; 27464 }); 27465 const maxVisibleTime = vue.computed(() => { 27466 if (timeUserInput.value.max !== null) 27467 return timeUserInput.value.max; 27468 if (maxDate.value || minDate.value) 27469 return (maxDate.value || minDate.value).format(timeFormat.value); 27470 return ""; 27471 }); 27472 const timeFormat = vue.computed(() => { 27473 return extractTimeFormat(format); 27474 }); 27475 const dateFormat = vue.computed(() => { 27476 return extractDateFormat(format); 27477 }); 27478 const leftPrevYear = () => { 27479 leftDate.value = leftDate.value.subtract(1, "year"); 27480 if (!props.unlinkPanels) { 27481 rightDate.value = leftDate.value.add(1, "month"); 27482 } 27483 handlePanelChange("year"); 27484 }; 27485 const leftPrevMonth = () => { 27486 leftDate.value = leftDate.value.subtract(1, "month"); 27487 if (!props.unlinkPanels) { 27488 rightDate.value = leftDate.value.add(1, "month"); 27489 } 27490 handlePanelChange("month"); 27491 }; 27492 const rightNextYear = () => { 27493 if (!props.unlinkPanels) { 27494 leftDate.value = leftDate.value.add(1, "year"); 27495 rightDate.value = leftDate.value.add(1, "month"); 27496 } else { 27497 rightDate.value = rightDate.value.add(1, "year"); 27498 } 27499 handlePanelChange("year"); 27500 }; 27501 const rightNextMonth = () => { 27502 if (!props.unlinkPanels) { 27503 leftDate.value = leftDate.value.add(1, "month"); 27504 rightDate.value = leftDate.value.add(1, "month"); 27505 } else { 27506 rightDate.value = rightDate.value.add(1, "month"); 27507 } 27508 handlePanelChange("month"); 27509 }; 27510 const leftNextYear = () => { 27511 leftDate.value = leftDate.value.add(1, "year"); 27512 handlePanelChange("year"); 27513 }; 27514 const leftNextMonth = () => { 27515 leftDate.value = leftDate.value.add(1, "month"); 27516 handlePanelChange("month"); 27517 }; 27518 const rightPrevYear = () => { 27519 rightDate.value = rightDate.value.subtract(1, "year"); 27520 handlePanelChange("year"); 27521 }; 27522 const rightPrevMonth = () => { 27523 rightDate.value = rightDate.value.subtract(1, "month"); 27524 handlePanelChange("month"); 27525 }; 27526 const handlePanelChange = (mode) => { 27527 emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode); 27528 }; 27529 const enableMonthArrow = vue.computed(() => { 27530 const nextMonth = (leftMonth.value + 1) % 12; 27531 const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0; 27532 return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value); 27533 }); 27534 const enableYearArrow = vue.computed(() => { 27535 return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12; 27536 }); 27537 const btnDisabled = vue.computed(() => { 27538 return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidRange([minDate.value, maxDate.value])); 27539 }); 27540 const showTime = vue.computed(() => props.type === "datetime" || props.type === "datetimerange"); 27541 const formatEmit = (emitDayjs, index) => { 27542 if (!emitDayjs) 27543 return; 27544 if (defaultTime) { 27545 const defaultTimeD = dayjs(defaultTime[index] || defaultTime).locale(lang.value); 27546 return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date()); 27547 } 27548 return emitDayjs; 27549 }; 27550 const handleRangePick = (val, close = true) => { 27551 const min_ = val.minDate; 27552 const max_ = val.maxDate; 27553 const minDate_ = formatEmit(min_, 0); 27554 const maxDate_ = formatEmit(max_, 1); 27555 if (maxDate.value === maxDate_ && minDate.value === minDate_) { 27556 return; 27557 } 27558 emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]); 27559 maxDate.value = maxDate_; 27560 minDate.value = minDate_; 27561 if (!close || showTime.value) 27562 return; 27563 handleRangeConfirm(); 27564 }; 27565 const minTimePickerVisible = vue.ref(false); 27566 const maxTimePickerVisible = vue.ref(false); 27567 const handleMinTimeClose = () => { 27568 minTimePickerVisible.value = false; 27569 }; 27570 const handleMaxTimeClose = () => { 27571 maxTimePickerVisible.value = false; 27572 }; 27573 const handleDateInput = (value, type) => { 27574 dateUserInput.value[type] = value; 27575 const parsedValueD = dayjs(value, dateFormat.value).locale(lang.value); 27576 if (parsedValueD.isValid()) { 27577 if (disabledDate && disabledDate(parsedValueD.toDate())) { 27578 return; 27579 } 27580 if (type === "min") { 27581 leftDate.value = parsedValueD; 27582 minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date()); 27583 if (!props.unlinkPanels) { 27584 rightDate.value = parsedValueD.add(1, "month"); 27585 maxDate.value = minDate.value.add(1, "month"); 27586 } 27587 } else { 27588 rightDate.value = parsedValueD; 27589 maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date()); 27590 if (!props.unlinkPanels) { 27591 leftDate.value = parsedValueD.subtract(1, "month"); 27592 minDate.value = maxDate.value.subtract(1, "month"); 27593 } 27594 } 27595 } 27596 }; 27597 const handleDateChange = (_, type) => { 27598 dateUserInput.value[type] = null; 27599 }; 27600 const handleTimeInput = (value, type) => { 27601 timeUserInput.value[type] = value; 27602 const parsedValueD = dayjs(value, timeFormat.value).locale(lang.value); 27603 if (parsedValueD.isValid()) { 27604 if (type === "min") { 27605 minTimePickerVisible.value = true; 27606 minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second()); 27607 if (!maxDate.value || maxDate.value.isBefore(minDate.value)) { 27608 maxDate.value = minDate.value; 27609 } 27610 } else { 27611 maxTimePickerVisible.value = true; 27612 maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second()); 27613 rightDate.value = maxDate.value; 27614 if (maxDate.value && maxDate.value.isBefore(minDate.value)) { 27615 minDate.value = maxDate.value; 27616 } 27617 } 27618 } 27619 }; 27620 const handleTimeChange = (value, type) => { 27621 timeUserInput.value[type] = null; 27622 if (type === "min") { 27623 leftDate.value = minDate.value; 27624 minTimePickerVisible.value = false; 27625 } else { 27626 rightDate.value = maxDate.value; 27627 maxTimePickerVisible.value = false; 27628 } 27629 }; 27630 const handleMinTimePick = (value, visible, first) => { 27631 if (timeUserInput.value.min) 27632 return; 27633 if (value) { 27634 leftDate.value = value; 27635 minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second()); 27636 } 27637 if (!first) { 27638 minTimePickerVisible.value = visible; 27639 } 27640 if (!maxDate.value || maxDate.value.isBefore(minDate.value)) { 27641 maxDate.value = minDate.value; 27642 rightDate.value = value; 27643 } 27644 }; 27645 const handleMaxTimePick = (value, visible, first) => { 27646 if (timeUserInput.value.max) 27647 return; 27648 if (value) { 27649 rightDate.value = value; 27650 maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second()); 27651 } 27652 if (!first) { 27653 maxTimePickerVisible.value = visible; 27654 } 27655 if (maxDate.value && maxDate.value.isBefore(minDate.value)) { 27656 minDate.value = maxDate.value; 27657 } 27658 }; 27659 const handleClear = () => { 27660 leftDate.value = getDefaultValue(vue.unref(defaultValue), { 27661 lang: vue.unref(lang), 27662 unit: "month", 27663 unlinkPanels: props.unlinkPanels 27664 })[0]; 27665 rightDate.value = leftDate.value.add(1, "month"); 27666 emit("pick", null); 27667 }; 27668 const formatToString = (value) => { 27669 return isArray$1(value) ? value.map((_) => _.format(format)) : value.format(format); 27670 }; 27671 const parseUserInput = (value) => { 27672 return isArray$1(value) ? value.map((_) => dayjs(_, format).locale(lang.value)) : dayjs(value, format).locale(lang.value); 27673 }; 27674 function onParsedValueChanged(minDate2, maxDate2) { 27675 if (props.unlinkPanels && maxDate2) { 27676 const minDateYear = (minDate2 == null ? void 0 : minDate2.ye
27676ar()) || 0; 27677 const minDateMonth = (minDate2 == null ? void 0 : minDate2.month()) || 0; 27678 const maxDateYear = maxDate2.year(); 27679 const maxDateMonth = maxDate2.month(); 27680 rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate2.add(1, unit$1) : maxDate2; 27681 } else { 27682 rightDate.value = leftDate.value.add(1, unit$1); 27683 if (maxDate2) { 27684 rightDate.value = rightDate.value.hour(maxDate2.hour()).minute(maxDate2.minute()).second(maxDate2.second()); 27685 } 27686 } 27687 } 27688 emit("set-picker-option", ["isValidValue", isValidRange]); 27689 emit("set-picker-option", ["parseUserInput", parseUserInput]); 27690 emit("set-picker-option", ["formatToString", formatToString]); 27691 emit("set-picker-option", ["handleClear", handleClear]); 27692 return (_ctx, _cache) => { 27693 return vue.openBlock(), vue.createElementBlock("div", { 27694 class: vue.normalizeClass([ 27695 vue.unref(ppNs).b(), 27696 vue.unref(drpNs).b(), 27697 { 27698 "has-sidebar": _ctx.$slots.sidebar || vue.unref(hasShortcuts), 27699 "has-time": vue.unref(showTime) 27700 } 27701 ]) 27702 }, [ 27703 vue.createElementVNode("div", { 27704 class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper")) 27705 }, [ 27706 vue.renderSlot(_ctx.$slots, "sidebar", { 27707 class: vue.normalizeClass(vue.unref(ppNs).e("sidebar")) 27708 }), 27709 vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", { 27710 key: 0, 27711 class: vue.normalizeClass(vue.unref(ppNs).e("sidebar")) 27712 }, [ 27713 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => { 27714 return vue.openBlock(), vue.createElementBlock("button", { 27715 key, 27716 type: "button", 27717 class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")), 27718 onClick: ($event) => vue.unref(handleShortcutClick)(shortcut) 27719 }, vue.toDisplayString(shortcut.text), 11, _hoisted_1$E); 27720 }), 128)) 27721 ], 2)) : vue.createCommentVNode("v-if", true), 27722 vue.createElementVNode("div", { 27723 class: vue.normalizeClass(vue.unref(ppNs).e("body")) 27724 }, [ 27725 vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", { 27726 key: 0, 27727 class: vue.normalizeClass(vue.unref(drpNs).e("time-header")) 27728 }, [ 27729 vue.createElementVNode("span", { 27730 class: vue.normalizeClass(vue.unref(drpNs).e("editors-wrap")) 27731 }, [ 27732 vue.createElementVNode("span", { 27733 class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap")) 27734 }, [ 27735 vue.createVNode(vue.unref(ElInput), { 27736 size: "small", 27737 disabled: vue.unref(rangeState).selecting, 27738 placeholder: vue.unref(t)("el.datepicker.startDate"), 27739 class: vue.normalizeClass(vue.unref(drpNs).e("editor")), 27740 "model-value": vue.unref(minVisibleDate), 27741 "validate-event": false, 27742 onInput: _cache[0] || (_cache[0] = (val) => handleDateInput(val, "min")), 27743 onChange: _cache[1] || (_cache[1] = (val) => handleDateChange(val, "min")) 27744 }, null, 8, ["disabled", "placeholder", "class", "model-value"]) 27745 ], 2), 27746 vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", { 27747 class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap")) 27748 }, [ 27749 vue.createVNode(vue.unref(ElInput), { 27750 size: "small", 27751 class: vue.normalizeClass(vue.unref(drpNs).e("editor")), 27752 disabled: vue.unref(rangeState).selecting, 27753 placeholder: vue.unref(t)("el.datepicker.startTime"), 27754 "model-value": vue.unref(minVisibleTime), 27755 "validate-event": false, 27756 onFocus: _cache[2] || (_cache[2] = ($event) => minTimePickerVisible.value = true), 27757 onInput: _cache[3] || (_cache[3] = (val) => handleTimeInput(val, "min")), 27758 onChange: _cache[4] || (_cache[4] = (val) => handleTimeChange(val, "min")) 27759 }, null, 8, ["class", "disabled", "placeholder", "model-value"]), 27760 vue.createVNode(vue.unref(TimePickPanel), { 27761 visible: minTimePickerVisible.value, 27762 format: vue.unref(timeFormat), 27763 "datetime-role": "start", 27764 "time-arrow-control": vue.unref(arrowControl), 27765 "parsed-value": leftDate.value, 27766 onPick: handleMinTimePick 27767 }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value"]) 27768 ], 2)), [ 27769 [vue.unref(ClickOutside), handleMinTimeClose] 27770 ]) 27771 ], 2), 27772 vue.createElementVNode("span", null, [ 27773 vue.createVNode(vue.unref(ElIcon), null, { 27774 default: vue.withCtx(() => [ 27775 vue.createVNode(vue.unref(arrow_right_default)) 27776 ]), 27777 _: 1 27778 }) 27779 ]), 27780 vue.createElementVNode("span", { 27781 class: vue.normalizeClass([vue.unref(drpNs).e("editors-wrap"), "is-right"]) 27782 }, [ 27783 vue.createElementVNode("span", { 27784 class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap")) 27785 }, [ 27786 vue.createVNode(vue.unref(ElInput), { 27787 size: "small", 27788 class: vue.normalizeClass(vue.unref(drpNs).e("editor")), 27789 disabled: vue.unref(rangeState).selecting, 27790 placeholder: vue.unref(t)("el.datepicker.endDate"), 27791 "model-value": vue.unref(maxVisibleDate), 27792 readonly: !vue.unref(minDate), 27793 "validate-event": false, 27794 onInput: _cache[5] || (_cache[5] = (val) => handleDateInput(val, "max")), 27795 onChange: _cache[6] || (_cache[6] = (val) => handleDateChange(val, "max")) 27796 }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly"]) 27797 ], 2), 27798 vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", { 27799 class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap")) 27800 }, [ 27801 vue.createVNode(vue.unref(ElInput), { 27802 size: "small", 27803 class: vue.normalizeClass(vue.unref(drpNs).e("editor")), 27804 disabled: vue.unref(rangeState).selecting, 27805 placeholder: vue.unref(t)("el.datepicker.endTime"), 27806 "model-value": vue.unref(maxVisibleTime), 27807 readonly: !vue.unref(minDate), 27808 "validate-event": false, 27809 onFocus: _cache[7] || (_cache[7] = ($event) => vue.unref(minDate) && (maxTimePickerVisible.value = true)), 27810 onInput: _cache[8] || (_cache[8] = (val) => handleTimeInput(val, "max")), 27811 onChange: _cache[9] || (_cache[9] = (val) => handleTimeChange(val, "max")) 27812 }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly"]), 27813 vue.createVNode(vue.unref(TimePickPanel), { 27814 "datetime-role": "end", 27815 visible: maxTimePickerVisible.value, 27816 format: vue.unref(timeFormat), 27817 "time-arrow-control": vue.unref(arrowControl), 27818 "parsed-value": rightDate.value, 27819 onPick: handleMaxTimePick 27820 }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value"]) 27821 ], 2)), [ 27822 [vue.unref(ClickOutside), handleMaxTimeClose] 27823 ]) 27824 ], 2) 27825 ], 2)) : vue.createCommentVNode("v-if", true), 27826 vue.createElementVNode("div", { 27827 class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-left"]) 27828 }, [ 27829 vue.createElementVNode("div", { 27830 class: vue.normalizeClass(vue.unref(drpNs).e("header")) 27831 }, [ 27832 vue.createElementVNode("button", { 27833 type: "button", 27834 class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-left"]), 27835 onClick: leftPrevYear 27836 }, [ 27837 vue.createVNode(vue.unref(ElIcon), null, { 27838 default: vue.withCtx(() => [ 27839 vue.createVNode(vue.unref(d_arrow_left_default)) 27840 ]), 27841 _: 1 27842 }) 27843 ], 2), 27844 vue.createElementVNode("button", { 27845 type: "button", 27846 class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-left"]), 27847 onClick: leftPrevMonth 27848 }, [ 27849 vue.createVNode(vue.unref(ElIcon), null, { 27850 default: vue.withCtx(() => [ 27851 vue.createVNode(vue.unref(arrow_left_default)) 27852 ]), 27853 _: 1 27854 }) 27855 ], 2), 27856 _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", { 27857 key: 0, 27858 type: "button", 27859 disabled: !vue.unref(enableYearArrow), 27860 class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-right"]), 27861 onClick: leftNextYear 27862 }, [ 27863 vue.createVNode(vue.unref(ElIcon), null, { 27864 default: vue.withCtx(() => [ 27865 vue.createVNode(vue.unref(d_arrow_right_default)) 27866 ]), 27867 _: 1 27868 }) 27869 ], 10, _hoisted_2$p)) : vue.createCommentVNode("v-if", true), 27870 _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", { 27871 key: 1, 27872 type: "button", 27873 disabled: !vue.unref(enableMonthArrow), 27874 class: vue.normalizeClass([[ 27875 vue.unref(ppNs).e("icon-btn"), 27876 { "is-disabled": !vue.unref(enableMonthArrow) } 27877 ], "arrow-right"]), 27878 onClick: leftNextMonth 27879 }, [ 27880 vue.createVNode(vue.unref(ElIcon), null, { 27881 default: vue.withCtx(() => [ 27882 vue.createVNode(vue.unref(arrow_right_default)) 27883 ]), 27884 _: 1 27885 }) 27886 ], 10, _hoisted_3$c)) : vue.createCommentVNode("v-if", true), 27887 vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(leftLabel)), 1) 27888 ], 2), 27889 vue.createVNode(DateTable, { 27890 "selection-mode": "range", 27891 date: leftDate.value, 27892 "min-date": vue.unref(minDate), 27893 "max-date": vue.unref(maxDate), 27894 "range-state": vue.unref(rangeState), 27895 "disabled-date": vue.unref(disabledDate), 27896 "cell-class-name": vue.unref(cellClassName), 27897 onChangerange: vue.unref(handleChangeRange), 27898 onPick: handleRangePick, 27899 onSelect: vue.unref(onSelect) 27900 }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"]) 27901 ], 2), 27902 vue.createElementVNode("div", { 27903 class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-right"]) 27904 }, [ 27905 vue.createElementVNode("div", { 27906 class: vue.normalizeClass(vue.unref(drpNs).e("header")) 27907 }, [ 27908 _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", { 27909 key: 0, 27910 type: "button", 27911 disabled: !vue.unref(enableYearArrow), 27912 class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-left"]), 27913 onClick: rightPrevYear 27914 }, [ 27915 vue.createVNode(vue.unref(ElIcon), null, { 27916 default: vue.withCtx(() => [ 27917 vue.createVNode(vue.unref(d_arrow_left_default)) 27918 ]), 27919 _: 1 27920 }) 27921 ], 10, _hoisted_4$8)) : vue.createCommentVNode("v-if", true), 27922 _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", { 27923 key: 1, 27924 type: "button", 27925 disabled: !vue.unref(enableMonthArrow), 27926 class: vue.normalizeClass([[ 27927 vue.unref(ppNs).e("icon-btn"), 27928 { "is-disabled": !vue.unref(enableMonthArrow) } 27929 ], "arrow-left"]), 27930 onClick: rightPrevMonth 27931 }, [ 27932 vue.createVNode(vue.unref(ElIcon), null, { 27933 default: vue.withCtx(() => [ 27934 vue.createVNode(vue.unref(arrow_left_default)) 27935 ]), 27936 _: 1 27937 }) 27938 ], 10, _hoisted_5$6)) : vue.createCommentVNode("v-if", true), 27939 vue.createElementVNode("button", { 27940 type: "button", 27941 class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]), 27942 onClick: rightNextYear 27943 }, [ 27944 vue.createVNode(vue.unref(ElIcon), null, { 27945 default: vue.withCtx(() => [ 27946 vue.createVNode(vue.unref(d_arrow_right_default)) 27947 ]), 27948 _: 1 27949 }) 27950 ], 2), 27951 vue.createElementVNode("button", { 27952 type: "button", 27953 class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-right"]), 27954 onClick: rightNextMonth 27955 }, [ 27956 vue.createVNode(vue.unref(ElIcon), null, { 27957 default: vue.withCtx(() => [ 27958 vue.createVNode(vue.unref(arrow_right_default)) 27959 ]), 27960 _: 1 27961 }) 27962 ], 2), 27963 vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(rightLabel)), 1) 27964 ], 2), 27965 vue.createVNode(DateTabl
27965e, { 27966 "selection-mode": "range", 27967 date: rightDate.value, 27968 "min-date": vue.unref(minDate), 27969 "max-date": vue.unref(maxDate), 27970 "range-state": vue.unref(rangeState), 27971 "disabled-date": vue.unref(disabledDate), 27972 "cell-class-name": vue.unref(cellClassName), 27973 onChangerange: vue.unref(handleChangeRange), 27974 onPick: handleRangePick, 27975 onSelect: vue.unref(onSelect) 27976 }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"]) 27977 ], 2) 27978 ], 2) 27979 ], 2), 27980 vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", { 27981 key: 0, 27982 class: vue.normalizeClass(vue.unref(ppNs).e("footer")) 27983 }, [ 27984 vue.unref(clearable) ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), { 27985 key: 0, 27986 text: "", 27987 size: "small", 27988 class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")), 27989 onClick: handleClear 27990 }, { 27991 default: vue.withCtx(() => [ 27992 vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.clear")), 1) 27993 ]), 27994 _: 1 27995 }, 8, ["class"])) : vue.createCommentVNode("v-if", true), 27996 vue.createVNode(vue.unref(ElButton), { 27997 plain: "", 27998 size: "small", 27999 class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")), 28000 disabled: vue.unref(btnDisabled), 28001 onClick: _cache[10] || (_cache[10] = ($event) => vue.unref(handleRangeConfirm)(false)) 28002 }, { 28003 default: vue.withCtx(() => [ 28004 vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 1) 28005 ]), 28006 _: 1 28007 }, 8, ["class", "disabled"]) 28008 ], 2)) : vue.createCommentVNode("v-if", true) 28009 ], 2); 28010 }; 28011 } 28012 }); 28013 var DateRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1h, [["__file", "panel-date-range.vue"]]); 28014 28015 const panelMonthRangeProps = buildProps({ 28016 ...panelRangeSharedProps 28017 }); 28018 const panelMonthRangeEmits = ["pick", "set-picker-option"]; 28019 28020 const useMonthRangeHeader = ({ 28021 unlinkPanels, 28022 leftDate, 28023 rightDate 28024 }) => { 28025 const { t } = useLocale(); 28026 const leftPrevYear = () => { 28027 leftDate.value = leftDate.value.subtract(1, "year"); 28028 if (!unlinkPanels.value) { 28029 rightDate.value = rightDate.value.subtract(1, "year"); 28030 } 28031 }; 28032 const rightNextYear = () => { 28033 if (!unlinkPanels.value) { 28034 leftDate.value = leftDate.value.add(1, "year"); 28035 } 28036 rightDate.value = rightDate.value.add(1, "year"); 28037 }; 28038 const leftNextYear = () => { 28039 leftDate.value = leftDate.value.add(1, "year"); 28040 }; 28041 const rightPrevYear = () => { 28042 rightDate.value = rightDate.value.subtract(1, "year"); 28043 }; 28044 const leftLabel = vue.computed(() => { 28045 return `${leftDate.value.year()} ${t("el.datepicker.year")}`; 28046 }); 28047 const rightLabel = vue.computed(() => { 28048 return `${rightDate.value.year()} ${t("el.datepicker.year")}`; 28049 }); 28050 const leftYear = vue.computed(() => { 28051 return leftDate.value.year(); 28052 }); 28053 const rightYear = vue.computed(() => { 28054 return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year(); 28055 }); 28056 return { 28057 leftPrevYear, 28058 rightNextYear, 28059 leftNextYear, 28060 rightPrevYear, 28061 leftLabel, 28062 rightLabel, 28063 leftYear, 28064 rightYear 28065 }; 28066 }; 28067 28068 const _hoisted_1$D = ["onClick"]; 28069 const _hoisted_2$o = ["disabled"]; 28070 const _hoisted_3$b = ["disabled"]; 28071 const unit = "year"; 28072 const __default__$R = vue.defineComponent({ 28073 name: "DatePickerMonthRange" 28074 });
28075 const _sfc_main$1g = /* @__PURE__ */ vue.defineComponent({ 28076 ...__default__$R, 28077 props: panelMonthRangeProps, 28078 emits: panelMonthRangeEmits, 28079 setup(__props, { emit }) { 28080 const props = __props; 28081 const { lang } = useLocale(); 28082 const pickerBase = vue.inject("EP_PICKER_BASE"); 28083 const { shortcuts, disabledDate, format } = pickerBase.props; 28084 const defaultValue = vue.toRef(pickerBase.props, "defaultValue"); 28085 const leftDate = vue.ref(dayjs().locale(lang.value)); 28086 const rightDate = vue.ref(dayjs().locale(lang.value).add(1, unit)); 28087 const { 28088 minDate, 28089 maxDate, 28090 rangeState, 28091 ppNs, 28092 drpNs, 28093 handleChangeRange, 28094 handleRangeConfirm, 28095 handleShortcutClick, 28096 onSelect 28097 } = useRangePicker(props, { 28098 defaultValue, 28099 leftDate, 28100 rightDate, 28101 unit, 28102 onParsedValueChanged 28103 }); 28104 const hasShortcuts = vue.computed(() => !!shortcuts.length); 28105 const { 28106 leftPrevYear, 28107 rightNextYear, 28108 leftNextYear, 28109 rightPrevYear, 28110 leftLabel, 28111 rightLabel, 28112 leftYear, 28113 rightYear 28114 } = useMonthRangeHeader({ 28115 unlinkPanels: vue.toRef(props, "unlinkPanels"), 28116 leftDate, 28117 rightDate 28118 }); 28119 const enableYearArrow = vue.computed(() => { 28120 return props.unlinkPanels && rightYear.value > leftYear.value + 1; 28121 }); 28122 const handleRangePick = (val, close = true) => { 28123 const minDate_ = val.minDate; 28124 const maxDate_ = val.maxDate; 28125 if (maxDate.value === maxDate_ && minDate.value === minDate_) { 28126 return; 28127 } 28128 maxDate.value = maxDate_; 28129 minDate.value = minDate_; 28130 if (!close) 28131 return; 28132 handleRangeConfirm(); 28133 }; 28134 const formatToString = (days) => { 28135 return days.map((day) => day.format(format)); 28136 }; 28137 function onParsedValueChanged(minDate2, maxDate2) { 28138 if (props.unlinkPanels && maxDate2) { 28139 const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0; 28140 const maxDateYear = maxDate2.year(); 28141 rightDate.value = minDateYear === maxDateYear ? maxDate2.add(1, unit) : maxDate2; 28142 } else { 28143 rightDate.value = leftDate.value.add(1, unit); 28144 } 28145 } 28146 emit("set-picker-option", ["formatToString", formatToString]); 28147 return (_ctx, _cache) => { 28148 return vue.openBlock(), vue.createElementBlock("div", { 28149 class: vue.normalizeClass([ 28150 vue.unref(ppNs).b(), 28151 vue.unref(drpNs).b(), 28152 { 28153 "has-sidebar": Boolean(_ctx.$slots.sidebar) || vue.unref(hasShortcuts) 28154 } 28155 ]) 28156 }, [ 28157 vue.createElementVNode("div", { 28158 class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper")) 28159 }, [ 28160 vue.renderSlot(_ctx.$slots, "sidebar", { 28161 class: vue.normalizeClass(vue.unref(ppNs).e("sidebar")) 28162 }), 28163 vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", { 28164 key: 0, 28165 class: vue.normalizeClass(vue.unref(ppNs).e("sidebar")) 28166 }, [ 28167 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => { 28168 return vue.openBlock(), vue.createElementBlock("button", { 28169 key, 28170 type: "button", 28171 class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")), 28172 onClick: ($event) => vue.unref(handleShortcutClick)(shortcut) 28173 }, vue.toDisplayString(shortcut.text), 11, _hoisted_1$D); 28174 }), 128)) 28175 ], 2)) : vue.createCommentVNode("v-if", true), 28176 vue.createElementVNode("div", { 28177 class: vue.normalizeClass(vue.unref(ppNs).e("body")) 28178 }, [ 28179 vue.createElementVNode("div", { 28180 class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-left"]) 28181 }, [ 28182 vue.createElementVNode("div", { 28183 class: vue.normalizeClass(vue.unref(drpNs).e("header")) 28184 }, [ 28185 vue.createElementVNode("button", { 28186 type: "button", 28187 class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-left"]), 28188 onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(leftPrevYear) && vue.unref(leftPrevYear)(...args)) 28189 }, [ 28190 vue.createVNode(vue.unref(ElIcon), null, { 28191 default: vue.withCtx(() => [ 28192 vue.createVNode(vue.unref(d_arrow_left_default)) 28193 ]), 28194 _: 1 28195 }) 28196 ], 2), 28197 _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", { 28198 key: 0, 28199 type: "button", 28200 disabled: !vue.unref(enableYearArrow), 28201 class: vue.normalizeClass([[ 28202 vue.unref(ppNs).e("icon-btn"), 28203 { [vue.unref(ppNs).is("disabled")]: !vue.unref(enableYearArrow) } 28204 ], "d-arrow-right"]), 28205 onClick: _cache[1] || (_cache[1] = (...args) => vue.unref(leftNextYear) && vue.unref(leftNextYear)(...args)) 28206 }, [ 28207 vue.createVNode(vue.unref(ElIcon), null, { 28208 default: vue.withCtx(() => [ 28209 vue.createVNode(vue.unref(d_arrow_right_default)) 28210 ]), 28211 _: 1 28212 }) 28213 ], 10, _hoisted_2$o)) : vue.createCommentVNode("v-if", true), 28214 vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(leftLabel)), 1) 28215 ], 2), 28216 vue.createVNode(MonthTable, { 28217 "selection-mode": "range", 28218 date: leftDate.value, 28219 "min-date": vue.unref(minDate), 28220 "max-date": vue.unref(maxDate), 28221 "range-state": vue.unref(rangeState), 28222 "disabled-date": vue.unref(disabledDate), 28223 onChangerange: vue.unref(handleChangeRange), 28224 onPick: handleRangePick, 28225 onSelect: vue.unref(onSelect) 28226 }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"]) 28227 ], 2), 28228 vue.createElementVNode("div", { 28229 class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-right"]) 28230 }, [ 28231 vue.createElementVNode("div", { 28232 class: vue.normalizeClass(vue.unref(drpNs).e("header")) 28233 }, [ 28234 _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", { 28235 key: 0, 28236 type: "button", 28237 disabled: !vue.unref(enableYearArrow), 28238 class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-left"]), 28239 onClick: _cache[2] || (_cache[2] = (...args) => vue.unref(rightPrevYear) && vue.unref(rightPrevYear)(...args)) 28240 }, [ 28241 vue.createVNode(vue.unref(ElIcon), null, { 28242 default: vue.withCtx(() => [ 28243 vue.createVNode(vue.unref(d_arrow_left_default)) 28244 ]), 28245 _: 1 28246 }) 28247 ], 10, _hoisted_3$b)) : vue.createCommentVNode("v-if", true), 28248 vue.createElementVNode("button", { 28249 type: "button", 28250 class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]), 28251 onClick: _cache[3] || (_cache[3] = (...args) => vue.unref(rightNextYear) && vue.unref(rightNextYear)(...args)) 28252 }, [ 28253 vue.createVNode(vue.unref(ElIcon), null, { 28254 default: vue.withCtx(() => [ 28255 vue.createVNode(vue.unref(d_arrow_right_default)) 28256 ]), 28257 _: 1 28258 }) 28259 ], 2), 28260 vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(rightLabel)), 1) 28261 ], 2), 28262 vue.createVNode(MonthTable, { 28263 "selection-mode": "range", 28264 date: rightDate.value, 28265 "min-date": vue.unref(minDate), 28266 "max-date": vue.unref(maxDate), 28267 "range-state": vue.unref(rangeState), 28268 "disabled-date": vue.unref(disabledDate), 28269 onChangerange: vue.unref(handleChangeRange), 28270 onPick: handleRangePick, 28271 onSelect: vue.unref(onSelect) 28272 }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"]) 28273 ], 2) 28274 ], 2) 28275 ], 2) 28276 ], 2); 28277 }; 28278 } 28279 });
28280 var MonthRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1g, [["__file", "panel-month-range.vue"]]); 28281 28282 const getPanel = function(type) { 28283 switch (type) { 28284 case "daterange": 28285 case "datetimerange": { 28286 return DateRangePickPanel; 28287 } 28288 case "monthrange": { 28289 return MonthRangePickPanel; 28290 } 28291 default: { 28292 return DatePickPanel; 28293 } 28294 } 28295 }; 28296 28297 dayjs.extend(localeData); 28298 dayjs.extend(advancedFormat); 28299 dayjs.extend(customParseFormat); 28300 dayjs.extend(weekOfYear); 28301 dayjs.extend(weekYear); 28302 dayjs.extend(dayOfYear); 28303 dayjs.extend(isSameOrAfter); 28304 dayjs.extend(isSameOrBefore); 28305 var DatePicker = vue.defineComponent({ 28306 name: "ElDatePicker", 28307 install: null, 28308 props: datePickerProps, 28309 emits: ["update:modelValue"], 28310 setup(props, { 28311 expose, 28312 emit, 28313 slots 28314 }) { 28315 const ns = useNamespace("picker-panel"); 28316 vue.provide("ElPopperOptions", vue.reactive(vue.toRef(props, "popperOptions"))); 28317 vue.provide(ROOT_PICKER_INJECTION_KEY, { 28318 slots, 28319 pickerNs: ns 28320 }); 28321 const commonPicker = vue.ref(); 28322 const refProps = { 28323 focus: (focusStartInput = true) => { 28324 var _a; 28325 (_a = commonPicker.value) == null ? void 0 : _a.focus(focusStartInput); 28326 }, 28327 handleOpen: () => { 28328 var _a; 28329 (_a = commonPicker.value) == null ? void 0 : _a.handleOpen(); 28330 }, 28331 handleClose: () => { 28332 var _a; 28333 (_a = commonPicker.value) == null ? void 0 : _a.handleClose(); 28334 } 28335 }; 28336 expose(refProps); 28337 const onModelValueUpdated = (val) => { 28338 emit("update:modelValue", val); 28339 }; 28340 return () => { 28341 var _a; 28342 const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE; 28343 const Component = getPanel(props.type); 28344 return vue.createVNode(CommonPicker, vue.mergeProps(props, { 28345 "format": format, 28346 "type": props.type, 28347 "ref": commonPicker, 28348 "onUpdate:modelValue": onModelValueUpdated 28349 }), { 28350 default: (scopedProps) => vue.createVNode(Component, scopedProps, null), 28351 "range-separator": slots["range-separator"] 28352 }); 28353 }; 28354 } 28355 }); 28356 28357 const _DatePicker = DatePicker; 28358 _DatePicker.install = (app) => { 28359 app.component(_DatePicker.name, _DatePicker); 28360 }; 28361 const ElDatePicker = _DatePicker; 28362 28363 const descriptionsKey = Symbol("elDescriptions"); 28364 28365 var ElDescriptionsCell = vue.defineComponent({ 28366 name: "ElDescriptionsCell", 28367 props: { 28368 cell: { 28369 type: Object 28370 }, 28371 tag: { 28372 type: String 28373 }, 28374 type: { 28375 type: String 28376 } 28377 }, 28378 setup() { 28379 const descriptions = vue.inject(descriptionsKey, {}); 28380 return { 28381 descriptions 28382 }; 28383 }, 28384 render() { 28385 var _a, _b, _c, _d, _e, _f; 28386 const item = getNormalizedProps(this.cell); 28387 const { border, direction } = this.descriptions; 28388 const isVertical = direction === "vertical"; 28389 const label = ((_c = (_b = (_a = this.cell) == null ? void 0 : _a.children) == null ? void 0 : _b.label) == null ? void 0 : _c.call(_b)) || item.label; 28390 const content = (_f = (_e = (_d = this.cell) == null ? void 0 : _d.children) == null ? void 0 : _e.default) == null ? void 0 : _f.call(_e); 28391 const span = item.span; 28392 const align = item.align ? `is-${item.align}` : ""; 28393 const labelAlign = item.labelAlign ? `is-${item.labelAlign}` : align; 28394 const className = item.className; 28395 const labelClassName = item.labelClassName; 28396 const style = { 28397 width: addUnit(item.width), 28398 minWidth: addUnit(item.minWidth) 28399 }; 28400 const ns = useNamespace("descriptions"); 28401 switch (this.type) { 28402 case "label": 28403 return vue.h(this.tag, { 28404 style, 28405 class: [ 28406 ns.e("cell"), 28407 ns.e("label"), 28408 ns.is("bordered-label", border), 28409 ns.is("vertical-label", isVertical), 28410 labelAlign, 28411 labelClassName 28412 ], 28413 colSpan: isVertical ? span : 1 28414 }, label); 28415 case "content": 28416 return vue.h(this.tag, { 28417 style, 28418 class: [ 28419 ns.e("cell"), 28420 ns.e("content"), 28421 ns.is("bordered-content", border), 28422 ns.is("vertical-content", isVertical), 28423 align, 28424 className 28425 ], 28426 colSpan: isVertical ? span : span * 2 - 1 28427 }, content); 28428 default: 28429 return vue.h("td", { 28430 style, 28431 class: [ns.e("cell"), align], 28432 colSpan: span 28433 }, [ 28434 !isNil(label) ? vue.h("span", { 28435 class: [ns.e("label"), labelClassName] 28436 }, label) : void 0, 28437 vue.h("span", { 28438 class: [ns.e("content"), className] 28439 }, content) 28440 ]); 28441 } 28442 } 28443 });
28444 28445 const descriptionsRowProps = buildProps({ 28446 row: { 28447 type: Array, 28448 default: () => [] 28449 } 28450 }); 28451 28452 const _hoisted_1$C = { key: 1 }; 28453 const __default__$Q = vue.defineComponent({ 28454 name: "ElDescriptionsRow" 28455 }); 28456 const _sfc_main$1f = /* @__PURE__ */ vue.defineComponent({ 28457 ...__default__$Q, 28458 props: descriptionsRowProps, 28459 setup(__props) { 28460 const descriptions = vue.inject(descriptionsKey, {}); 28461 return (_ctx, _cache) => { 28462 return vue.unref(descriptions).direction === "vertical" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ 28463 vue.createElementVNode("tr", null, [ 28464 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, index) => { 28465 return vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), { 28466 key: `tr1-${index}`, 28467 cell, 28468 tag: "th", 28469 type: "label" 28470 }, null, 8, ["cell"]); 28471 }), 128)) 28472 ]), 28473 vue.createElementVNode("tr", null, [ 28474 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, index) => { 28475 return vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), { 28476 key: `tr2-${index}`, 28477 cell, 28478 tag: "td", 28479 type: "content" 28480 }, null, 8, ["cell"]); 28481 }), 128)) 28482 ]) 28483 ], 64)) : (vue.openBlock(), vue.createElementBlock("tr", _hoisted_1$C, [ 28484 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, index) => { 28485 return vue.openBlock(), vue.createElementBlock(vue.Fragment, { 28486 key: `tr3-${index}` 28487 }, [ 28488 vue.unref(descriptions).border ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ 28489 vue.createVNode(vue.unref(ElDescriptionsCell), { 28490 cell, 28491 tag: "td", 28492 type: "label" 28493 }, null, 8, ["cell"]), 28494 vue.createVNode(vue.unref(ElDescriptionsCell), { 28495 cell, 28496 tag: "td", 28497 type: "content" 28498 }, null, 8, ["cell"]) 28499 ], 64)) : (vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), { 28500 key: 1, 28501 cell, 28502 tag: "td", 28503 type: "both" 28504 }, null, 8, ["cell"])) 28505 ], 64); 28506 }), 128)) 28507 ])); 28508 }; 28509 } 28510 }); 28511 var ElDescriptionsRow = /* @__PURE__ */ _export_sfc(_sfc_main$1f, [["__file", "descriptions-row.vue"]]); 28512 28513 const descriptionProps = buildProps({ 28514 border: { 28515 type: Boolean, 28516 default: false 28517 }, 28518 column: { 28519 type: Number, 28520 default: 3 28521 }, 28522 direction: { 28523 type: String, 28524 values: ["horizontal", "vertical"], 28525 default: "horizontal" 28526 }, 28527 size: useSizeProp, 28528 title: { 28529 type: String, 28530 default: "" 28531 }, 28532 extra: { 28533 type: String, 28534 default: "" 28535 } 28536 }); 28537 28538 const __default__$P = vue.defineComponent({ 28539 name: "ElDescriptions" 28540 }); 28541 const _sfc_main$1e = /* @__PURE__ */ vue.defineComponent({ 28542 ...__default__$P, 28543 props: descriptionProps, 28544 setup(__props) { 28545 const props = __props; 28546 const ns = useNamespace("descriptions"); 28547 const descriptionsSize = useFormSize(); 28548 const slots = vue.useSlots(); 28549 vue.provide(descriptionsKey, props); 28550 const descriptionKls = vue.computed(() => [ns.b(), ns.m(descriptionsSize.value)]); 28551 const filledNode = (node, span, count, isLast = false) => { 28552 if (!node.props) { 28553 node.props = {}; 28554 } 28555 if (span > count) { 28556 node.props.span = count; 28557 } 28558 if (isLast) { 28559 node.props.span = span; 28560 } 28561 return node; 28562 }; 28563 const getRows = () => { 28564 var _a; 28565 const children = flattedChildren((_a = slots.default) == null ? void 0 : _a.call(slots)).filter((node) => { 28566 var _a2; 28567 return ((_a2 = node == null ? void 0 : node.type) == null ? void 0 : _a2.name) === "ElDescriptionsItem"; 28568 }); 28569 const rows = []; 28570 let temp = []; 28571 let count = props.column; 28572 let totalSpan = 0;
28573 children.forEach((node, index) => { 28574 var _a2; 28575 const span = ((_a2 = node.props) == null ? void 0 : _a2.span) || 1; 28576 if (index < children.length - 1) { 28577 totalSpan += span > count ? count : span; 28578 } 28579 if (index === children.length - 1) { 28580 const lastSpan = props.column - totalSpan % props.column; 28581 temp.push(filledNode(node, lastSpan, count, true)); 28582 rows.push(temp); 28583 return; 28584 } 28585 if (span < count) { 28586 count -= span; 28587 temp.push(node); 28588 } else { 28589 temp.push(filledNode(node, span, count)); 28590 rows.push(temp); 28591 count = props.column; 28592 temp = []; 28593 } 28594 }); 28595 return rows; 28596 }; 28597 return (_ctx, _cache) => { 28598 return vue.openBlock(), vue.createElementBlock("div", { 28599 class: vue.normalizeClass(vue.unref(descriptionKls)) 28600 }, [ 28601 _ctx.title || _ctx.extra || _ctx.$slots.title || _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", { 28602 key: 0, 28603 class: vue.normalizeClass(vue.unref(ns).e("header")) 28604 }, [ 28605 vue.createElementVNode("div", { 28606 class: vue.normalizeClass(vue.unref(ns).e("title")) 28607 }, [ 28608 vue.renderSlot(_ctx.$slots, "title", {}, () => [ 28609 vue.createTextVNode(vue.toDisplayString(_ctx.title), 1) 28610 ]) 28611 ], 2), 28612 vue.createElementVNode("div", { 28613 class: vue.normalizeClass(vue.unref(ns).e("extra")) 28614 }, [ 28615 vue.renderSlot(_ctx.$slots, "extra", {}, () => [ 28616 vue.createTextVNode(vue.toDisplayString(_ctx.extra), 1) 28617 ]) 28618 ], 2) 28619 ], 2)) : vue.createCommentVNode("v-if", true), 28620 vue.createElementVNode("div", { 28621 class: vue.normalizeClass(vue.unref(ns).e("body")) 28622 }, [ 28623 vue.createElementVNode("table", { 28624 class: vue.normalizeClass([vue.unref(ns).e("table"), vue.unref(ns).is("bordered", _ctx.border)]) 28625 }, [ 28626 vue.createElementVNode("tbody", null, [ 28627 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(getRows(), (row, index) => { 28628 return vue.openBlock(), vue.createBlock(ElDescriptionsRow, { 28629 key: index, 28630 row 28631 }, null, 8, ["row"]); 28632 }), 128)) 28633 ]) 28634 ], 2) 28635 ], 2) 28636 ], 2); 28637 }; 28638 } 28639 }); 28640 var Descriptions = /* @__PURE__ */ _export_sfc(_sfc_main$1e, [["__file", "description.vue"]]); 28641 28642 var DescriptionsItem = vue.defineComponent({ 28643 name: "ElDescriptionsItem", 28644 props: { 28645 label: { 28646 type: String, 28647 default: "" 28648 }, 28649 span: { 28650 type: Number, 28651 default: 1 28652 }, 28653 width: { 28654 type: [String, Number], 28655 default: "" 28656 }, 28657 minWidth: { 28658 type: [String, Number], 28659 default: "" 28660 }, 28661 align: { 28662 type: String, 28663 default: "left" 28664 }, 28665 labelAlign: { 28666 type: String, 28667 default: "" 28668 }, 28669 className: { 28670 type: String, 28671 default: "" 28672 }, 28673 labelClassName: { 28674 type: String, 28675 default: "" 28676 } 28677 } 28678 }); 28679 28680 const ElDescriptions = withInstall(Descriptions, { 28681 DescriptionsItem 28682 }); 28683 const ElDescriptionsItem = withNoopInstall(DescriptionsItem); 28684 28685 const overlayProps = buildProps({ 28686 mask: { 28687 type: Boolean, 28688 default: true 28689 }, 28690 customMaskEvent: { 28691 type: Boolean, 28692 default: false 28693 }, 28694 overlayClass: { 28695 type: definePropType([ 28696 String, 28697 Array, 28698 Object 28699 ]) 28700 }, 28701 zIndex: { 28702 type: definePropType([String, Number]) 28703 } 28704 });
28705 const overlayEmits = { 28706 click: (evt) => evt instanceof MouseEvent 28707 }; 28708 const BLOCK = "overlay"; 28709 var Overlay$1 = vue.defineComponent({ 28710 name: "ElOverlay", 28711 props: overlayProps, 28712 emits: overlayEmits, 28713 setup(props, { slots, emit }) { 28714 const ns = useNamespace(BLOCK); 28715 const onMaskClick = (e) => { 28716 emit("click", e); 28717 }; 28718 const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick); 28719 return () => { 28720 return props.mask ? vue.createVNode("div", { 28721 class: [ns.b(), props.overlayClass], 28722 style: { 28723 zIndex: props.zIndex 28724 }, 28725 onClick, 28726 onMousedown, 28727 onMouseup 28728 }, [vue.renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : vue.h("div", { 28729 class: props.overlayClass, 28730 style: { 28731 zIndex: props.zIndex, 28732 position: "fixed", 28733 top: "0px", 28734 right: "0px", 28735 bottom: "0px", 28736 left: "0px" 28737 } 28738 }, [vue.renderSlot(slots, "default")]); 28739 }; 28740 } 28741 }); 28742 28743 const ElOverlay = Overlay$1; 28744 28745 const dialogInjectionKey = Symbol("dialogInjectionKey"); 28746 28747 const dialogContentProps = buildProps({ 28748 center: { 28749 type: Boolean, 28750 default: false 28751 }, 28752 alignCenter: { 28753 type: Boolean, 28754 default: false 28755 }, 28756 closeIcon: { 28757 type: iconPropType 28758 }, 28759 customClass: { 28760 type: String, 28761 default: "" 28762 }, 28763 draggable: { 28764 type: Boolean, 28765 default: false 28766 }, 28767 fullscreen: { 28768 type: Boolean, 28769 default: false 28770 }, 28771 showClose: { 28772 type: Boolean, 28773 default: true 28774 }, 28775 title: { 28776 type: String, 28777 default: "" 28778 } 28779 }); 28780 const dialogContentEmits = { 28781 close: () => true 28782 }; 28783 28784 const _hoisted_1$B = ["aria-label"]; 28785 const _hoisted_2$n = ["id"]; 28786 const __default__$O = vue.defineComponent({ name: "ElDialogContent" }); 28787 const _sfc_main$1d = /* @__PURE__ */ vue.defineComponent({ 28788 ...__default__$O, 28789 props: dialogContentProps, 28790 emits: dialogContentEmits, 28791 setup(__props) { 28792 const props = __props; 28793 const { t } = useLocale(); 28794 const { Close } = CloseComponents; 28795 const { dialogRef, headerRef, bodyId, ns, style } = vue.inject(dialogInjectionKey); 28796 const { focusTrapRef } = vue.inject(FOCUS_TRAP_INJECTION_KEY); 28797 const composedDialogRef = composeRefs(focusTrapRef, dialogRef); 28798 const draggable = vue.computed(() => props.draggable); 28799 useDraggable(dialogRef, headerRef, draggable); 28800 return (_ctx, _cache) => { 28801 return vue.openBlock(), vue.createElementBlock("div", { 28802 ref: vue.unref(composedDialogRef), 28803 class: vue.normalizeClass([ 28804 vue.unref(ns).b(), 28805 vue.unref(ns).is("fullscreen", _ctx.fullscreen), 28806 vue.unref(ns).is("draggable", vue.unref(draggable)), 28807 vue.unref(ns).is("align-center", _ctx.alignCenter), 28808 { [vue.unref(ns).m("center")]: _ctx.center }, 28809 _ctx.customClass 28810 ]), 28811 style: vue.normalizeStyle(vue.unref(style)), 28812 tabindex: "-1" 28813 }, [ 28814 vue.createElementVNode("header", { 28815 ref_key: "headerRef", 28816 ref: headerRef, 28817 class: vue.normalizeClass(vue.unref(ns).e("header")) 28818 }, [ 28819 vue.renderSlot(_ctx.$slots, "header", {}, () => [ 28820 vue.createElementVNode("span", { 28821 role: "heading", 28822 class: vue.normalizeClass(vue.unref(ns).e("title")) 28823 }, vue.toDisplayString(_ctx.title), 3) 28824 ]), 28825 _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", { 28826 key: 0, 28827 "aria-label": vue.unref(t)("el.dialog.close"), 28828 class: vue.normalizeClass(vue.unref(ns).e("headerbtn")), 28829 type: "button", 28830 onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close")) 28831 }, [ 28832 vue.createVNode(vue.unref(ElIcon), { 28833 class: vue.normalizeClass(vue.unref(ns).e("close")) 28834 }, { 28835 default: vue.withCtx(() => [ 28836 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.closeIcon || vue.unref(Close)))) 28837 ]), 28838 _: 1 28839 }, 8, ["class"]) 28840 ], 10, _hoisted_1$B)) : vue.createCommentVNode("v-if", true) 28841 ], 2), 28842 vue.createElementVNode("div", { 28843 id: vue.unref(bodyId), 28844 class: vue.normalizeClass(vue.unref(ns).e("body")) 28845 }, [
28846 vue.renderSlot(_ctx.$slots, "default") 28847 ], 10, _hoisted_2$n), 28848 _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("footer", { 28849 key: 0, 28850 class: vue.normalizeClass(vue.unref(ns).e("footer")) 28851 }, [ 28852 vue.renderSlot(_ctx.$slots, "footer") 28853 ], 2)) : vue.createCommentVNode("v-if", true) 28854 ], 6); 28855 }; 28856 } 28857 }); 28858 var ElDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$1d, [["__file", "dialog-content.vue"]]); 28859 28860 const dialogProps = buildProps({ 28861 ...dialogContentProps, 28862 appendToBody: { 28863 type: Boolean, 28864 default: false 28865 }, 28866 beforeClose: { 28867 type: definePropType(Function) 28868 }, 28869 destroyOnClose: { 28870 type: Boolean, 28871 default: false 28872 }, 28873 closeOnClickModal: { 28874 type: Boolean, 28875 default: true 28876 }, 28877 closeOnPressEscape: { 28878 type: Boolean, 28879 default: true 28880 }, 28881 lockScroll: { 28882 type: Boolean, 28883 default: true 28884 }, 28885 modal: { 28886 type: Boolean, 28887 default: true 28888 }, 28889 openDelay: { 28890 type: Number, 28891 default: 0 28892 }, 28893 closeDelay: { 28894 type: Number, 28895 default: 0 28896 }, 28897 top: { 28898 type: String 28899 }, 28900 modelValue: { 28901 type: Boolean, 28902 default: false 28903 }, 28904 modalClass: String, 28905 width: { 28906 type: [String, Number] 28907 }, 28908 zIndex: { 28909 type: Number 28910 }, 28911 trapFocus: { 28912 type: Boolean, 28913 default: false 28914 } 28915 }); 28916 const dialogEmits = { 28917 open: () => true, 28918 opened: () => true, 28919 close: () => true, 28920 closed: () => true, 28921 [UPDATE_MODEL_EVENT]: (value) => isBoolean(value), 28922 openAutoFocus: () => true, 28923 closeAutoFocus: () => true 28924 }; 28925 28926 const useDialog = (props, targetRef) => { 28927 const instance = vue.getCurrentInstance(); 28928 const emit = instance.emit; 28929 const { nextZIndex } = useZIndex(); 28930 let lastPosition = ""; 28931 const titleId = useId(); 28932 const bodyId = useId(); 28933 const visible = vue.ref(false); 28934 const closed = vue.ref(false); 28935 const rendered = vue.ref(false); 28936 const zIndex = vue.ref(props.zIndex || nextZIndex()); 28937 let openTimer = void 0; 28938 let closeTimer = void 0; 28939 const namespace = useGlobalConfig("namespace", defaultNamespace); 28940 const style = vue.computed(() => { 28941 const style2 = {}; 28942 const varPrefix = `--${namespace.value}-dialog`; 28943 if (!props.fullscreen) { 28944 if (props.top) { 28945 style2[`${varPrefix}-margin-top`] = props.top; 28946 } 28947 if (props.width) { 28948 style2[`${varPrefix}-width`] = addUnit(props.width); 28949 } 28950 } 28951 return style2; 28952 }); 28953 const overlayDialogStyle = vue.computed(() => { 28954 if (props.alignCenter) { 28955 return { display: "flex" }; 28956 } 28957 return {}; 28958 }); 28959 function afterEnter() { 28960 emit("opened"); 28961 } 28962 function afterLeave() { 28963 emit("closed"); 28964 emit(UPDATE_MODEL_EVENT, false); 28965 if (props.destroyOnClose) { 28966 rendered.value = false; 28967 } 28968 } 28969 function beforeLeave() { 28970 emit("close"); 28971 } 28972 function open() { 28973 closeTimer == null ? void 0 : closeTimer(); 28974 openTimer == null ? void 0 : openTimer(); 28975 if (props.openDelay && props.openDelay > 0) { 28976 ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay)); 28977 } else { 28978 doOpen(); 28979 } 28980 } 28981 function close() { 28982 openTimer == null ? void 0 : openTimer(); 28983 closeTimer == null ? void 0 : closeTimer(); 28984 if (props.closeDelay && props.closeDelay > 0) { 28985 ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay)); 28986 } else { 28987 doClose(); 28988 } 28989 } 28990 function handleClose() { 28991 function hide(shouldCancel) { 28992 if (shouldCancel) 28993 return; 28994 closed.value = true; 28995 visible.value = false; 28996 } 28997 if (props.beforeClose) { 28998 props.beforeClose(hide); 28999 } else { 29000 close(); 29001 } 29002 } 29003 function onModalClick() { 29004 if (props.closeOnClickModal) { 29005 handleClose(); 29006 } 29007 } 29008 function doOpen() { 29009 if (!isClient) 29010 return; 29011 visible.value = true; 29012 } 29013 function doClose() { 29014 visible.value = false; 29015 } 29016 function onOpenAutoFocus() { 29017 emit("openAutoFocus"); 29018 } 29019 function onCloseAutoFocus() { 29020 emit("closeAutoFocus"); 29021 } 29022 function onFocusoutPrevented(event) { 29023 var _a; 29024 if (((_a = event.detail) == null ? void 0 : _a.focusReason) === "pointer") { 29025 event.preventDefault(); 29026 } 29027 } 29028 if (props.lockScroll) { 29029 useLockscreen(visible); 29030 } 29031 function onCloseRequested() { 29032 if (props.closeOnPressEscape) { 29033 handleClose(); 29034 } 29035 } 29036 vue.watch(() => props.modelValue, (val) => { 29037 if (val) { 29038 closed.value = false; 29039 open(); 29040 rendered.value = true; 29041 zIndex.value = props.zIndex ? zIndex.value++ : nextZIndex(); 29042 vue.nextTick(() => { 29043 emit("open"); 29044 if (targetRef.value) { 29045 targetRef.value.scrollTop = 0; 29046 } 29047 }); 29048 } else { 29049 if (visible.value) { 29050 close(); 29051 } 29052 } 29053 }); 29054 vue.watch(() => props.fullscreen, (val) => { 29055 if (!targetRef.value) 29056 return; 29057 if (val) { 29058 lastPosition = targetRef.value.style.transform; 29059 targetRef.value.style.transform = ""; 29060 } else { 29061 targetRef.value.style.transform = lastPosition; 29062 } 29063 }); 29064 vue.onMounted(() => { 29065 if (props.modelValue) { 29066 visible.value = true; 29067 rendered.value = true; 29068 open(); 29069 } 29070 }); 29071 return { 29072 afterEnter, 29073 afterLeave, 29074 beforeLeave, 29075 handleClose, 29076 onModalClick, 29077 close, 29078 doClose, 29079 onOpenAutoFocus, 29080 onCloseAutoFocus, 29081 onCloseRequested, 29082 onFocusoutPrevented, 29083 titleId, 29084 bodyId, 29085 closed, 29086 style, 29087 overlayDialogStyle, 29088 rendered, 29089 visible, 29090 zIndex 29091 }; 29092 }; 29093 29094 const _hoisted_1$A = ["aria-label", "aria-labelledby", "aria-describedby"]; 29095 const __default__$N = vue.defineComponent({ 29096 name: "ElDialog", 29097 inheritAttrs: false 29098 });
29099 const _sfc_main$1c = /* @__PURE__ */ vue.defineComponent({ 29100 ...__default__$N, 29101 props: dialogProps, 29102 emits: dialogEmits, 29103 setup(__props, { expose }) { 29104 const props = __props; 29105 const slots = vue.useSlots(); 29106 useDeprecated({ 29107 scope: "el-dialog", 29108 from: "the title slot", 29109 replacement: "the header slot", 29110 version: "3.0.0", 29111 ref: "https://element-plus.org/en-US/component/dialog.html#slots" 29112 }, vue.computed(() => !!slots.title)); 29113 useDeprecated({ 29114 scope: "el-dialog", 29115 from: "custom-class", 29116 replacement: "class", 29117 version: "2.3.0", 29118 ref: "https://element-plus.org/en-US/component/dialog.html#attributes", 29119 type: "Attribute" 29120 }, vue.computed(() => !!props.customClass)); 29121 const ns = useNamespace("dialog"); 29122 const dialogRef = vue.ref(); 29123 const headerRef = vue.ref(); 29124 const dialogContentRef = vue.ref(); 29125 const { 29126 visible, 29127 titleId, 29128 bodyId, 29129 style, 29130 overlayDialogStyle, 29131 rendered, 29132 zIndex, 29133 afterEnter, 29134 afterLeave, 29135 beforeLeave, 29136 handleClose, 29137 onModalClick, 29138 onOpenAutoFocus, 29139 onCloseAutoFocus, 29140 onCloseRequested, 29141 onFocusoutPrevented 29142 } = useDialog(props, dialogRef); 29143 vue.provide(dialogInjectionKey, { 29144 dialogRef, 29145 headerRef, 29146 bodyId, 29147 ns, 29148 rendered, 29149 style 29150 }); 29151 const overlayEvent = useSameTarget(onModalClick); 29152 const draggable = vue.computed(() => props.draggable && !props.fullscreen); 29153 expose({ 29154 visible, 29155 dialogContentRef 29156 }); 29157 return (_ctx, _cache) => { 29158 return vue.openBlock(), vue.createBlock(vue.Teleport, { 29159 to: "body", 29160 disabled: !_ctx.appendToBody 29161 }, [ 29162 vue.createVNode(vue.Transition, { 29163 name: "dialog-fade", 29164 onAfterEnter: vue.unref(afterEnter), 29165 onAfterLeave: vue.unref(afterLeave), 29166 onBeforeLeave: vue.unref(beforeLeave), 29167 persisted: "" 29168 }, { 29169 default: vue.withCtx(() => [ 29170 vue.withDirectives(vue.createVNode(vue.unref(ElOverlay), { 29171 "custom-mask-event": "", 29172 mask: _ctx.modal, 29173 "overlay-class": _ctx.modalClass, 29174 "z-index": vue.unref(zIndex) 29175 }, { 29176 default: vue.withCtx(() => [ 29177 vue.createElementVNode("div", { 29178 role: "dialog", 29179 "aria-modal": "true", 29180 "aria-label": _ctx.title || void 0, 29181 "aria-labelledby": !_ctx.title ? vue.unref(titleId) : void 0, 29182 "aria-describedby": vue.unref(bodyId), 29183 class: vue.normalizeClass(`${vue.unref(ns).namespace.value}-overlay-dialog`), 29184 style: vue.normalizeStyle(vue.unref(overlayDialogStyle)), 29185 onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(overlayEvent).onClick && vue.unref(overlayEvent).onClick(...args)), 29186 onMousedown: _cache[1] || (_cache[1] = (...args) => vue.unref(overlayEvent).onMousedown && vue.unref(overlayEvent).onMousedown(...args)), 29187 onMouseup: _cache[2] || (_cache[2] = (...args) => vue.unref(overlayEvent).onMouseup && vue.unref(overlayEvent).onMouseup(...args)) 29188 }, [ 29189 vue.createVNode(vue.unref(ElFocusTrap), { 29190 loop: "", 29191 trapped: vue.unref(visible), 29192 "focus-start-el": "container", 29193 onFocusAfterTrapped: vue.unref(onOpenAutoFocus), 29194 onFocusAfterReleased: vue.unref(onCloseAutoFocus), 29195 onFocusoutPrevented: vue.unref(onFocusoutPrevented), 29196 onReleaseRequested: vue.unref(onCloseRequested) 29197 }, { 29198 default: vue.withCtx(() => [ 29199 vue.unref(rendered) ? (vue.openBlock(), vue.createBlock(ElDialogContent, vue.mergeProps({ 29200 key: 0, 29201 ref_key: "dialogContentRef", 29202 ref: dialogContentRef 29203 }, _ctx.$attrs, { 29204 "custom-class": _ctx.customClass, 29205 center: _ctx.center, 29206 "align-center": _ctx.alignCenter, 29207 "close-icon": _ctx.closeIcon, 29208 draggable: vue.unref(draggable), 29209 fullscreen: _ctx.fullscreen, 29210 "show-close": _ctx.showClose, 29211 title: _ctx.title, 29212 onClose: vue.unref(handleClose) 29213 }), vue.createSlots({ 29214 header: vue.withCtx(() => [
29215 !_ctx.$slots.title ? vue.renderSlot(_ctx.$slots, "header", { 29216 key: 0, 29217 close: vue.unref(handleClose), 29218 titleId: vue.unref(titleId), 29219 titleClass: vue.unref(ns).e("title") 29220 }) : vue.renderSlot(_ctx.$slots, "title", { key: 1 }) 29221 ]), 29222 default: vue.withCtx(() => [ 29223 vue.renderSlot(_ctx.$slots, "default") 29224 ]), 29225 _: 2 29226 }, [ 29227 _ctx.$slots.footer ? { 29228 name: "footer", 29229 fn: vue.withCtx(() => [ 29230 vue.renderSlot(_ctx.$slots, "footer") 29231 ]) 29232 } : void 0 29233 ]), 1040, ["custom-class", "center", "align-center", "close-icon", "draggable", "fullscreen", "show-close", "title", "onClose"])) : vue.createCommentVNode("v-if", true) 29234 ]), 29235 _: 3 29236 }, 8, ["trapped", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"]) 29237 ], 46, _hoisted_1$A) 29238 ]), 29239 _: 3 29240 }, 8, ["mask", "overlay-class", "z-index"]), [ 29241 [vue.vShow, vue.unref(visible)] 29242 ]) 29243 ]), 29244 _: 3 29245 }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"]) 29246 ], 8, ["disabled"]); 29247 }; 29248 } 29249 }); 29250 var Dialog = /* @__PURE__ */ _export_sfc(_sfc_main$1c, [["__file", "dialog.vue"]]); 29251 29252 const ElDialog = withInstall(Dialog); 29253 29254 const dividerProps = buildProps({ 29255 direction: { 29256 type: String, 29257 values: ["horizontal", "vertical"], 29258 default: "horizontal" 29259 }, 29260 contentPosition: { 29261 type: String, 29262 values: ["left", "center", "right"], 29263 default: "center" 29264 }, 29265 borderStyle: { 29266 type: definePropType(String), 29267 default: "solid" 29268 } 29269 }); 29270 29271 const __default__$M = vue.defineComponent({ 29272 name: "ElDivider" 29273 }); 29274 const _sfc_main$1b = /* @__PURE__ */ vue.defineComponent({ 29275 ...__default__$M, 29276 props: dividerProps, 29277 setup(__props) { 29278 const props = __props; 29279 const ns = useNamespace("divider"); 29280 const dividerStyle = vue.computed(() => { 29281 return ns.cssVar({ 29282 "border-style": props.borderStyle 29283 }); 29284 }); 29285 return (_ctx, _cache) => { 29286 return vue.openBlock(), vue.createElementBlock("div", { 29287 class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.direction)]), 29288 style: vue.normalizeStyle(vue.unref(dividerStyle)), 29289 role: "separator" 29290 }, [ 29291 _ctx.$slots.default && _ctx.direction !== "vertical" ? (vue.openBlock(), vue.createElementBlock("div", { 29292 key: 0, 29293 class: vue.normalizeClass([vue.unref(ns).e("text"), vue.unref(ns).is(_ctx.contentPosition)]) 29294 }, [ 29295 vue.renderSlot(_ctx.$slots, "default") 29296 ], 2)) : vue.createCommentVNode("v-if", true) 29297 ], 6); 29298 }; 29299 } 29300 }); 29301 var Divider = /* @__PURE__ */ _export_sfc(_sfc_main$1b, [["__file", "divider.vue"]]); 29302 29303 const ElDivider = withInstall(Divider); 29304 29305 const drawerProps = buildProps({ 29306 ...dialogProps, 29307 direction: { 29308 type: String, 29309 default: "rtl", 29310 values: ["ltr", "rtl", "ttb", "btt"] 29311 }, 29312 size: { 29313 type: [String, Number], 29314 default: "30%" 29315 }, 29316 withHeader: { 29317 type: Boolean, 29318 default: true 29319 }, 29320 modalFade: { 29321 type: Boolean, 29322 default: true 29323 } 29324 }); 29325 const drawerEmits = dialogEmits; 29326 29327 const _sfc_main$1a = vue.defineComponent({ 29328 name: "ElDrawer", 29329 components: { 29330 ElOverlay, 29331 ElFocusTrap, 29332 ElIcon, 29333 Close: close_default 29334 }, 29335 inheritAttrs: false, 29336 props: drawerProps, 29337 emits: drawerEmits, 29338 setup(props, { slots }) { 29339 useDeprecated({ 29340 scope: "el-drawer", 29341 from: "the title slot", 29342 replacement: "the header slot", 29343 version: "3.0.0", 29344 ref: "https://element-plus.org/en-US/component/drawer.html#slots" 29345 }, vue.computed(() => !!slots.title)); 29346 useDeprecated({ 29347 scope: "el-drawer", 29348 from: "custom-class", 29349 replacement: "class", 29350 version: "2.3.0", 29351 ref: "https://element-plus.org/en-US/component/drawer.html#attributes", 29352 type: "Attribute" 29353 }, vue.computed(() => !!props.customClass)); 29354 const drawerRef = vue.ref(); 29355 const focusStartRef = vue.ref(); 29356 const ns = useNamespace("drawer"); 29357 const { t } = useLocale(); 29358 const isHorizontal = vue.computed(() => props.direction === "rtl" || props.direction === "ltr"); 29359 const drawerSize = vue.computed(() => addUnit(props.size)); 29360 return { 29361 ...useDialog(props, drawerRef), 29362 drawerRef, 29363 focusStartRef, 29364 isHorizontal, 29365 drawerSize, 29366 ns, 29367 t 29368 }; 29369 } 29370 });
29371 const _hoisted_1$z = ["aria-label", "aria-labelledby", "aria-describedby"]; 29372 const _hoisted_2$m = ["id"]; 29373 const _hoisted_3$a = ["aria-label"]; 29374 const _hoisted_4$7 = ["id"]; 29375 function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) { 29376 const _component_close = vue.resolveComponent("close"); 29377 const _component_el_icon = vue.resolveComponent("el-icon"); 29378 const _component_el_focus_trap = vue.resolveComponent("el-focus-trap"); 29379 const _component_el_overlay = vue.resolveComponent("el-overlay"); 29380 return vue.openBlock(), vue.createBlock(vue.Teleport, { 29381 to: "body", 29382 disabled: !_ctx.appendToBody 29383 }, [ 29384 vue.createVNode(vue.Transition, { 29385 name: _ctx.ns.b("fade"), 29386 onAfterEnter: _ctx.afterEnter, 29387 onAfterLeave: _ctx.afterLeave, 29388 onBeforeLeave: _ctx.beforeLeave, 29389 persisted: "" 29390 }, { 29391 default: vue.withCtx(() => [ 29392 vue.withDirectives(vue.createVNode(_component_el_overlay, { 29393 mask: _ctx.modal, 29394 "overlay-class": _ctx.modalClass, 29395 "z-index": _ctx.zIndex, 29396 onClick: _ctx.onModalClick 29397 }, { 29398 default: vue.withCtx(() => [ 29399 vue.createVNode(_component_el_focus_trap, { 29400 loop: "", 29401 trapped: _ctx.visible, 29402 "focus-trap-el": _ctx.drawerRef, 29403 "focus-start-el": _ctx.focusStartRef, 29404 onReleaseRequested: _ctx.onCloseRequested 29405 }, { 29406 default: vue.withCtx(() => [ 29407 vue.createElementVNode("div", vue.mergeProps({ 29408 ref: "drawerRef", 29409 "aria-modal": "true", 29410 "aria-label": _ctx.title || void 0, 29411 "aria-labelledby": !_ctx.title ? _ctx.titleId : void 0, 29412 "aria-describedby": _ctx.bodyId 29413 }, _ctx.$attrs, { 29414 class: [_ctx.ns.b(), _ctx.direction, _ctx.visible && "open", _ctx.customClass], 29415 style: _ctx.isHorizontal ? "width: " + _ctx.drawerSize : "height: " + _ctx.drawerSize, 29416 role: "dialog", 29417 onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => { 29418 }, ["stop"])) 29419 }), [ 29420 vue.createElementVNode("span", { 29421 ref: "focusStartRef", 29422 class: vue.normalizeClass(_ctx.ns.e("sr-focus")), 29423 tabindex: "-1" 29424 }, null, 2), 29425 _ctx.withHeader ? (vue.openBlock(), vue.createElementBlock("header", { 29426 key: 0, 29427 class: vue.normalizeClass(_ctx.ns.e("header")) 29428 }, [ 29429 !_ctx.$slots.title ? vue.renderSlot(_ctx.$slots, "header", { 29430 key: 0, 29431 close: _ctx.handleClose, 29432 titleId: _ctx.titleId, 29433 titleClass: _ctx.ns.e("title") 29434 }, () => [ 29435 !_ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("span", { 29436 key: 0, 29437 id: _ctx.titleId, 29438 role: "heading", 29439 class: vue.normalizeClass(_ctx.ns.e("title")) 29440 }, vue.toDisplayString(_ctx.title), 11, _hoisted_2$m)) : vue.createCommentVNode("v-if", true) 29441 ]) : vue.renderSlot(_ctx.$slots, "title", { key: 1 }, () => [ 29442 vue.createCommentVNode(" DEPRECATED SLOT ") 29443 ]), 29444 _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", { 29445 key: 2, 29446 "aria-label": _ctx.t("el.drawer.close"), 29447 class: vue.normalizeClass(_ctx.ns.e("close-btn")), 29448 type: "button", 29449 onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClose && _ctx.handleClose(...args)) 29450 }, [ 29451 vue.createVNode(_component_el_icon, { 29452 class: vue.normalizeClass(_ctx.ns.e("close")) 29453 }, { 29454 default: vue.withCtx(() => [ 29455 vue.createVNode(_component_close) 29456 ]), 29457 _: 1 29458 }, 8, ["class"]) 29459 ], 10, _hoisted_3$a)) : vue.createCommentVNode("v-if", true) 29460 ], 2)) : vue.createCommentVNode("v-if", true), 29461 _ctx.rendered ? (vue.openBlock(), vue.createElementBlock("div", { 29462 key: 1, 29463 id: _ctx.bodyId, 29464 class: vue.normalizeClass(_ctx.ns.e("body")) 29465 }, [
29466 vue.renderSlot(_ctx.$slots, "default") 29467 ], 10, _hoisted_4$7)) : vue.createCommentVNode("v-if", true), 29468 _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", { 29469 key: 2, 29470 class: vue.normalizeClass(_ctx.ns.e("footer")) 29471 }, [ 29472 vue.renderSlot(_ctx.$slots, "footer") 29473 ], 2)) : vue.createCommentVNode("v-if", true) 29474 ], 16, _hoisted_1$z) 29475 ]), 29476 _: 3 29477 }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onReleaseRequested"]) 29478 ]), 29479 _: 3 29480 }, 8, ["mask", "overlay-class", "z-index", "onClick"]), [ 29481 [vue.vShow, _ctx.visible] 29482 ]) 29483 ]), 29484 _: 3 29485 }, 8, ["name", "onAfterEnter", "onAfterLeave", "onBeforeLeave"]) 29486 ], 8, ["disabled"]); 29487 } 29488 var Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$1a, [["render", _sfc_render$o], ["__file", "drawer.vue"]]); 29489 29490 const ElDrawer = withInstall(Drawer); 29491 29492 const _sfc_main$19 = /* @__PURE__ */ vue.defineComponent({ 29493 inheritAttrs: false 29494 }); 29495 function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) { 29496 return vue.renderSlot(_ctx.$slots, "default"); 29497 } 29498 var Collection = /* @__PURE__ */ _export_sfc(_sfc_main$19, [["render", _sfc_render$n], ["__file", "collection.vue"]]); 29499 29500 const _sfc_main$18 = /* @__PURE__ */ vue.defineComponent({ 29501 name: "ElCollectionItem", 29502 inheritAttrs: false 29503 }); 29504 function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) { 29505 return vue.renderSlot(_ctx.$slots, "default"); 29506 } 29507 var CollectionItem = /* @__PURE__ */ _export_sfc(_sfc_main$18, [["render", _sfc_render$m], ["__file", "collection-item.vue"]]); 29508 29509 const COLLECTION_ITEM_SIGN = `data-el-collection-item`; 29510 const createCollectionWithScope = (name) => { 29511 const COLLECTION_NAME = `El${name}Collection`; 29512 const COLLECTION_ITEM_NAME = `${COLLECTION_NAME}Item`; 29513 const COLLECTION_INJECTION_KEY = Symbol(COLLECTION_NAME); 29514 const COLLECTION_ITEM_INJECTION_KEY = Symbol(COLLECTION_ITEM_NAME); 29515 const ElCollection = { 29516 ...Collection, 29517 name: COLLECTION_NAME, 29518 setup() { 29519 const collectionRef = vue.ref(null); 29520 const itemMap = /* @__PURE__ */ new Map(); 29521 const getItems = () => { 29522 const collectionEl = vue.unref(collectionRef); 29523 if (!collectionEl) 29524 return []; 29525 const orderedNodes = Array.from(collectionEl.querySelectorAll(`[${COLLECTION_ITEM_SIGN}]`)); 29526 const items = [...itemMap.values()]; 29527 return items.sort((a, b) => orderedNodes.indexOf(a.ref) - orderedNodes.indexOf(b.ref)); 29528 }; 29529 vue.provide(COLLECTION_INJECTION_KEY, { 29530 itemMap, 29531 getItems, 29532 collectionRef 29533 }); 29534 } 29535 }; 29536 const ElCollectionItem = { 29537 ...CollectionItem, 29538 name: COLLECTION_ITEM_NAME, 29539 setup(_, { attrs }) { 29540 const collectionItemRef = vue.ref(null); 29541 const collectionInjection = vue.inject(COLLECTION_INJECTION_KEY, void 0); 29542 vue.provide(COLLECTION_ITEM_INJECTION_KEY, { 29543 collectionItemRef 29544 }); 29545 vue.onMounted(() => { 29546 const collectionItemEl = vue.unref(collectionItemRef); 29547 if (collectionItemEl) { 29548 collectionInjection.itemMap.set(collectionItemEl, { 29549 ref: collectionItemEl, 29550 ...attrs 29551 }); 29552 } 29553 }); 29554 vue.onBeforeUnmount(() => { 29555 const collectionItemEl = vue.unref(collectionItemRef); 29556 collectionInjection.itemMap.delete(collectionItemEl); 29557 }); 29558 } 29559 }; 29560 return { 29561 COLLECTION_INJECTION_KEY, 29562 COLLECTION_ITEM_INJECTION_KEY, 29563 ElCollection, 29564 ElCollectionItem 29565 }; 29566 }; 29567 29568 const rovingFocusGroupProps = buildProps({ 29569 style: { type: definePropType([String, Array, Object]) }, 29570 currentTabId: { 29571 type: definePropType(String) 29572 }, 29573 defaultCurrentTabId: String, 29574 loop: Boolean, 29575 dir: { 29576 type: String, 29577 values: ["ltr", "rtl"], 29578 default: "ltr" 29579 }, 29580 orientation: { 29581 type: definePropType(String) 29582 }, 29583 onBlur: Function, 29584 onFocus: Function, 29585 onMousedown: Function 29586 });
29587 const { 29588 ElCollection: ElCollection$1, 29589 ElCollectionItem: ElCollectionItem$1, 29590 COLLECTION_INJECTION_KEY: COLLECTION_INJECTION_KEY$1, 29591 COLLECTION_ITEM_INJECTION_KEY: COLLECTION_ITEM_INJECTION_KEY$1 29592 } = createCollectionWithScope("RovingFocusGroup"); 29593 29594 const ROVING_FOCUS_GROUP_INJECTION_KEY = Symbol("elRovingFocusGroup"); 29595 const ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY = Symbol("elRovingFocusGroupItem"); 29596 29597 const MAP_KEY_TO_FOCUS_INTENT = { 29598 ArrowLeft: "prev", 29599 ArrowUp: "prev", 29600 ArrowRight: "next", 29601 ArrowDown: "next", 29602 PageUp: "first", 29603 Home: "first", 29604 PageDown: "last", 29605 End: "last" 29606 }; 29607 const getDirectionAwareKey = (key, dir) => { 29608 if (dir !== "rtl") 29609 return key; 29610 switch (key) { 29611 case EVENT_CODE.right: 29612 return EVENT_CODE.left; 29613 case EVENT_CODE.left: 29614 return EVENT_CODE.right; 29615 default: 29616 return key; 29617 } 29618 }; 29619 const getFocusIntent = (event, orientation, dir) => { 29620 const key = getDirectionAwareKey(event.key, dir); 29621 if (orientation === "vertical" && [EVENT_CODE.left, EVENT_CODE.right].includes(key)) 29622 return void 0; 29623 if (orientation === "horizontal" && [EVENT_CODE.up, EVENT_CODE.down].includes(key)) 29624 return void 0; 29625 return MAP_KEY_TO_FOCUS_INTENT[key]; 29626 }; 29627 const reorderArray = (array, atIdx) => { 29628 return array.map((_, idx) => array[(idx + atIdx) % array.length]); 29629 }; 29630 const focusFirst = (elements) => { 29631 const { activeElement: prevActive } = document; 29632 for (const element of elements) { 29633 if (element === prevActive) 29634 return; 29635 element.focus(); 29636 if (prevActive !== document.activeElement) 29637 return; 29638 } 29639 }; 29640 29641 const CURRENT_TAB_ID_CHANGE_EVT = "currentTabIdChange"; 29642 const ENTRY_FOCUS_EVT = "rovingFocusGroup.entryFocus"; 29643 const EVT_OPTS = { bubbles: false, cancelable: true }; 29644 const _sfc_main$17 = vue.defineComponent({ 29645 name: "ElRovingFocusGroupImpl", 29646 inheritAttrs: false, 29647 props: rovingFocusGroupProps, 29648 emits: [CURRENT_TAB_ID_CHANGE_EVT, "entryFocus"], 29649 setup(props, { emit }) { 29650 var _a; 29651 const currentTabbedId = vue.ref((_a = props.currentTabId || props.defaultCurrentTabId) != null ? _a : null); 29652 const isBackingOut = vue.ref(false); 29653 const isClickFocus = vue.ref(false); 29654 const rovingFocusGroupRef = vue.ref(null); 29655 const { getItems } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0); 29656 const rovingFocusGroupRootStyle = vue.computed(() => { 29657 return [ 29658 { 29659 outline: "none" 29660 }, 29661 props.style 29662 ]; 29663 }); 29664 const onItemFocus = (tabbedId) => { 29665 emit(CURRENT_TAB_ID_CHANGE_EVT, tabbedId); 29666 }; 29667 const onItemShiftTab = () => { 29668 isBackingOut.value = true; 29669 }; 29670 const onMousedown = composeEventHandlers((e) => { 29671 var _a2; 29672 (_a2 = props.onMousedown) == null ? void 0 : _a2.call(props, e); 29673 }, () => { 29674 isClickFocus.value = true; 29675 }); 29676 const onFocus = composeEventHandlers((e) => { 29677 var _a2; 29678 (_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e); 29679 }, (e) => { 29680 const isKeyboardFocus = !vue.unref(isClickFocus); 29681 const { target, currentTarget } = e; 29682 if (target === currentTarget && isKeyboardFocus && !vue.unref(isBackingOut)) { 29683 const entryFocusEvt = new Event(ENTRY_FOCUS_EVT, EVT_OPTS); 29684 currentTarget == null ? void 0 : currentTarget.dispatchEvent(entryFocusEvt); 29685 if (!entryFocusEvt.defaultPrevented) { 29686 const items = getItems().filter((item) => item.focusable); 29687 const activeItem = items.find((item) => item.active); 29688 const currentItem = items.find((item) => item.id === vue.unref(currentTabbedId)); 29689 const candidates = [activeItem, currentItem, ...items].filter(
29689Boolean); 29690 const candidateNodes = candidates.map((item) => item.ref); 29691 focusFirst(candidateNodes); 29692 } 29693 } 29694 isClickFocus.value = false; 29695 }); 29696 const onBlur = composeEventHandlers((e) => { 29697 var _a2; 29698 (_a2 = props.onBlur) == null ? void 0 : _a2.call(props, e); 29699 }, () => { 29700 isBackingOut.value = false; 29701 }); 29702 const handleEntryFocus = (...args) => { 29703 emit("entryFocus", ...args); 29704 }; 29705 vue.provide(ROVING_FOCUS_GROUP_INJECTION_KEY, { 29706 currentTabbedId: vue.readonly(currentTabbedId), 29707 loop: vue.toRef(props, "loop"), 29708 tabIndex: vue.computed(() => { 29709 return vue.unref(isBackingOut) ? -1 : 0; 29710 }), 29711 rovingFocusGroupRef, 29712 rovingFocusGroupRootStyle, 29713 orientation: vue.toRef(props, "orientation"), 29714 dir: vue.toRef(props, "dir"), 29715 onItemFocus, 29716 onItemShiftTab, 29717 onBlur, 29718 onFocus, 29719 onMousedown 29720 }); 29721 vue.watch(() => props.currentTabId, (val) => { 29722 currentTabbedId.value = val != null ? val : null; 29723 }); 29724 useEventListener(rovingFocusGroupRef, ENTRY_FOCUS_EVT, handleEntryFocus); 29725 } 29726 }); 29727 function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) { 29728 return vue.renderSlot(_ctx.$slots, "default"); 29729 } 29730 var ElRovingFocusGroupImpl = /* @__PURE__ */ _export_sfc(_sfc_main$17, [["render", _sfc_render$l], ["__file", "roving-focus-group-impl.vue"]]); 29731 29732 const _sfc_main$16 = vue.defineComponent({ 29733 name: "ElRovingFocusGroup", 29734 components: { 29735 ElFocusGroupCollection: ElCollection$1, 29736 ElRovingFocusGroupImpl 29737 } 29738 }); 29739 function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) { 29740 const _component_el_roving_focus_group_impl = vue.resolveComponent("el-roving-focus-group-impl"); 29741 const _component_el_focus_group_collection = vue.resolveComponent("el-focus-group-collection"); 29742 return vue.openBlock(), vue.createBlock(_component_el_focus_group_collection, null, { 29743 default: vue.withCtx(() => [ 29744 vue.createVNode(_component_el_roving_focus_group_impl, vue.normalizeProps(vue.guardReactiveProps(_ctx.$attrs)), { 29745 default: vue.withCtx(() => [ 29746 vue.renderSlot(_ctx.$slots, "default") 29747 ]), 29748 _: 3 29749 }, 16) 29750 ]), 29751 _: 3 29752 }); 29753 } 29754 var ElRovingFocusGroup = /* @__PURE__ */ _export_sfc(_sfc_main$16, [["render", _sfc_render$k], ["__file", "roving-focus-group.vue"]]); 29755 29756 const _sfc_main$15 = vue.defineComponent({ 29757 components: { 29758 ElRovingFocusCollectionItem: ElCollectionItem$1 29759 }, 29760 props: { 29761 focusable: { 29762 type: Boolean, 29763 default: true 29764 }, 29765 active: { 29766 type: Boolean, 29767 default: false 29768 } 29769 }, 29770 emits: ["mousedown", "focus", "keydown"], 29771 setup(props, { emit }) { 29772 const { currentTabbedId, loop, onItemFocus, onItemShiftTab } = vue.inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0); 29773 const { getItems } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0); 29774 const id = useId(); 29775 const rovingFocusGroupItemRef = vue.ref(null); 29776 const handleMousedown = composeEventHandlers((e) => { 29777 emit("mousedown", e); 29778 }, (e) => { 29779 if (!props.focusable) { 29780 e.preventDefault(); 29781 } else { 29782 onItemFocus(vue.unref(id)); 29783 } 29784 }); 29785 const handleFocus = composeEventHandlers((e) => { 29786 emit("focus", e); 29787 }, () => { 29788 onItemFocus(vue.unref(id)); 29789 }); 29790 const handleKeydown = composeEventHandlers((e) => { 29791 emit("keydown", e); 29792 }, (e) => { 29793 const { key, shiftKey, target, currentTarget } = e; 29794 if (key === EVENT_CODE.tab && shiftKey) { 29795 onItemShiftTab(); 29796 return; 29797 } 29798 if (target !== currentTarget) 29799 return; 29800 const focusIntent = getFocusIntent(e); 29801 if (focusIntent) { 29802 e.preventDefault(); 29803 const items = getItems().filter((item) => item.focusable); 29804 let elements = items.map((item) => item.ref); 29805 switch (focusIntent) { 29806 case "last": { 29807 elements.reverse(); 29808 break; 29809 } 29810 case "prev": 29811 case "next": { 29812 if (focusIntent === "prev") { 29813 elements.reverse(); 29814 } 29815 const currentIdx = elements.indexOf(currentTarget); 29816 elements = loop.value ? reorderArray(elements, currentIdx + 1) : elements.slice(currentIdx + 1); 29817 break; 29818 } 29819 } 29820 vue.nextTick(() => { 29821 focusFirst(elements); 29822 }); 29823 } 29824 }); 29825 const isCurrentTab = vue.computed(() => currentTabbedId.value === vue.unref(id)); 29826 vue.provide(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, { 29827 rovingFocusGroupItemRef, 29828 tabIndex: vue.computed(() => vue.unref(isCurrentTab) ? 0 : -1), 29829 handleMousedown, 29830 handleFocus, 29831 handleKeydown 29832 }); 29833 return { 29834 id, 29835 handleKeydown, 29836 handleFocus, 29837 handleMousedown 29838 }; 29839 } 29840 });
29841 function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) { 29842 const _component_el_roving_focus_collection_item = vue.resolveComponent("el-roving-focus-collection-item"); 29843 return vue.openBlock(), vue.createBlock(_component_el_roving_focus_collection_item, { 29844 id: _ctx.id, 29845 focusable: _ctx.focusable, 29846 active: _ctx.active 29847 }, { 29848 default: vue.withCtx(() => [ 29849 vue.renderSlot(_ctx.$slots, "default") 29850 ]), 29851 _: 3 29852 }, 8, ["id", "focusable", "active"]); 29853 } 29854 var ElRovingFocusItem = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["render", _sfc_render$j], ["__file", "roving-focus-item.vue"]]); 29855 29856 const dropdownProps = buildProps({ 29857 trigger: useTooltipTriggerProps.trigger, 29858 effect: { 29859 ...useTooltipContentProps.effect, 29860 default: "light" 29861 }, 29862 type: { 29863 type: definePropType(String) 29864 }, 29865 placement: { 29866 type: definePropType(String), 29867 default: "bottom" 29868 }, 29869 popperOptions: { 29870 type: definePropType(Object), 29871 default: () => ({}) 29872 }, 29873 id: String, 29874 size: { 29875 type: String, 29876 default: "" 29877 }, 29878 splitButton: Boolean, 29879 hideOnClick: { 29880 type: Boolean, 29881 default: true 29882 }, 29883 loop: { 29884 type: Boolean, 29885 default: true 29886 }, 29887 showTimeout: { 29888 type: Number, 29889 default: 150 29890 }, 29891 hideTimeout: { 29892 type: Number, 29893 default: 150 29894 }, 29895 tabindex: { 29896 type: definePropType([Number, String]), 29897 default: 0 29898 }, 29899 maxHeight: { 29900 type: definePropType([Number, String]), 29901 default: "" 29902 }, 29903 popperClass: { 29904 type: String, 29905 default: "" 29906 }, 29907 disabled: { 29908 type: Boolean, 29909 default: false 29910 }, 29911 role: { 29912 type: String, 29913 default: "menu" 29914 }, 29915 buttonProps: { 29916 type: definePropType(Object) 29917 }, 29918 teleported: useTooltipContentProps.teleported 29919 }); 29920 const dropdownItemProps = buildProps({ 29921 command: { 29922 type: [Object, String, Number], 29923 default: () => ({}) 29924 }, 29925 disabled: Boolean, 29926 divided: Boolean, 29927 textValue: String, 29928 icon: { 29929 type: iconPropType 29930 } 29931 }); 29932 const dropdownMenuProps = buildProps({ 29933 onKeydown: { type: definePropType(Function) } 29934 }); 29935 const FIRST_KEYS = [ 29936 EVENT_CODE.down, 29937 EVENT_CODE.pageDown, 29938 EVENT_CODE.home 29939 ]; 29940 const LAST_KEYS = [EVENT_CODE.up, EVENT_CODE.pageUp, EVENT_CODE.end]; 29941 const FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS]; 29942 const { 29943 ElCollection, 29944 ElCollectionItem, 29945 COLLECTION_INJECTION_KEY, 29946 COLLECTION_ITEM_INJECTION_KEY 29947 } = createCollectionWithScope("Dropdown"); 29948 29949 const DROPDOWN_INJECTION_KEY = Symbol("elDropdown"); 29950 29951 const { ButtonGroup: ElButtonGroup } = ElButton; 29952 const _sfc_main$14 = vue.defineComponent({ 29953 name: "ElDropdown", 29954 components: { 29955 ElButton, 29956 ElButtonGroup, 29957 ElScrollbar, 29958 ElDropdownCollection: ElCollection, 29959 ElTooltip, 29960 ElRovingFocusGroup, 29961 ElOnlyChild: OnlyChild, 29962 ElIcon, 29963 ArrowDown: arrow_down_default 29964 }, 29965 props: dropdownProps, 29966 emits: ["visible-change", "click", "command"], 29967 setup(props, { emit }) { 29968 const _instance = vue.getCurrentInstance(); 29969 const ns = useNamespace("dropdown"); 29970 const { t } = useLocale(); 29971 const triggeringElementRef = vue.ref(); 29972 const referenceElementRef = vue.ref(); 29973 const popperRef = vue.ref(null); 29974 const contentRef = vue.ref(null); 29975 const scrollbar = vue.ref(null); 29976 const currentTabId = vue.ref(null); 29977 const isUsingKeyboard = vue.ref(false); 29978 const triggerKeys = [EVENT_CODE.enter, EVENT_CODE.space, EVENT_CODE.down]; 29979 const wrapStyle = vue.computed(() => ({ 29980 maxHeight: addUnit(props.maxHeight) 29981 })); 29982 const dropdownTriggerKls = vue.computed(() => [ns.m(dropdownSize.value)]);
29983 const defaultTriggerId = useId().value; 29984 const triggerId = vue.computed(() => { 29985 return props.id || defaultTriggerId; 29986 }); 29987 vue.watch([triggeringElementRef, vue.toRef(props, "trigger")], ([triggeringElement, trigger], [prevTriggeringElement]) => { 29988 var _a, _b, _c; 29989 const triggerArray = isArray$1(trigger) ? trigger : [trigger]; 29990 if ((_a = prevTriggeringElement == null ? void 0 : prevTriggeringElement.$el) == null ? void 0 : _a.removeEventListener) { 29991 prevTriggeringElement.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter); 29992 } 29993 if ((_b = triggeringElement == null ? void 0 : triggeringElement.$el) == null ? void 0 : _b.removeEventListener) { 29994 triggeringElement.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter); 29995 } 29996 if (((_c = triggeringElement == null ? void 0 : triggeringElement.$el) == null ? void 0 : _c.addEventListener) && triggerArray.includes("hover")) { 29997 triggeringElement.$el.addEventListener("pointerenter", onAutofocusTriggerEnter); 29998 } 29999 }, { immediate: true }); 30000 vue.onBeforeUnmount(() => { 30001 var _a, _b; 30002 if ((_b = (_a = triggeringElementRef.value) == null ? void 0 : _a.$el) == null ? void 0 : _b.removeEventListener) { 30003 triggeringElementRef.value.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter); 30004 } 30005 }); 30006 function handleClick() { 30007 handleClose(); 30008 } 30009 function handleClose() { 30010 var _a; 30011 (_a = popperRef.value) == null ? void 0 : _a.onClose(); 30012 } 30013 function handleOpen() { 30014 var _a; 30015 (_a = popperRef.value) == null ? void 0 : _a.onOpen(); 30016 } 30017 const dropdownSize = useFormSize(); 30018 function commandHandler(...args) { 30019 emit("command", ...args); 30020 } 30021 function onAutofocusTriggerEnter() { 30022 var _a, _b; 30023 (_b = (_a = triggeringElementRef.value) == null ? void 0 : _a.$el) == null ? void 0 : _b.focus(); 30024 } 30025 function onItemEnter() { 30026 } 30027 function onItemLeave() { 30028 const contentEl = vue.unref(contentRef); 30029 contentEl == null ? void 0 : contentEl.focus(); 30030 currentTabId.value = null; 30031 } 30032 function handleCurrentTabIdChange(id) { 30033 currentTabId.value = id; 30034 } 30035 function handleEntryFocus(e) { 30036 if (!isUsingKeyboard.value) { 30037 e.preventDefault(); 30038 e.stopImmediatePropagation(); 30039 } 30040 } 30041 function handleBeforeShowTooltip() { 30042 emit("visible-change", true); 30043 } 30044 function handleShowTooltip(event) { 30045 if ((event == null ? void 0 : event.type) === "keydown") { 30046 contentRef.value.focus(); 30047 } 30048 } 30049 function handleBeforeHideTooltip() { 30050 emit("visible-change", false); 30051 } 30052 vue.provide(DROPDOWN_INJECTION_KEY, { 30053 contentRef, 30054 role: vue.computed(() => props.role), 30055 triggerId, 30056 isUsingKeyboard, 30057 onItemEnter, 30058 onItemLeave 30059 }); 30060 vue.provide("elDropdown", { 30061 instance: _instance, 30062 dropdownSize, 30063 handleClick, 30064 commandHandler, 30065 trigger: vue.toRef(props, "trigger"), 30066 hideOnClick: vue.toRef(props, "hideOnClick") 30067 }); 30068 const onFocusAfterTrapped = (e) => { 30069 var _a, _b; 30070 e.preventDefault(); 30071 (_b = (_a = contentRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a, { 30072 preventScroll: true 30073 }); 30074 }; 30075 const handlerMainButtonClick = (event) => { 30076 emit("click", event); 30077 }; 30078 return { 30079 t, 30080 ns, 30081 scrollbar, 30082 wrapStyle, 30083 dropdownTriggerKls, 30084 dropdownSize, 30085 triggerId, 30086 triggerKeys, 30087 currentTabId,
30088 handleCurrentTabIdChange, 30089 handlerMainButtonClick, 30090 handleEntryFocus, 30091 handleClose, 30092 handleOpen, 30093 handleBeforeShowTooltip, 30094 handleShowTooltip, 30095 handleBeforeHideTooltip, 30096 onFocusAfterTrapped, 30097 popperRef, 30098 contentRef, 30099 triggeringElementRef, 30100 referenceElementRef 30101 }; 30102 } 30103 }); 30104 function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) { 30105 var _a; 30106 const _component_el_dropdown_collection = vue.resolveComponent("el-dropdown-collection"); 30107 const _component_el_roving_focus_group = vue.resolveComponent("el-roving-focus-group"); 30108 const _component_el_scrollbar = vue.resolveComponent("el-scrollbar"); 30109 const _component_el_only_child = vue.resolveComponent("el-only-child"); 30110 const _component_el_tooltip = vue.resolveComponent("el-tooltip"); 30111 const _component_el_button = vue.resolveComponent("el-button"); 30112 const _component_arrow_down = vue.resolveComponent("arrow-down"); 30113 const _component_el_icon = vue.resolveComponent("el-icon"); 30114 const _component_el_button_group = vue.resolveComponent("el-button-group"); 30115 return vue.openBlock(), vue.createElementBlock("div", { 30116 class: vue.normalizeClass([_ctx.ns.b(), _ctx.ns.is("disabled", _ctx.disabled)]) 30117 }, [ 30118 vue.createVNode(_component_el_tooltip, { 30119 ref: "popperRef", 30120 role: _ctx.role, 30121 effect: _ctx.effect, 30122 "fallback-placements": ["bottom", "top"], 30123 "popper-options": _ctx.popperOptions, 30124 "gpu-acceleration": false, 30125 "hide-after": _ctx.trigger === "hover" ? _ctx.hideTimeout : 0, 30126 "manual-mode": true, 30127 placement: _ctx.placement, 30128 "popper-class": [_ctx.ns.e("popper"), _ctx.popperClass], 30129 "reference-element": (_a = _ctx.referenceElementRef) == null ? void 0 : _a.$el, 30130 trigger: _ctx.trigger, 30131 "trigger-keys": _ctx.triggerKeys, 30132 "trigger-target-el": _ctx.contentRef, 30133 "show-after": _ctx.trigger === "hover" ? _ctx.showTimeout : 0, 30134 "stop-popper-mouse-event": false, 30135 "virtual-ref": _ctx.triggeringElementRef, 30136 "virtual-triggering": _ctx.splitButton, 30137 disabled: _ctx.disabled, 30138 transition: `${_ctx.ns.namespace.value}-zoom-in-top`, 30139 teleported: _ctx.teleported, 30140 pure: "", 30141 persistent: "", 30142 onBeforeShow: _ctx.handleBeforeShowTooltip, 30143 onShow: _ctx.handleShowTooltip, 30144 onBeforeHide: _ctx.handleBeforeHideTooltip 30145 }, vue.createSlots({ 30146 content: vue.withCtx(() => [ 30147 vue.createVNode(_component_el_scrollbar, { 30148 ref: "scrollbar", 30149 "wrap-style": _ctx.wrapStyle, 30150 tag: "div", 30151 "view-class": _ctx.ns.e("list") 30152 }, { 30153 default: vue.withCtx(() => [ 30154 vue.createVNode(_component_el_roving_focus_group, { 30155 loop: _ctx.loop, 30156 "current-tab-id": _ctx.currentTabId, 30157 orientation: "horizontal", 30158 onCurrentTabIdChange: _ctx.handleCurrentTabIdChange, 30159 onEntryFocus: _ctx.handleEntryFocus 30160 }, { 30161 default: vue.withCtx(() => [ 30162 vue.createVNode(_component_el_dropdown_collection, null, { 30163 default: vue.withCtx(() => [ 30164 vue.renderSlot(_ctx.$slots, "dropdown") 30165 ]), 30166 _: 3 30167 }) 30168 ]), 30169 _: 3 30170 }, 8, ["loop", "current-tab-id", "onCurrentTabIdChange", "onEntryFocus"]) 30171 ]), 30172 _: 3 30173 }, 8, ["wrap-style", "view-class"]) 30174 ]), 30175 _: 2 30176 }, [ 30177 !_ctx.splitButton ? { 30178 name: "default", 30179 fn: vue.withCtx(() => [ 30180 vue.createVNode(_component_el_only_child, { 30181 id: _ctx.triggerId, 30182 ref: "triggeringElementRef", 30183 role: "button", 30184 tabindex: _ctx.tabindex 30185 }, { 30186 default: vue.withCtx(() => [
30187 vue.renderSlot(_ctx.$slots, "default") 30188 ]), 30189 _: 3 30190 }, 8, ["id", "tabindex"]) 30191 ]) 30192 } : void 0 30193 ]), 1032, ["role", "effect", "popper-options", "hide-after", "placement", "popper-class", "reference-element", "trigger", "trigger-keys", "trigger-target-el", "show-after", "virtual-ref", "virtual-triggering", "disabled", "transition", "teleported", "onBeforeShow", "onShow", "onBeforeHide"]), 30194 _ctx.splitButton ? (vue.openBlock(), vue.createBlock(_component_el_button_group, { key: 0 }, { 30195 default: vue.withCtx(() => [ 30196 vue.createVNode(_component_el_button, vue.mergeProps({ ref: "referenceElementRef" }, _ctx.buttonProps, { 30197 size: _ctx.dropdownSize, 30198 type: _ctx.type, 30199 disabled: _ctx.disabled, 30200 tabindex: _ctx.tabindex, 30201 onClick: _ctx.handlerMainButtonClick 30202 }), { 30203 default: vue.withCtx(() => [ 30204 vue.renderSlot(_ctx.$slots, "default") 30205 ]), 30206 _: 3 30207 }, 16, ["size", "type", "disabled", "tabindex", "onClick"]), 30208 vue.createVNode(_component_el_button, vue.mergeProps({ 30209 id: _ctx.triggerId, 30210 ref: "triggeringElementRef" 30211 }, _ctx.buttonProps, { 30212 role: "button", 30213 size: _ctx.dropdownSize, 30214 type: _ctx.type, 30215 class: _ctx.ns.e("caret-button"), 30216 disabled: _ctx.disabled, 30217 tabindex: _ctx.tabindex, 30218 "aria-label": _ctx.t("el.dropdown.toggleDropdown") 30219 }), { 30220 default: vue.withCtx(() => [ 30221 vue.createVNode(_component_el_icon, { 30222 class: vue.normalizeClass(_ctx.ns.e("icon")) 30223 }, { 30224 default: vue.withCtx(() => [ 30225 vue.createVNode(_component_arrow_down) 30226 ]), 30227 _: 1 30228 }, 8, ["class"]) 30229 ]), 30230 _: 1 30231 }, 16, ["id", "size", "type", "class", "disabled", "tabindex", "aria-label"]) 30232 ]), 30233 _: 3 30234 })) : vue.createCommentVNode("v-if", true) 30235 ], 2); 30236 } 30237 var Dropdown = /* @__PURE__ */ _export_sfc(_sfc_main$14, [["render", _sfc_render$i], ["__file", "dropdown.vue"]]); 30238 30239 const _sfc_main$13 = vue.defineComponent({ 30240 name: "DropdownItemImpl", 30241 components: { 30242 ElIcon 30243 }, 30244 props: dropdownItemProps, 30245 emits: ["pointermove", "pointerleave", "click", "clickimpl"], 30246 setup(_, { emit }) { 30247 const ns = useNamespace("dropdown"); 30248 const { role: menuRole } = vue.inject(DROPDOWN_INJECTION_KEY, void 0); 30249 const { collectionItemRef: dropdownCollectionItemRef } = vue.inject(COLLECTION_ITEM_INJECTION_KEY, void 0); 30250 const { collectionItemRef: rovingFocusCollectionItemRef } = vue.inject(COLLECTION_ITEM_INJECTION_KEY$1, void 0); 30251 const { 30252 rovingFocusGroupItemRef, 30253 tabIndex, 30254 handleFocus, 30255 handleKeydown: handleItemKeydown, 30256 handleMousedown 30257 } = vue.inject(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, void 0); 30258 const itemRef = composeRefs(dropdownCollectionItemRef, rovingFocusCollectionItemRef, rovingFocusGroupItemRef); 30259 const role = vue.computed(() => { 30260 if (menuRole.value === "menu") { 30261 return "menuitem"; 30262 } else if (menuRole.value === "navigation") { 30263 return "link"; 30264 } 30265 return "button"; 30266 }); 30267 const handleKeydown = composeEventHandlers((e) => { 30268 const { code } = e; 30269 if (code === EVENT_CODE.enter || code === EVENT_CODE.space) { 30270 e.preventDefault(); 30271 e.stopImmediatePropagation(); 30272 emit("clickimpl", e); 30273 return true; 30274 } 30275 }, handleItemKeydown); 30276 return { 30277 ns, 30278 itemRef, 30279 dataset: { 30280 [COLLECTION_ITEM_SIGN]: "" 30281 }, 30282 role, 30283 tabIndex, 30284 handleFocus, 30285 handleKeydown, 30286 handleMousedown 30287 }; 30288 } 30289 });
30290 const _hoisted_1$y = ["aria-disabled", "tabindex", "role"]; 30291 function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) { 30292 const _component_el_icon = vue.resolveComponent("el-icon"); 30293 return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [ 30294 _ctx.divided ? (vue.openBlock(), vue.createElementBlock("li", vue.mergeProps({ 30295 key: 0, 30296 role: "separator", 30297 class: _ctx.ns.bem("menu", "item", "divided") 30298 }, _ctx.$attrs), null, 16)) : vue.createCommentVNode("v-if", true), 30299 vue.createElementVNode("li", vue.mergeProps({ ref: _ctx.itemRef }, { ..._ctx.dataset, ..._ctx.$attrs }, { 30300 "aria-disabled": _ctx.disabled, 30301 class: [_ctx.ns.be("menu", "item"), _ctx.ns.is("disabled", _ctx.disabled)], 30302 tabindex: _ctx.tabIndex, 30303 role: _ctx.role, 30304 onClick: _cache[0] || (_cache[0] = (e) => _ctx.$emit("clickimpl", e)), 30305 onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)), 30306 onKeydown: _cache[2] || (_cache[2] = vue.withModifiers((...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args), ["self"])), 30307 onMousedown: _cache[3] || (_cache[3] = (...args) => _ctx.handleMousedown && _ctx.handleMousedown(...args)), 30308 onPointermove: _cache[4] || (_cache[4] = (e) => _ctx.$emit("pointermove", e)), 30309 onPointerleave: _cache[5] || (_cache[5] = (e) => _ctx.$emit("pointerleave", e)) 30310 }), [ 30311 _ctx.icon ? (vue.openBlock(), vue.createBlock(_component_el_icon, { key: 0 }, { 30312 default: vue.withCtx(() => [ 30313 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon))) 30314 ]), 30315 _: 1 30316 })) : vue.createCommentVNode("v-if", true), 30317 vue.renderSlot(_ctx.$slots, "default") 30318 ], 16, _hoisted_1$y) 30319 ], 64); 30320 } 30321 var ElDropdownItemImpl = /* @__PURE__ */ _export_sfc(_sfc_main$13, [["render", _sfc_render$h], ["__file", "dropdown-item-impl.vue"]]); 30322 30323 const useDropdown = () => { 30324 const elDropdown = vue.inject("elDropdown", {}); 30325 const _elDropdownSize = vue.computed(() => elDropdown == null ? void 0 : elDropdown.dropdownSize); 30326 return { 30327 elDropdown, 30328 _elDropdownSize 30329 }; 30330 }; 30331 30332 const _sfc_main$12 = vue.defineComponent({ 30333 name: "ElDropdownItem", 30334 components: { 30335 ElDropdownCollectionItem: ElCollectionItem, 30336 ElRovingFocusItem, 30337 ElDropdownItemImpl 30338 }, 30339 inheritAttrs: false, 30340 props: dropdownItemProps, 30341 emits: ["pointermove", "pointerleave", "click"], 30342 setup(props, { emit, attrs }) { 30343 const { elDropdown } = useDropdown(); 30344 const _instance = vue.getCurrentInstance(); 30345 const itemRef = vue.ref(null); 30346 const textContent = vue.computed(() => { 30347 var _a, _b; 30348 return (_b = (_a = vue.unref(itemRef)) == null ? void 0 : _a.textContent) != null ? _b : ""; 30349 }); 30350 const { onItemEnter, onItemLeave } = vue.inject(DROPDOWN_INJECTION_KEY, void 0); 30351 const handlePointerMove = composeEventHandlers((e) => { 30352 emit("pointermove", e); 30353 return e.defaultPrevented; 30354 }, whenMouse((e) => { 30355 if (props.disabled) { 30356 onItemLeave(e); 30357 return; 30358 } 30359 const target = e.currentTarget; 30360 if (target === document.activeElement || target.contains(document.activeElement)) { 30361 return; 30362 } 30363 onItemEnter(e); 30364 if (!e.defaultPrevented) { 30365 target == null ? void 0 : target.focus(); 30366 } 30367 })); 30368 const handlePointerLeave = composeEventHandlers((e) => { 30369 emit("pointerleave", e); 30370 return e.defaultPrevented; 30371 }, whenMouse((e) => { 30372 onItemLeave(e); 30373 })); 30374 const handleClick = composeEventHandlers((e) => { 30375 if (props.disabled) { 30376 return; 30377 } 30378 emit("click", e); 30379 return e.type !== "keydown" && e.defaultPrevented; 30380 }, (e) => { 30381 var _a, _b, _c; 30382 if (props.disabled) { 30383 e.stopImmediatePropagation(); 30384 return; 30385 } 30386 if ((_a = elDropdown == null ? void 0 : elDropdown.hideOnClick) == null ? void 0 : _a.value) { 30387 (_b = elDropdown.handleClick) == null ? void 0 : _b.call(elDropdown); 30388 } 30389 (_c = elDropdown.commandHandler) == null ? void 0 : _c.call(elDropdown, props.command, _instance, e); 30390 }); 30391 const propsAndAttrs = vue.computed(() => { 30392 return { ...props, ...attrs }; 30393 }); 30394 return { 30395 handleClick, 30396 handlePointerMove, 30397 handlePointerLeave, 30398 textContent, 30399 propsAndAttrs 30400 }; 30401 } 30402 });
30403 function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) { 30404 var _a; 30405 const _component_el_dropdown_item_impl = vue.resolveComponent("el-dropdown-item-impl"); 30406 const _component_el_roving_focus_item = vue.resolveComponent("el-roving-focus-item"); 30407 const _component_el_dropdown_collection_item = vue.resolveComponent("el-dropdown-collection-item"); 30408 return vue.openBlock(), vue.createBlock(_component_el_dropdown_collection_item, { 30409 disabled: _ctx.disabled, 30410 "text-value": (_a = _ctx.textValue) != null ? _a : _ctx.textContent 30411 }, { 30412 default: vue.withCtx(() => [ 30413 vue.createVNode(_component_el_roving_focus_item, { 30414 focusable: !_ctx.disabled 30415 }, { 30416 default: vue.withCtx(() => [ 30417 vue.createVNode(_component_el_dropdown_item_impl, vue.mergeProps(_ctx.propsAndAttrs, { 30418 onPointerleave: _ctx.handlePointerLeave, 30419 onPointermove: _ctx.handlePointerMove, 30420 onClickimpl: _ctx.handleClick 30421 }), { 30422 default: vue.withCtx(() => [ 30423 vue.renderSlot(_ctx.$slots, "default") 30424 ]), 30425 _: 3 30426 }, 16, ["onPointerleave", "onPointermove", "onClickimpl"]) 30427 ]), 30428 _: 3 30429 }, 8, ["focusable"]) 30430 ]), 30431 _: 3 30432 }, 8, ["disabled", "text-value"]); 30433 } 30434 var DropdownItem = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["render", _sfc_render$g], ["__file", "dropdown-item.vue"]]); 30435 30436 const _sfc_main$11 = vue.defineComponent({ 30437 name: "ElDropdownMenu", 30438 props: dropdownMenuProps, 30439 setup(props) { 30440 const ns = useNamespace("dropdown"); 30441 const { _elDropdownSize } = useDropdown(); 30442 const size = _elDropdownSize.value; 30443 const { focusTrapRef, onKeydown } = vue.inject(FOCUS_TRAP_INJECTION_KEY, void 0); 30444 const { contentRef, role, triggerId } = vue.inject(DROPDOWN_INJECTION_KEY, void 0); 30445 const { collectionRef: dropdownCollectionRef, getItems } = vue.inject(COLLECTION_INJECTION_KEY, void 0); 30446 const { 30447 rovingFocusGroupRef, 30448 rovingFocusGroupRootStyle, 30449 tabIndex, 30450 onBlur, 30451 onFocus, 30452 onMousedown 30453 } = vue.inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0); 30454 const { collectionRef: rovingFocusGroupCollectionRef } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0); 30455 const dropdownKls = vue.computed(() => { 30456 return [ns.b("menu"), ns.bm("menu", size == null ? void 0 : size.value)]; 30457 }); 30458 const dropdownListWrapperRef = composeRefs(contentRef, dropdownCollectionRef, focusTrapRef, rovingFocusGroupRef, rovingFocusGroupCollectionRef); 30459 const composedKeydown = composeEventHandlers((e) => { 30460 var _a; 30461 (_a = props.onKeydown) == null ? void 0 : _a.call(props, e); 30462 }, (e) => { 30463 const { currentTarget, code, target } = e; 30464 currentTarget.contains(target); 30465 if (EVENT_CODE.tab === code) { 30466 e.stopImmediatePropagation(); 30467 } 30468 e.preventDefault(); 30469 if (target !== vue.unref(contentRef)) 30470 return; 30471 if (!FIRST_LAST_KEYS.includes(code)) 30472 return; 30473 const items = getItems().filter((item) => !item.disabled); 30474 const targets = items.map((item) => item.ref); 30475 if (LAST_KEYS.includes(code)) { 30476 targets.reverse(); 30477 } 30478 focusFirst(targets); 30479 }); 30480 const handleKeydown = (e) => { 30481 composedKeydown(e); 30482 onKeydown(e); 30483 }; 30484 return { 30485 size, 30486 rovingFocusGroupRootStyle, 30487 tabIndex, 30488 dropdownKls, 30489 role, 30490 triggerId, 30491 dropdownListWrapperRef, 30492 handleKeydown, 30493 onBlur, 30494 onFocus, 30495 onMousedown 30496 }; 30497 } 30498 }); 30499 const _hoisted_1$x = ["role", "aria-labelledby"]; 30500 function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
30501 return vue.openBlock(), vue.createElementBlock("ul", { 30502 ref: _ctx.dropdownListWrapperRef, 30503 class: vue.normalizeClass(_ctx.dropdownKls), 30504 style: vue.normalizeStyle(_ctx.rovingFocusGroupRootStyle), 30505 tabindex: -1, 30506 role: _ctx.role, 30507 "aria-labelledby": _ctx.triggerId, 30508 onBlur: _cache[0] || (_cache[0] = (...args) => _ctx.onBlur && _ctx.onBlur(...args)), 30509 onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)), 30510 onKeydown: _cache[2] || (_cache[2] = vue.withModifiers((...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args), ["self"])), 30511 onMousedown: _cache[3] || (_cache[3] = vue.withModifiers((...args) => _ctx.onMousedown && _ctx.onMousedown(...args), ["self"])) 30512 }, [ 30513 vue.renderSlot(_ctx.$slots, "default") 30514 ], 46, _hoisted_1$x); 30515 } 30516 var DropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["render", _sfc_render$f], ["__file", "dropdown-menu.vue"]]); 30517 30518 const ElDropdown = withInstall(Dropdown, { 30519 DropdownItem, 30520 DropdownMenu 30521 }); 30522 const ElDropdownItem = withNoopInstall(DropdownItem); 30523 const ElDropdownMenu = withNoopInstall(DropdownMenu); 30524 30525 const _hoisted_1$w = { 30526 viewBox: "0 0 79 86", 30527 version: "1.1", 30528 xmlns: "http://www.w3.org/2000/svg", 30529 "xmlns:xlink": "http://www.w3.org/1999/xlink" 30530 }; 30531 const _hoisted_2$l = ["id"]; 30532 const _hoisted_3$9 = ["stop-color"]; 30533 const _hoisted_4$6 = ["stop-color"]; 30534 const _hoisted_5$5 = ["id"]; 30535 const _hoisted_6$1 = ["stop-color"]; 30536 const _hoisted_7 = ["stop-color"]; 30537 const _hoisted_8 = ["id"]; 30538 const _hoisted_9 = { 30539 id: "Illustrations", 30540 stroke: "none", 30541 "stroke-width": "1", 30542 fill: "none", 30543 "fill-rule": "evenodd" 30544 }; 30545 const _hoisted_10 = { 30546 id: "B-type", 30547 transform: "translate(-1268.000000, -535.000000)" 30548 }; 30549 const _hoisted_11 = { 30550 id: "Group-2", 30551 transform: "translate(1268.000000, 535.000000)" 30552 }; 30553 const _hoisted_12 = ["fill"]; 30554 const _hoisted_13 = ["fill"]; 30555 const _hoisted_14 = { 30556 id: "Group-Copy", 30557 transform: "translate(34.500000, 31.500000) scale(-1, 1) rotate(-25.000000) translate(-34.500000, -31.500000) translate(7.000000, 10.000000)" 30558 }; 30559 const _hoisted_15 = ["fill"]; 30560 const _hoisted_16 = ["fill"]; 30561 const _hoisted_17 = ["fill"]; 30562 const _hoisted_18 = ["fill"]; 30563 const _hoisted_19 = ["fill"]; 30564 const _hoisted_20 = { 30565 id: "Rectangle-Copy-17", 30566 transform: "translate(53.000000, 45.000000)" 30567 }; 30568 const _hoisted_21 = ["fill", "xlink:href"]; 30569 const _hoisted_22 = ["fill", "mask"]; 30570 const _hoisted_23 = ["fill"]; 30571 const __default__$L = vue.defineComponent({ 30572 name: "ImgEmpty" 30573 }); 30574 const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({ 30575 ...__default__$L, 30576 setup(__props) { 30577 const ns = useNamespace("empty"); 30578 const id = useId(); 30579 return (_ctx, _cache) => { 30580 return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$w, [ 30581 vue.createElementVNode("defs", null, [ 30582 vue.createElementVNode("linearGradient", { 30583 id: `linearGradient-1-${vue.unref(id)}`, 30584 x1: "38.8503086%", 30585 y1: "0%", 30586 x2: "61.1496914%", 30587 y2: "100%" 30588 }, [ 30589 vue.createElementVNode("stop", { 30590 "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-1")})`, 30591 offset: "0%" 30592 }, null, 8, _hoisted_3$9), 30593 vue.createElementVNode("stop", { 30594 "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-4")})`, 30595 offset: "100%" 30596 }, null, 8, _hoisted_4$6) 30597 ], 8, _hoisted_2$l), 30598 vue.createElementVNode("linearGradient", { 30599 id: `linearGradient-2-${vue.unref(id)}`, 30600 x1: "0%", 30601 y1: "9.5%", 30602 x2: "100%", 30603 y2: "90.5%" 30604 }, [ 30605 vue.createElementVNode("stop", { 30606 "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-1")})`, 30607 offset: "0%" 30608 }, null, 8, _hoisted_6$1), 30609 vue.createElementVNode("stop", { 30610 "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-6")})`, 30611 offset: "100%" 30612 }, null, 8, _hoisted_7) 30613 ], 8, _hoisted_5$5), 30614 vue.createElementVNode("rect", { 30615 id: `path-3-${vue.unref(id)}`, 30616 x: "0", 30617 y: "0", 30618 width: "17", 30619 height: "36" 30620 }, null, 8, _hoisted_8) 30621 ]), 30622 vue.createElementVNode("g", _hoisted_9, [ 30623 vue.createElementVNode("g", _hoisted_10, [ 30624 vue.createElementVNode("g", _hoisted_11, [ 30625 vue.createElementVNode("path", { 30626 id: "Oval-Copy-2", 30627 d: "M39.5,86 C61.3152476,86 79,83.9106622 79,81.3333333 C79,78.7560045 57.3152476,78 35.5,78 C13.6847524,78 0,78.7560045 0,81.3333333 C0,83.9106622 17.6847524,86 39.5,86 Z", 30628 fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-3")})` 30629 }, null, 8, _hoisted_12), 30630 vue.createElementVNode("polygon", { 30631 id: "Rectangle-Copy-14", 30632 fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-7")})`, 30633 transform: "translate(27.500000, 51.500000) scale(1, -1) translate(-27.500000, -51.500000) ", 30634 points: "13 58 53 58 42 45 2 45" 30635 }, null, 8, _hoisted_13), 30636 vue.createElementVNode("g", _hoisted_14, [ 30637 vue.createElementVNode("polygon", { 30638 id: "Rectangle-Copy-10", 30639 fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-7")})`, 30640 transform: "translate(11.500000, 5.000000) scale(1, -1) translate(-11.500000, -5.000000) ", 30641 points: "2.84078316e-14 3 18 3 23 7 5 7" 30642 }, null, 8, _hoisted_15), 30643 vue.createElementVNode("polygon", { 30644 id: "Rectangle-Copy-11", 30645 fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-5")})`, 30646 points: "-3.69149156e-15 7 38 7 38 43 -3.69149156e-15 43" 30647 }, null, 8, _hoisted_16), 30648 vue.createElementVNode("rect", { 30649 id: "Rectangle-Copy-12", 30650 fill: `url(#linearGradient-1-${vue.unref(id)})`, 30651 transform: "translate(46.500000, 25.000000) scale(-1, 1) translate(-46.500000, -25.000000) ", 30652 x: "38", 30653 y: "7", 30654 width: "17", 30655 height: "36" 30656 }, null, 8, _hoisted_17), 30657 vue.createElementVNode("polygon", { 30658 id: "Rectangle-Copy-13", 30659 fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-2")})`, 30660 transform: "translate(39.500000, 3.500000) scale(-1, 1) translate(-39.500000, -3.500000) ", 30661 points: "24 7 41 7 55 -3.63806207e-12 38 -3.63806207e-12" 30662 }, null, 8, _hoisted_18) 30663 ]), 30664 vue.createElementVNode("rect", { 30665 id: "Rectangle-Copy-15", 30666 fill: `url(#linearGradient-2-${vue.unref(id)})`, 30667 x: "13", 30668 y: "45", 30669 width: "40", 30670 height: "36" 30671 }, null, 8, _hoisted_19), 30672 vue.createElementVNode("g", _hoisted_20, [ 30673 vue.createElementVNode("use", { 30674 id: "Mask", 30675 fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-8")})`,
30676 transform: "translate(8.500000, 18.000000) scale(-1, 1) translate(-8.500000, -18.000000) ", 30677 "xlink:href": `#path-3-${vue.unref(id)}` 30678 }, null, 8, _hoisted_21), 30679 vue.createElementVNode("polygon", { 30680 id: "Rectangle-Copy", 30681 fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-9")})`, 30682 mask: `url(#mask-4-${vue.unref(id)})`, 30683 transform: "translate(12.000000, 9.000000) scale(-1, 1) translate(-12.000000, -9.000000) ", 30684 points: "7 0 24 0 20 18 7 16.5" 30685 }, null, 8, _hoisted_22) 30686 ]), 30687 vue.createElementVNode("polygon", { 30688 id: "Rectangle-Copy-18", 30689 fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-2")})`, 30690 transform: "translate(66.000000, 51.500000) scale(-1, 1) translate(-66.000000, -51.500000) ", 30691 points: "62 45 79 45 70 58 53 58" 30692 }, null, 8, _hoisted_23) 30693 ]) 30694 ]) 30695 ]) 30696 ]); 30697 }; 30698 } 30699 }); 30700 var ImgEmpty = /* @__PURE__ */ _export_sfc(_sfc_main$10, [["__file", "img-empty.vue"]]); 30701 30702 const emptyProps = buildProps({ 30703 image: { 30704 type: String, 30705 default: "" 30706 }, 30707 imageSize: Number, 30708 description: { 30709 type: String, 30710 default: "" 30711 } 30712 }); 30713 30714 const _hoisted_1$v = ["src"]; 30715 const _hoisted_2$k = { key: 1 }; 30716 const __default__$K = vue.defineComponent({ 30717 name: "ElEmpty" 30718 }); 30719 const _sfc_main$$ = /* @__PURE__ */ vue.defineComponent({ 30720 ...__default__$K, 30721 props: emptyProps, 30722 setup(__props) { 30723 const props = __props; 30724 const { t } = useLocale(); 30725 const ns = useNamespace("empty"); 30726 const emptyDescription = vue.computed(() => props.description || t("el.table.emptyText")); 30727 const imageStyle = vue.computed(() => ({ 30728 width: addUnit(props.imageSize) 30729 })); 30730 return (_ctx, _cache) => { 30731 return vue.openBlock(), vue.createElementBlock("div", { 30732 class: vue.normalizeClass(vue.unref(ns).b()) 30733 }, [ 30734 vue.createElementVNode("div", { 30735 class: vue.normalizeClass(vue.unref(ns).e("image")), 30736 style: vue.normalizeStyle(vue.unref(imageStyle)) 30737 }, [ 30738 _ctx.image ? (vue.openBlock(), vue.createElementBlock("img", { 30739 key: 0, 30740 src: _ctx.image, 30741 ondragstart: "return false" 30742 }, null, 8, _hoisted_1$v)) : vue.renderSlot(_ctx.$slots, "image", { key: 1 }, () => [ 30743 vue.createVNode(ImgEmpty) 30744 ]) 30745 ], 6), 30746 vue.createElementVNode("div", { 30747 class: vue.normalizeClass(vue.unref(ns).e("description")) 30748 }, [ 30749 _ctx.$slots.description ? vue.renderSlot(_ctx.$slots, "description", { key: 0 }) : (vue.openBlock(), vue.createElementBlock("p", _hoisted_2$k, vue.toDisplayString(vue.unref(emptyDescription)), 1)) 30750 ], 2), 30751 _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("div", { 30752 key: 0, 30753 class: vue.normalizeClass(vue.unref(ns).e("bottom")) 30754 }, [ 30755 vue.renderSlot(_ctx.$slots, "default") 30756 ], 2)) : vue.createCommentVNode("v-if", true) 30757 ], 2); 30758 }; 30759 } 30760 }); 30761 var Empty = /* @__PURE__ */ _export_sfc(_sfc_main$$, [["__file", "empty.vue"]]); 30762 30763 const ElEmpty = withInstall(Empty); 30764 30765 const imageViewerProps = buildProps({ 30766 urlList: { 30767 type: definePropType(Array), 30768 default: () => mutable([]) 30769 }, 30770 zIndex: { 30771 type: Number 30772 }, 30773 initialIndex: { 30774 type: Number, 30775 default: 0 30776 }, 30777 infinite: { 30778 type: Boolean, 30779 default: true 30780 }, 30781 hideOnClickModal: { 30782 type: Boolean, 30783 default: false 30784 }, 30785 teleported: { 30786 type: Boolean, 30787 default: false 30788 }, 30789 closeOnPressEscape: { 30790 type: Boolean, 30791 default: true 30792 }, 30793 zoomRate: { 30794 type: Number, 30795 default: 1.2 30796 } 30797 });
30798 const imageViewerEmits = { 30799 close: () => true, 30800 switch: (index) => isNumber(index) 30801 }; 30802 30803 const _hoisted_1$u = ["src"]; 30804 const __default__$J = vue.defineComponent({ 30805 name: "ElImageViewer" 30806 }); 30807 const _sfc_main$_ = /* @__PURE__ */ vue.defineComponent({ 30808 ...__default__$J, 30809 props: imageViewerProps, 30810 emits: imageViewerEmits, 30811 setup(__props, { expose, emit }) { 30812 const props = __props; 30813 const modes = { 30814 CONTAIN: { 30815 name: "contain", 30816 icon: vue.markRaw(full_screen_default) 30817 }, 30818 ORIGINAL: { 30819 name: "original", 30820 icon: vue.markRaw(scale_to_original_default) 30821 } 30822 }; 30823 const { t } = useLocale(); 30824 const ns = useNamespace("image-viewer"); 30825 const { nextZIndex } = useZIndex(); 30826 const wrapper = vue.ref(); 30827 const imgRefs = vue.ref([]); 30828 const scopeEventListener = vue.effectScope(); 30829 const loading = vue.ref(true); 30830 const activeIndex = vue.ref(props.initialIndex); 30831 const mode = vue.shallowRef(modes.CONTAIN); 30832 const transform = vue.ref({ 30833 scale: 1, 30834 deg: 0, 30835 offsetX: 0, 30836 offsetY: 0, 30837 enableTransition: false 30838 }); 30839 const isSingle = vue.computed(() => { 30840 const { urlList } = props; 30841 return urlList.length <= 1; 30842 }); 30843 const isFirst = vue.computed(() => { 30844 return activeIndex.value === 0; 30845 }); 30846 const isLast = vue.computed(() => { 30847 return activeIndex.value === props.urlList.length - 1; 30848 }); 30849 const currentImg = vue.computed(() => { 30850 return props.urlList[activeIndex.value]; 30851 }); 30852 const imgStyle = vue.computed(() => { 30853 const { scale, deg, offsetX, offsetY, enableTransition } = transform.value; 30854 let translateX = offsetX / scale; 30855 let translateY = offsetY / scale; 30856 switch (deg % 360) { 30857 case 90: 30858 case -270: 30859 [translateX, translateY] = [translateY, -translateX]; 30860 break; 30861 case 180: 30862 case -180: 30863 [translateX, translateY] = [-translateX, -translateY]; 30864 break; 30865 case 270: 30866 case -90: 30867 [translateX, translateY] = [-translateY, translateX]; 30868 break; 30869 } 30870 const style = { 30871 transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`, 30872 transition: enableTransition ? "transform .3s" : "" 30873 }; 30874 if (mode.value.name === modes.CONTAIN.name) { 30875 style.maxWidth = style.maxHeight = "100%"; 30876 } 30877 return style; 30878 }); 30879 const computedZIndex = vue.computed(() => { 30880 return isNumber(props.zIndex) ? props.zIndex : nextZIndex(); 30881 }); 30882 function hide() { 30883 unregisterEventListener(); 30884 emit("close"); 30885 } 30886 function registerEventListener() { 30887 const keydownHandler = throttle((e) => { 30888 switch (e.code) { 30889 case EVENT_CODE.esc: 30890 props.closeOnPressEscape && hide(); 30891 break; 30892 case EVENT_CODE.space: 30893 toggleMode(); 30894 break; 30895 case EVENT_CODE.left: 30896 prev(); 30897 break; 30898 case EVENT_CODE.up: 30899 handleActions("zoomIn"); 30900 break; 30901 case EVENT_CODE.right: 30902 next(); 30903 break; 30904 case EVENT_CODE.down: 30905 handleActions("zoomOut"); 30906 break; 30907 } 30908 }); 30909 const mousewheelHandler = throttle((e) => { 30910 const delta = e.deltaY || e.deltaX; 30911 handleActions(delta < 0 ? "zoomIn" : "zoomOut", { 30912 zoomRate: props.zoomRate, 30913 enableTransition: false 30914 }); 30915 }); 30916 scopeEventListener.run(() => { 30917 useEventListener(document, "keydown", keydownHandler); 30918 useEventListener(document, "wheel", mousewheelHandler); 30919 }); 30920 } 30921 function unregisterEventListener() { 30922 scopeEventListener.stop(); 30923 } 30924 function handleImgLoad() { 30925 loading.value = false; 30926 } 30927 function handleImgError(e) { 30928 loading.value = false; 30929 e.target.alt = t("el.image.error"); 30930 } 30931 function handleMouseDown(e) { 30932 if (loading.value || e.button !== 0 || !wrapper.value) 30933 return; 30934 transform.value.enableTransition = false; 30935 const { offsetX, offsetY } = transform.value; 30936 const startX = e.pageX; 30937 const startY = e.pageY; 30938 const dragHandler = throttle((ev) => { 30939 transform.value = { 30940 ...transform.value, 30941 offsetX: offsetX + ev.pageX - startX, 30942 offsetY: offsetY + ev.pageY - startY 30943 }; 30944 }); 30945 const removeMousemove = useEventListener(document, "mousemove", dragHandler); 30946 useEventListener(document, "mouseup", () => { 30947 removeMousemove(); 30948 }); 30949 e.preventDefault(); 30950 } 30951 function reset() { 30952 transform.value = { 30953 scale: 1, 30954 deg: 0, 30955 offsetX: 0, 30956 offsetY: 0, 30957 enableTransition: false 30958 }; 30959 } 30960 function toggleMode() { 30961 if (loading.value) 30962 return; 30963 const modeNames = keysOf(modes); 30964 const modeValues = Object.values(modes); 30965 const currentMode = mode.value.name; 30966 const index = modeValues.findIndex((i) => i.name === currentMode); 30967 const nextIndex = (index + 1) % modeNames.length; 30968 mode.value = modes[modeNames[nextIndex]]; 30969 reset(); 30970 } 30971 function setActiveItem(index) { 30972 const len = props.urlList.length; 30973 activeIndex.value = (index + len) % len; 30974 } 30975 function prev() { 30976 if (isFirst.value && !props.infinite) 30977 return;
30978 setActiveItem(activeIndex.value - 1); 30979 } 30980 function next() { 30981 if (isLast.value && !props.infinite) 30982 return; 30983 setActiveItem(activeIndex.value + 1); 30984 } 30985 function handleActions(action, options = {}) { 30986 if (loading.value) 30987 return; 30988 const { zoomRate, rotateDeg, enableTransition } = { 30989 zoomRate: props.zoomRate, 30990 rotateDeg: 90, 30991 enableTransition: true, 30992 ...options 30993 }; 30994 switch (action) { 30995 case "zoomOut": 30996 if (transform.value.scale > 0.2) { 30997 transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3)); 30998 } 30999 break; 31000 case "zoomIn": 31001 if (transform.value.scale < 7) { 31002 transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3)); 31003 } 31004 break; 31005 case "clockwise": 31006 transform.value.deg += rotateDeg; 31007 break; 31008 case "anticlockwise": 31009 transform.value.deg -= rotateDeg; 31010 break; 31011 } 31012 transform.value.enableTransition = enableTransition; 31013 } 31014 vue.watch(currentImg, () => { 31015 vue.nextTick(() => { 31016 const $img = imgRefs.value[0]; 31017 if (!($img == null ? void 0 : $img.complete)) { 31018 loading.value = true; 31019 } 31020 }); 31021 }); 31022 vue.watch(activeIndex, (val) => { 31023 reset(); 31024 emit("switch", val); 31025 }); 31026 vue.onMounted(() => { 31027 var _a, _b; 31028 registerEventListener(); 31029 (_b = (_a = wrapper.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a); 31030 }); 31031 expose({
31032 setActiveItem 31033 }); 31034 return (_ctx, _cache) => { 31035 return vue.openBlock(), vue.createBlock(vue.Teleport, { 31036 to: "body", 31037 disabled: !_ctx.teleported 31038 }, [ 31039 vue.createVNode(vue.Transition, { 31040 name: "viewer-fade", 31041 appear: "" 31042 }, { 31043 default: vue.withCtx(() => [ 31044 vue.createElementVNode("div", { 31045 ref_key: "wrapper", 31046 ref: wrapper, 31047 tabindex: -1, 31048 class: vue.normalizeClass(vue.unref(ns).e("wrapper")), 31049 style: vue.normalizeStyle({ zIndex: vue.unref(computedZIndex) }) 31050 }, [ 31051 vue.createElementVNode("div", { 31052 class: vue.normalizeClass(vue.unref(ns).e("mask")), 31053 onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => _ctx.hideOnClickModal && hide(), ["self"])) 31054 }, null, 2), 31055 vue.createCommentVNode(" CLOSE "), 31056 vue.createElementVNode("span", { 31057 class: vue.normalizeClass([vue.unref(ns).e("btn"), vue.unref(ns).e("close")]), 31058 onClick: hide 31059 }, [ 31060 vue.createVNode(vue.unref(ElIcon), null, { 31061 default: vue.withCtx(() => [ 31062 vue.createVNode(vue.unref(close_default)) 31063 ]), 31064 _: 1 31065 }) 31066 ], 2), 31067 vue.createCommentVNode(" ARROW "), 31068 !vue.unref(isSingle) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ 31069 vue.createElementVNode("span", { 31070 class: vue.normalizeClass([ 31071 vue.unref(ns).e("btn"), 31072 vue.unref(ns).e("prev"), 31073 vue.unref(ns).is("disabled", !_ctx.infinite && vue.unref(isFirst)) 31074 ]), 31075 onClick: prev 31076 }, [ 31077 vue.createVNode(vue.unref(ElIcon), null, { 31078 default: vue.withCtx(() => [ 31079 vue.createVNode(vue.unref(arrow_left_default)) 31080 ]), 31081 _: 1 31082 }) 31083 ], 2), 31084 vue.createElementVNode("span", { 31085 class: vue.normalizeClass([ 31086 vue.unref(ns).e("btn"), 31087 vue.unref(ns).e("next"), 31088 vue.unref(ns).is("disabled", !_ctx.infinite && vue.unref(isLast)) 31089 ]), 31090 onClick: next 31091 }, [ 31092 vue.createVNode(vue.unref(ElIcon), null, { 31093 default: vue.withCtx(() => [ 31094 vue.createVNode(vue.unref(arrow_right_default)) 31095 ]), 31096 _: 1 31097 }) 31098 ], 2) 31099 ], 64)) : vue.createCommentVNode("v-if", true), 31100 vue.createCommentVNode(" ACTIONS "), 31101 vue.createElementVNode("div", { 31102 class: vue.normalizeClass([vue.unref(ns).e("btn"), vue.unref(ns).e("actions")]) 31103 }, [ 31104 vue.createElementVNode("div", { 31105 class: vue.normalizeClass(vue.unref(ns).e("actions__inner")) 31106 }, [ 31107 vue.createVNode(vue.unref(ElIcon), { 31108 onClick: _cache[1] || (_cache[1] = ($event) => handleActions("zoomOut")) 31109 }, { 31110 default: vue.withCtx(() => [ 31111 vue.createVNode(vue.unref(zoom_out_default)) 31112 ]), 31113 _: 1 31114 }), 31115 vue.createVNode(vue.unref(ElIcon), { 31116 onClick: _cache[2] || (_cache[2] = ($event) => handleActions("zoomIn")) 31117 }, { 31118 default: vue.withCtx(() => [ 31119 vue.createVNode(vue.unref(zoom_in_default)) 31120 ]), 31121 _: 1 31122 }), 31123 vue.createElementVNode("i", { 31124 class: vue.normalizeClass(vue.unref(ns).e("actions__divider")) 31125 }, null, 2), 31126 vue.createVNode(vue.unref(ElIcon), { onClick: toggleMode }, { 31127 default: vue.withCtx(() => [ 31128 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(mode).icon))) 31129 ]), 31130 _: 1 31131 }), 31132 vue.createElementVNode("i", { 31133 class: vue.normalizeClass(vue.unref(ns).e("actions__divider")) 31134 }, null, 2), 31135 vue.createVNode(vue.unref(ElIcon), { 31136 onClick: _cache[3] || (_cache[3] = ($event) => handleActions("anticlockwise")) 31137 }, { 31138 default: vue.withCtx(() => [ 31139 vue.createVNode(vue.unref(refresh_left_default)) 31140 ]), 31141 _: 1 31142 }), 31143 vue.createVNode(vue.unref(ElIcon), { 31144 onClick: _cache[4] || (_cache[4] = ($event) => handleActions("clockwise")) 31145 }, { 31146 default: vue.withCtx(() => [ 31147 vue.createVNode(vue.unref(refresh_right_default)) 31148 ]), 31149 _: 1 31150 }) 31151 ], 2) 31152 ], 2), 31153 vue.createCommentVNode(" CANVAS "), 31154 vue.createElementVNode("div", { 31155 class: vue.normalizeClass(vue.unref(ns).e("canvas")) 31156 }, [ 31157 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.urlList, (url, i) => { 31158 return vue.withDirectives((vue.openBlock(), vue.createElementBlock("img", { 31159 ref_for: true, 31160 ref: (el) => imgRefs.value[i] = el, 31161 key: url, 31162 src: url, 31163 style: vue.normalizeStyle(vue.unref(imgStyle)), 31164 class: vue.normalizeClass(vue.unref(ns).e("img")), 31165 onLoad: handleImgLoad, 31166 onError: handleImgError, 31167 onMousedown: handleMouseDown 31168 }, null, 46, _hoisted_1$u)), [ 31169 [vue.vShow, i === activeIndex.value] 31170 ]); 31171 }), 128)) 31172 ], 2),
31173 vue.renderSlot(_ctx.$slots, "default") 31174 ], 6) 31175 ]), 31176 _: 3 31177 }) 31178 ], 8, ["disabled"]); 31179 }; 31180 } 31181 }); 31182 var ImageViewer = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["__file", "image-viewer.vue"]]); 31183 31184 const ElImageViewer = withInstall(ImageViewer); 31185 31186 const imageProps = buildProps({ 31187 hideOnClickModal: { 31188 type: Boolean, 31189 default: false 31190 }, 31191 src: { 31192 type: String, 31193 default: "" 31194 }, 31195 fit: { 31196 type: String, 31197 values: ["", "contain", "cover", "fill", "none", "scale-down"], 31198 default: "" 31199 }, 31200 loading: { 31201 type: String, 31202 values: ["eager", "lazy"] 31203 }, 31204 lazy: { 31205 type: Boolean, 31206 default: false 31207 }, 31208 scrollContainer: { 31209 type: definePropType([String, Object]) 31210 }, 31211 previewSrcList: { 31212 type: definePropType(Array), 31213 default: () => mutable([]) 31214 }, 31215 previewTeleported: { 31216 type: Boolean, 31217 default: false 31218 }, 31219 zIndex: { 31220 type: Number 31221 }, 31222 initialIndex: { 31223 type: Number, 31224 default: 0 31225 }, 31226 infinite: { 31227 type: Boolean, 31228 default: true 31229 }, 31230 closeOnPressEscape: { 31231 type: Boolean, 31232 default: true 31233 }, 31234 zoomRate: { 31235 type: Number, 31236 default: 1.2 31237 } 31238 }); 31239 const imageEmits = { 31240 load: (evt) => evt instanceof Event, 31241 error: (evt) => evt instanceof Event, 31242 switch: (val) => isNumber(val), 31243 close: () => true, 31244 show: () => true 31245 }; 31246 31247 const _hoisted_1$t = ["src", "loading"]; 31248 const _hoisted_2$j = { key: 0 }; 31249 const __default__$I = vue.defineComponent({ 31250 name: "ElImage", 31251 inheritAttrs: false 31252 }); 31253 const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({ 31254 ...__default__$I, 31255 props: imageProps, 31256 emits: imageEmits, 31257 setup(__props, { emit }) { 31258 const props = __props; 31259 let prevOverflow = ""; 31260 const { t } = useLocale(); 31261 const ns = useNamespace("image"); 31262 const rawAttrs = vue.useAttrs(); 31263 const attrs = useAttrs(); 31264 const imageSrc = vue.ref(); 31265 const hasLoadError = vue.ref(false); 31266 const isLoading = vue.ref(true); 31267 const showViewer = vue.ref(false); 31268 const container = vue.ref(); 31269 const _scrollContainer = vue.ref(); 31270 const supportLoading = isClient && "loading" in HTMLImageElement.prototype; 31271 let stopScrollListener; 31272 let stopWheelListener; 31273 const containerStyle = vue.computed(() => rawAttrs.style); 31274 const imageStyle = vue.computed(() => { 31275 const { fit } = props; 31276 if (isClient && fit) { 31277 return { objectFit: fit }; 31278 } 31279 return {}; 31280 }); 31281 const preview = vue.computed(() => { 31282 const { previewSrcList } = props; 31283 return Array.isArray(previewSrcList) && previewSrcList.length > 0; 31284 }); 31285 const imageIndex = vue.computed(() => { 31286 const { previewSrcList, initialIndex } = props; 31287 let previewIndex = initialIndex; 31288 if (initialIndex > previewSrcList.length - 1) { 31289 previewIndex = 0; 31290 } 31291 return previewIndex; 31292 }); 31293 const isManual = vue.computed(() => { 31294 if (props.loading === "eager") 31295 return false; 31296 return !supportLoading && props.loading === "lazy" || props.lazy; 31297 }); 31298 const loadImage = () => { 31299 if (!isClient) 31300 return; 31301 isLoading.value = true; 31302 hasLoadError.value = false; 31303 imageSrc.value = props.src; 31304 }; 31305 function handleLoad(event) { 31306 isLoading.value = false; 31307 hasLoadError.value = false; 31308 emit("load", event); 31309 } 31310 function handleError(event) { 31311 isLoading.value = false; 31312 hasLoadError.value = true; 31313 emit("error", event); 31314 } 31315 function handleLazyLoad() { 31316 if (isInContainer(container.value, _scrollContainer.value)) { 31317 loadImage(); 31318 removeLazyLoadListener(); 31319 } 31320 } 31321 const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200, true); 31322 async function addLazyLoadListener() { 31323 var _a; 31324 if (!isClient) 31325 return; 31326 await vue.nextTick(); 31327 const { scrollContainer } = props; 31328 if (isElement$1(scrollContainer)) {
31329 _scrollContainer.value = scrollContainer; 31330 } else if (isString$1(scrollContainer) && scrollContainer !== "") { 31331 _scrollContainer.value = (_a = document.querySelector(scrollContainer)) != null ? _a : void 0; 31332 } else if (container.value) { 31333 _scrollContainer.value = getScrollContainer(container.value); 31334 } 31335 if (_scrollContainer.value) { 31336 stopScrollListener = useEventListener(_scrollContainer, "scroll", lazyLoadHandler); 31337 setTimeout(() => handleLazyLoad(), 100); 31338 } 31339 } 31340 function removeLazyLoadListener() { 31341 if (!isClient || !_scrollContainer.value || !lazyLoadHandler) 31342 return; 31343 stopScrollListener == null ? void 0 : stopScrollListener(); 31344 _scrollContainer.value = void 0; 31345 } 31346 function wheelHandler(e) { 31347 if (!e.ctrlKey) 31348 return; 31349 if (e.deltaY < 0) { 31350 e.preventDefault(); 31351 return false; 31352 } else if (e.deltaY > 0) { 31353 e.preventDefault(); 31354 return false; 31355 } 31356 } 31357 function clickHandler() { 31358 if (!preview.value) 31359 return; 31360 stopWheelListener = useEventListener("wheel", wheelHandler, { 31361 passive: false 31362 }); 31363 prevOverflow = document.body.style.overflow; 31364 document.body.style.overflow = "hidden"; 31365 showViewer.value = true; 31366 emit("show"); 31367 } 31368 function closeViewer() { 31369 stopWheelListener == null ? void 0 : stopWheelListener(); 31370 document.body.style.overflow = prevOverflow; 31371 showViewer.value = false; 31372 emit("close"); 31373 } 31374 function switchViewer(val) { 31375 emit("switch", val); 31376 } 31377 vue.watch(() => props.src, () => { 31378 if (isManual.value) { 31379 isLoading.value = true; 31380 hasLoadError.value = false; 31381 removeLazyLoadListener(); 31382 addLazyLoadListener(); 31383 } else { 31384 loadImage(); 31385 } 31386 }); 31387 vue.onMounted(() => { 31388 if (isManual.value) { 31389 addLazyLoadListener(); 31390 } else { 31391 loadImage(); 31392 } 31393 }); 31394 return (_ctx, _cache) => { 31395 return vue.openBlock(), vue.createElementBlock("div", { 31396 ref_key: "container", 31397 ref: container, 31398 class: vue.normalizeClass([vue.unref(ns).b(), _ctx.$attrs.class]), 31399 style: vue.normalizeStyle(vue.unref(containerStyle)) 31400 }, [ 31401 hasLoadError.value ? vue.renderSlot(_ctx.$slots, "error", { key: 0 }, () => [ 31402 vue.createElementVNode("div", { 31403 class: vue.normalizeClass(vue.unref(ns).e("error")) 31404 }, vue.toDisplayString(vue.unref(t)("el.image.error")), 3) 31405 ]) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [ 31406 imageSrc.value !== void 0 ? (vue.openBlock(), vue.createElementBlock("img", vue.mergeProps({ key: 0 }, vue.unref(attrs), { 31407 src: imageSrc.value, 31408 loading: _ctx.loading, 31409 style: vue.unref(imageStyle), 31410 class: [ 31411 vue.unref(ns).e("inner"), 31412 vue.unref(preview) && vue.unref(ns).e("preview"), 31413 isLoading.value && vue.unref(ns).is("loading") 31414 ], 31415 onClick: clickHandler, 31416 onLoad: handleLoad, 31417 onError: handleError 31418 }), null, 16, _hoisted_1$t)) : vue.createCommentVNode("v-if", true), 31419 isLoading.value ? (vue.openBlock(), vue.createElementBlock("div", { 31420 key: 1, 31421 class: vue.normalizeClass(vue.unref(ns).e("wrapper")) 31422 }, [ 31423 vue.renderSlot(_ctx.$slots, "placeholder", {}, () => [ 31424 vue.createElementVNode("div", { 31425 class: vue.normalizeClass(vue.unref(ns).e("placeholder")) 31426 }, null, 2) 31427 ]) 31428 ], 2)) : vue.createCommentVNode("v-if", true) 31429 ], 64)), 31430 vue.unref(preview) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [ 31431 showViewer.value ? (vue.openBlock(), vue.createBlock(vue.unref(ElImageViewer), { 31432 key: 0, 31433 "z-index": _ctx.zIndex, 31434 "initial-index": vue.unref(imageIndex), 31435 infinite: _ctx.infinite, 31436 "zoom-rate": _ctx.zoomRate, 31437 "url-list": _ctx.previewSrcList, 31438 "hide-on-click-modal": _ctx.hideOnClickModal, 31439 teleported: _ctx.previewTeleported, 31440 "close-on-press-escape": _ctx.closeOnPressEscape, 31441 onClose: closeViewer, 31442 onSwitch: switchViewer 31443 }, { 31444 default: vue.withCtx(() => [ 31445 _ctx.$slots.viewer ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$j, [
31446 vue.renderSlot(_ctx.$slots, "viewer") 31447 ])) : vue.createCommentVNode("v-if", true) 31448 ]), 31449 _: 3 31450 }, 8, ["z-index", "initial-index", "infinite", "zoom-rate", "url-list", "hide-on-click-modal", "teleported", "close-on-press-escape"])) : vue.createCommentVNode("v-if", true) 31451 ], 64)) : vue.createCommentVNode("v-if", true) 31452 ], 6); 31453 }; 31454 } 31455 }); 31456 var Image = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__file", "image.vue"]]); 31457 31458 const ElImage = withInstall(Image); 31459 31460 const inputNumberProps = buildProps({ 31461 id: { 31462 type: String, 31463 default: void 0 31464 }, 31465 step: { 31466 type: Number, 31467 default: 1 31468 }, 31469 stepStrictly: Boolean, 31470 max: { 31471 type: Number, 31472 default: Number.POSITIVE_INFINITY 31473 }, 31474 min: { 31475 type: Number, 31476 default: Number.NEGATIVE_INFINITY 31477 }, 31478 modelValue: Number, 31479 readonly: Boolean, 31480 disabled: Boolean, 31481 size: useSizeProp, 31482 controls: { 31483 type: Boolean, 31484 default: true 31485 }, 31486 controlsPosition: { 31487 type: String, 31488 default: "", 31489 values: ["", "right"] 31490 }, 31491 valueOnClear: { 31492 type: [String, Number, null], 31493 validator: (val) => val === null || isNumber(val) || ["min", "max"].includes(val), 31494 default: null 31495 }, 31496 name: String, 31497 label: String, 31498 placeholder: String, 31499 precision: { 31500 type: Number, 31501 validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10) 31502 }, 31503 validateEvent: { 31504 type: Boolean, 31505 default: true 31506 } 31507 }); 31508 const inputNumberEmits = { 31509 [CHANGE_EVENT]: (cur, prev) => prev !== cur, 31510 blur: (e) => e instanceof FocusEvent, 31511 focus: (e) => e instanceof FocusEvent, 31512 [INPUT_EVENT]: (val) => isNumber(val) || isNil(val), 31513 [UPDATE_MODEL_EVENT]: (val) => isNumber(val) || isNil(val) 31514 }; 31515 31516 const _hoisted_1$s = ["aria-label", "onKeydown"]; 31517 const _hoisted_2$i = ["aria-label", "onKeydown"]; 31518 const __default__$H = vue.defineComponent({ 31519 name: "ElInputNumber" 31520 }); 31521 const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({ 31522 ...__default__$H, 31523 props: inputNumberProps, 31524 emits: inputNumberEmits, 31525 setup(__props, { expose, emit }) { 31526 const props = __props; 31527 const { t } = useLocale(); 31528 const ns = useNamespace("input-number"); 31529 const input = vue.ref(); 31530 const data = vue.reactive({ 31531 currentValue: props.modelValue, 31532 userInput: null 31533 }); 31534 const { formItem } = useFormItem(); 31535 const minDisabled = vue.computed(() => isNumber(props.modelValue) && props.modelValue <= props.min); 31536 const maxDisabled = vue.computed(() => isNumber(props.modelValue) && props.modelValue >= props.max); 31537 const numPrecision = vue.computed(() => { 31538 const stepPrecision = getPrecision(props.step); 31539 if (!isUndefined(props.precision)) { 31540 if (stepPrecision > props.precision) ; 31541 return props.precision; 31542 } else { 31543 return Math.max(getPrecision(props.modelValue), stepPrecision); 31544 } 31545 }); 31546 const controlsAtRight = vue.computed(() => { 31547 return props.controls && props.controlsPosition === "right"; 31548 }); 31549 const inputNumberSize = useFormSize(); 31550 const inputNumberDisabled = useFormDisabled(); 31551 const displayValue = vue.computed(() => { 31552 if (data.userInput !== null) { 31553 return data.userInput; 31554 } 31555 let currentValue = data.currentValue; 31556 if (isNil(currentValue)) 31557 return ""; 31558 if (isNumber(currentValue)) { 31559 if (Number.isNaN(currentValue)) 31560 return ""; 31561 if (!isUndefined(props.precision)) { 31562 currentValue = currentValue.toFixed(props.precision); 31563 } 31564 } 31565 return currentValue; 31566 }); 31567 const toPrecision = (num, pre) => { 31568 if (isUndefined(pre)) 31569 pre = numPrecision.value; 31570 if (pre === 0) 31571 return Math.round(num); 31572 let snum = String(num);
31573 const pointPos = snum.indexOf("."); 31574 if (pointPos === -1) 31575 return num; 31576 const nums = snum.replace(".", "").split(""); 31577 const datum = nums[pointPos + pre]; 31578 if (!datum) 31579 return num; 31580 const length = snum.length; 31581 if (snum.charAt(length - 1) === "5") { 31582 snum = `${snum.slice(0, Math.max(0, length - 1))}6`; 31583 } 31584 return Number.parseFloat(Number(snum).toFixed(pre)); 31585 }; 31586 const getPrecision = (value) => { 31587 if (isNil(value)) 31588 return 0; 31589 const valueString = value.toString(); 31590 const dotPosition = valueString.indexOf("."); 31591 let precision = 0; 31592 if (dotPosition !== -1) { 31593 precision = valueString.length - dotPosition - 1; 31594 } 31595 return precision; 31596 }; 31597 const ensurePrecision = (val, coefficient = 1) => { 31598 if (!isNumber(val)) 31599 return data.currentValue; 31600 return toPrecision(val + props.step * coefficient); 31601 }; 31602 const increase = () => { 31603 if (props.readonly || inputNumberDisabled.value || maxDisabled.value) 31604 return; 31605 const value = Number(displayValue.value) || 0; 31606 const newVal = ensurePrecision(value); 31607 setCurrentValue(newVal); 31608 emit(INPUT_EVENT, data.currentValue); 31609 }; 31610 const decrease = () => { 31611 if (props.readonly || inputNumberDisabled.value || minDisabled.value) 31612 return; 31613 const value = Number(displayValue.value) || 0; 31614 const newVal = ensurePrecision(value, -1); 31615 setCurrentValue(newVal); 31616 emit(INPUT_EVENT, data.currentValue); 31617 }; 31618 const verifyValue = (value, update) => { 31619 const { max, min, step, precision, stepStrictly, valueOnClear } = props; 31620 if (max < min) { 31621 throwError("InputNumber", "min should not be greater than max."); 31622 } 31623 let newVal = Number(value); 31624 if (isNil(value) || Number.isNaN(newVal)) { 31625 return null; 31626 } 31627 if (value === "") { 31628 if (valueOnClear === null) { 31629 return null; 31630 } 31631 newVal = isString$1(valueOnClear) ? { min, max }[valueOnClear] : valueOnClear; 31632 } 31633 if (stepStrictly) { 31634 newVal = toPrecision(Math.round(newVal / step) * step, precision); 31635 } 31636 if (!isUndefined(precision)) { 31637 newVal = toPrecision(newVal, precision); 31638 } 31639 if (newVal > max || newVal < min) { 31640 newVal = newVal > max ? max : min; 31641 update && emit(UPDATE_MODEL_EVENT, newVal); 31642 } 31643 return newVal; 31644 }; 31645 const setCurrentValue = (value, emitChange = true) => { 31646 var _a; 31647 const oldVal = data.currentValue; 31648 const newVal = verifyValue(value); 31649 if (!emitChange) { 31650 emit(UPDATE_MODEL_EVENT, newVal); 31651 return; 31652 } 31653 if (oldVal === newVal) 31654 return; 31655 data.userInput = null; 31656 emit(UPDATE_MODEL_EVENT, newVal); 31657 emit(CHANGE_EVENT, newVal, oldVal); 31658 if (props.validateEvent) { 31659 (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn()); 31660 } 31661 data.currentValue = newVal; 31662 }; 31663 const handleInput = (value) => { 31664 data.userInput = value; 31665 const newVal = value === "" ? null : Number(value); 31666 emit(INPUT_EVENT, newVal); 31667 setCurrentValue(newVal, false); 31668 }; 31669 const handleInputChange = (value) => { 31670 const newVal = value !== "" ? Number(value) : ""; 31671 if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") { 31672 setCurrentValue(newVal); 31673 } 31674 data.userInput = null; 31675 }; 31676 const focus = () => { 31677 var _a, _b; 31678 (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a); 31679 }; 31680 const blur = () => { 31681 var _a, _b; 31682 (_b = (_a = input.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a); 31683 }; 31684 const handleFocus = (event) => { 31685 emit("focus", event); 31686 }; 31687 const handleBlur = (event) => { 31688 var _a; 31689 emit("blur", event); 31690 if (props.validateEvent) { 31691 (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn()); 31692 } 31693 }; 31694 vue.watch(() => props.modelValue, (value) => { 31695 const userInput = verifyValue(data.userInput); 31696 const newValue = verifyValue(value, true); 31697 if (!isNumber(userInput) && (!userInput || userInput !== newValue)) { 31698 data.currentValue = newValue; 31699 data.userInput = null; 31700 } 31701 }, { immediate: true });
31702 vue.onMounted(() => { 31703 var _a; 31704 const { min, max, modelValue } = props; 31705 const innerInput = (_a = input.value) == null ? void 0 : _a.input; 31706 innerInput.setAttribute("role", "spinbutton"); 31707 if (Number.isFinite(max)) { 31708 innerInput.setAttribute("aria-valuemax", String(max)); 31709 } else { 31710 innerInput.removeAttribute("aria-valuemax"); 31711 } 31712 if (Number.isFinite(min)) { 31713 innerInput.setAttribute("aria-valuemin", String(min)); 31714 } else { 31715 innerInput.removeAttribute("aria-valuemin"); 31716 } 31717 innerInput.setAttribute("aria-valuenow", String(data.currentValue)); 31718 innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value)); 31719 if (!isNumber(modelValue) && modelValue != null) { 31720 let val = Number(modelValue); 31721 if (Number.isNaN(val)) { 31722 val = null; 31723 } 31724 emit(UPDATE_MODEL_EVENT, val); 31725 } 31726 }); 31727 vue.onUpdated(() => { 31728 var _a; 31729 const innerInput = (_a = input.value) == null ? void 0 : _a.input; 31730 innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", `${data.currentValue}`); 31731 }); 31732 expose({ 31733 focus, 31734 blur 31735 }); 31736 return (_ctx, _cache) => { 31737 return vue.openBlock(), vue.createElementBlock("div", { 31738 class: vue.normalizeClass([ 31739 vue.unref(ns).b(), 31740 vue.unref(ns).m(vue.unref(inputNumberSize)), 31741 vue.unref(ns).is("disabled", vue.unref(inputNumberDisabled)),
31742 vue.unref(ns).is("without-controls", !_ctx.controls), 31743 vue.unref(ns).is("controls-right", vue.unref(controlsAtRight)) 31744 ]), 31745 onDragstart: _cache[1] || (_cache[1] = vue.withModifiers(() => { 31746 }, ["prevent"])) 31747 }, [ 31748 _ctx.controls ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", { 31749 key: 0, 31750 role: "button", 31751 "aria-label": vue.unref(t)("el.inputNumber.decrease"), 31752 class: vue.normalizeClass([vue.unref(ns).e("decrease"), vue.unref(ns).is("disabled", vue.unref(minDisabled))]), 31753 onKeydown: vue.withKeys(decrease, ["enter"]) 31754 }, [ 31755 vue.createVNode(vue.unref(ElIcon), null, { 31756 default: vue.withCtx(() => [ 31757 vue.unref(controlsAtRight) ? (vue.openBlock(), vue.createBlock(vue.unref(arrow_down_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(minus_default), { key: 1 })) 31758 ]), 31759 _: 1 31760 }) 31761 ], 42, _hoisted_1$s)), [ 31762 [vue.unref(vRepeatClick), decrease] 31763 ]) : vue.createCommentVNode("v-if", true), 31764 _ctx.controls ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", { 31765 key: 1, 31766 role: "button", 31767 "aria-label": vue.unref(t)("el.inputNumber.increase"), 31768 class: vue.normalizeClass([vue.unref(ns).e("increase"), vue.unref(ns).is("disabled", vue.unref(maxDisabled))]), 31769 onKeydown: vue.withKeys(increase, ["enter"]) 31770 }, [ 31771 vue.createVNode(vue.unref(ElIcon), null, { 31772 default: vue.withCtx(() => [ 31773 vue.unref(controlsAtRight) ? (vue.openBlock(), vue.createBlock(vue.unref(arrow_up_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(plus_default), { key: 1 })) 31774 ]), 31775 _: 1 31776 }) 31777 ], 42, _hoisted_2$i)), [ 31778 [vue.unref(vRepeatClick), increase] 31779 ]) : vue.createCommentVNode("v-if", true), 31780 vue.createVNode(vue.unref(ElInput), { 31781 id: _ctx.id, 31782 ref_key: "input", 31783 ref: input, 31784 type: "number", 31785 step: _ctx.step, 31786 "model-value": vue.unref(displayValue), 31787 placeholder: _ctx.placeholder, 31788 readonly: _ctx.readonly, 31789 disabled: vue.unref(inputNumberDisabled), 31790 size: vue.unref(inputNumberSize), 31791 max: _ctx.max, 31792 min: _ctx.min, 31793 name: _ctx.name, 31794 label: _ctx.label, 31795 "validate-event": false, 31796 onWheel: _cache[0] || (_cache[0] = vue.withModifiers(() => { 31797 }, ["prevent"])), 31798 onKeydown: [ 31799 vue.withKeys(vue.withModifiers(increase, ["prevent"]), ["up"]), 31800 vue.withKeys(vue.withModifiers(decrease, ["prevent"]), ["down"]) 31801 ], 31802 onBlur: handleBlur, 31803 onFocus: handleFocus, 31804 onInput: handleInput, 31805 onChange: handleInputChange 31806 }, null, 8, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "label", "onKeydown"]) 31807 ], 34); 31808 }; 31809 } 31810 }); 31811 var InputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__file", "input-number.vue"]]); 31812 31813 const ElInputNumber = withInstall(InputNumber); 31814 31815 const linkProps = buildProps({ 31816 type: { 31817 type: String, 31818 values: ["primary", "success", "warning", "info", "danger", "default"], 31819 default: "default" 31820 }, 31821 underline: { 31822 type: Boolean, 31823 default: true 31824 }, 31825 disabled: { type: Boolean, default: false }, 31826 href: { type: String, default: "" }, 31827 icon: { 31828 type: iconPropType 31829 } 31830 }); 31831 const linkEmits = { 31832 click: (evt) => evt instanceof MouseEvent 31833 }; 31834 31835 const _hoisted_1$r = ["href"]; 31836 const __default__$G = vue.defineComponent({ 31837 name: "ElLink" 31838 });
31839 const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({ 31840 ...__default__$G, 31841 props: linkProps, 31842 emits: linkEmits, 31843 setup(__props, { emit }) { 31844 const props = __props; 31845 const ns = useNamespace("link"); 31846 const linkKls = vue.computed(() => [ 31847 ns.b(), 31848 ns.m(props.type), 31849 ns.is("disabled", props.disabled), 31850 ns.is("underline", props.underline && !props.disabled) 31851 ]); 31852 function handleClick(event) { 31853 if (!props.disabled) 31854 emit("click", event); 31855 } 31856 return (_ctx, _cache) => { 31857 return vue.openBlock(), vue.createElementBlock("a", { 31858 class: vue.normalizeClass(vue.unref(linkKls)), 31859 href: _ctx.disabled || !_ctx.href ? void 0 : _ctx.href, 31860 onClick: handleClick 31861 }, [ 31862 _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, { 31863 default: vue.withCtx(() => [ 31864 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon))) 31865 ]), 31866 _: 1 31867 })) : vue.createCommentVNode("v-if", true), 31868 _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", { 31869 key: 1, 31870 class: vue.normalizeClass(vue.unref(ns).e("inner")) 31871 }, [ 31872 vue.renderSlot(_ctx.$slots, "default") 31873 ], 2)) : vue.createCommentVNode("v-if", true), 31874 _ctx.$slots.icon ? vue.renderSlot(_ctx.$slots, "icon", { key: 2 }) : vue.createCommentVNode("v-if", true) 31875 ], 10, _hoisted_1$r); 31876 }; 31877 } 31878 }); 31879 var Link = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["__file", "link.vue"]]); 31880 31881 const ElLink = withInstall(Link); 31882 31883 class SubMenu$1 { 31884 constructor(parent, domNode) { 31885 this.parent = parent; 31886 this.domNode = domNode; 31887 this.subIndex = 0; 31888 this.subIndex = 0; 31889 this.init(); 31890 } 31891 init() { 31892 this.subMenuItems = this.domNode.querySelectorAll("li"); 31893 this.addListeners(); 31894 } 31895 gotoSubIndex(idx) { 31896 if (idx === this.subMenuItems.length) { 31897 idx = 0; 31898 } else if (idx < 0) { 31899 idx = this.subMenuItems.length - 1; 31900 } 31901 this.subMenuItems[idx].focus(); 31902 this.subIndex = idx; 31903 } 31904 addListeners() { 31905 const parentNode = this.parent.domNode; 31906 Array.prototype.forEach.call(this.subMenuItems, (el) => { 31907 el.addEventListener("keydown", (event) => { 31908 let prevDef = false; 31909 switch (event.code) { 31910 case EVENT_CODE.down: { 31911 this.gotoSubIndex(this.subIndex + 1); 31912 prevDef = true; 31913 break; 31914 } 31915 case EVENT_CODE.up: { 31916 this.gotoSubIndex(this.subIndex - 1); 31917 prevDef = true; 31918 break; 31919 } 31920 case EVENT_CODE.tab: { 31921 triggerEvent(parentNode, "mouseleave"); 31922 break; 31923 } 31924 case EVENT_CODE.enter: 31925 case EVENT_CODE.space: { 31926 prevDef = true; 31927 event.currentTarget.click(); 31928 break; 31929 } 31930 } 31931 if (prevDef) { 31932 event.preventDefault(); 31933 event.stopPropagation(); 31934 } 31935 return false; 31936 }); 31937 }); 31938 } 31939 } 31940 var SubMenu$2 = SubMenu$1; 31941 31942 class MenuItem$1 { 31943 constructor(domNode, namespace) { 31944 this.domNode = domNode; 31945 this.submenu = null; 31946 this.submenu = null; 31947 this.init(namespace); 31948 } 31949 init(namespace) { 31950 this.domNode.setAttribute("tabindex", "0"); 31951 const menuChild = this.domNode.querySelector(`.${namespace}-menu`); 31952 if (menuChild) { 31953 this.submenu = new SubMenu$2(this, menuChild); 31954 } 31955 this.addListeners(); 31956 } 31957 addListeners() { 31958 this.domNode.addEventListener("keydown", (event) => { 31959 let prevDef = false; 31960 switch (event.code) { 31961 case EVENT_CODE.down: { 31962 triggerEvent(event.currentTarget, "mouseenter"); 31963 this.submenu && this.submenu.gotoSubIndex(0); 31964 prevDef = true; 31965 break; 31966 } 31967 case EVENT_CODE.up: { 31968 triggerEvent(event.currentTarget, "mouseenter"); 31969 this.submenu && this.submenu.gotoSubIndex(this.submenu.subMenuItems.length - 1); 31970 prevDef = true; 31971 break; 31972 } 31973 case EVENT_CODE.tab: { 31974 triggerEvent(event.currentTarget, "mouseleave"); 31975 break; 31976 }
31977 case EVENT_CODE.enter: 31978 case EVENT_CODE.space: { 31979 prevDef = true; 31980 event.currentTarget.click(); 31981 break; 31982 } 31983 } 31984 if (prevDef) { 31985 event.preventDefault(); 31986 } 31987 }); 31988 } 31989 } 31990 var MenuItem$2 = MenuItem$1; 31991 31992 class Menu$1 { 31993 constructor(domNode, namespace) { 31994 this.domNode = domNode; 31995 this.init(namespace); 31996 } 31997 init(namespace) { 31998 const menuChildren = this.domNode.childNodes; 31999 Array.from(menuChildren).forEach((child) => { 32000 if (child.nodeType === 1) { 32001 new MenuItem$2(child, namespace); 32002 } 32003 }); 32004 } 32005 } 32006 var Menubar = Menu$1; 32007 32008 const _sfc_main$W = vue.defineComponent({ 32009 name: "ElMenuCollapseTransition", 32010 setup() { 32011 const ns = useNamespace("menu"); 32012 const listeners = { 32013 onBeforeEnter: (el) => el.style.opacity = "0.2", 32014 onEnter(el, done) { 32015 addClass(el, `${ns.namespace.value}-opacity-transition`); 32016 el.style.opacity = "1"; 32017 done(); 32018 }, 32019 onAfterEnter(el) { 32020 removeClass(el, `${ns.namespace.value}-opacity-transition`); 32021 el.style.opacity = ""; 32022 }, 32023 onBeforeLeave(el) { 32024 if (!el.dataset) { 32025 el.dataset = {}; 32026 } 32027 if (hasClass(el, ns.m("collapse"))) { 32028 removeClass(el, ns.m("collapse")); 32029 el.dataset.oldOverflow = el.style.overflow; 32030 el.dataset.scrollWidth = el.clientWidth.toString(); 32031 addClass(el, ns.m("collapse")); 32032 } else { 32033 addClass(el, ns.m("collapse")); 32034 el.dataset.oldOverflow = el.style.overflow; 32035 el.dataset.scrollWidth = el.clientWidth.toString(); 32036 removeClass(el, ns.m("collapse")); 32037 } 32038 el.style.width = `${el.scrollWidth}px`; 32039 el.style.overflow = "hidden"; 32040 }, 32041 onLeave(el) { 32042 addClass(el, "horizontal-collapse-transition"); 32043 el.style.width = `${el.dataset.scrollWidth}px`; 32044 } 32045 }; 32046 return { 32047 listeners 32048 }; 32049 } 32050 }); 32051 function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) { 32052 return vue.openBlock(), vue.createBlock(vue.Transition, vue.mergeProps({ mode: "out-in" }, _ctx.listeners), { 32053 default: vue.withCtx(() => [ 32054 vue.renderSlot(_ctx.$slots, "default") 32055 ]), 32056 _: 3 32057 }, 16); 32058 } 32059 var ElMenuCollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["render", _sfc_render$e], ["__file", "menu-collapse-transition.vue"]]); 32060 32061 function useMenu(instance, currentIndex) { 32062 const indexPath = vue.computed(() => { 32063 let parent = instance.parent; 32064 const path = [currentIndex.value]; 32065 while (parent.type.name !== "ElMenu") { 32066 if (parent.props.index) { 32067 path.unshift(parent.props.index); 32068 } 32069 parent = parent.parent; 32070 } 32071 return path; 32072 }); 32073 const parentMenu = vue.computed(() => { 32074 let parent = instance.parent; 32075 while (parent && !["ElMenu", "ElSubMenu"].includes(parent.type.name)) { 32076 parent = parent.parent; 32077 } 32078 return parent; 32079 }); 32080 return { 32081 parentMenu, 32082 indexPath 32083 }; 32084 } 32085 32086 function useMenuColor(props) { 32087 const menuBarColor = vue.computed(() => { 32088 const color = props.backgroundColor; 32089 if (!color) { 32090 return ""; 32091 } else { 32092 return new TinyColor(color).shade(20).toString(); 32093 } 32094 }); 32095 return menuBarColor; 32096 } 32097 32098 const useMenuCssVar = (props, level) => { 32099 const ns = useNamespace("menu"); 32100 return vue.computed(() => { 32101 return ns.cssVarBlock({ 32102 "text-color": props.textColor || "", 32103 "hover-text-color": props.textColor || "", 32104 "bg-color": props.backgroundColor || "", 32105 "hover-bg-color": useMenuColor(props).value || "", 32106 "active-color": props.activeTextColor || "", 32107 level: `${level}` 32108 }); 32109 }); 32110 }; 32111 32112 const subMenuProps = buildProps({ 32113 index: { 32114 type: String, 32115 required: true 32116 }, 32117 showTimeout: { 32118 type: Number, 32119 default: 300 32120 }, 32121 hideTimeout: { 32122 type: Number, 32123 default: 300 32124 }, 32125 popperClass: String, 32126 disabled: Boolean, 32127 popperAppendToBody: { 32128 type: Boolean, 32129 default: void 0 32130 }, 32131 teleported: { 32132 type: Boolean, 32133 default: void 0 32134 }, 32135 popperOffset: { 32136 type: Number, 32137 default: 6 32138 }, 32139 expandCloseIcon: { 32140 type: iconPropType 32141 }, 32142 expandOpenIcon: { 32143 type: iconPropType 32144 }, 32145 collapseCloseIcon: { 32146 type: iconPropType 32147 }, 32148 collapseOpenIcon: { 32149 type: iconPropType 32150 } 32151 });
32152 const COMPONENT_NAME$c = "ElSubMenu"; 32153 var SubMenu = vue.defineComponent({ 32154 name: COMPONENT_NAME$c, 32155 props: subMenuProps, 32156 setup(props, { slots, expose }) { 32157 useDeprecated({ 32158 from: "popper-append-to-body", 32159 replacement: "teleported", 32160 scope: COMPONENT_NAME$c, 32161 version: "2.3.0", 32162 ref: "https://element-plus.org/en-US/component/menu.html#submenu-attributes" 32163 }, vue.computed(() => props.popperAppendToBody !== void 0)); 32164 const instance = vue.getCurrentInstance(); 32165 const { indexPath, parentMenu } = useMenu(instance, vue.computed(() => props.index)); 32166 const nsMenu = useNamespace("menu"); 32167 const nsSubMenu = useNamespace("sub-menu"); 32168 const rootMenu = vue.inject("rootMenu"); 32169 if (!rootMenu) 32170 throwError(COMPONENT_NAME$c, "can not inject root menu"); 32171 const subMenu = vue.inject(`subMenu:${parentMenu.value.uid}`); 32172 if (!subMenu) 32173 throwError(COMPONENT_NAME$c, "can not inject sub menu"); 32174 const items = vue.ref({}); 32175 const subMenus = vue.ref({}); 32176 let timeout; 32177 const mouseInChild = vue.ref(false); 32178 const verticalTitleRef = vue.ref(); 32179 const vPopper = vue.ref(null); 32180 const currentPlacement = vue.computed(() => mode.value === "horizontal" && isFirstLevel.value ? "bottom-start" : "right-start"); 32181 const subMenuTitleIcon = vue.computed(() => { 32182 return mode.value === "horizontal" && isFirstLevel.value || mode.value === "vertical" && !rootMenu.props.collapse ? props.expandCloseIcon && props.expandOpenIcon ? opened.value ? props.expandOpenIcon : props.expandCloseIcon : arrow_down_default : props.collapseCloseIcon && props.collapseOpenIcon ? opened.value ? props.collapseOpenIcon : props.collapseCloseIcon : arrow_right_default; 32183 }); 32184 const isFirstLevel = vue.computed(() => { 32185 return subMenu.level === 0; 32186 }); 32187 const appendToBody = vue.computed(() => { 32188 var _a; 32189 const value = (_a = props.teleported) != null ? _a : props.popperAppendToBody; 32190 return value === void 0 ? isFirstLevel.value : value; 32191 }); 32192 const menuTransitionName = vue.computed(() => rootMenu.props.collapse ? `${nsMenu.namespace.value}-zoom-in-left` : `${nsMenu.namespace.value}-zoom-in-top`); 32193 const fallbackPlacements = vue.computed(() => mode.value === "horizontal" && isFirstLevel.value ? [ 32194 "bottom-start", 32195 "bottom-end", 32196 "top-start", 32197 "top-end", 32198 "right-start", 32199 "left-start" 32200 ] : [ 32201 "right-start", 32202 "left-start", 32203 "bottom-start", 32204 "bottom-end", 32205 "top-start", 32206 "top-end" 32207 ]); 32208 const opened = vue.computed(() => rootMenu.openedMenus.includes(props.index)); 32209 const active = vue.computed(() => { 32210 let isActive = false; 32211 Object.values(items.value).forEach((item2) => { 32212 if (item2.active) { 32213 isActive = true; 32214 } 32215 }); 32216 Object.values(subMenus.value).forEach((subItem) => { 32217 if (subItem.active) { 32218 isActive = true; 32219 } 32220 }); 32221 return isActive; 32222 }); 32223 const backgroundColor = vue.computed(() => rootMenu.props.backgroundColor || ""); 32224 const activeTextColor = vue.computed(() => rootMenu.props.activeTextColor || ""); 32225 const textColor = vue.computed(() => rootMenu.props.textColor || ""); 32226 const mode = vue.computed(() => rootMenu.props.mode); 32227 const item = vue.reactive({ 32228 index: props.index, 32229 indexPath, 32230 active 32231 }); 32232 const ulStyle = useMenuCssVar(rootMenu.props, subMenu.level + 1); 32233 const titleStyle = vue.computed(() => { 32234 if (mode.value !== "horizontal") { 32235 return { 32236 color: textColor.value 32237 }; 32238 } 32239 return { 32240 borderBottomColor: active.value ? rootMenu.props.activeTextColor ? activeTextColor.value : "" : "transparent", 32241 color: active.value ? activeTextColor.value : textColor.value 32242 }; 32243 }); 32244 const doDestroy = () => { 32245 var _a, _b, _c; 32246 return (_c = (_b = (_a = vPopper.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.popperInstanceRef) == null ? void 0 : _c.destroy(); 32247 }; 32248 const handleCollapseToggle = (value) => { 32249 if (!value) { 32250 doDestroy(); 32251 } 32252 }; 32253 const handleClick = () => { 32254 if (rootMenu.props.menuTrigger === "hover" && rootMenu.props.mode === "horizontal" || rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled) 32255 return; 32256 rootMenu.handleSubMenuClick({ 32257 index: props.index, 32258 indexPath: indexPath.value, 32259 active: active.value 32260 }); 32261 }; 32262 const handleMouseenter = (event, showTimeout = props.showTimeout) => { 32263 var _a; 32264 if (event.type === "focus") { 32265 return; 32266 } 32267 if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled) { 32268 return; 32269 } 32270 subMenu.mouseInChild.value = true; 32271 timeout == null ? void 0 : timeout(); 32272 ({ stop: timeout } = useTimeoutFn(() => { 32273 rootMenu.openMenu(props.index, indexPath.value); 32274 }, showTimeout)); 32275 if (appendToBody.value) { 32276 (_a = parentMenu.value.vnode.el) == null ? void 0 : _a.dispatchEvent(new MouseEvent("mouseenter")); 32277 } 32278 }; 32279 const handleMouseleave = (deepDispatch = false) => { 32280 var _a, _b; 32281 if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical") { 32282 return; 32283 } 32284 timeout == null ? void 0 : timeout(); 32285 subMenu.mouseInChild.value = false; 32286 ({ stop: timeout } = useTimeoutFn(() => !mouseInChild.value && rootMenu.closeMenu(props.index, indexPath.value), props.hideTimeout)); 32287 if (appendToBody.value && deepDispatch) { 32288 if (((_a = instance.parent) == null ? void 0 : _a.type.name) === "ElSubMenu") { 32289 (_b = subMenu.handleMouseleave) == null ? void 0 : _b.call(subMenu, true); 32290 } 32291 } 32292 }; 32293 vue.watch(() => rootMenu.props.collapse, (value) => handleCollapseToggle(Boolean(value))); 32294 { 32295 const addSubMenu = (item2) => { 32296 subMenus.value[item2.index] = item2; 32297 }; 32298 const removeSubMenu = (item2) => { 32299 delete subMenus.value[item2.index]; 32300 }; 32301 vue.provide(`subMenu:${instance.uid}`, { 32302 addSubMenu, 32303 removeSubMenu, 32304 handleMouseleave, 32305 mouseInChild, 32306 level: subMenu.level + 1 32307 }); 32308 } 32309 expose({ 32310 opened 32311 }); 32312 vue.onMounted(() => { 32313 rootMenu.addSubMenu(item); 32314 subMenu.addSubMenu(item); 32315 }); 32316 vue.onBeforeUnmount(() => { 32317 subMenu.removeSubMenu(item); 32318 rootMenu.removeSubMenu(item); 32319 }); 32320 return () => { 32321 var _a; 32322 const titleTag = [ 32323 (_a = slots.title) == null ? void 0 : _a.call(slots), 32324 vue.h(ElIcon, { 32325 class: nsSubMenu.e("icon-arrow"), 32326 style: { 32327 transform: opened.value ? props.expandCloseIcon && props.expandOpenIcon || props.collapseCloseIcon && props.collapseOpenIcon && rootMenu.props.collapse ? "none" : "rotateZ(180deg)" : "none" 32328 } 32329 }, { 32330 default: () => isString$1(subMenuTitleIcon.value) ? vue.h(instance.appContext.components[subMenuTitleIcon.value]) : vue.h(subMenuTitleIcon.value) 32331 }) 32332 ]; 32333 const child = rootMenu.isMenuPopup ? vue.h(ElTooltip, { 32334 ref: vPopper, 32335 visible: opened.value, 32336 effect: "light", 32337 pure: true, 32338 offset: props.popperOffset,
32339 showArrow: false, 32340 persistent: true, 32341 popperClass: props.popperClass, 32342 placement: currentPlacement.value, 32343 teleported: appendToBody.value, 32344 fallbackPlacements: fallbackPlacements.value, 32345 transition: menuTransitionName.value, 32346 gpuAcceleration: false 32347 }, { 32348 content: () => { 32349 var _a2; 32350 return vue.h("div", { 32351 class: [ 32352 nsMenu.m(mode.value), 32353 nsMenu.m("popup-container"), 32354 props.popperClass 32355 ], 32356 onMouseenter: (evt) => handleMouseenter(evt, 100), 32357 onMouseleave: () => handleMouseleave(true), 32358 onFocus: (evt) => handleMouseenter(evt, 100) 32359 }, [ 32360 vue.h("ul", { 32361 class: [ 32362 nsMenu.b(), 32363 nsMenu.m("popup"), 32364 nsMenu.m(`popup-${currentPlacement.value}`) 32365 ], 32366 style: ulStyle.value 32367 }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]) 32368 ]); 32369 }, 32370 default: () => vue.h("div", { 32371 class: nsSubMenu.e("title"), 32372 style: [ 32373 titleStyle.value, 32374 { backgroundColor: backgroundColor.value } 32375 ], 32376 onClick: handleClick 32377 }, titleTag) 32378 }) : vue.h(vue.Fragment, {}, [ 32379 vue.h("div", { 32380 class: nsSubMenu.e("title"), 32381 style: [ 32382 titleStyle.value, 32383 { backgroundColor: backgroundColor.value } 32384 ], 32385 ref: verticalTitleRef, 32386 onClick: handleClick 32387 }, titleTag), 32388 vue.h(_CollapseTransition, {}, { 32389 default: () => { 32390 var _a2; 32391 return vue.withDirectives(vue.h("ul", { 32392 role: "menu", 32393 class: [nsMenu.b(), nsMenu.m("inline")], 32394 style: ulStyle.value 32395 }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]), [[vue.vShow, opened.value]]); 32396 } 32397 }) 32398 ]); 32399 return vue.h("li", { 32400 class: [ 32401 nsSubMenu.b(), 32402 nsSubMenu.is("active", active.value), 32403 nsSubMenu.is("opened", opened.value), 32404 nsSubMenu.is("disabled", props.disabled) 32405 ], 32406 role: "menuitem", 32407 ariaHaspopup: true, 32408 ariaExpanded: opened.value, 32409 onMouseenter: handleMouseenter, 32410 onMouseleave: () => handleMouseleave(true), 32411 onFocus: handleMouseenter 32412 }, [child]); 32413 }; 32414 } 32415 }); 32416 32417 const menuProps = buildProps({ 32418 mode: { 32419 type: String, 32420 values: ["horizontal", "vertical"], 32421 default: "vertical" 32422 }, 32423 defaultActive: { 32424 type: String, 32425 default: "" 32426 }, 32427 defaultOpeneds: { 32428 type: definePropType(Array), 32429 default: () => mutable([]) 32430 }, 32431 uniqueOpened: Boolean, 32432 router: Boolean, 32433 menuTrigger: { 32434 type: String, 32435 values: ["hover", "click"], 32436 default: "hover" 32437 }, 32438 collapse: Boolean, 32439 backgroundColor: String, 32440 textColor: String, 32441 activeTextColor: String, 32442 collapseTransition: { 32443 type: Boolean, 32444 default: true 32445 }, 32446 ellipsis: { 32447 type: Boolean, 32448 default: true 32449 }, 32450 popperEffect: { 32451 type: String, 32452 values: ["dark", "light"], 32453 default: "dark" 32454 } 32455 }); 32456 const checkIndexPath = (indexPath) => Array.isArray(indexPath) && indexPath.every((path) => isString$1(path)); 32457 const menuEmits = { 32458 close: (index, indexPath) => isString$1(index) && checkIndexPath(indexPath), 32459 open: (index, indexPath) => isString$1(index) && checkIndexPath(indexPath), 32460 select: (index, indexPath, item, routerResult) => isString$1(index) && checkIndexPath(indexPath) && isObject$1(item) && (routerResult === void 0 || routerResult instanceof Promise) 32461 }; 32462 var Menu = vue.defineComponent({ 32463 name: "ElMenu", 32464 props: menuProps, 32465 emits: menuEmits, 32466 setup(props, { emit, slots, expose }) { 32467 const instance = vue.getCurrentInstance(); 32468 const router = instance.appContext.config.globalProperties.$router; 32469 const menu = vue.ref(); 32470 const nsMenu = useNamespace("menu"); 32471 const nsSubMenu = useNamespace("sub-menu"); 32472 const sliceIndex = vue.ref(-1); 32473 const openedMenus = vue.ref(props.defaultOpeneds && !props.collapse ? props.defaultOpeneds.slice(0) : []); 32474 const activeIndex = vue.ref(props.defaultActive); 32475 const items = vue.ref({}); 32476 const subMenus = vue.ref({}); 32477 const isMenuPopup = vue.computed(() => { 32478 return props.mode === "horizontal" || props.mode === "vertical" && props.collapse; 32479 }); 32480 const initMenu = () => { 32481 const activeItem = activeIndex.value && items.value[activeIndex.value]; 32482 if (!activeItem || props.mode === "horizontal" || props.collapse) 32483 return; 32484 const indexPath = activeItem.indexPath; 32485 indexPath.forEach((index) => { 32486 const subMenu = subMenus.value[index]; 32487 subMenu && openMenu(index, subMenu.indexPath); 32488 }); 32489 }; 32490 const openMenu = (index, indexPath) => { 32491 if (openedMenus.value.includes(index)) 32492 return; 32493 if (props.uniqueOpened) { 32494 openedMenus.value = openedMenus.value.filter((index2) => indexPath.includes(index2)); 32495 } 32496 openedMenus.value.push(index); 32497 emit("open", index, indexPath); 32498 }; 32499 const close = (index) => { 32500 const i = openedMenus.value.indexOf(index); 32501 if (i !== -1) { 32502 openedMenus.value.splice(i, 1); 32503 } 32504 }; 32505 const closeMenu = (index, indexPath) => { 32506 close(index); 32507 emit("close", index, indexPath); 32508 }; 32509 const handleSubMenuClick = ({ 32510 index, 32511 indexPath 32512 }) => { 32513 const isOpened = openedMenus.value.includes(index); 32514 if (isOpened) { 32515 closeMenu(index, indexPath); 32516 } else { 32517 openMenu(index, indexPath); 32518 } 32519 }; 32520 const handleMenuItemClick = (menuItem) => { 32521 if (props.mode === "horizontal" || props.collapse) { 32522 openedMenus.value = []; 32523 } 32524 const { index, indexPath } = menuItem; 32525 if (isNil(index) || isNil(indexPath)) 32526 return; 32527 if (props.router && router) { 32528 const route = menuItem.route || index; 32529 const routerResult = router.push(route).then((res) => { 32530 if (!res) 32531 activeIndex.value = index; 32532 return res; 32533 }); 32534 emit("select", index, indexPath, { index, indexPath, route }, routerResult); 32535 } else { 32536 activeIndex.value = index; 32537 emit("select", index, indexPath, { index, indexPath }); 32538 } 32539 }; 32540 const updateActiveIndex = (val) => { 32541 const itemsInData = items.value; 32542 const item = itemsInData[val] || activeIndex.value && itemsInData[activeIndex.value] || itemsInData[props.defaultActive]; 32543 if (item) { 32544 activeIndex.value = item.index; 32545 } else { 32546 activeIndex.value = val; 32547 } 32548 }; 32549 const calcSliceIndex = () => { 32550 var _a, _b; 32551 if (!menu.value) 32552 return -1; 32553 const items2 = Array.from((_b = (_a = menu.value) == null ? void 0 : _a.childNodes) != null ? _b : []).filter((item) => item.nodeName !== "#comment" && (item.nodeName !== "#text" || item.nodeValue)); 32554 const moreItemWidth = 64; 32555 const paddingLeft = Number.parseInt(getComputedStyle(menu.value).paddingLeft, 10); 32556 const paddingRight = Number.parseInt(getComputedStyle(menu.value).paddingRight, 10); 32557 const menuWidth = menu.value.clientWidth - paddingLeft - paddingRight; 32558 let calcWidth = 0; 32559 let sliceIndex2 = 0; 32560 items2.forEach((item, index) => { 32561 calcWidth += item.offsetWidth || 0; 32562 if (calcWidth <= menuWidth - moreItemWidth) { 32563 sliceIndex2 = index + 1; 32564 } 32565 }); 32566 return sliceIndex2 === items2.length ? -1 : sliceIndex2; 32567 }; 32568 const debounce = (fn, wait = 33.34) => { 32569 let timmer; 32570 return () => { 32571 timmer && clearTimeout(timmer); 32572 timmer = setTimeout(() => { 32573 fn(); 32574 }, wait); 32575 }; 32576 }; 32577 let isFirstTimeRender = true; 32578 const handleResize = () => { 32579 const callback = () => { 32580 sliceIndex.value = -1; 32581 vue.nextTick(() => { 32582 sliceIndex.value = calcSliceIndex(); 32583 }); 32584 }; 32585 isFirstTimeRender ? callback() : debounce(callback)(); 32586 isFirstTimeRender = false; 32587 }; 32588 vue.watch(() => props.defaultActive, (currentActive) => { 32589 if (!items.value[currentActive]) { 32590 activeIndex.value = ""; 32591 } 32592 updateActiveIndex(currentActive); 32593 }); 32594 vue.watch(() => props.collapse, (value) => { 32595 if (value) 32596 openedMenus.value = []; 32597 }); 32598 vue.watch(items.value, initMenu); 32599 let resizeStopper; 32600 vue.watchEffect(() => { 32601 if (props.mode === "horizontal" && props.ellipsis) 32602 resizeStopper = useResizeObserver(menu, handleResize).stop; 32603 else 32604 resizeStopper == null ? void 0 : resizeStopper(); 32605 }); 32606 { 32607 const addSubMenu = (item) => { 32608 subMenus.value[item.index] = item; 32609 }; 32610 const removeSubMenu = (item) => { 32611 delete subMenus.value[item.index]; 32612 }; 32613 const addMenuItem = (item) => { 32614 items.value[item.index] = item; 32615 }; 32616 const removeMenuItem = (item) => { 32617 delete items.value[item.index]; 32618 }; 32619 vue.provide("rootMenu", vue.reactive({ 32620 props, 32621 openedMenus, 32622 items, 32623 subMenus, 32624 activeIndex, 32625 isMenuPopup, 32626 addMenuItem, 32627 removeMenuItem, 32628 addSubMenu, 32629 removeSubMenu, 32630 openMenu, 32631 closeMenu, 32632 handleMenuItemClick, 32633 handleSubMenuClick 32634 })); 32635 vue.provide(`subMenu:${instance.uid}`, { 32636 addSubMenu, 32637 removeSubMenu, 32638 mouseInChild: vue.ref(false), 32639 level: 0 32640 }); 32641 } 32642 vue.onMounted(() => { 32643 if (props.mode === "horizontal") { 32644 new Menubar(instance.vnode.el, nsMenu.namespace.value); 32645 } 32646 }); 32647 { 32648 const open = (index) => { 32649 const { indexPath } = subMenus.value[index]; 32650 indexPath.forEach((i) => openMenu(i, indexPath)); 32651 }; 32652 expose({ 32653 open, 32654 close, 32655 handleResize 32656 }); 32657 } 32658 return () => { 32659 var _a, _b; 32660 let slot = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : []; 32661 const vShowMore = []; 32662 if (props.mode === "horizontal" && menu.value) { 32663 const originalSlot = flattedChildren(slot); 32664 const slotDefault = sliceIndex.value === -1 ? originalSlot : originalSlot.slice(0, sliceIndex.value); 32665 const slotMore = sliceIndex.value === -1 ? [] : originalSlot.slice(sliceIndex.value); 32666 if ((slotMore == null ? void 0 : slotMore.length) && props.ellipsis) { 32667 slot = slotDefault; 32668 vShowMore.push(vue.h(SubMenu, {
32669 index: "sub-menu-more", 32670 class: nsSubMenu.e("hide-arrow") 32671 }, { 32672 title: () => vue.h(ElIcon, { 32673 class: nsSubMenu.e("icon-more") 32674 }, { default: () => vue.h(more_default) }), 32675 default: () => slotMore 32676 })); 32677 } 32678 } 32679 const ulStyle = useMenuCssVar(props, 0); 32680 const vMenu = vue.h("ul", { 32681 key: String(props.collapse), 32682 role: "menubar", 32683 ref: menu, 32684 style: ulStyle.value, 32685 class: { 32686 [nsMenu.b()]: true, 32687 [nsMenu.m(props.mode)]: true, 32688 [nsMenu.m("collapse")]: props.collapse 32689 } 32690 }, [...slot, ...vShowMore]); 32691 if (props.collapseTransition && props.mode === "vertical") { 32692 return vue.h(ElMenuCollapseTransition, () => vMenu); 32693 } 32694 return vMenu; 32695 }; 32696 } 32697 }); 32698 32699 const menuItemProps = buildProps({ 32700 index: { 32701 type: definePropType([String, null]), 32702 default: null 32703 }, 32704 route: { 32705 type: definePropType([String, Object]) 32706 }, 32707 disabled: Boolean 32708 }); 32709 const menuItemEmits = { 32710 click: (item) => isString$1(item.index) && Array.isArray(item.indexPath) 32711 }; 32712 32713 const COMPONENT_NAME$b = "ElMenuItem"; 32714 const _sfc_main$V = vue.defineComponent({ 32715 name: COMPONENT_NAME$b, 32716 components: { 32717 ElTooltip 32718 }, 32719 props: menuItemProps, 32720 emits: menuItemEmits, 32721 setup(props, { emit }) { 32722 const instance = vue.getCurrentInstance(); 32723 const rootMenu = vue.inject("rootMenu"); 32724 const nsMenu = useNamespace("menu"); 32725 const nsMenuItem = useNamespace("menu-item"); 32726 if (!rootMenu) 32727 throwError(COMPONENT_NAME$b, "can not inject root menu"); 32728 const { parentMenu, indexPath } = useMenu(instance, vue.toRef(props, "index")); 32729 const subMenu = vue.inject(`subMenu:${parentMenu.value.uid}`); 32730 if (!subMenu) 32731 throwError(COMPONENT_NAME$b, "can not inject sub menu"); 32732 const active = vue.computed(() => props.index === rootMenu.activeIndex); 32733 const item = vue.reactive({ 32734 index: props.index, 32735 indexPath, 32736 active 32737 }); 32738 const handleClick = () => { 32739 if (!props.disabled) { 32740 rootMenu.handleMenuItemClick({ 32741 index: props.index, 32742 indexPath: indexPath.value, 32743 route: props.route 32744 }); 32745 emit("click", item); 32746 } 32747 }; 32748 vue.onMounted(() => { 32749 subMenu.addSubMenu(item); 32750 rootMenu.addMenuItem(item); 32751 }); 32752 vue.onBeforeUnmount(() => { 32753 subMenu.removeSubMenu(item); 32754 rootMenu.removeMenuItem(item); 32755 }); 32756 return { 32757 parentMenu, 32758 rootMenu, 32759 active, 32760 nsMenu, 32761 nsMenuItem, 32762 handleClick 32763 }; 32764 } 32765 }); 32766 function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) { 32767 const _component_el_tooltip = vue.resolveComponent("el-tooltip"); 32768 return vue.openBlock(), vue.createElementBlock("li", { 32769 class: vue.normalizeClass([ 32770 _ctx.nsMenuItem.b(), 32771 _ctx.nsMenuItem.is("active", _ctx.active), 32772 _ctx.nsMenuItem.is("disabled", _ctx.disabled) 32773 ]), 32774 role: "menuitem", 32775 tabindex: "-1", 32776 onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args)) 32777 }, [ 32778 _ctx.parentMenu.type.name === "ElMenu" && _ctx.rootMenu.props.collapse && _ctx.$slots.title ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, { 32779 key: 0, 32780 effect: _ctx.rootMenu.props.popperEffect, 32781 placement: "right", 32782 "fallback-placements": ["left"], 32783 persistent: "" 32784 }, { 32785 content: vue.withCtx(() => [ 32786 vue.renderSlot(_ctx.$slots, "title") 32787 ]), 32788 default: vue.withCtx(() => [ 32789 vue.createElementVNode("div", { 32790 class: vue.normalizeClass(_ctx.nsMenu.be("tooltip", "trigger")) 32791 }, [
32792 vue.renderSlot(_ctx.$slots, "default") 32793 ], 2) 32794 ]), 32795 _: 3 32796 }, 8, ["effect"])) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [ 32797 vue.renderSlot(_ctx.$slots, "default"), 32798 vue.renderSlot(_ctx.$slots, "title") 32799 ], 64)) 32800 ], 2); 32801 } 32802 var MenuItem = /* @__PURE__ */ _export_sfc(_sfc_main$V, [["render", _sfc_render$d], ["__file", "menu-item.vue"]]); 32803 32804 const menuItemGroupProps = { 32805 title: String 32806 }; 32807 32808 const COMPONENT_NAME$a = "ElMenuItemGroup"; 32809 const _sfc_main$U = vue.defineComponent({ 32810 name: COMPONENT_NAME$a, 32811 props: menuItemGroupProps, 32812 setup() { 32813 const ns = useNamespace("menu-item-group"); 32814 return { 32815 ns 32816 }; 32817 } 32818 }); 32819 function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) { 32820 return vue.openBlock(), vue.createElementBlock("li", { 32821 class: vue.normalizeClass(_ctx.ns.b()) 32822 }, [ 32823 vue.createElementVNode("div", { 32824 class: vue.normalizeClass(_ctx.ns.e("title")) 32825 }, [ 32826 !_ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ 32827 vue.createTextVNode(vue.toDisplayString(_ctx.title), 1) 32828 ], 64)) : vue.renderSlot(_ctx.$slots, "title", { key: 1 }) 32829 ], 2), 32830 vue.createElementVNode("ul", null, [ 32831 vue.renderSlot(_ctx.$slots, "default") 32832 ]) 32833 ], 2); 32834 } 32835 var MenuItemGroup = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["render", _sfc_render$c], ["__file", "menu-item-group.vue"]]); 32836 32837 const ElMenu = withInstall(Menu, { 32838 MenuItem, 32839 MenuItemGroup, 32840 SubMenu 32841 }); 32842 const ElMenuItem = withNoopInstall(MenuItem); 32843 const ElMenuItemGroup = withNoopInstall(MenuItemGroup); 32844 const ElSubMenu = withNoopInstall(SubMenu); 32845 32846 const pageHeaderProps = buildProps({ 32847 icon: { 32848 type: iconPropType, 32849 default: () => back_default 32850 }, 32851 title: String, 32852 content: { 32853 type: String, 32854 default: "" 32855 } 32856 }); 32857 const pageHeaderEmits = { 32858 back: () => true 32859 }; 32860 32861 const _hoisted_1$q = ["aria-label"]; 32862 const __default__$F = vue.defineComponent({ 32863 name: "ElPageHeader" 32864 }); 32865 const _sfc_main$T = /* @__PURE__ */ vue.defineComponent({ 32866 ...__default__$F, 32867 props: pageHeaderProps, 32868 emits: pageHeaderEmits, 32869 setup(__props, { emit }) { 32870 const slots = vue.useSlots(); 32871 const { t } = useLocale(); 32872 const ns = useNamespace("page-header"); 32873 const kls = vue.computed(() => { 32874 return [ 32875 ns.b(), 32876 { 32877 [ns.m("has-breadcrumb")]: !!slots.breadcrumb, 32878 [ns.m("has-extra")]: !!slots.extra, 32879 [ns.is("contentful")]: !!slots.default 32880 } 32881 ]; 32882 }); 32883 function handleClick() { 32884 emit("back"); 32885 } 32886 return (_ctx, _cache) => { 32887 return vue.openBlock(), vue.createElementBlock("div", { 32888 class: vue.normalizeClass(vue.unref(kls)) 32889 }, [ 32890 _ctx.$slots.breadcrumb ? (vue.openBlock(), vue.createElementBlock("div", { 32891 key: 0, 32892 class: vue.normalizeClass(vue.unref(ns).e("breadcrumb")) 32893 }, [ 32894 vue.renderSlot(_ctx.$slots, "breadcrumb") 32895 ], 2)) : vue.createCommentVNode("v-if", true), 32896 vue.createElementVNode("div", { 32897 class: vue.normalizeClass(vue.unref(ns).e("header")) 32898 }, [ 32899 vue.createElementVNode("div", { 32900 class: vue.normalizeClass(vue.unref(ns).e("left")) 32901 }, [ 32902 vue.createElementVNode("div", { 32903 class: vue.normalizeClass(vue.unref(ns).e("back")), 32904 role: "button", 32905 tabindex: "0", 32906 onClick: handleClick 32907 }, [ 32908 _ctx.icon || _ctx.$slots.icon ? (vue.openBlock(), vue.createElementBlock("div", { 32909 key: 0, 32910 "aria-label": _ctx.title || vue.unref(t)("el.pageHeader.title"), 32911 class: vue.normalizeClass(vue.unref(ns).e("icon")) 32912 }, [
32913 vue.renderSlot(_ctx.$slots, "icon", {}, () => [ 32914 _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, { 32915 default: vue.withCtx(() => [ 32916 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon))) 32917 ]), 32918 _: 1 32919 })) : vue.createCommentVNode("v-if", true) 32920 ]) 32921 ], 10, _hoisted_1$q)) : vue.createCommentVNode("v-if", true), 32922 vue.createElementVNode("div", { 32923 class: vue.normalizeClass(vue.unref(ns).e("title")) 32924 }, [ 32925 vue.renderSlot(_ctx.$slots, "title", {}, () => [ 32926 vue.createTextVNode(vue.toDisplayString(_ctx.title || vue.unref(t)("el.pageHeader.title")), 1) 32927 ]) 32928 ], 2) 32929 ], 2), 32930 vue.createVNode(vue.unref(ElDivider), { direction: "vertical" }), 32931 vue.createElementVNode("div", { 32932 class: vue.normalizeClass(vue.unref(ns).e("content")) 32933 }, [ 32934 vue.renderSlot(_ctx.$slots, "content", {}, () => [ 32935 vue.createTextVNode(vue.toDisplayString(_ctx.content), 1) 32936 ]) 32937 ], 2) 32938 ], 2), 32939 _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", { 32940 key: 0, 32941 class: vue.normalizeClass(vue.unref(ns).e("extra")) 32942 }, [ 32943 vue.renderSlot(_ctx.$slots, "extra") 32944 ], 2)) : vue.createCommentVNode("v-if", true) 32945 ], 2), 32946 _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("div", { 32947 key: 1, 32948 class: vue.normalizeClass(vue.unref(ns).e("main")) 32949 }, [ 32950 vue.renderSlot(_ctx.$slots, "default") 32951 ], 2)) : vue.createCommentVNode("v-if", true) 32952 ], 2); 32953 }; 32954 } 32955 }); 32956 var PageHeader = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__file", "page-header.vue"]]); 32957 32958 const ElPageHeader = withInstall(PageHeader); 32959 32960 const elPaginationKey = Symbol("elPaginationKey"); 32961 32962 const paginationPrevProps = buildProps({ 32963 disabled: Boolean, 32964 currentPage: { 32965 type: Number, 32966 default: 1 32967 }, 32968 prevText: { 32969 type: String 32970 }, 32971 prevIcon: { 32972 type: iconPropType 32973 } 32974 }); 32975 const paginationPrevEmits = { 32976 click: (evt) => evt instanceof MouseEvent 32977 }; 32978 32979 const _hoisted_1$p = ["disabled", "aria-label", "aria-disabled"]; 32980 const _hoisted_2$h = { key: 0 }; 32981 const __default__$E = vue.defineComponent({ 32982 name: "ElPaginationPrev" 32983 }); 32984 const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({ 32985 ...__default__$E, 32986 props: paginationPrevProps, 32987 emits: paginationPrevEmits, 32988 setup(__props) { 32989 const props = __props; 32990 const { t } = useLocale(); 32991 const internalDisabled = vue.computed(() => props.disabled || props.currentPage <= 1); 32992 return (_ctx, _cache) => { 32993 return vue.openBlock(), vue.createElementBlock("button", { 32994 type: "button", 32995 class: "btn-prev", 32996 disabled: vue.unref(internalDisabled), 32997 "aria-label": _ctx.prevText || vue.unref(t)("el.pagination.prev"), 32998 "aria-disabled": vue.unref(internalDisabled), 32999 onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event)) 33000 }, [ 33001 _ctx.prevText ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$h, vue.toDisplayString(_ctx.prevText), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, { 33002 default: vue.withCtx(() => [ 33003 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prevIcon))) 33004 ]), 33005 _: 1 33006 })) 33007 ], 8, _hoisted_1$p); 33008 }; 33009 } 33010 });
33011 var Prev = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__file", "prev.vue"]]); 33012 33013 const paginationNextProps = buildProps({ 33014 disabled: Boolean, 33015 currentPage: { 33016 type: Number, 33017 default: 1 33018 }, 33019 pageCount: { 33020 type: Number, 33021 default: 50 33022 }, 33023 nextText: { 33024 type: String 33025 }, 33026 nextIcon: { 33027 type: iconPropType 33028 } 33029 }); 33030 33031 const _hoisted_1$o = ["disabled", "aria-label", "aria-disabled"]; 33032 const _hoisted_2$g = { key: 0 }; 33033 const __default__$D = vue.defineComponent({ 33034 name: "ElPaginationNext" 33035 }); 33036 const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({ 33037 ...__default__$D, 33038 props: paginationNextProps, 33039 emits: ["click"], 33040 setup(__props) { 33041 const props = __props; 33042 const { t } = useLocale(); 33043 const internalDisabled = vue.computed(() => props.disabled || props.currentPage === props.pageCount || props.pageCount === 0); 33044 return (_ctx, _cache) => { 33045 return vue.openBlock(), vue.createElementBlock("button", { 33046 type: "button", 33047 class: "btn-next", 33048 disabled: vue.unref(internalDisabled), 33049 "aria-label": _ctx.nextText || vue.unref(t)("el.pagination.next"), 33050 "aria-disabled": vue.unref(internalDisabled), 33051 onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event)) 33052 }, [ 33053 _ctx.nextText ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$g, vue.toDisplayString(_ctx.nextText), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, { 33054 default: vue.withCtx(() => [ 33055 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.nextIcon))) 33056 ]), 33057 _: 1 33058 })) 33059 ], 8, _hoisted_1$o); 33060 }; 33061 } 33062 }); 33063 var Next = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__file", "next.vue"]]); 33064 33065 const selectGroupKey = Symbol("ElSelectGroup"); 33066 const selectKey = Symbol("ElSelect"); 33067 33068 function useOption$1(props, states) { 33069 const select = vue.inject(selectKey); 33070 const selectGroup = vue.inject(selectGroupKey, { disabled: false }); 33071 const isObject = vue.computed(() => { 33072 return Object.prototype.toString.call(props.value).toLowerCase() === "[object object]"; 33073 }); 33074 const itemSelected = vue.computed(() => { 33075 if (!select.props.multiple) { 33076 return isEqual(props.value, select.props.modelValue); 33077 } else { 33078 return contains(select.props.modelValue, props.value); 33079 } 33080 }); 33081 const limitReached = vue.computed(() => { 33082 if (select.props.multiple) { 33083 const modelValue = select.props.modelValue || []; 33084 return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0; 33085 } else { 33086 return false; 33087 } 33088 }); 33089 const currentLabel = vue.computed(() => { 33090 return props.label || (isObject.value ? "" : props.value); 33091 }); 33092 const currentValue = vue.computed(() => { 33093 return props.value || props.label || ""; 33094 }); 33095 const isDisabled = vue.computed(() => { 33096 return props.disabled || states.groupDisabled || limitReached.value; 33097 }); 33098 const instance = vue.getCurrentInstance(); 33099 const contains = (arr = [], target) => { 33100 if (!isObject.value) { 33101 return arr && arr.includes(target); 33102 } else { 33103 const valueKey = select.props.valueKey; 33104 return arr && arr.some((item) => { 33105 return vue.toRaw(get(item, valueKey)) === get(target, valueKey); 33106 }); 33107 } 33108 }; 33109 const isEqual = (a, b) => { 33110 if (!isObject.value) { 33111 return a === b; 33112 } else { 33113 const { valueKey } = select.props; 33114 return get(a, valueKey) === get(b, valueKey); 33115 } 33116 }; 33117 const hoverItem = () => { 33118 if (!props.disabled && !selectGroup.disabled) { 33119 select.hoverIndex = select.optionsArray.indexOf(instance.proxy); 33120 } 33121 }; 33122 vue.watch(() => currentLabel.value, () => { 33123 if (!props.created && !select.props.remote) 33124 select.setSelected(); 33125 }); 33126 vue.watch(() => props.value, (val, oldVal) => { 33127 const { remote, valueKey } = select.props; 33128 if (!Object.is(val, oldVal)) { 33129 select.onOptionDestroy(oldVal, instance.proxy); 33130 select.onOptionCreate(instance.proxy); 33131 } 33132 if (!props.created && !remote) { 33133 if (valueKey && typeof val === "object" && typeof oldVal === "object" && val[valueKey] === oldVal[valueKey]) { 33134 return; 33135 } 33136 select.setSelected(); 33137 } 33138 }); 33139 vue.watch(() => selectGroup.disabled, () => { 33140 states.groupDisabled = selectGroup.disabled; 33141 }, { immediate: true });
33142 const { queryChange } = vue.toRaw(select); 33143 vue.watch(queryChange, (changes) => { 33144 const { query } = vue.unref(changes); 33145 const regexp = new RegExp(escapeStringRegexp(query), "i"); 33146 states.visible = regexp.test(currentLabel.value) || props.created; 33147 if (!states.visible) { 33148 select.filteredOptionsCount--; 33149 } 33150 }, { immediate: true }); 33151 return { 33152 select, 33153 currentLabel, 33154 currentValue, 33155 itemSelected, 33156 isDisabled, 33157 hoverItem 33158 }; 33159 } 33160 33161 const _sfc_main$Q = vue.defineComponent({ 33162 name: "ElOption", 33163 componentName: "ElOption", 33164 props: { 33165 value: { 33166 required: true, 33167 type: [String, Number, Boolean, Object] 33168 }, 33169 label: [String, Number], 33170 created: Boolean, 33171 disabled: { 33172 type: Boolean, 33173 default: false 33174 } 33175 }, 33176 setup(props) { 33177 const ns = useNamespace("select"); 33178 const states = vue.reactive({ 33179 index: -1, 33180 groupDisabled: false, 33181 visible: true, 33182 hitState: false, 33183 hover: false 33184 }); 33185 const { currentLabel, itemSelected, isDisabled, select, hoverItem } = useOption$1(props, states); 33186 const { visible, hover } = vue.toRefs(states); 33187 const vm = vue.getCurrentInstance().proxy; 33188 select.onOptionCreate(vm); 33189 vue.onBeforeUnmount(() => { 33190 const key = vm.value; 33191 const { selected } = select; 33192 const selectedOptions = select.props.multiple ? selected : [selected]; 33193 const doesSelected = selectedOptions.some((item) => { 33194 return item.value === vm.value; 33195 }); 33196 vue.nextTick(() => { 33197 if (select.cachedOptions.get(key) === vm && !doesSelected) { 33198 select.cachedOptions.delete(key); 33199 } 33200 }); 33201 select.onOptionDestroy(key, vm); 33202 }); 33203 function selectOptionClick() { 33204 if (props.disabled !== true && states.groupDisabled !== true) { 33205 select.handleOptionSelect(vm, true); 33206 } 33207 } 33208 return { 33209 ns, 33210 currentLabel, 33211 itemSelected, 33212 isDisabled, 33213 select, 33214 hoverItem, 33215 visible, 33216 hover, 33217 selectOptionClick, 33218 states 33219 }; 33220 } 33221 }); 33222 function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) { 33223 return vue.withDirectives((vue.openBlock(), vue.createElementBlock("li", { 33224 class: vue.normalizeClass([ 33225 _ctx.ns.be("dropdown", "item"), 33226 _ctx.ns.is("disabled", _ctx.isDisabled), 33227 { 33228 selected: _ctx.itemSelected, 33229 hover: _ctx.hover 33230 } 33231 ]), 33232 onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)), 33233 onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"])) 33234 }, [ 33235 vue.renderSlot(_ctx.$slots, "default", {}, () => [ 33236 vue.createElementVNode("span", null, vue.toDisplayString(_ctx.currentLabel), 1) 33237 ]) 33238 ], 34)), [ 33239 [vue.vShow, _ctx.visible] 33240 ]); 33241 } 33242 var Option = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["render", _sfc_render$b], ["__file", "option.vue"]]); 33243 33244 const _sfc_main$P = vue.defineComponent({ 33245 name: "ElSelectDropdown", 33246 componentName: "ElSelectDropdown", 33247 setup() { 33248 const select = vue.inject(selectKey); 33249 const ns = useNamespace("select"); 33250 const popperClass = vue.computed(() => select.props.popperClass); 33251 const isMultiple = vue.computed(() => select.props.multiple); 33252 const isFitInputWidth = vue.computed(() => select.props.fitInputWidth); 33253 const minWidth = vue.ref(""); 33254 function updateMinWidth() { 33255 var _a; 33256 minWidth.value = `${(_a = select.selectWrapper) == null ? void 0 : _a.offsetWidth}px`; 33257 } 33258 vue.onMounted(() => { 33259 updateMinWidth(); 33260 useResizeObserver(select.selectWrapper, updateMinWidth); 33261 }); 33262 return { 33263 ns, 33264 minWidth, 33265 popperClass, 33266 isMultiple, 33267 isFitInputWidth 33268 }; 33269 } 33270 });
33271 function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) { 33272 return vue.openBlock(), vue.createElementBlock("div", { 33273 class: vue.normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]), 33274 style: vue.normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth }) 33275 }, [ 33276 vue.renderSlot(_ctx.$slots, "default") 33277 ], 6); 33278 } 33279 var ElSelectMenu$1 = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["render", _sfc_render$a], ["__file", "select-dropdown.vue"]]); 33280 33281 function useSelectStates(props) { 33282 const { t } = useLocale(); 33283 return vue.reactive({ 33284 options: /* @__PURE__ */ new Map(), 33285 cachedOptions: /* @__PURE__ */ new Map(), 33286 createdLabel: null, 33287 createdSelected: false, 33288 selected: props.multiple ? [] : {}, 33289 inputLength: 20, 33290 inputWidth: 0, 33291 optionsCount: 0, 33292 filteredOptionsCount: 0, 33293 visible: false, 33294 softFocus: false, 33295 selectedLabel: "", 33296 hoverIndex: -1, 33297 query: "", 33298 previousQuery: null, 33299 inputHovering: false, 33300 cachedPlaceHolder: "", 33301 currentPlaceholder: t("el.select.placeholder"), 33302 menuVisibleOnFocus: false, 33303 isOnComposition: false, 33304 isSilentBlur: false, 33305 prefixWidth: 11, 33306 tagInMultiLine: false, 33307 mouseEnter: false 33308 }); 33309 } 33310 const useSelect$3 = (props, states, ctx) => { 33311 const { t } = useLocale(); 33312 const ns = useNamespace("select"); 33313 useDeprecated({ 33314 from: "suffixTransition", 33315 replacement: "override style scheme", 33316 version: "2.3.0", 33317 scope: "props", 33318 ref: "https://element-plus.org/en-US/component/select.html#select-attributes" 33319 }, vue.computed(() => props.suffixTransition === false)); 33320 const reference = vue.ref(null); 33321 const input = vue.ref(null); 33322 const iOSInput = vue.ref(null); 33323 const tooltipRef = vue.ref(null); 33324 const tags = vue.ref(null); 33325 const selectWrapper = vue.ref(null); 33326 const scrollbar = vue.ref(null); 33327 const hoverOption = vue.ref(-1); 33328 const queryChange = vue.shallowRef({ query: "" }); 33329 const groupQueryChange = vue.shallowRef(""); 33330 const optionList = vue.ref([]); 33331 let originClientHeight = 0; 33332 const { form, formItem } = useFormItem(); 33333 const readonly = vue.computed(() => !props.filterable || props.multiple || !states.visible); 33334 const selectDisabled = vue.computed(() => props.disabled || (form == null ? void 0 : form.disabled)); 33335 const showClose = vue.computed(() => { 33336 const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : props.modelValue !== void 0 && props.modelValue !== null && props.modelValue !== ""; 33337 const criteria = props.clearable && !selectDisabled.value && states.inputHovering && hasValue; 33338 return criteria; 33339 }); 33340 const iconComponent = vue.computed(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon); 33341 const iconReverse = vue.computed(() => ns.is("reverse", iconComponent.value && states.visible && props.suffixTransition)); 33342 const debounce$1 = vue.computed(() => props.remote ? 300 : 0); 33343 const emptyText = vue.computed(() => { 33344 if (props.loading) { 33345 return props.loadingText || t("el.select.loading"); 33346 } else { 33347 if (props.remote && states.query === "" && states.options.size === 0) 33348 return false; 33349 if (props.filterable && states.query && states.options.size > 0 && states.filteredOptionsCount === 0) { 33350 return props.noMatchText || t("el.select.noMatch"); 33351 } 33352 if (states.options.size === 0) { 33353 return props.noDataText || t("el.select.noData"); 33354 } 33355 } 33356 return null; 33357 }); 33358 const optionsArray = vue.computed(() => { 33359 const list = Array.from(states.options.values()); 33360 const newList = []; 33361 optionList.value.forEach((item) => { 33362 const index = list.findIndex((i) => i.currentLabel === item); 33363 if (index > -1) { 33364 newList.push(list[index]); 33365 } 33366 }); 33367 return newList.length ? newList : list; 33368 }); 33369 const cachedOptionsArray = vue.computed(() =>
33369 Array.from(states.cachedOptions.values())); 33370 const showNewOption = vue.computed(() => { 33371 const hasExistingOption = optionsArray.value.filter((option) => { 33372 return !option.created; 33373 }).some((option) => { 33374 return option.currentLabel === states.query; 33375 }); 33376 return props.filterable && props.allowCreate && states.query !== "" && !hasExistingOption; 33377 }); 33378 const selectSize = useFormSize(); 33379 const collapseTagSize = vue.computed(() => ["small"].includes(selectSize.value) ? "small" : "default"); 33380 const dropMenuVisible = vue.computed({ 33381 get() { 33382 return states.visible && emptyText.value !== false; 33383 }, 33384 set(val) { 33385 states.visible = val; 33386 } 33387 }); 33388 vue.watch([() => selectDisabled.value, () => selectSize.value, () => form == null ? void 0 : form.size], () => { 33389 vue.nextTick(() => { 33390 resetInputHeight(); 33391 }); 33392 }); 33393 vue.watch(() => props.placeholder, (val) => { 33394 states.cachedPlaceHolder = states.currentPlaceholder = val; 33395 const hasValue = props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0; 33396 if (hasValue) { 33397 states.currentPlaceholder = ""; 33398 } 33399 }); 33400 vue.watch(() => props.modelValue, (val, oldVal) => { 33401 if (props.multiple) { 33402 resetInputHeight(); 33403 if (val && val.length > 0 || input.value && states.query !== "") { 33404 states.currentPlaceholder = ""; 33405 } else { 33406 states.currentPlaceholder = states.cachedPlaceHolder; 33407 } 33408 if (props.filterable && !props.reserveKeyword) { 33409 states.query = ""; 33410 handleQueryChange(states.query); 33411 } 33412 } 33413 setSelected(); 33414 if (props.filterable && !props.multiple) { 33415 states.inputLength = 20; 33416 } 33417 if (!isEqual$1(val, oldVal) && props.validateEvent) { 33418 formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()); 33419 } 33420 }, { 33421 flush: "post", 33422 deep: true 33423 }); 33424 vue.watch(() => states.visible, (val) => { 33425 var _a, _b, _c, _d, _e; 33426 if (!val) { 33427 if (props.filterable) { 33428 if (isFunction$1(props.filterMethod)) { 33429 props.filterMethod(""); 33430 } 33431 if (isFunction$1(props.remoteMethod)) { 33432 props.remoteMethod(""); 33433 } 33434 } 33435 input.value && input.value.blur(); 33436 states.query = ""; 33437 states.previousQuery = null; 33438 states.selectedLabel = ""; 33439 states.inputLength = 20; 33440 states.menuVisibleOnFocus = false; 33441 resetHoverIndex(); 33442 vue.nextTick(() => { 33443 if (input.value && input.value.value === "" && states.selected.length === 0) { 33444 states.currentPlaceholder = states.cachedPlaceHolder; 33445 } 33446 }); 33447 if (!props.multiple) { 33448 if (states.selected) { 33449 if (props.filterable && props.allowCreate && states.createdSelected && states.createdLabel) { 33450 states.selectedLabel = states.createdLabel; 33451 } else { 33452 states.selectedLabel = states.selected.currentLabel; 33453 } 33454 if (props.filterable) 33455 states.query = states.selectedLabel; 33456 } 33457 if (props.filterable) { 33458 states.currentPlaceholder = states.cachedPlaceHolder; 33459 } 33460 } 33461 } else { 33462 (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a); 33463 if (props.filterable) { 33464 states.filteredOptionsCount = states.optionsCount; 33465 states.query = props.remote ? "" : states.selectedLabel; 33466 (_d = (_c = iOSInput.value) == null ? void 0 : _c.focus) == null ? void 0 : _d.call(_c); 33467 if (props.multiple) { 33468 (_e = input.value) == null ? void 0 : _e.focus(); 33469 } else { 33470 if (states.selectedLabel) { 33471 states.currentPlaceholder = `${states.selectedLabel}`; 33472 states.selectedLabel = ""; 33473 } 33474 } 33475 handleQueryChange(states.query); 33476 if (!props.multiple && !props.remote) { 33477 queryChange.value.query = ""; 33478 vue.triggerRef(queryChange); 33479 vue.triggerRef(groupQueryChange); 33480 } 33481 } 33482 } 33483 ctx.emit("visible-change", val); 33484 }); 33485 vue.watch(() => states.options.entries(), () => { 33486 var _a, _b, _c; 33487 if (!isClient) 33488 return; 33489 (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a); 33490 if (props.multiple) { 33491 resetInputHeight(); 33492 } 33493 const inputs = ((_c = selectWrapper.value) == null ? void 0 : _c.querySelectorAll("input")) || []; 33494 if (!Array.from(inputs).includes(document.activeElement)) { 33495 setSelected(); 33496 } 33497 if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) { 33498 checkDefaultFirstOption(); 33499 } 33500 }, { 33501 flush: "post" 33502 }); 33503 vue.watch(() => states.hoverIndex, (val) => { 33504 if (isNumber(val) && val > -1) { 33505 hoverOption.value = optionsArray.value[val] || {}; 33506 } else { 33507 hoverOption.value = {}; 33508 } 33509 optionsArray.value.forEach((option) => { 33510 option.hover = hoverOption.value === option; 33511 }); 33512 }); 33513 const resetInputHeight = () => { 33514 vue.nextTick(() => { 33515 var _a, _b; 33516 if (!reference.value) 33517 return; 33518 const input2 = reference.value.$el.querySelector("input"); 33519 originClientHeight = originClientHeight || (input2.clientHeight > 0 ? input2.clientHeight + 2 : 0); 33520 const _tags = tags.value; 33521 const gotSize = getComponentSize(selectSize.value || (form == null ? void 0 : form.size)); 33522 const sizeInMap = selectSize.value || gotSize === originClientHeight || originClientHeight <= 0 ? gotSize : originClientHeight; 33523 const isElHidden = input2.offsetParent === null; 33524 !isElHidden && (input2.style.height = `${(states.selected.length === 0 ? sizeInMap : Math.max(_tags ? _tags.clientHeight + (_tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap)) - 2}px`); 33525 states.tagInMultiLine = Number.parseFloat(input2.style.height) >= sizeInMap; 33526 if (states.visible && emptyText.value !== false) { 33527 (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a); 33528 } 33529 }); 33530 }; 33531 const handleQueryChange = async (val) => { 33532 if (states.previousQuery === val || states.isOnComposition) 33533 return; 33534 if (states.previousQuery === null && (isFunction$1(props.filterMethod) || isFunction$1(props.remoteMethod))) { 33535 states.previousQuery = val; 33536 return; 33537 } 33538 states.previousQuery = val; 33539 vue.nextTick(() => { 33540 var _a, _b; 33541 if (states.visible) 33542 (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a); 33543 }); 33544 states.hoverIndex = -1; 33545 if (props.multiple && props.filterable) { 33546 vue.nextTick(() => { 33547 const length = input.value.value.length * 15 + 20; 33548 states.inputLength = props.collapseTags ? Math.min(50, length) : length; 33549 managePlaceholder(); 33550 resetInputHeight(); 33551 }); 33552 } 33553 if (props.remote && isFunction$1(props.remoteMethod)) { 33554 states.hoverIndex = -1; 33555 props.remoteMethod(val); 33556 } else if (isFunction$1(props.filterMethod)) { 33557 props.filterMethod(val); 33558 vue.triggerRef(groupQueryChange); 33559 } else { 33560 states.filteredOptionsCount = states.optionsCount; 33561 queryChange.value.query = val; 33562 vue.triggerRef(queryChange); 33563 vue.triggerRef(groupQueryChange); 33564 } 33565 if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) { 33566 await vue.nextTick(); 33567 checkDefaultFirstOption(); 33568 } 33569 }; 33570 const managePlaceholder = () => { 33571 if (states.currentPlaceholder !== "") { 33572 states.currentPlaceholder = input.value.value ? "" : states.cachedPlaceHolder; 33573 } 33574 }; 33575 const checkDefaultFirstOption = () => { 33576 const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled); 33577 const userCreatedOption = optionsInDropdown.find((n) => n.created); 33578 const firstOriginOption = optionsInDropdown[0]; 33579 states.hoverIndex = getValueIndex(optionsArray.value, userCreatedOption || firstOriginOption); 33580 }; 33581 const setSelected = () => { 33582 var _a; 33583 if (!props.multiple) { 33584 const option = getOption(props.modelValue); 33585 if ((_a = option.props) == null ? void 0 : _a.created) { 33586 states.createdLabel = option.props.value; 33587 states.createdSelected = true; 33588 } else { 33589 states.createdSelected = false; 33590 } 33591 states.selectedLabel = option.currentLabel; 33592 states.selected = option; 33593 if (props.filterable) 33594 states.query = states.selectedLabel; 33595 return; 33596 } else { 33597 states.selectedLabel = ""; 33598 } 33599 const result = []; 33600 if (Array.isArray(props.modelValue)) { 33601 props.modelValue.forEach((value) => { 33602 result.push(getOption(value)); 33603 }); 33604 } 33605 states.selected = result; 33606 vue.nextTick(() => { 33607 resetInputHeight(); 33608 }); 33609 }; 33610 const getOption = (value) => { 33611 let option; 33612 const isObjectValue = toRawType(value).toLowerCase() === "object"; 33613 const isNull = toRawType(value).toLowerCase() === "null"; 33614 const isUndefined = toRawType(value).toLowerCase() === "undefined"; 33615 for (let i = states.cachedOptions.size - 1; i >= 0; i--) { 33616 const cachedOption = cachedOptionsArray.value[i]; 33617 const isEqualValue = isObjectValue ? get(cachedOption.value, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value; 33618 if (isEqualValue) { 33619 option = { 33620 value, 33621 currentLabel: cachedOption.currentLabel, 33622 isDisabled: cachedOption.isDisabled 33623 }; 33624 break; 33625 } 33626 } 33627 if (option) 33628 return option; 33629 const label = isObjectValue ? value.label : !isNull && !isUndefined ? value : ""; 33630 const newOption = { 33631 value, 33632 currentLabel: label 33633 }; 33634 if (props.multiple) { 33635 newOption.hitState = false; 33636 } 33637 return newOption; 33638 }; 33639 const resetHoverIndex = () => { 33640 setTimeout(() => { 33641 const valueKey = props.valueKey; 33642 if (!props.multiple) { 33643 states.hoverIndex = optionsArray.value.findIndex((item) => { 33644 return getValueKey(item) === getValueKey(states.selected); 33645 }); 33646 } else { 33647 if (states.selected.length > 0) { 33648 states.hoverIndex = Math.min.apply(null, states.selected.map((selected) => { 33649 return optionsArray.value.findIndex((item) => { 33650 return get(item, valueKey) === get(selected, valueKey); 33651 }); 33652 })); 33653 } else { 33654 states.hoverIndex = -1; 33655 } 33656 } 33657 }, 300); 33658 }; 33659 const handleResize = () => { 33660 var _a, _b; 33661 resetInputWidth(); 33662 (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a); 33663 if (props.multiple) 33664 resetInputHeight(); 33665 }; 33666 const resetInputWidth = () => { 33667 var _a;
33668 states.inputWidth = (_a = reference.value) == null ? void 0 : _a.$el.offsetWidth; 33669 }; 33670 const onInputChange = () => { 33671 if (props.filterable && states.query !== states.selectedLabel) { 33672 states.query = states.selectedLabel; 33673 handleQueryChange(states.query); 33674 } 33675 }; 33676 const debouncedOnInputChange = debounce(() => { 33677 onInputChange(); 33678 }, debounce$1.value); 33679 const debouncedQueryChange = debounce((e) => { 33680 handleQueryChange(e.target.value); 33681 }, debounce$1.value); 33682 const emitChange = (val) => { 33683 if (!isEqual$1(props.modelValue, val)) { 33684 ctx.emit(CHANGE_EVENT, val); 33685 } 33686 }; 33687 const deletePrevTag = (e) => { 33688 if (e.code === EVENT_CODE.delete) 33689 return; 33690 if (e.target.value.length <= 0 && !toggleLastOptionHitState()) { 33691 const value = props.modelValue.slice(); 33692 value.pop(); 33693 ctx.emit(UPDATE_MODEL_EVENT, value); 33694 emitChange(value); 33695 } 33696 if (e.target.value.length === 1 && props.modelValue.length === 0) { 33697 states.currentPlaceholder = states.cachedPlaceHolder; 33698 } 33699 }; 33700 const deleteTag = (event, tag) => { 33701 const index = states.selected.indexOf(tag); 33702 if (index > -1 && !selectDisabled.value) { 33703 const value = props.modelValue.slice(); 33704 value.splice(index, 1); 33705 ctx.emit(UPDATE_MODEL_EVENT, value); 33706 emitChange(value); 33707 ctx.emit("remove-tag", tag.value); 33708 } 33709 event.stopPropagation(); 33710 }; 33711 const deleteSelected = (event) => { 33712 event.stopPropagation(); 33713 const value = props.multiple ? [] : ""; 33714 if (!isString$1(value)) { 33715 for (const item of states.selected) { 33716 if (item.isDisabled) 33717 value.push(item.value); 33718 } 33719 } 33720 ctx.emit(UPDATE_MODEL_EVENT, value); 33721 emitChange(value); 33722 states.hoverIndex = -1; 33723 states.visible = false; 33724 ctx.emit("clear"); 33725 }; 33726 const handleOptionSelect = (option, byClick) => { 33727 var _a; 33728 if (props.multiple) { 33729 const value = (props.modelValue || []).slice(); 33730 const optionIndex = getValueIndex(value, option.value); 33731 if (optionIndex > -1) { 33732 value.splice(optionIndex, 1); 33733 } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) { 33734 value.push(option.value); 33735 } 33736 ctx.emit(UPDATE_MODEL_EVENT, value); 33737 emitChange(value); 33738 if (option.created) { 33739 states.query = ""; 33740 handleQueryChange(""); 33741 states.inputLength = 20; 33742 } 33743 if (props.filterable) 33744 (_a = input.value) == null ? void 0 : _a.focus(); 33745 } else { 33746 ctx.emit(UPDATE_MODEL_EVENT, option.value); 33747 emitChange(option.value); 33748 states.visible = false; 33749 } 33750 states.isSilentBlur = byClick; 33751 setSoftFocus(); 33752 if (states.visible) 33753 return; 33754 vue.nextTick(() => { 33755 scrollToOption(option); 33756 }); 33757 }; 33758 const getValueIndex = (arr = [], value) => { 33759 if (!isObject$1(value)) 33760 return arr.indexOf(value); 33761 const valueKey = props.valueKey; 33762 let index = -1; 33763 arr.some((item, i) => { 33764 if (vue.toRaw(get(item, valueKey)) === get(value, valueKey)) { 33765 index = i; 33766 return true; 33767 } 33768 return false; 33769 }); 33770 return index; 33771 }; 33772 const setSoftFocus = () => { 33773 states.softFocus = true; 33774 const _input = input.value || reference.value; 33775 if (_input) { 33776 _input == null ? void 0 : _input.focus(); 33777 } 33778 }; 33779 const scrollToOption = (option) => { 33780 var _a, _b, _c, _d, _e; 33781 const targetOption = Array.isArray(option) ? option[0] : option; 33782 let target = null; 33783 if (targetOption == null ? void 0 : targetOption.value) { 33784 const options = optionsArray.value.filter((item) => item.value === targetOption.value); 33785 if (options.length > 0) { 33786 target = options[0].$el; 33787 } 33788 } 33789 if (tooltipRef.value && target) { 33790 const menu = (_d = (_c = (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef) == null ? void 0 : _c.querySelector) == null ? void 0 : _d.call(_c, `.${ns.be("dropdown", "wrap")}`); 33791 if (menu) { 33792 scrollIntoView(menu, target); 33793 } 33794 } 33795 (_e = scrollbar.value) == null ? void 0 : _e.handleScroll(); 33796 }; 33797 const onOptionCreate = (vm) => { 33798 states.optionsCount++; 33799 states.filteredOptionsCount++; 33800 states.options.set(vm.value, vm); 33801 states.cachedOptions.set(vm.value, vm); 33802 }; 33803 const onOptionDestroy = (key, vm) => { 33804 if (states.options.get(key) === vm) { 33805 states.optionsCount--; 33806 states.filteredOptionsCount--; 33807 states.options.delete(key); 33808 } 33809 }; 33810 const resetInputState = (e) => { 33811 if (e.code !== EVENT_CODE.backspace) 33812 toggleLastOptionHitState(false); 33813 states.inputLength = input.value.value.length * 15 + 20; 33814 resetInputHeight(); 33815 }; 33816 const toggleLastOptionHitState = (hit) => { 33817 if (!Array.isArray(states.selected)) 33818 return; 33819 const option = states.selected[states.selected.length - 1]; 33820 if (!option) 33821 return; 33822 if (hit === true || hit === false) { 33823 option.hitState = hit; 33824 return hit; 33825 } 33826 option.hitState = !option.hitState; 33827 return option.hitState; 33828 }; 33829 const handleComposition = (event) => { 33830 const text = event.target.value; 33831 if (event.type === "compositionend") { 33832 states.isOnComposition = false; 33833 vue.nextTick(() => handleQueryChange(text)); 33834 } else { 33835 const lastCharacter = text[text.length - 1] || ""; 33836 states.isOnComposition = !isKorean(lastCharacter); 33837 } 33838 }; 33839 const handleMenuEnter = () => { 33840 vue.nextTick(() => scrollToOption(states.selected)); 33841 }; 33842 const handleFocus = (event) => { 33843 if (!states.softFocus) { 33844 if (props.automaticDropdown || props.filterable) { 33845 if (props.filterable && !states.visible) { 33846 states.menuVisibleOnFocus = true; 33847 } 33848 states.visible = true; 33849 } 33850 ctx.emit("focus", event); 33851 } else { 33852 states.softFocus = false; 33853 } 33854 }; 33855 const blur = () => { 33856 var _a, _b, _c; 33857 states.visible = false; 33858 (_a = reference.value) == null ? void 0 : _a.blur(); 33859 (_c = (_b = iOSInput.value) == null ? void 0 : _b.blur) == null ? void 0 : _c.call(_b); 33860 }; 33861 const handleBlur = (event) => { 33862 vue.nextTick(() => { 33863 if (states.isSilentBlur) { 33864 states.isSilentBlur = false; 33865 } else { 33866 ctx.emit("blur", event); 33867 } 33868 }); 33869 states.softFocus = false; 33870 }; 33871 const handleClearClick = (event) => { 33872 deleteSelected(event); 33873 }; 33874 const handleClose = () => { 33875 states.visible = false; 33876 }; 33877 const handleKeydownEscape = (event) => { 33878 if (states.visible) { 33879 event.preventDefault(); 33880 event.stopPropagation(); 33881 states.visible = false; 33882 } 33883 }; 33884 const toggleMenu = (e) => { 33885 var _a; 33886 if (e && !states.mouseEnter) { 33887 return; 33888 } 33889 if (!selectDisabled.value) { 33890 if (states.menuVisibleOnFocus) { 33891 states.menuVisibleOnFocus = false; 33892 } else { 33893 if (!tooltipRef.value || !tooltipRef.value.isFocusInsideContent()) { 33894 states.visible = !states.visible; 33895 } 33896 } 33897 if (states.visible) { 33898 (_a = input.value || reference.value) == null ? void 0 : _a.focus(); 33899 } 33900 } 33901 }; 33902 const selectOption = () => { 33903 if (!states.visible) { 33904 toggleMenu(); 33905 } else { 33906 if (optionsArray.value[states.hoverIndex]) { 33907 handleOptionSelect(optionsArray.value[states.hoverIndex], void 0); 33908 } 33909 } 33910 }; 33911 const getValueKey = (item) => { 33912 return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value; 33913 }; 33914 const optionsAllDisabled = vue.computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.disabled)); 33915 const showTagList = vue.computed(() => states.selected.slice(0, props.maxCollapseTags)); 33916 const collapseTagList = vue.computed(() => states.selected.slice(props.maxCollapseTags)); 33917 const navigateOptions = (direction) => { 33918 if (!states.visible) { 33919 states.visible = true; 33920 return; 33921 } 33922 if (states.options.size === 0 || states.filteredOptionsCount === 0) 33923 return; 33924 if (states.isOnComposition) 33925 return; 33926 if (!optionsAllDisabled.value) { 33927 if (direction === "next") { 33928 states.hoverIndex++; 33929 if (states.hoverIndex === states.options.size) { 33930 states.hoverIndex = 0; 33931 } 33932 } else if (direction === "prev") { 33933 states.hoverIndex--; 33934 if (states.hoverIndex < 0) { 33935 states.hoverIndex = states.options.size - 1; 33936 } 33937 } 33938 const option = optionsArray.value[states.hoverIndex]; 33939 if (option.disabled === true || option.states.groupDisabled === true || !option.visible) { 33940 navigateOptions(direction); 33941 } 33942 vue.nextTick(() => scrollToOption(hoverOption.value)); 33943 } 33944 }; 33945 const handleMouseEnter = () => { 33946 states.mouseEnter = true; 33947 }; 33948 const handleMouseLeave = () => { 33949 states.mouseEnter = false; 33950 }; 33951 return { 33952 optionList, 33953 optionsArray, 33954 selectSize, 33955 handleResize, 33956 debouncedOnInputChange, 33957 debouncedQueryChange, 33958 deletePrevTag, 33959 deleteTag, 33960 deleteSelected, 33961 handleOptionSelect, 33962 scrollToOption, 33963 readonly, 33964 resetInputHeight, 33965 showClose, 33966 iconComponent, 33967 iconReverse, 33968 showNewOption, 33969 collapseTagSize, 33970 setSelected, 33971 managePlaceholder, 33972 selectDisabled, 33973 emptyText, 33974 toggleLastOptionHitState, 33975 resetInputState, 33976 handleComposition, 33977 onOptionCreate, 33978 onOptionDestroy, 33979 handleMenuEnter, 33980 handleFocus, 33981 blur, 33982 handleBlur, 33983 handleClearClick, 33984 handleClose, 33985 handleKeydownEscape, 33986 toggleMenu, 33987 selectOption, 33988 getValueKey, 33989 navigateOptions, 33990 dropMenuVisible, 33991 queryChange, 33992 groupQueryChange, 33993 showTagList, 33994 collapseTagList, 33995 reference, 33996 input, 33997 iOSInput, 33998 tooltipRef, 33999 tags, 34000 selectWrapper, 34001 scrollbar, 34002 handleMouseEnter, 34003 handleMouseLeave 34004 }; 34005 }; 34006 34007 var ElOptions = vue.defineComponent({ 34008 name: "ElOptions", 34009 emits: ["update-options"], 34010 setup(_, { slots, emit }) { 34011 let cachedOptions = []; 34012 function isSameOptions(a, b) { 34013 if (a.length !== b.length) 34014 return false; 34015 for (const [index] of a.entries()) { 34016 if (a[index] != b[index]) { 34017 return false; 34018 } 34019 } 34020 return true; 34021 } 34022 return () => { 34023 var _a, _b; 34024 const children = (_a = slots.default) == null ? void 0 : _a.call(slots); 34025 const filteredOptions = []; 34026 function filterOptions(children2) { 34027 if (!Array.isArray(children2)) 34028 return; 34029 children2.forEach((item) => { 34030 var _a2, _b2, _c, _d; 34031 const name = (_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name; 34032 if (name === "ElOptionGroup") { 34033 filterOptions(!isString$1(item.children) && !Array.isArray(item.children) && isFunction$1((_b2 = item.children) == null ? void 0 : _b2.default) ? (_c = item.children) == null ? void 0 : _c.default() : item.children); 34034 } else if (name === "ElOption") { 34035 filteredOptions.push((_d = item.props) == null ? void 0 : _d.label); 34036 } else if (Array.isArray(item.children)) { 34037 filterOptions(item.children); 34038 } 34039 }); 34040 } 34041 if (children.length) { 34042 filterOptions((_b = children[0]) == null ? void 0 : _b.children); 34043 } 34044 if (!isSameOptions(filteredOptions, cachedOptions)) { 34045 cachedOptions = filteredOptions; 34046 emit("update-options", filteredOptions); 34047 } 34048 return children; 34049 }; 34050 } 34051 });
vendor: 4,762 bytes, lines 34052-34238
34052 34053 const COMPONENT_NAME$9 = "ElSelect"; 34054 const _sfc_main$O = vue.defineComponent({ 34055 name: COMPONENT_NAME$9, 34056 componentName: COMPONENT_NAME$9, 34057 components: { 34058 ElInput, 34059 ElSelectMenu: ElSelectMenu$1, 34060 ElOption: Option, 34061 ElOptions, 34062 ElTag, 34063 ElScrollbar, 34064 ElTooltip, 34065 ElIcon 34066 }, 34067 directives: { ClickOutside }, 34068 props: { 34069 name: String, 34070 id: String, 34071 modelValue: { 34072 type: [Array, String, Number, Boolean, Object], 34073 default: void 0 34074 }, 34075 autocomplete: { 34076 type: String, 34077 default: "off" 34078 }, 34079 automaticDropdown: Boolean, 34080 size: { 34081 type: String, 34082 validator: isValidComponentSize 34083 }, 34084 effect: { 34085 type: String, 34086 default: "light" 34087 }, 34088 disabled: Boolean, 34089 clearable: Boolean, 34090 filterable: Boolean, 34091 allowCreate: Boolean, 34092 loading: Boolean, 34093 popperClass: { 34094 type: String, 34095 default: "" 34096 }, 34097 popperOptions: { 34098 type: Object, 34099 default: () => ({}) 34100 }, 34101 remote: Boolean, 34102 loadingText: String, 34103 noMatchText: String, 34104 noDataText: String, 34105 remoteMethod: Function, 34106 filterMethod: Function, 34107 multiple: Boolean, 34108 multipleLimit: { 34109 type: Number, 34110 default: 0 34111 }, 34112 placeholder: { 34113 type: String 34114 }, 34115 defaultFirstOption: Boolean, 34116 reserveKeyword: { 34117 type: Boolean, 34118 default: true 34119 }, 34120 valueKey: { 34121 type: String, 34122 default: "value" 34123 }, 34124 collapseTags: Boolean, 34125 collapseTagsTooltip: { 34126 type: Boolean, 34127 default: false 34128 }, 34129 maxCollapseTags: { 34130 type: Number, 34131 default: 1 34132 }, 34133 teleported: useTooltipContentProps.teleported, 34134 persistent: { 34135 type: Boolean, 34136 default: true 34137 }, 34138 clearIcon: { 34139 type: iconPropType, 34140 default: circle_close_default 34141 }, 34142 fitInputWidth: { 34143 type: Boolean, 34144 default: false 34145 }, 34146 suffixIcon: { 34147 type: iconPropType, 34148 default: arrow_down_default 34149 }, 34150 tagType: { ...tagProps.type, default: "info" }, 34151 validateEvent: { 34152 type: Boolean, 34153 default: true 34154 }, 34155 remoteShowSuffix: { 34156 type: Boolean, 34157 default: false 34158 }, 34159 suffixTransition: { 34160 type: Boolean, 34161 default: true 34162 }, 34163 placement: { 34164 type: String, 34165 values: Ee, 34166 default: "bottom-start" 34167 } 34168 }, 34169 emits: [ 34170 UPDATE_MODEL_EVENT, 34171 CHANGE_EVENT, 34172 "remove-tag", 34173 "clear", 34174 "visible-change", 34175 "focus", 34176 "blur" 34177 ], 34178 setup(props, ctx) { 34179 const nsSelect = useNamespace("select"); 34180 const nsInput = useNamespace("input"); 34181 const { t } = useLocale(); 34182 const states = useSelectStates(props); 34183 const { 34184 optionList, 34185 optionsArray, 34186 selectSize, 34187 readonly, 34188 handleResize, 34189 collapseTagSize, 34190 debouncedOnInputChange, 34191 debouncedQueryChange, 34192 deletePrevTag, 34193 deleteTag, 34194 deleteSelected, 34195 handleOptionSelect, 34196 scrollToOption, 34197 setSelected, 34198 resetInputHeight, 34199 managePlaceholder, 34200 showClose, 34201 selectDisabled, 34202 iconComponent, 34203 iconReverse, 34204 showNewOption, 34205 emptyText, 34206 toggleLastOptionHitState, 34207 resetInputState, 34208 handleComposition, 34209 onOptionCreate, 34210 onOptionDestroy, 34211 handleMenuEnter, 34212 handleFocus, 34213 blur, 34214 handleBlur, 34215 handleClearClick, 34216 handleClose, 34217 handleKeydownEscape, 34218 toggleMenu, 34219 selectOption, 34220 getValueKey, 34221 navigateOptions, 34222 dropMenuVisible, 34223 reference, 34224 input, 34225 iOSInput, 34226 tooltipRef, 34227 tags, 34228 selectWrapper, 34229 scrollbar, 34230 queryChange, 34231 groupQueryChange, 34232 handleMouseEnter, 34233 handleMouseLeave, 34234 showTagList, 34235 collapseTagList 34236 } = useSelect$3(props, states, ctx); 34237 const { focus } = useFocus(reference); 34238 const {
34239 inputWidth, 34240 selected, 34241 inputLength, 34242 filteredOptionsCount, 34243 visible, 34244 softFocus, 34245 selectedLabel, 34246 hoverIndex, 34247 query, 34248 inputHovering, 34249 currentPlaceholder, 34250 menuVisibleOnFocus, 34251 isOnComposition, 34252 isSilentBlur, 34253 options, 34254 cachedOptions, 34255 optionsCount, 34256 prefixWidth, 34257 tagInMultiLine 34258 } = vue.toRefs(states); 34259 const wrapperKls = vue.computed(() => { 34260 const classList = [nsSelect.b()]; 34261 const _selectSize = vue.unref(selectSize); 34262 if (_selectSize) { 34263 classList.push(nsSelect.m(_selectSize)); 34264 } 34265 if (props.disabled) { 34266 classList.push(nsSelect.m("disabled")); 34267 } 34268 return classList; 34269 }); 34270 const selectTagsStyle = vue.computed(() => ({ 34271 maxWidth: `${vue.unref(inputWidth) - 32}px`, 34272 width: "100%" 34273 })); 34274 const tagTextStyle = vue.computed(() => { 34275 const maxWidth = vue.unref(inputWidth) > 123 ? vue.unref(inputWidth) - 123 : vue.unref(inputWidth) - 75; 34276 return { maxWidth: `${maxWidth}px` }; 34277 }); 34278 vue.provide(selectKey, vue.reactive({ 34279 props, 34280 options, 34281 optionsArray, 34282 cachedOptions, 34283 optionsCount, 34284 filteredOptionsCount, 34285 hoverIndex, 34286 handleOptionSelect, 34287 onOptionCreate, 34288 onOptionDestroy, 34289 selectWrapper, 34290 selected, 34291 setSelected, 34292 queryChange, 34293 groupQueryChange 34294 })); 34295 vue.onMounted(() => { 34296 states.cachedPlaceHolder = currentPlaceholder.value = props.placeholder || (() => t("el.select.placeholder")); 34297 if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) { 34298 currentPlaceholder.value = ""; 34299 } 34300 useResizeObserver(selectWrapper, handleResize); 34301 if (props.remote && props.multiple) { 34302 resetInputHeight(); 34303 } 34304 vue.nextTick(() => { 34305 const refEl = reference.value && reference.value.$el; 34306 if (!refEl) 34307 return; 34308 inputWidth.value = refEl.getBoundingClientRect().width; 34309 if (ctx.slots.prefix) { 34310 const prefix = refEl.querySelector(`.${nsInput.e("prefix")}`); 34311 prefixWidth.value = Math.max(prefix.getBoundingClientRect().width + 5, 30); 34312 } 34313 }); 34314 setSelected(); 34315 }); 34316 if (props.multiple && !Array.isArray(props.modelValue)) { 34317 ctx.emit(UPDATE_MODEL_EVENT, []); 34318 } 34319 if (!props.multiple && Array.isArray(props.modelValue)) { 34320 ctx.emit(UPDATE_MODEL_EVENT, ""); 34321 } 34322 const popperPaneRef = vue.computed(() => { 34323 var _a, _b; 34324 return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef; 34325 }); 34326 const onOptionsRendered = (v) => { 34327 optionList.value = v; 34328 }; 34329 return { 34330 isIOS, 34331 onOptionsRendered, 34332 tagInMultiLine, 34333 prefixWidth, 34334 selectSize, 34335 readonly, 34336 handleResize, 34337 collapseTagSize, 34338 debouncedOnInputChange, 34339 debouncedQueryChange, 34340 deletePrevTag, 34341 deleteTag, 34342 deleteSelected, 34343 handleOptionSelect, 34344 scrollToOption, 34345 inputWidth, 34346 selected, 34347 inputLength, 34348 filteredOptionsCount, 34349 visible, 34350 softFocus, 34351 selectedLabel, 34352 hoverIndex, 34353 query, 34354 inputHovering, 34355 currentPlaceholder, 34356 menuVisibleOnFocus, 34357 isOnComposition, 34358 isSilentBlur, 34359 options, 34360 resetInputHeight, 34361 managePlaceholder, 34362 showClose, 34363 selectDisabled, 34364 iconComponent, 34365 iconReverse, 34366 showNewOption, 34367 emptyText, 34368 toggleLastOptionHitState, 34369 resetInputState, 34370 handleComposition, 34371 handleMenuEnter, 34372 handleFocus, 34373 blur, 34374 handleBlur, 34375 handleClearClick, 34376 handleClose, 34377 handleKeydownEscape, 34378 toggleMenu, 34379 selectOption, 34380 getValueKey, 34381 navigateOptions, 34382 dropMenuVisible, 34383 focus, 34384 reference, 34385 input, 34386 iOSInput, 34387 tooltipRef, 34388 popperPaneRef, 34389 tags, 34390 selectWrapper, 34391 scrollbar, 34392 wrapperKls, 34393 selectTagsStyle, 34394 nsSelect, 34395 tagTextStyle, 34396 handleMouseEnter, 34397 handleMouseLeave, 34398 showTagList, 34399 collapseTagList 34400 }; 34401 } 34402 });
34403 const _hoisted_1$n = ["disabled", "autocomplete"]; 34404 const _hoisted_2$f = ["disabled"]; 34405 const _hoisted_3$8 = { style: { "height": "100%", "display": "flex", "justify-content": "center", "align-items": "center" } }; 34406 function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) { 34407 const _component_el_tag = vue.resolveComponent("el-tag"); 34408 const _component_el_tooltip = vue.resolveComponent("el-tooltip"); 34409 const _component_el_icon = vue.resolveComponent("el-icon"); 34410 const _component_el_input = vue.resolveComponent("el-input"); 34411 const _component_el_option = vue.resolveComponent("el-option"); 34412 const _component_el_options = vue.resolveComponent("el-options"); 34413 const _component_el_scrollbar = vue.resolveComponent("el-scrollbar"); 34414 const _component_el_select_menu = vue.resolveComponent("el-select-menu"); 34415 const _directive_click_outside = vue.resolveDirective("click-outside"); 34416 return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", { 34417 ref: "selectWrapper", 34418 class: vue.normalizeClass(_ctx.wrapperKls), 34419 onMouseenter: _cache[21] || (_cache[21] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)), 34420 onMouseleave: _cache[22] || (_cache[22] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)), 34421 onClick: _cache[23] || (_cache[23] = vue.withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"])) 34422 }, [ 34423 vue.createVNode(_component_el_tooltip, { 34424 ref: "tooltipRef", 34425 visible: _ctx.dropMenuVisible, 34426 placement: _ctx.placement, 34427 teleported: _ctx.teleported, 34428 "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass], 34429 "popper-options": _ctx.popperOptions, 34430 "fallback-placements": ["bottom-start", "top-start", "right", "left"], 34431 effect: _ctx.effect, 34432 pure: "", 34433 trigger: "click", 34434 transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`, 34435 "stop-popper-mouse-event": false, 34436 "gpu-acceleration": false, 34437 persistent: _ctx.persistent, 34438 onShow: _ctx.handleMenuEnter 34439 }, { 34440 default: vue.withCtx(() => [ 34441 vue.createElementVNode("div", { 34442 class: "select-trigger", 34443 onMouseenter: _cache[19] || (_cache[19] = ($event) => _ctx.inputHovering = true), 34444 onMouseleave: _cache[20] || (_cache[20] = ($event) => _ctx.inputHovering = false) 34445 }, [ 34446 _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("div", { 34447 key: 0, 34448 ref: "tags", 34449 class: vue.normalizeClass([ 34450 _ctx.nsSelect.e("tags"), 34451 _ctx.nsSelect.is("disabled", _ctx.selectDisabled) 34452 ]), 34453 style: vue.normalizeStyle(_ctx.selectTagsStyle) 34454 }, [ 34455 _ctx.collapseTags && _ctx.selected.length ? (vue.openBlock(), vue.createBlock(vue.Transition, { 34456 key: 0, 34457 onAfterLeave: _ctx.resetInputHeight 34458 }, { 34459 default: vue.withCtx(() => [ 34460 vue.createElementVNode("span", { 34461 class: vue.normalizeClass([ 34462 _ctx.nsSelect.b("tags-wrapper"), 34463 { "has-prefix": _ctx.prefixWidth && _ctx.selected.length } 34464 ]) 34465 }, [ 34466 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.showTagList, (item) => { 34467 return vue.openBlock(), vue.createBlock(_component_el_tag, { 34468 key: _ctx.getValueKey(item), 34469 closable: !_ctx.selectDisabled && !item.isDisabled, 34470 size: _ctx.collapseTagSize, 34471 hit: item.hitState, 34472 type: _ctx.tagType, 34473 "disable-transitions": "", 34474 onClose: ($event) => _ctx.deleteTag($event, item) 34475 }, { 34476 default: vue.withCtx(() => [ 34477 vue.createElementVNode("span", { 34478 class: vue.normalizeClass(_ctx.nsSelect.e("tags-text")), 34479 style: vue.normalizeStyle(_ctx.tagTextStyle) 34480 }, vue.toDisplayString(item.currentLabel), 7) 34481 ]), 34482 _: 2 34483 }, 1032, ["closable", "size", "hit", "type", "onClose"]); 34484 }), 128)), 34485 _ctx.selected.length > _ctx.maxCollapseTags ? (vue.openBlock(), vue.createBlock(_component_el_tag, { 34486 key: 0, 34487 closable: false, 34488 size: _ctx.collapseTagSize, 34489 type: _ctx.tagType, 34490 "disable-transitions": "" 34491 }, { 34492 default: vue.withCtx(() => [ 34493 _ctx.collapseTagsTooltip ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, { 34494 key: 0, 34495 disabled: _ctx.dropMenuVisible, 34496 "fallback-placements": ["bottom", "top", "right", "left"], 34497 effect: _ctx.effect, 34498 placement: "bottom", 34499 teleported: _ctx.teleported 34500 }, { 34501 default: vue.withCtx(() => [ 34502 vue.createElementVNode("span", { 34503 class: vue.normalizeClass(_ctx.nsSelect.e("tags-text")) 34504 }, "+ " + vue.toDisplayString(_ctx.selected.length - _ctx.maxCollapseTags), 3) 34505 ]), 34506 content: vue.withCtx(() => [ 34507 vue.createElementVNode("div", { 34508 class: vue.normalizeClass(_ctx.nsSelect.e("collapse-tags")) 34509 }, [ 34510 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.collapseTagList, (item) => {
34511 return vue.openBlock(), vue.createElementBlock("div", { 34512 key: _ctx.getValueKey(item), 34513 class: vue.normalizeClass(_ctx.nsSelect.e("collapse-tag")) 34514 }, [ 34515 vue.createVNode(_component_el_tag, { 34516 class: "in-tooltip", 34517 closable: !_ctx.selectDisabled && !item.isDisabled, 34518 size: _ctx.collapseTagSize, 34519 hit: item.hitState, 34520 type: _ctx.tagType, 34521 "disable-transitions": "", 34522 style: { margin: "2px" }, 34523 onClose: ($event) => _ctx.deleteTag($event, item) 34524 }, { 34525 default: vue.withCtx(() => [ 34526 vue.createElementVNode("span", { 34527 class: vue.normalizeClass(_ctx.nsSelect.e("tags-text")), 34528 style: vue.normalizeStyle({ 34529 maxWidth: _ctx.inputWidth - 75 + "px" 34530 }) 34531 }, vue.toDisplayString(item.currentLabel), 7) 34532 ]), 34533 _: 2 34534 }, 1032, ["closable", "size", "hit", "type", "onClose"]) 34535 ], 2); 34536 }), 128)) 34537 ], 2) 34538 ]), 34539 _: 1 34540 }, 8, ["disabled", "effect", "teleported"])) : (vue.openBlock(), vue.createElementBlock("span", { 34541 key: 1, 34542 class: vue.normalizeClass(_ctx.nsSelect.e("tags-text")) 34543 }, "+ " + vue.toDisplayString(_ctx.selected.length - _ctx.maxCollapseTags), 3)) 34544 ]), 34545 _: 1 34546 }, 8, ["size", "type"])) : vue.createCommentVNode("v-if", true) 34547 ], 2) 34548 ]), 34549 _: 1 34550 }, 8, ["onAfterLeave"])) : vue.createCommentVNode("v-if", true), 34551 !_ctx.collapseTags ? (vue.openBlock(), vue.createBlock(vue.Transition, { 34552 key: 1, 34553 onAfterLeave: _ctx.resetInputHeight 34554 }, { 34555 default: vue.withCtx(() => [ 34556 vue.createElementVNode("span", { 34557 class: vue.normalizeClass([ 34558 _ctx.nsSelect.b("tags-wrapper"), 34559 { "has-prefix": _ctx.prefixWidth && _ctx.selected.length } 34560 ]) 34561 }, [ 34562 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.selected, (item) => { 34563 return vue.openBlock(), vue.createBlock(_component_el_tag, { 34564 key: _ctx.getValueKey(item), 34565 closable: !_ctx.selectDisabled && !item.isDisabled, 34566 size: _ctx.collapseTagSize, 34567 hit: item.hitState, 34568 type: _ctx.tagType, 34569 "disable-transitions": "", 34570 onClose: ($event) => _ctx.deleteTag($event, item) 34571 }, { 34572 default: vue.withCtx(() => [ 34573 vue.createElementVNode("span", { 34574 class: vue.normalizeClass(_ctx.nsSelect.e("tags-text")), 34575 style: vue.normalizeStyle({ maxWidth: _ctx.inputWidth - 75 + "px" }) 34576 }, vue.toDisplayString(item.currentLabel), 7) 34577 ]), 34578 _: 2 34579 }, 1032, ["closable", "size", "hit", "type", "onClose"]); 34580 }), 128)) 34581 ], 2) 34582 ]), 34583 _: 1 34584 }, 8, ["onAfterLeave"])) : vue.createCommentVNode("v-if", true), 34585 _ctx.filterable ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", { 34586 key: 2, 34587 ref: "input", 34588 "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.query = $event), 34589 type: "text", 34590 class: vue.normalizeClass([ 34591 _ctx.nsSelect.e("input"), 34592 _ctx.nsSelect.is(_ctx.selectSize), 34593 _ctx.nsSelect.is("disabled", _ctx.selectDisabled) 34594 ]), 34595 disabled: _ctx.selectDisabled, 34596 autocomplete: _ctx.autocomplete, 34597 style: vue.normalizeStyle({ 34598 marginLeft: _ctx.prefixWidth && !_ctx.selected.length || _ctx.tagInMultiLine ? `${_ctx.prefixWidth}px` : "", 34599 flexGrow: 1,
34600 width: `${_ctx.inputLength / (_ctx.inputWidth - 32)}%`, 34601 maxWidth: `${_ctx.inputWidth - 42}px` 34602 }), 34603 onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)), 34604 onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)), 34605 onKeyup: _cache[3] || (_cache[3] = (...args) => _ctx.managePlaceholder && _ctx.managePlaceholder(...args)), 34606 onKeydown: [ 34607 _cache[4] || (_cache[4] = (...args) => _ctx.resetInputState && _ctx.resetInputState(...args)), 34608 _cache[5] || (_cache[5] = vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("next"), ["prevent"]), ["down"])), 34609 _cache[6] || (_cache[6] = vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("prev"), ["prevent"]), ["up"])), 34610 _cache[7] || (_cache[7] = vue.withKeys((...args) => _ctx.handleKeydownEscape && _ctx.handleKeydownEscape(...args), ["esc"])), 34611 _cache[8] || (_cache[8] = vue.withKeys(vue.withModifiers((...args) => _ctx.selectOption && _ctx.selectOption(...args), ["stop", "prevent"]), ["enter"])), 34612 _cache[9] || (_cache[9] = vue.withKeys((...args) => _ctx.deletePrevTag && _ctx.deletePrevTag(...args), ["delete"])), 34613 _cache[10] || (_cache[10] = vue.withKeys(($event) => _ctx.visible = false, ["tab"])) 34614 ], 34615 onCompositionstart: _cache[11] || (_cache[11] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)), 34616 onCompositionupdate: _cache[12] || (_cache[12] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)), 34617 onCompositionend: _cache[13] || (_cache[13] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)), 34618 onInput: _cache[14] || (_cache[14] = (...args) => _ctx.debouncedQueryChange && _ctx.debouncedQueryChange(...args)) 34619 }, null, 46, _hoisted_1$n)), [ 34620 [vue.vModelText, _ctx.query] 34621 ]) : vue.createCommentVNode("v-if", true) 34622 ], 6)) : vue.createCommentVNode("v-if", true), 34623 vue.createCommentVNode(" fix: https://github.com/element-plus/element-plus/issues/11415 "), 34624 _ctx.isIOS && !_ctx.multiple && _ctx.filterable && _ctx.readonly ? (vue.openBlock(), vue.createElementBlock("input", { 34625 key: 1, 34626 ref: "iOSInput", 34627 class: vue.normalizeClass([ 34628 _ctx.nsSelect.e("input"), 34629 _ctx.nsSelect.is(_ctx.selectSize), 34630 _ctx.nsSelect.em("input", "iOS") 34631 ]), 34632 disabled: _ctx.selectDisabled, 34633 type: "text" 34634 }, null, 10, _hoisted_2$f)) : vue.createCommentVNode("v-if", true), 34635 vue.createVNode(_component_el_input, { 34636 id: _ctx.id, 34637 ref: "reference", 34638 modelValue: _ctx.selectedLabel, 34639 "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.selectedLabel = $event), 34640 type: "text", 34641 placeholder: typeof _ctx.currentPlaceholder === "function" ? _ctx.currentPlaceholder() : _ctx.currentPlaceholder, 34642 name: _ctx.name, 34643 autocomplete: _ctx.autocomplete, 34644 size: _ctx.selectSize, 34645 disabled: _ctx.selectDisabled, 34646 readonly: _ctx.readonly, 34647 "validate-event": false, 34648 class: vue.normalizeClass([_ctx.nsSelect.is("focus", _ctx.visible)]), 34649 tabindex: _ctx.multiple && _ctx.filterable ? -1 : void 0, 34650 onFocus: _ctx.handleFocus, 34651 onBlur: _ctx.handleBlur, 34652 onInput: _ctx.debouncedOnInputChange, 34653 onPaste: _ctx.debouncedOnInputChange, 34654 onCompositionstart: _ctx.handleComposition, 34655 onCompositionupdate: _ctx.handleComposition, 34656 onCompositionend: _ctx.handleComposition, 34657 onKeydown: [ 34658 _cache[16] || (_cache[16] = vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"])), 34659 _cache[17] || (_cache[17] = vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"])), 34660 vue.withKeys(vue.withModifiers(_ctx.selectOption, ["stop", "prevent"]), ["enter"]), 34661 vue.withKeys(_ctx.handleKeydownEscape, ["esc"]), 34662 _cache[18] || (_cache[18] = vue.withKeys(($event) => _ctx.visible = false, ["tab"])) 34663 ] 34664 }, vue.createSlots({ 34665 suffix: vue.withCtx(() => [ 34666 _ctx.iconComponent && !_ctx.showClose ? (vue.openBlock(), vue.createBlock(_component_el_icon, { 34667 key: 0, 34668 class: vue.normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse]) 34669 }, { 34670 default: vue.withCtx(() => [ 34671 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent))) 34672 ]), 34673 _: 1 34674 }, 8, ["class"])) : vue.createCommentVNode("v-if", true), 34675 _ctx.showClose && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, { 34676 key: 1, 34677 class: vue.normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon")]), 34678 onClick: _ctx.handleClearClick 34679 }, { 34680 default: vue.withCtx(() => [ 34681 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon))) 34682 ]), 34683 _: 1 34684 }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true) 34685 ]), 34686 _: 2 34687 }, [ 34688 _ctx.$slots.prefix ? { 34689 name: "prefix", 34690 fn: vue.withCtx(() => [ 34691 vue.createElementVNode("div", _hoisted_3$8, [
34692 vue.renderSlot(_ctx.$slots, "prefix") 34693 ]) 34694 ]) 34695 } : void 0 34696 ]), 1032, ["id", "modelValue", "placeholder", "name", "autocomplete", "size", "disabled", "readonly", "class", "tabindex", "onFocus", "onBlur", "onInput", "onPaste", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown"]) 34697 ], 32) 34698 ]), 34699 content: vue.withCtx(() => [ 34700 vue.createVNode(_component_el_select_menu, null, { 34701 default: vue.withCtx(() => [ 34702 vue.withDirectives(vue.createVNode(_component_el_scrollbar, { 34703 ref: "scrollbar", 34704 tag: "ul", 34705 "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"), 34706 "view-class": _ctx.nsSelect.be("dropdown", "list"), 34707 class: vue.normalizeClass([ 34708 _ctx.nsSelect.is("empty", !_ctx.allowCreate && Boolean(_ctx.query) && _ctx.filteredOptionsCount === 0) 34709 ]) 34710 }, { 34711 default: vue.withCtx(() => [ 34712 _ctx.showNewOption ? (vue.openBlock(), vue.createBlock(_component_el_option, { 34713 key: 0, 34714 value: _ctx.query, 34715 created: true 34716 }, null, 8, ["value"])) : vue.createCommentVNode("v-if", true), 34717 vue.createVNode(_component_el_options, { onUpdateOptions: _ctx.onOptionsRendered }, { 34718 default: vue.withCtx(() => [ 34719 vue.renderSlot(_ctx.$slots, "default") 34720 ]), 34721 _: 3 34722 }, 8, ["onUpdateOptions"]) 34723 ]), 34724 _: 3 34725 }, 8, ["wrap-class", "view-class", "class"]), [ 34726 [vue.vShow, _ctx.options.size > 0 && !_ctx.loading] 34727 ]), 34728 _ctx.emptyText && (!_ctx.allowCreate || _ctx.loading || _ctx.allowCreate && _ctx.options.size === 0) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ 34729 _ctx.$slots.empty ? vue.renderSlot(_ctx.$slots, "empty", { key: 0 }) : (vue.openBlock(), vue.createElementBlock("p", { 34730 key: 1, 34731 class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "empty")) 34732 }, vue.toDisplayString(_ctx.emptyText), 3)) 34733 ], 64)) : vue.createCommentVNode("v-if", true) 34734 ]), 34735 _: 3 34736 }) 34737 ]), 34738 _: 3 34739 }, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "effect", "transition", "persistent", "onShow"]) 34740 ], 34)), [ 34741 [_directive_click_outside, _ctx.handleClose, _ctx.popperPaneRef] 34742 ]); 34743 } 34744 var Select$1 = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["render", _sfc_render$9], ["__file", "select.vue"]]); 34745 34746 const _sfc_main$N = vue.defineComponent({ 34747 name: "ElOptionGroup", 34748 componentName: "ElOptionGroup", 34749 props: { 34750 label: String, 34751 disabled: { 34752 type: Boolean, 34753 default: false 34754 } 34755 }, 34756 setup(props) { 34757 const ns = useNamespace("select"); 34758 const visible = vue.ref(true); 34759 const instance = vue.getCurrentInstance(); 34760 const children = vue.ref([]); 34761 vue.provide(selectGroupKey, vue.reactive({ 34762 ...vue.toRefs(props) 34763 })); 34764 const select = vue.inject(selectKey); 34765 vue.onMounted(() => { 34766 children.value = flattedChildren(instance.subTree); 34767 }); 34768 const flattedChildren = (node) => { 34769 const children2 = []; 34770 if (Array.isArray(node.children)) { 34771 node.children.forEach((child) => { 34772 var _a; 34773 if (child.type && child.type.name === "ElOption" && child.component && child.component.proxy) { 34774 children2.push(child.component.proxy); 34775 } else if ((_a = child.children) == null ? void 0 : _a.length) { 34776 children2.push(...flattedChildren(child)); 34777 } 34778 }); 34779 } 34780 return children2; 34781 }; 34782 const { groupQueryChange } = vue.toRaw(select); 34783 vue.watch(groupQueryChange, () => { 34784 visible.value = children.value.some((option) => option.visible === true); 34785 }, { flush: "post" }); 34786 return { 34787 visible, 34788 ns 34789 }; 34790 } 34791 });
34792 function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) { 34793 return vue.withDirectives((vue.openBlock(), vue.createElementBlock("ul", { 34794 class: vue.normalizeClass(_ctx.ns.be("group", "wrap")) 34795 }, [ 34796 vue.createElementVNode("li", { 34797 class: vue.normalizeClass(_ctx.ns.be("group", "title")) 34798 }, vue.toDisplayString(_ctx.label), 3), 34799 vue.createElementVNode("li", null, [ 34800 vue.createElementVNode("ul", { 34801 class: vue.normalizeClass(_ctx.ns.b("group")) 34802 }, [ 34803 vue.renderSlot(_ctx.$slots, "default") 34804 ], 2) 34805 ]) 34806 ], 2)), [ 34807 [vue.vShow, _ctx.visible] 34808 ]); 34809 } 34810 var OptionGroup = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["render", _sfc_render$8], ["__file", "option-group.vue"]]); 34811 34812 const ElSelect = withInstall(Select$1, { 34813 Option, 34814 OptionGroup 34815 }); 34816 const ElOption = withNoopInstall(Option); 34817 const ElOptionGroup = withNoopInstall(OptionGroup); 34818 34819 const usePagination = () => vue.inject(elPaginationKey, {}); 34820 34821 const paginationSizesProps = buildProps({ 34822 pageSize: { 34823 type: Number, 34824 required: true 34825 }, 34826 pageSizes: { 34827 type: definePropType(Array), 34828 default: () => mutable([10, 20, 30, 40, 50, 100]) 34829 }, 34830 popperClass: { 34831 type: String 34832 }, 34833 disabled: Boolean, 34834 size: { 34835 type: String, 34836 values: componentSizes 34837 } 34838 }); 34839 34840 const __default__$C = vue.defineComponent({ 34841 name: "ElPaginationSizes" 34842 }); 34843 const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({ 34844 ...__default__$C, 34845 props: paginationSizesProps, 34846 emits: ["page-size-change"], 34847 setup(__props, { emit }) { 34848 const props = __props; 34849 const { t } = useLocale(); 34850 const ns = useNamespace("pagination"); 34851 const pagination = usePagination(); 34852 const innerPageSize = vue.ref(props.pageSize); 34853 vue.watch(() => props.pageSizes, (newVal, oldVal) => { 34854 if (isEqual$1(newVal, oldVal)) 34855 return; 34856 if (Array.isArray(newVal)) { 34857 const pageSize = newVal.includes(props.pageSize) ? props.pageSize : props.pageSizes[0]; 34858 emit("page-size-change", pageSize); 34859 } 34860 }); 34861 vue.watch(() => props.pageSize, (newVal) => { 34862 innerPageSize.value = newVal; 34863 }); 34864 const innerPageSizes = vue.computed(() => props.pageSizes); 34865 function handleChange(val) { 34866 var _a; 34867 if (val !== innerPageSize.value) { 34868 innerPageSize.value = val; 34869 (_a = pagination.handleSizeChange) == null ? void 0 : _a.call(pagination, Number(val)); 34870 } 34871 } 34872 return (_ctx, _cache) => { 34873 return vue.openBlock(), vue.createElementBlock("span", { 34874 class: vue.normalizeClass(vue.unref(ns).e("sizes")) 34875 }, [ 34876 vue.createVNode(vue.unref(ElSelect), { 34877 "model-value": innerPageSize.value, 34878 disabled: _ctx.disabled, 34879 "popper-class": _ctx.popperClass, 34880 size: _ctx.size, 34881 "validate-event": false, 34882 onChange: handleChange 34883 }, { 34884 default: vue.withCtx(() => [ 34885 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(innerPageSizes), (item) => { 34886 return vue.openBlock(), vue.createBlock(vue.unref(ElOption), { 34887 key: item, 34888 value: item, 34889 label: item + vue.unref(t)("el.pagination.pagesize") 34890 }, null, 8, ["value", "label"]); 34891 }), 128)) 34892 ]), 34893 _: 1 34894 }, 8, ["model-value", "disabled", "popper-class", "size"]) 34895 ], 2); 34896 }; 34897 } 34898 }); 34899 var Sizes = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__file", "sizes.vue"]]); 34900 34901 const paginationJumperProps = buildProps({ 34902 size: { 34903 type: String, 34904 values: componentSizes 34905 } 34906 });
34907 34908 const _hoisted_1$m = ["disabled"]; 34909 const __default__$B = vue.defineComponent({ 34910 name: "ElPaginationJumper" 34911 }); 34912 const _sfc_main$L = /* @__PURE__ */ vue.defineComponent({ 34913 ...__default__$B, 34914 props: paginationJumperProps, 34915 setup(__props) { 34916 const { t } = useLocale(); 34917 const ns = useNamespace("pagination"); 34918 const { pageCount, disabled, currentPage, changeEvent } = usePagination(); 34919 const userInput = vue.ref(); 34920 const innerValue = vue.computed(() => { 34921 var _a; 34922 return (_a = userInput.value) != null ? _a : currentPage == null ? void 0 : currentPage.value; 34923 }); 34924 function handleInput(val) { 34925 userInput.value = val ? +val : ""; 34926 } 34927 function handleChange(val) { 34928 val = Math.trunc(+val); 34929 changeEvent == null ? void 0 : changeEvent(val); 34930 userInput.value = void 0; 34931 } 34932 return (_ctx, _cache) => { 34933 return vue.openBlock(), vue.createElementBlock("span", { 34934 class: vue.normalizeClass(vue.unref(ns).e("jump")), 34935 disabled: vue.unref(disabled) 34936 }, [ 34937 vue.createElementVNode("span", { 34938 class: vue.normalizeClass([vue.unref(ns).e("goto")]) 34939 }, vue.toDisplayString(vue.unref(t)("el.pagination.goto")), 3), 34940 vue.createVNode(vue.unref(ElInput), { 34941 size: _ctx.size, 34942 class: vue.normalizeClass([vue.unref(ns).e("editor"), vue.unref(ns).is("in-pagination")]), 34943 min: 1, 34944 max: vue.unref(pageCount), 34945 disabled: vue.unref(disabled), 34946 "model-value": vue.unref(innerValue), 34947 "validate-event": false, 34948 label: vue.unref(t)("el.pagination.page"), 34949 type: "number", 34950 "onUpdate:modelValue": handleInput, 34951 onChange: handleChange 34952 }, null, 8, ["size", "class", "max", "disabled", "model-value", "label"]), 34953 vue.createElementVNode("span", { 34954 class: vue.normalizeClass([vue.unref(ns).e("classifier")]) 34955 }, vue.toDisplayString(vue.unref(t)("el.pagination.pageClassifier")), 3) 34956 ], 10, _hoisted_1$m); 34957 }; 34958 } 34959 }); 34960 var Jumper = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["__file", "jumper.vue"]]); 34961 34962 const paginationTotalProps = buildProps({ 34963 total: { 34964 type: Number, 34965 default: 1e3 34966 } 34967 }); 34968 34969 const _hoisted_1$l = ["disabled"]; 34970 const __default__$A = vue.defineComponent({ 34971 name: "ElPaginationTotal" 34972 }); 34973 const _sfc_main$K = /* @__PURE__ */ vue.defineComponent({ 34974 ...__default__$A, 34975 props: paginationTotalProps, 34976 setup(__props) { 34977 const { t } = useLocale(); 34978 const ns = useNamespace("pagination"); 34979 const { disabled } = usePagination(); 34980 return (_ctx, _cache) => { 34981 return vue.openBlock(), vue.createElementBlock("span", { 34982 class: vue.normalizeClass(vue.unref(ns).e("total")), 34983 disabled: vue.unref(disabled) 34984 }, vue.toDisplayString(vue.unref(t)("el.pagination.total", { 34985 total: _ctx.total 34986 })), 11, _hoisted_1$l); 34987 }; 34988 } 34989 }); 34990 var Total = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__file", "total.vue"]]); 34991 34992 const paginationPagerProps = buildProps({ 34993 currentPage: { 34994 type: Number, 34995 default: 1 34996 }, 34997 pageCount: { 34998 type: Number, 34999 required: true 35000 }, 35001 pagerCount: { 35002 type: Number, 35003 default: 7 35004 }, 35005 disabled: Boolean 35006 }); 35007 35008 const _hoisted_1$k = ["onKeyup"]; 35009 const _hoisted_2$e = ["aria-current", "aria-label", "tabindex"]; 35010 const _hoisted_3$7 = ["tabindex", "aria-label"]; 35011 const _hoisted_4$5 = ["aria-current", "aria-label", "tabindex"]; 35012 const _hoisted_5$4 = ["tabindex", "aria-label"]; 35013 const _hoisted_6 = ["aria-current", "aria-label", "tabindex"]; 35014 const __default__$z = vue.defineComponent({ 35015 name: "ElPaginationPager" 35016 });
35017 const _sfc_main$J = /* @__PURE__ */ vue.defineComponent({ 35018 ...__default__$z, 35019 props: paginationPagerProps, 35020 emits: ["change"], 35021 setup(__props, { emit }) { 35022 const props = __props; 35023 const nsPager = useNamespace("pager"); 35024 const nsIcon = useNamespace("icon"); 35025 const { t } = useLocale(); 35026 const showPrevMore = vue.ref(false); 35027 const showNextMore = vue.ref(false); 35028 const quickPrevHover = vue.ref(false); 35029 const quickNextHover = vue.ref(false); 35030 const quickPrevFocus = vue.ref(false); 35031 const quickNextFocus = vue.ref(false); 35032 const pagers = vue.computed(() => { 35033 const pagerCount = props.pagerCount; 35034 const halfPagerCount = (pagerCount - 1) / 2; 35035 const currentPage = Number(props.currentPage); 35036 const pageCount = Number(props.pageCount); 35037 let showPrevMore2 = false; 35038 let showNextMore2 = false; 35039 if (pageCount > pagerCount) { 35040 if (currentPage > pagerCount - halfPagerCount) { 35041 showPrevMore2 = true; 35042 } 35043 if (currentPage < pageCount - halfPagerCount) { 35044 showNextMore2 = true; 35045 } 35046 } 35047 const array = []; 35048 if (showPrevMore2 && !showNextMore2) { 35049 const startPage = pageCount - (pagerCount - 2); 35050 for (let i = startPage; i < pageCount; i++) { 35051 array.push(i); 35052 } 35053 } else if (!showPrevMore2 && showNextMore2) { 35054 for (let i = 2; i < pagerCount; i++) { 35055 array.push(i); 35056 } 35057 } else if (showPrevMore2 && showNextMore2) { 35058 const offset = Math.floor(pagerCount / 2) - 1; 35059 for (let i = currentPage - offset; i <= currentPage + offset; i++) { 35060 array.push(i); 35061 } 35062 } else { 35063 for (let i = 2; i < pageCount; i++) { 35064 array.push(i); 35065 } 35066 } 35067 return array; 35068 }); 35069 const tabindex = vue.computed(() => props.disabled ? -1 : 0); 35070 vue.watchEffect(() => { 35071 const halfPagerCount = (props.pagerCount - 1) / 2; 35072 showPrevMore.value = false; 35073 showNextMore.value = false; 35074 if (props.pageCount > props.pagerCount) { 35075 if (props.currentPage > props.pagerCount - halfPagerCount) { 35076 showPrevMore.value = true; 35077 } 35078 if (props.currentPage < props.pageCount - halfPagerCount) { 35079 showNextMore.value = true; 35080 } 35081 } 35082 }); 35083 function onMouseEnter(forward = false) { 35084 if (props.disabled) 35085 return; 35086 if (forward) { 35087 quickPrevHover.value = true; 35088 } else { 35089 quickNextHover.value = true; 35090 } 35091 } 35092 function onFocus(forward = false) { 35093 if (forward) { 35094 quickPrevFocus.value = true; 35095 } else { 35096 quickNextFocus.value = true; 35097 } 35098 } 35099 function onEnter(e) { 35100 const target = e.target; 35101 if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("number")) { 35102 const newPage = Number(target.textContent); 35103 if (newPage !== props.currentPage) { 35104 emit("change", newPage); 35105 } 35106 } else if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("more")) { 35107 onPagerClick(e); 35108 } 35109 } 35110 function onPagerClick(event) { 35111 const target = event.target; 35112 if (target.tagName.toLowerCase() === "ul" || props.disabled) { 35113 return; 35114 } 35115 let newPage = Number(target.textContent); 35116 const pageCount = props.pageCount; 35117 const currentPage = props.currentPage; 35118 const pagerCountOffset = props.pagerCount - 2; 35119 if (target.className.includes("more")) { 35120 if (target.className.includes("quickprev")) { 35121 newPage = currentPage - pagerCountOffset; 35122 } else if (target.className.includes("quicknext")) { 35123 newPage = currentPage + pagerCountOffset; 35124 } 35125 } 35126 if (!Number.isNaN(+newPage)) { 35127 if (newPage < 1) { 35128 newPage = 1; 35129 } 35130 if (newPage > pageCount) { 35131 newPage = pageCount; 35132 } 35133 } 35134 if (newPage !== currentPage) { 35135 emit("change", newPage); 35136 } 35137 } 35138 return (_ctx, _cache) => {
35139 return vue.openBlock(), vue.createElementBlock("ul", { 35140 class: vue.normalizeClass(vue.unref(nsPager).b()), 35141 onClick: onPagerClick, 35142 onKeyup: vue.withKeys(onEnter, ["enter"]) 35143 }, [ 35144 _ctx.pageCount > 0 ? (vue.openBlock(), vue.createElementBlock("li", { 35145 key: 0, 35146 class: vue.normalizeClass([[ 35147 vue.unref(nsPager).is("active", _ctx.currentPage === 1), 35148 vue.unref(nsPager).is("disabled", _ctx.disabled) 35149 ], "number"]), 35150 "aria-current": _ctx.currentPage === 1, 35151 "aria-label": vue.unref(t)("el.pagination.currentPage", { pager: 1 }), 35152 tabindex: vue.unref(tabindex) 35153 }, " 1 ", 10, _hoisted_2$e)) : vue.createCommentVNode("v-if", true), 35154 showPrevMore.value ? (vue.openBlock(), vue.createElementBlock("li", { 35155 key: 1, 35156 class: vue.normalizeClass([ 35157 "more", 35158 "btn-quickprev", 35159 vue.unref(nsIcon).b(), 35160 vue.unref(nsPager).is("disabled", _ctx.disabled) 35161 ]), 35162 tabindex: vue.unref(tabindex), 35163 "aria-label": vue.unref(t)("el.pagination.prevPages", { pager: _ctx.pagerCount - 2 }), 35164 onMouseenter: _cache[0] || (_cache[0] = ($event) => onMouseEnter(true)), 35165 onMouseleave: _cache[1] || (_cache[1] = ($event) => quickPrevHover.value = false), 35166 onFocus: _cache[2] || (_cache[2] = ($event) => onFocus(true)), 35167 onBlur: _cache[3] || (_cache[3] = ($event) => quickPrevFocus.value = false) 35168 }, [ 35169 (quickPrevHover.value || quickPrevFocus.value) && !_ctx.disabled ? (vue.openBlock(), vue.createBlock(vue.unref(d_arrow_left_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(more_filled_default), { key: 1 })) 35170 ], 42, _hoisted_3$7)) : vue.createCommentVNode("v-if", true), 35171 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(pagers), (pager) => { 35172 return vue.openBlock(), vue.createElementBlock("li", { 35173 key: pager, 35174 class: vue.normalizeClass([[ 35175 vue.unref(nsPager).is("active", _ctx.currentPage === pager), 35176 vue.unref(nsPager).is("disabled", _ctx.disabled) 35177 ], "number"]), 35178 "aria-current": _ctx.currentPage === pager, 35179 "aria-label": vue.unref(t)("el.pagination.currentPage", { pager }), 35180 tabindex: vue.unref(tabindex) 35181 }, vue.toDisplayString(pager), 11, _hoisted_4$5); 35182 }), 128)), 35183 showNextMore.value ? (vue.openBlock(), vue.createElementBlock("li", { 35184 key: 2, 35185 class: vue.normalizeClass([ 35186 "more", 35187 "btn-quicknext", 35188 vue.unref(nsIcon).b(), 35189 vue.unref(nsPager).is("disabled", _ctx.disabled) 35190 ]), 35191 tabindex: vue.unref(tabindex), 35192 "aria-label": vue.unref(t)("el.pagination.nextPages", { pager: _ctx.pagerCount - 2 }), 35193 onMouseenter: _cache[4] || (_cache[4] = ($event) => onMouseEnter()), 35194 onMouseleave: _cache[5] || (_cache[5] = ($event) => quickNextHover.value = false), 35195 onFocus: _cache[6] || (_cache[6] = ($event) => onFocus()), 35196 onBlur: _cache[7] || (_cache[7] = ($event) => quickNextFocus.value = false) 35197 }, [ 35198 (quickNextHover.value || quickNextFocus.value) && !_ctx.disabled ? (vue.openBlock(), vue.createBlock(vue.unref(d_arrow_right_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(more_filled_default), { key: 1 })) 35199 ], 42, _hoisted_5$4)) : vue.createCommentVNode("v-if", true), 35200 _ctx.pageCount > 1 ? (vue.openBlock(), vue.createElementBlock("li", { 35201 key: 3, 35202 class: vue.normalizeClass([[ 35203 vue.unref(nsPager).is("active", _ctx.currentPage === _ctx.pageCount), 35204 vue.unref(nsPager).is("disabled", _ctx.disabled) 35205 ], "number"]), 35206 "aria-current": _ctx.currentPage === _ctx.pageCount, 35207 "aria-label": vue.unref(t)("el.pagination.currentPage", { pager: _ctx.pageCount }), 35208 tabindex: vue.unref(tabindex) 35209 }, vue.toDisplayString(_ctx.pageCount), 11, _hoisted_6)) : vue.createCommentVNode("v-if", true) 35210 ], 42, _hoisted_1$k); 35211 }; 35212 } 35213 });
35214 var Pager = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__file", "pager.vue"]]); 35215 35216 const isAbsent = (v) => typeof v !== "number"; 35217 const paginationProps = buildProps({ 35218 total: Number, 35219 pageSize: Number, 35220 defaultPageSize: Number, 35221 currentPage: Number, 35222 defaultCurrentPage: Number, 35223 pageCount: Number, 35224 pagerCount: { 35225 type: Number, 35226 validator: (value) => { 35227 return isNumber(value) && Math.trunc(value) === value && value > 4 && value < 22 && value % 2 === 1; 35228 }, 35229 default: 7 35230 }, 35231 layout: { 35232 type: String, 35233 default: ["prev", "pager", "next", "jumper", "->", "total"].join(", ") 35234 }, 35235 pageSizes: { 35236 type: definePropType(Array), 35237 default: () => mutable([10, 20, 30, 40, 50, 100]) 35238 }, 35239 popperClass: { 35240 type: String, 35241 default: "" 35242 }, 35243 prevText: { 35244 type: String, 35245 default: "" 35246 }, 35247 prevIcon: { 35248 type: iconPropType, 35249 default: () => arrow_left_default 35250 }, 35251 nextText: { 35252 type: String, 35253 default: "" 35254 }, 35255 nextIcon: { 35256 type: iconPropType, 35257 default: () => arrow_right_default 35258 }, 35259 small: Boolean, 35260 background: Boolean, 35261 disabled: Boolean, 35262 hideOnSinglePage: Boolean 35263 }); 35264 const paginationEmits = { 35265 "update:current-page": (val) => isNumber(val), 35266 "update:page-size": (val) => isNumber(val), 35267 "size-change": (val) => isNumber(val), 35268 "current-change": (val) => isNumber(val), 35269 "prev-click": (val) => isNumber(val), 35270 "next-click": (val) => isNumber(val) 35271 }; 35272 const componentName = "ElPagination"; 35273 var Pagination = vue.defineComponent({ 35274 name: componentName, 35275 props: paginationProps, 35276 emits: paginationEmits, 35277 setup(props, { emit, slots }) { 35278 const { t } = useLocale(); 35279 const ns = useNamespace("pagination"); 35280 const vnodeProps = vue.getCurrentInstance().vnode.props || {}; 35281 const hasCurrentPageListener = "onUpdate:currentPage" in vnodeProps || "onUpdate:current-page" in vnodeProps || "onCurrentChange" in vnodeProps; 35282 const hasPageSizeListener = "onUpdate:pageSize" in vnodeProps || "onUpdate:page-size" in vnodeProps || "onSizeChange" in vnodeProps; 35283 const assertValidUsage = vue.computed(() => { 35284 if (isAbsent(props.total) && isAbsent(props.pageCount)) 35285 return false; 35286 if (!isAbsent(props.currentPage) && !hasCurrentPageListener) 35287 return false; 35288 if (props.layout.includes("sizes")) { 35289 if (!isAbsent(props.pageCount)) { 35290 if (!hasPageSizeListener) 35291 return false; 35292 } else if (!isAbsent(props.total)) { 35293 if (!isAbsent(props.pageSize)) { 35294 if (!hasPageSizeListener) { 35295 return false; 35296 } 35297 } 35298 } 35299 } 35300 return true; 35301 }); 35302 const innerPageSize = vue.ref(isAbsent(props.defaultPageSize) ? 10 : props.defaultPageSize); 35303 const innerCurrentPage = vue.ref(isAbsent(props.defaultCurrentPage) ? 1 : props.defaultCurrentPage); 35304 const pageSizeBridge = vue.computed({ 35305 get() { 35306 return isAbsent(props.pageSize) ? innerPageSize.value : props.pageSize; 35307 }, 35308 set(v) { 35309 if (isAbsent(props.pageSize)) { 35310 innerPageSize.value = v; 35311 } 35312 if (hasPageSizeListener) { 35313 emit("update:page-size", v); 35314 emit("size-change", v); 35315 } 35316 } 35317 }); 35318 const pageCountBridge = vue.computed(() => { 35319 let pageCount = 0; 35320 if (!isAbsent(props.pageCount)) { 35321 pageCount = props.pageCount; 35322 } else if (!isAbsent(props.total)) { 35323 pageCount = Math.max(1, Math.ceil(props.total / pageSizeBridge.value)); 35324 } 35325 return pageCount; 35326 }); 35327 const currentPageBridge = vue.computed({ 35328 get() { 35329 return isAbsent(props.currentPage) ? innerCurrentPage.value : props.currentPage; 35330 }, 35331 set(v) { 35332 let newCurrentPage = v; 35333 if (v < 1) { 35334 newCurrentPage = 1; 35335 } else if (v > pageCountBridge.value) { 35336 newCurrentPage = pageCountBridge.value; 35337 } 35338 if (isAbsent(props.currentPage)) { 35339 innerCurrentPage.value = newCurrentPage; 35340 } 35341 if (hasCurrentPageListener) { 35342 emit("update:current-page", newCurrentPage); 35343 emit("current-change", newCurrentPage); 35344 } 35345 } 35346 }); 35347 vue.watch(pageCountBridge, (val) => { 35348 if (currentPageBridge.value > val) 35349 currentPageBridge.value = val; 35350 }); 35351 function handleCurrentChange(val) { 35352 currentPageBridge.value = val; 35353 } 35354 function handleSizeChange(val) { 35355 pageSizeBridge.value = val; 35356 const newPageCount = pageCountBridge.value; 35357 if (currentPageBridge.value > newPageCount) { 35358 currentPageBridge.value = newPageCount; 35359 } 35360 } 35361 function prev() { 35362 if (props.disabled) 35363 return; 35364 currentPageBridge.value -= 1;
35365 emit("prev-click", currentPageBridge.value); 35366 } 35367 function next() { 35368 if (props.disabled) 35369 return; 35370 currentPageBridge.value += 1; 35371 emit("next-click", currentPageBridge.value); 35372 } 35373 function addClass(element, cls) { 35374 if (element) { 35375 if (!element.props) { 35376 element.props = {}; 35377 } 35378 element.props.class = [element.props.class, cls].join(" "); 35379 } 35380 } 35381 vue.provide(elPaginationKey, { 35382 pageCount: pageCountBridge, 35383 disabled: vue.computed(() => props.disabled), 35384 currentPage: currentPageBridge, 35385 changeEvent: handleCurrentChange, 35386 handleSizeChange 35387 }); 35388 return () => { 35389 var _a, _b; 35390 if (!assertValidUsage.value) { 35391 debugWarn(componentName, t("el.pagination.deprecationWarning")); 35392 return null; 35393 } 35394 if (!props.layout) 35395 return null; 35396 if (props.hideOnSinglePage && pageCountBridge.value <= 1) 35397 return null; 35398 const rootChildren = []; 35399 const rightWrapperChildren = []; 35400 const rightWrapperRoot = vue.h("div", { class: ns.e("rightwrapper") }, rightWrapperChildren); 35401 const TEMPLATE_MAP = { 35402 prev: vue.h(Prev, { 35403 disabled: props.disabled, 35404 currentPage: currentPageBridge.value, 35405 prevText: props.prevText, 35406 prevIcon: props.prevIcon, 35407 onClick: prev 35408 }), 35409 jumper: vue.h(Jumper, { 35410 size: props.small ? "small" : "default" 35411 }), 35412 pager: vue.h(Pager, { 35413 currentPage: currentPageBridge.value, 35414 pageCount: pageCountBridge.value, 35415 pagerCount: props.pagerCount, 35416 onChange: handleCurrentChange, 35417 disabled: props.disabled 35418 }), 35419 next: vue.h(Next, { 35420 disabled: props.disabled, 35421 currentPage: currentPageBridge.value, 35422 pageCount: pageCountBridge.value, 35423 nextText: props.nextText, 35424 nextIcon: props.nextIcon, 35425 onClick: next 35426 }), 35427 sizes: vue.h(Sizes, { 35428 pageSize: pageSizeBridge.value, 35429 pageSizes: props.pageSizes, 35430 popperClass: props.popperClass, 35431 disabled: props.disabled, 35432 size: props.small ? "small" : "default" 35433 }), 35434 slot: (_b = (_a = slots == null ? void 0 : slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : null, 35435 total: vue.h(Total, { total: isAbsent(props.total) ? 0 : props.total }) 35436 }; 35437 const components = props.layout.split(",").map((item) => item.trim()); 35438 let haveRightWrapper = false; 35439 components.forEach((c) => { 35440 if (c === "->") { 35441 haveRightWrapper = true; 35442 return; 35443 } 35444 if (!haveRightWrapper) { 35445 rootChildren.push(TEMPLATE_MAP[c]); 35446 } else { 35447 rightWrapperChildren.push(TEMPLATE_MAP[c]); 35448 } 35449 }); 35450 addClass(rootChildren[0], ns.is("first")); 35451 addClass(rootChildren[rootChildren.length - 1], ns.is("last")); 35452 if (haveRightWrapper && rightWrapperChildren.length > 0) { 35453 addClass(rightWrapperChildren[0], ns.is("first")); 35454 addClass(rightWrapperChildren[rightWrapperChildren.length - 1], ns.is("last")); 35455 rootChildren.push(rightWrapperRoot); 35456 } 35457 return vue.h("div", { 35458 class: [ 35459 ns.b(), 35460 ns.is("background", props.background), 35461 { 35462 [ns.m("small")]: props.small 35463 } 35464 ] 35465 }, rootChildren); 35466 }; 35467 } 35468 }); 35469 35470 const ElPagination = withInstall(Pagination); 35471 35472 const popconfirmProps = buildProps({ 35473 title: String, 35474 confirmButtonText: String, 35475 cancelButtonText: String, 35476 confirmButtonType: { 35477 type: String, 35478 values: buttonTypes, 35479 default: "primary" 35480 }, 35481 cancelButtonType: { 35482 type: String, 35483 values: buttonTypes, 35484 default: "text" 35485 }, 35486 icon: { 35487 type: iconPropType, 35488 default: () => question_filled_default 35489 }, 35490 iconColor: { 35491 type: String, 35492 default: "#f90" 35493 }, 35494 hideIcon: { 35495 type: Boolean, 35496 default: false 35497 }, 35498 hideAfter: { 35499 type: Number, 35500 default: 200 35501 }, 35502 teleported: useTooltipContentProps.teleported, 35503 persistent: useTooltipContentProps.persistent, 35504 width: { 35505 type: [String, Number], 35506 default: 150 35507 } 35508 });
35509 const popconfirmEmits = { 35510 confirm: (e) => e instanceof MouseEvent, 35511 cancel: (e) => e instanceof MouseEvent 35512 }; 35513 35514 const __default__$y = vue.defineComponent({ 35515 name: "ElPopconfirm" 35516 }); 35517 const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({ 35518 ...__default__$y, 35519 props: popconfirmProps, 35520 emits: popconfirmEmits, 35521 setup(__props, { emit }) { 35522 const props = __props; 35523 const { t } = useLocale(); 35524 const ns = useNamespace("popconfirm"); 35525 const tooltipRef = vue.ref(); 35526 const hidePopper = () => { 35527 var _a, _b; 35528 (_b = (_a = tooltipRef.value) == null ? void 0 : _a.onClose) == null ? void 0 : _b.call(_a); 35529 }; 35530 const style = vue.computed(() => { 35531 return { 35532 width: addUnit(props.width) 35533 }; 35534 }); 35535 const confirm = (e) => { 35536 emit("confirm", e); 35537 hidePopper(); 35538 }; 35539 const cancel = (e) => { 35540 emit("cancel", e); 35541 hidePopper(); 35542 }; 35543 const finalConfirmButtonText = vue.computed(() => props.confirmButtonText || t("el.popconfirm.confirmButtonText")); 35544 const finalCancelButtonText = vue.computed(() => props.cancelButtonText || t("el.popconfirm.cancelButtonText")); 35545 return (_ctx, _cache) => { 35546 return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({ 35547 ref_key: "tooltipRef", 35548 ref: tooltipRef, 35549 trigger: "click", 35550 effect: "light" 35551 }, _ctx.$attrs, { 35552 "popper-class": `${vue.unref(ns).namespace.value}-popover`, 35553 "popper-style": vue.unref(style), 35554 teleported: _ctx.teleported, 35555 "fallback-placements": ["bottom", "top", "right", "left"], 35556 "hide-after": _ctx.hideAfter, 35557 persistent: _ctx.persistent 35558 }), { 35559 content: vue.withCtx(() => [ 35560 vue.createElementVNode("div", { 35561 class: vue.normalizeClass(vue.unref(ns).b()) 35562 }, [ 35563 vue.createElementVNode("div", { 35564 class: vue.normalizeClass(vue.unref(ns).e("main")) 35565 }, [ 35566 !_ctx.hideIcon && _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 35567 key: 0, 35568 class: vue.normalizeClass(vue.unref(ns).e("icon")), 35569 style: vue.normalizeStyle({ color: _ctx.iconColor }) 35570 }, { 35571 default: vue.withCtx(() => [ 35572 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon))) 35573 ]), 35574 _: 1 35575 }, 8, ["class", "style"])) : vue.createCommentVNode("v-if", true), 35576 vue.createTextVNode(" " + vue.toDisplayString(_ctx.title), 1) 35577 ], 2), 35578 vue.createElementVNode("div", { 35579 class: vue.normalizeClass(vue.unref(ns).e("action")) 35580 }, [ 35581 vue.createVNode(vue.unref(ElButton), { 35582 size: "small", 35583 type: _ctx.cancelButtonType === "text" ? "" : _ctx.cancelButtonType, 35584 text: _ctx.cancelButtonType === "text", 35585 onClick: cancel 35586 }, { 35587 default: vue.withCtx(() => [ 35588 vue.createTextVNode(vue.toDisplayString(vue.unref(finalCancelButtonText)), 1) 35589 ]), 35590 _: 1 35591 }, 8, ["type", "text"]), 35592 vue.createVNode(vue.unref(ElButton), { 35593 size: "small", 35594 type: _ctx.confirmButtonType === "text" ? "" : _ctx.confirmButtonType, 35595 text: _ctx.confirmButtonType === "text", 35596 onClick: confirm 35597 }, { 35598 default: vue.withCtx(() => [ 35599 vue.createTextVNode(vue.toDisplayString(vue.unref(finalConfirmButtonText)), 1) 35600 ]), 35601 _: 1 35602 }, 8, ["type", "text"]) 35603 ], 2) 35604 ], 2) 35605 ]), 35606 default: vue.withCtx(() => [
35607 _ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true) 35608 ]), 35609 _: 3 35610 }, 16, ["popper-class", "popper-style", "teleported", "hide-after", "persistent"]); 35611 }; 35612 } 35613 }); 35614 var Popconfirm = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__file", "popconfirm.vue"]]); 35615 35616 const ElPopconfirm = withInstall(Popconfirm); 35617 35618 const popoverProps = buildProps({ 35619 trigger: useTooltipTriggerProps.trigger, 35620 placement: dropdownProps.placement, 35621 disabled: useTooltipTriggerProps.disabled, 35622 visible: useTooltipContentProps.visible, 35623 transition: useTooltipContentProps.transition, 35624 popperOptions: dropdownProps.popperOptions, 35625 tabindex: dropdownProps.tabindex, 35626 content: useTooltipContentProps.content, 35627 popperStyle: useTooltipContentProps.popperStyle, 35628 popperClass: useTooltipContentProps.popperClass, 35629 enterable: { 35630 ...useTooltipContentProps.enterable, 35631 default: true 35632 }, 35633 effect: { 35634 ...useTooltipContentProps.effect, 35635 default: "light" 35636 }, 35637 teleported: useTooltipContentProps.teleported, 35638 title: String, 35639 width: { 35640 type: [String, Number], 35641 default: 150 35642 }, 35643 offset: { 35644 type: Number, 35645 default: void 0 35646 }, 35647 showAfter: { 35648 type: Number, 35649 default: 0 35650 }, 35651 hideAfter: { 35652 type: Number, 35653 default: 200 35654 }, 35655 autoClose: { 35656 type: Number, 35657 default: 0 35658 }, 35659 showArrow: { 35660 type: Boolean, 35661 default: true 35662 }, 35663 persistent: { 35664 type: Boolean, 35665 default: true 35666 }, 35667 "onUpdate:visible": { 35668 type: Function 35669 } 35670 }); 35671 const popoverEmits = { 35672 "update:visible": (value) => isBoolean(value), 35673 "before-enter": () => true, 35674 "before-leave": () => true, 35675 "after-enter": () => true, 35676 "after-leave": () => true 35677 }; 35678 35679 const updateEventKeyRaw = `onUpdate:visible`; 35680 const __default__$x = vue.defineComponent({ 35681 name: "ElPopover" 35682 }); 35683 const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({ 35684 ...__default__$x, 35685 props: popoverProps, 35686 emits: popoverEmits, 35687 setup(__props, { expose, emit }) { 35688 const props = __props; 35689 const onUpdateVisible = vue.computed(() => { 35690 return props[updateEventKeyRaw]; 35691 }); 35692 const ns = useNamespace("popover"); 35693 const tooltipRef = vue.ref(); 35694 const popperRef = vue.computed(() => { 35695 var _a; 35696 return (_a = vue.unref(tooltipRef)) == null ? void 0 : _a.popperRef; 35697 }); 35698 const style = vue.computed(() => { 35699 return [ 35700 { 35701 width: addUnit(props.width) 35702 }, 35703 props.popperStyle 35704 ]; 35705 }); 35706 const kls = vue.computed(() => { 35707 return [ns.b(), props.popperClass, { [ns.m("plain")]: !!props.content }]; 35708 }); 35709 const gpuAcceleration = vue.computed(() => { 35710 return props.transition === `${ns.namespace.value}-fade-in-linear`; 35711 }); 35712 const hide = () => { 35713 var _a; 35714 (_a = tooltipRef.value) == null ? void 0 : _a.hide(); 35715 }; 35716 const beforeEnter = () => { 35717 emit("before-enter"); 35718 }; 35719 const beforeLeave = () => { 35720 emit("before-leave"); 35721 }; 35722 const afterEnter = () => { 35723 emit("after-enter"); 35724 }; 35725 const afterLeave = () => { 35726 emit("update:visible", false); 35727 emit("after-leave"); 35728 }; 35729 expose({ 35730 popperRef, 35731 hide 35732 }); 35733 return (_ctx, _cache) => { 35734 return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({ 35735 ref_key: "tooltipRef", 35736 ref: tooltipRef 35737 }, _ctx.$attrs, { 35738 trigger: _ctx.trigger, 35739 placement: _ctx.placement, 35740 disabled: _ctx.disabled, 35741 visible: _ctx.visible, 35742 transition: _ctx.transition, 35743 "popper-options": _ctx.popperOptions, 35744 tabindex: _ctx.tabindex, 35745 content: _ctx.content, 35746 offset: _ctx.offset, 35747 "show-after": _ctx.showAfter, 35748 "hide-after": _ctx.hideAfter, 35749 "auto-close": _ctx.autoClose, 35750 "show-arrow": _ctx.showArrow, 35751 "aria-label": _ctx.title, 35752 effect: _ctx.effect, 35753 enterable: _ctx.enterable, 35754 "popper-class": vue.unref(kls), 35755 "popper-style": vue.unref(style), 35756 teleported: _ctx.teleported, 35757 persistent: _ctx.persistent, 35758 "gpu-acceleration": vue.unref(gpuAcceleration), 35759 "onUpdate:visible": vue.unref(onUpdateVisible), 35760 onBeforeShow: beforeEnter, 35761 onBeforeHide: beforeLeave, 35762 onShow: afterEnter, 35763 onHide: afterLeave 35764 }), { 35765 content: vue.withCtx(() => [ 35766 _ctx.title ? (vue.openBlock(), vue.createElementBlock("div", { 35767 key: 0, 35768 class: vue.normalizeClass(vue.unref(ns).e("title")), 35769 role: "title"
35770 }, vue.toDisplayString(_ctx.title), 3)) : vue.createCommentVNode("v-if", true), 35771 vue.renderSlot(_ctx.$slots, "default", {}, () => [ 35772 vue.createTextVNode(vue.toDisplayString(_ctx.content), 1) 35773 ]) 35774 ]), 35775 default: vue.withCtx(() => [ 35776 _ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true) 35777 ]), 35778 _: 3 35779 }, 16, ["trigger", "placement", "disabled", "visible", "transition", "popper-options", "tabindex", "content", "offset", "show-after", "hide-after", "auto-close", "show-arrow", "aria-label", "effect", "enterable", "popper-class", "popper-style", "teleported", "persistent", "gpu-acceleration", "onUpdate:visible"]); 35780 }; 35781 } 35782 }); 35783 var Popover = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__file", "popover.vue"]]); 35784 35785 const attachEvents = (el, binding) => { 35786 const popperComponent = binding.arg || binding.value; 35787 const popover = popperComponent == null ? void 0 : popperComponent.popperRef; 35788 if (popover) { 35789 popover.triggerRef = el; 35790 } 35791 }; 35792 var PopoverDirective = { 35793 mounted(el, binding) { 35794 attachEvents(el, binding); 35795 }, 35796 updated(el, binding) { 35797 attachEvents(el, binding); 35798 } 35799 }; 35800 const VPopover = "popover"; 35801 35802 const ElPopoverDirective = withInstallDirective(PopoverDirective, VPopover); 35803 const ElPopover = withInstall(Popover, { 35804 directive: ElPopoverDirective 35805 }); 35806 35807 const progressProps = buildProps({ 35808 type: { 35809 type: String, 35810 default: "line", 35811 values: ["line", "circle", "dashboard"] 35812 }, 35813 percentage: { 35814 type: Number, 35815 default: 0, 35816 validator: (val) => val >= 0 && val <= 100 35817 }, 35818 status: { 35819 type: String, 35820 default: "", 35821 values: ["", "success", "exception", "warning"] 35822 }, 35823 indeterminate: { 35824 type: Boolean, 35825 default: false 35826 }, 35827 duration: { 35828 type: Number, 35829 default: 3 35830 }, 35831 strokeWidth: { 35832 type: Number, 35833 default: 6 35834 }, 35835 strokeLinecap: { 35836 type: definePropType(String), 35837 default: "round" 35838 }, 35839 textInside: { 35840 type: Boolean, 35841 default: false 35842 }, 35843 width: { 35844 type: Number, 35845 default: 126 35846 }, 35847 showText: { 35848 type: Boolean, 35849 default: true 35850 }, 35851 color: { 35852 type: definePropType([ 35853 String, 35854 Array, 35855 Function 35856 ]), 35857 default: "" 35858 }, 35859 striped: Boolean, 35860 stripedFlow: Boolean, 35861 format: { 35862 type: definePropType(Function), 35863 default: (percentage) => `${percentage}%` 35864 } 35865 }); 35866 35867 const _hoisted_1$j = ["aria-valuenow"]; 35868 const _hoisted_2$d = { viewBox: "0 0 100 100" }; 35869 const _hoisted_3$6 = ["d", "stroke", "stroke-width"]; 35870 const _hoisted_4$4 = ["d", "stroke", "opacity", "stroke-linecap", "stroke-width"]; 35871 const _hoisted_5$3 = { key: 0 }; 35872 const __default__$w = vue.defineComponent({ 35873 name: "ElProgress" 35874 }); 35875 const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({ 35876 ...__default__$w, 35877 props: progressProps, 35878 setup(__props) { 35879 const props = __props; 35880 const STATUS_COLOR_MAP = { 35881 success: "#13ce66", 35882 exception: "#ff4949", 35883 warning: "#e6a23c", 35884 default: "#20a0ff" 35885 }; 35886 const ns = useNamespace("progress"); 35887 const barStyle = vue.computed(() => ({ 35888 width: `${props.percentage}%`, 35889 animationDuration: `${props.duration}s`, 35890 backgroundColor: getCurrentColor(props.percentage) 35891 })); 35892 const relativeStrokeWidth = vue.computed(() => (props.strokeWidth / props.width * 100).toFixed(1)); 35893 const radius = vue.computed(() => { 35894 if (["circle", "dashboard"].includes(props.type)) { 35895 return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10); 35896 } 35897 return 0; 35898 }); 35899 const trackPath = vue.computed(() => { 35900 const r = radius.value; 35901 const isDashboard = props.type === "dashboard"; 35902 return ` 35903 M 50 50 35904 m 0 ${isDashboard ? "" : "-"}${r} 35905 a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2} 35906 a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2} 35907 `; 35908 }); 35909 const perimeter = vue.computed(() => 2 * Math.PI * radius.value); 35910 const rate = vue.computed(() => props.type === "dashboard" ? 0.75 : 1); 35911 const strokeDashoffset = vue.computed(() => { 35912 const offset = -1 * perimeter.value * (1 - rate.value) / 2; 35913 return `${offset}px`; 35914 }); 35915 const trailPathStyle = vue.computed(() => ({ 35916 strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`, 35917 strokeDashoffset: strokeDashoffset.value 35918 })); 35919 const circlePathStyle = vue.computed(() => ({ 35920 strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`, 35921 strokeDashoffset: strokeDashoffset.value, 35922 transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s" 35923 })); 35924 const stroke = vue.computed(() => { 35925 let ret; 35926 if (props.color) { 35927 ret = getCurrentColor(props.percentage); 35928 } else { 35929 ret = STATUS_COLOR_MAP[props.status] || STATUS_COLOR_MAP.default; 35930 } 35931 return ret; 35932 }); 35933 const statusIcon = vue.computed(() => { 35934 if (props.status === "warning") { 35935 return warning_filled_default; 35936 } 35937 if (props.type === "line") { 35938 return props.status === "success" ? circle_check_default : circle_close_default; 35939 } else { 35940 return props.status === "success" ? check_default : close_default; 35941 } 35942 }); 35943 const progressTextSize = vue.computed(() => { 35944 return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2; 35945 }); 35946 const content = vue.computed(() => props.format(props.percentage)); 35947 function getColors(color) { 35948 const span = 100 / color.length; 35949 const seriesColors = color.map((seriesColor, index) => { 35950 if (isString$1(seriesColor)) { 35951 return { 35952 color: seriesColor, 35953 percentage: (index + 1) * span 35954 }; 35955 } 35956 return seriesColor; 35957 }); 35958 return seriesColors.sort((a, b) => a.percentage - b.percentage); 35959 } 35960 const getCurrentColor = (percentage) => { 35961 var _a; 35962 const { color } = props; 35963 if (isFunction$1(color)) { 35964 return color(percentage); 35965 } else if (isString$1(color)) { 35966 return color; 35967 } else { 35968 const colors = getColors(color); 35969 for (const color2 of colors) { 35970 if (color2.percentage > percentage) 35971 return color2.color; 35972 } 35973 return (_a = colors[colors.length - 1]) == null ? void 0 : _a.color; 35974 } 35975 }; 35976 return (_ctx, _cache) => {
35977 return vue.openBlock(), vue.createElementBlock("div", { 35978 class: vue.normalizeClass([ 35979 vue.unref(ns).b(), 35980 vue.unref(ns).m(_ctx.type), 35981 vue.unref(ns).is(_ctx.status), 35982 { 35983 [vue.unref(ns).m("without-text")]: !_ctx.showText, 35984 [vue.unref(ns).m("text-inside")]: _ctx.textInside 35985 } 35986 ]), 35987 role: "progressbar", 35988 "aria-valuenow": _ctx.percentage, 35989 "aria-valuemin": "0", 35990 "aria-valuemax": "100" 35991 }, [ 35992 _ctx.type === "line" ? (vue.openBlock(), vue.createElementBlock("div", { 35993 key: 0, 35994 class: vue.normalizeClass(vue.unref(ns).b("bar")) 35995 }, [ 35996 vue.createElementVNode("div", { 35997 class: vue.normalizeClass(vue.unref(ns).be("bar", "outer")), 35998 style: vue.normalizeStyle({ height: `${_ctx.strokeWidth}px` }) 35999 }, [ 36000 vue.createElementVNode("div", { 36001 class: vue.normalizeClass([ 36002 vue.unref(ns).be("bar", "inner"), 36003 { [vue.unref(ns).bem("bar", "inner", "indeterminate")]: _ctx.indeterminate }, 36004 { [vue.unref(ns).bem("bar", "inner", "striped")]: _ctx.striped }, 36005 { [vue.unref(ns).bem("bar", "inner", "striped-flow")]: _ctx.stripedFlow } 36006 ]), 36007 style: vue.normalizeStyle(vue.unref(barStyle)) 36008 }, [ 36009 (_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (vue.openBlock(), vue.createElementBlock("div", { 36010 key: 0, 36011 class: vue.normalizeClass(vue.unref(ns).be("bar", "innerText")) 36012 }, [ 36013 vue.renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [ 36014 vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(content)), 1) 36015 ]) 36016 ], 2)) : vue.createCommentVNode("v-if", true) 36017 ], 6) 36018 ], 6) 36019 ], 2)) : (vue.openBlock(), vue.createElementBlock("div", { 36020 key: 1, 36021 class: vue.normalizeClass(vue.unref(ns).b("circle")), 36022 style: vue.normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` }) 36023 }, [ 36024 (vue.openBlock(), vue.createElementBlock("svg", _hoisted_2$d, [ 36025 vue.createElementVNode("path", { 36026 class: vue.normalizeClass(vue.unref(ns).be("circle", "track")), 36027 d: vue.unref(trackPath), 36028 stroke: `var(${vue.unref(ns).cssVarName("fill-color-light")}, #e5e9f2)`, 36029 "stroke-width": vue.unref(relativeStrokeWidth), 36030 fill: "none", 36031 style: vue.normalizeStyle(vue.unref(trailPathStyle)) 36032 }, null, 14, _hoisted_3$6), 36033 vue.createElementVNode("path", { 36034 class: vue.normalizeClass(vue.unref(ns).be("circle", "path")), 36035 d: vue.unref(trackPath), 36036 stroke: vue.unref(stroke), 36037 fill: "none", 36038 opacity: _ctx.percentage ? 1 : 0, 36039 "stroke-linecap": _ctx.strokeLinecap, 36040 "stroke-width": vue.unref(relativeStrokeWidth), 36041 style: vue.normalizeStyle(vue.unref(circlePathStyle)) 36042 }, null, 14, _hoisted_4$4) 36043 ])) 36044 ], 6)), 36045 (_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (vue.openBlock(), vue.createElementBlock("div", { 36046 key: 2, 36047 class: vue.normalizeClass(vue.unref(ns).e("text")), 36048 style: vue.normalizeStyle({ fontSize: `${vue.unref(progressTextSize)}px` }) 36049 }, [ 36050 vue.renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [ 36051 !_ctx.status ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_5$3, vue.toDisplayString(vue.unref(content)), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, { 36052 default: vue.withCtx(() => [ 36053 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(statusIcon)))) 36054 ]), 36055 _: 1 36056 })) 36057 ])
36058 ], 6)) : vue.createCommentVNode("v-if", true) 36059 ], 10, _hoisted_1$j); 36060 }; 36061 } 36062 }); 36063 var Progress = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__file", "progress.vue"]]); 36064 36065 const ElProgress = withInstall(Progress); 36066 36067 const rateProps = buildProps({ 36068 modelValue: { 36069 type: Number, 36070 default: 0 36071 }, 36072 id: { 36073 type: String, 36074 default: void 0 36075 }, 36076 lowThreshold: { 36077 type: Number, 36078 default: 2 36079 }, 36080 highThreshold: { 36081 type: Number, 36082 default: 4 36083 }, 36084 max: { 36085 type: Number, 36086 default: 5 36087 }, 36088 colors: { 36089 type: definePropType([Array, Object]), 36090 default: () => mutable(["", "", ""]) 36091 }, 36092 voidColor: { 36093 type: String, 36094 default: "" 36095 }, 36096 disabledVoidColor: { 36097 type: String, 36098 default: "" 36099 }, 36100 icons: { 36101 type: definePropType([Array, Object]), 36102 default: () => [star_filled_default, star_filled_default, star_filled_default] 36103 }, 36104 voidIcon: { 36105 type: iconPropType, 36106 default: () => star_default 36107 }, 36108 disabledVoidIcon: { 36109 type: iconPropType, 36110 default: () => star_filled_default 36111 }, 36112 disabled: Boolean, 36113 allowHalf: Boolean, 36114 showText: Boolean, 36115 showScore: Boolean, 36116 textColor: { 36117 type: String, 36118 default: "" 36119 }, 36120 texts: { 36121 type: definePropType(Array), 36122 default: () => mutable([ 36123 "Extremely bad", 36124 "Disappointed", 36125 "Fair", 36126 "Satisfied", 36127 "Surprise" 36128 ]) 36129 }, 36130 scoreTemplate: { 36131 type: String, 36132 default: "{value}" 36133 }, 36134 size: useSizeProp, 36135 label: { 36136 type: String, 36137 default: void 0 36138 }, 36139 clearable: { 36140 type: Boolean, 36141 default: false 36142 } 36143 }); 36144 const rateEmits = { 36145 [CHANGE_EVENT]: (value) => isNumber(value), 36146 [UPDATE_MODEL_EVENT]: (value) => isNumber(value) 36147 }; 36148 36149 const _hoisted_1$i = ["id", "aria-label", "aria-labelledby", "aria-valuenow", "aria-valuetext", "aria-valuemax"]; 36150 const _hoisted_2$c = ["onMousemove", "onClick"]; 36151 const __default__$v = vue.defineComponent({ 36152 name: "ElRate" 36153 }); 36154 const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({ 36155 ...__default__$v, 36156 props: rateProps, 36157 emits: rateEmits, 36158 setup(__props, { expose, emit }) { 36159 const props = __props; 36160 function getValueFromMap(value, map) { 36161 const isExcludedObject = (val) => isObject$1(val); 36162 const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => { 36163 const val = map[key]; 36164 const excluded = isExcludedObject(val) ? val.excluded : false; 36165 return excluded ? value < key : value <= key; 36166 }).sort((a, b) => a - b); 36167 const matchedValue = map[matchedKeys[0]]; 36168 return isExcludedObject(matchedValue) && matchedValue.value || matchedValue; 36169 } 36170 const formContext = vue.inject(formContextKey, void 0); 36171 const formItemContext = vue.inject(formItemContextKey, void 0); 36172 const rateSize = useFormSize(); 36173 const ns = useNamespace("rate"); 36174 const { inputId, isLabeledByFormItem } = useFormItemInputId(props, { 36175 formItemContext 36176 }); 36177 const currentValue = vue.ref(props.modelValue); 36178 const hoverIndex = vue.ref(-1); 36179 const pointerAtLeftHalf = vue.ref(true); 36180 const rateClasses = vue.computed(() => [ns.b(), ns.m(rateSize.value)]); 36181 const rateDisabled = vue.computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled)); 36182 const rateStyles = vue.computed(() => { 36183 return ns.cssVarBlock({ 36184 "void-color": props.voidColor, 36185 "disabled-void-color": props.disabledVoidColor, 36186 "fill-color": activeColor.value 36187 }); 36188 }); 36189 const text = vue.computed(() => { 36190 let result = ""; 36191 if (props.showScore) { 36192 result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`); 36193 } else if (props.showText) { 36194 result = props.texts[Math.ceil(currentValue.value) - 1]; 36195 } 36196 return result; 36197 }); 36198 const valueDecimal = vue.computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100); 36199 const colorMap = vue.computed(() => isArray$1(props.colors) ? { 36200 [props.lowThreshold]: props.colors[0], 36201 [props.highThreshold]: { value: props.colors[1], excluded: true }, 36202 [props.max]: props.colors[2] 36203 } : props.colors); 36204 const activeColor = vue.computed(() => { 36205 const color = getValueFromMap(currentValue.value, colorMap.value); 36206 return isObject$1(color) ? "" : color; 36207 }); 36208 const decimalStyle = vue.computed(() => { 36209 let width = ""; 36210 if (rateDisabled.value) { 36211 width = `${valueDecimal.value}%`; 36212 } else if (props.allowHalf) { 36213 width = "50%"; 36214 } 36215 return { 36216 color: activeColor.value, 36217 width 36218 }; 36219 }); 36220 const componentMap = vue.computed(() => { 36221 let icons = isArray$1(props.icons) ? [...props.icons] : { ...props.icons }; 36222 icons = vue.markRaw(icons);
36223 return isArray$1(icons) ? { 36224 [props.lowThreshold]: icons[0], 36225 [props.highThreshold]: { 36226 value: icons[1], 36227 excluded: true 36228 }, 36229 [props.max]: icons[2] 36230 } : icons; 36231 }); 36232 const decimalIconComponent = vue.computed(() => getValueFromMap(props.modelValue, componentMap.value)); 36233 const voidComponent = vue.computed(() => rateDisabled.value ? isString$1(props.disabledVoidIcon) ? props.disabledVoidIcon : vue.markRaw(props.disabledVoidIcon) : isString$1(props.voidIcon) ? props.voidIcon : vue.markRaw(props.voidIcon)); 36234 const activeComponent = vue.computed(() => getValueFromMap(currentValue.value, componentMap.value)); 36235 function showDecimalIcon(item) { 36236 const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue; 36237 const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value; 36238 return showWhenDisabled || showWhenAllowHalf; 36239 } 36240 function emitValue(value) { 36241 if (props.clearable && value === props.modelValue) { 36242 value = 0; 36243 } 36244 emit(UPDATE_MODEL_EVENT, value); 36245 if (props.modelValue !== value) { 36246 emit("change", value); 36247 } 36248 } 36249 function selectValue(value) { 36250 if (rateDisabled.value) { 36251 return; 36252 } 36253 if (props.allowHalf && pointerAtLeftHalf.value) { 36254 emitValue(currentValue.value); 36255 } else { 36256 emitValue(value); 36257 } 36258 } 36259 function handleKey(e) { 36260 if (rateDisabled.value) { 36261 return; 36262 } 36263 let _currentValue = currentValue.value; 36264 const code = e.code; 36265 if (code === EVENT_CODE.up || code === EVENT_CODE.right) { 36266 if (props.allowHalf) { 36267 _currentValue += 0.5; 36268 } else { 36269 _currentValue += 1; 36270 } 36271 e.stopPropagation(); 36272 e.preventDefault(); 36273 } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) { 36274 if (props.allowHalf) { 36275 _currentValue -= 0.5; 36276 } else { 36277 _currentValue -= 1; 36278 } 36279 e.stopPropagation(); 36280 e.preventDefault(); 36281 } 36282 _currentValue = _currentValue < 0 ? 0 : _currentValue; 36283 _currentValue = _currentValue > props.max ? props.max : _currentValue; 36284 emit(UPDATE_MODEL_EVENT, _currentValue); 36285 emit("change", _currentValue); 36286 return _currentValue; 36287 } 36288 function setCurrentValue(value, event) { 36289 if (rateDisabled.value) { 36290 return; 36291 } 36292 if (props.allowHalf && event) { 36293 let target = event.target; 36294 if (hasClass(target, ns.e("item"))) { 36295 target = target.querySelector(`.${ns.e("icon")}`); 36296 } 36297 if (target.clientWidth === 0 || hasClass(target, ns.e("decimal"))) { 36298 target = target.parentNode; 36299 } 36300 pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth; 36301 currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value; 36302 } else { 36303 currentValue.value = value; 36304 } 36305 hoverIndex.value = value; 36306 } 36307 function resetCurrentValue() { 36308 if (rateDisabled.value) { 36309 return; 36310 } 36311 if (props.allowHalf) { 36312 pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue); 36313 } 36314 currentValue.value = props.modelValue; 36315 hoverIndex.value = -1; 36316 } 36317 vue.watch(() => props.modelValue, (val) => { 36318 currentValue.value = val; 36319 pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue); 36320 }); 36321 if (!props.modelValue) { 36322 emit(UPDATE_MODEL_EVENT, 0); 36323 } 36324 expose({ 36325 setCurrentValue, 36326 resetCurrentValue 36327 }); 36328 return (_ctx, _cache) => { 36329 var _a;
36330 return vue.openBlock(), vue.createElementBlock("div", { 36331 id: vue.unref(inputId), 36332 class: vue.normalizeClass([vue.unref(rateClasses), vue.unref(ns).is("disabled", vue.unref(rateDisabled))]), 36333 role: "slider", 36334 "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.label || "rating" : void 0, 36335 "aria-labelledby": vue.unref(isLabeledByFormItem) ? (_a = vue.unref(formItemContext)) == null ? void 0 : _a.labelId : void 0, 36336 "aria-valuenow": currentValue.value, 36337 "aria-valuetext": vue.unref(text) || void 0, 36338 "aria-valuemin": "0", 36339 "aria-valuemax": _ctx.max, 36340 tabindex: "0", 36341 style: vue.normalizeStyle(vue.unref(rateStyles)), 36342 onKeydown: handleKey 36343 }, [ 36344 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.max, (item, key) => { 36345 return vue.openBlock(), vue.createElementBlock("span", { 36346 key, 36347 class: vue.normalizeClass(vue.unref(ns).e("item")), 36348 onMousemove: ($event) => setCurrentValue(item, $event), 36349 onMouseleave: resetCurrentValue, 36350 onClick: ($event) => selectValue(item) 36351 }, [ 36352 vue.createVNode(vue.unref(ElIcon), { 36353 class: vue.normalizeClass([ 36354 vue.unref(ns).e("icon"), 36355 { hover: hoverIndex.value === item }, 36356 vue.unref(ns).is("active", item <= currentValue.value) 36357 ]) 36358 }, { 36359 default: vue.withCtx(() => [ 36360 !showDecimalIcon(item) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ 36361 vue.withDirectives((vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(activeComponent)), null, null, 512)), [ 36362 [vue.vShow, item <= currentValue.value] 36363 ]), 36364 vue.withDirectives((vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(voidComponent)), null, null, 512)), [ 36365 [vue.vShow, !(item <= currentValue.value)] 36366 ]) 36367 ], 64)) : vue.createCommentVNode("v-if", true), 36368 showDecimalIcon(item) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 36369 key: 1, 36370 style: vue.normalizeStyle(vue.unref(decimalStyle)), 36371 class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).e("decimal")]) 36372 }, { 36373 default: vue.withCtx(() => [ 36374 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(decimalIconComponent)))) 36375 ]), 36376 _: 1 36377 }, 8, ["style", "class"])) : vue.createCommentVNode("v-if", true) 36378 ]), 36379 _: 2 36380 }, 1032, ["class"]) 36381 ], 42, _hoisted_2$c); 36382 }), 128)), 36383 _ctx.showText || _ctx.showScore ? (vue.openBlock(), vue.createElementBlock("span", { 36384 key: 0, 36385 class: vue.normalizeClass(vue.unref(ns).e("text")) 36386 }, vue.toDisplayString(vue.unref(text)), 3)) : vue.createCommentVNode("v-if", true) 36387 ], 46, _hoisted_1$i); 36388 }; 36389 } 36390 }); 36391 var Rate = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__file", "rate.vue"]]); 36392 36393 const ElRate = withInstall(Rate); 36394 36395 const IconMap = { 36396 success: "icon-success", 36397 warning: "icon-warning", 36398 error: "icon-error", 36399 info: "icon-info" 36400 }; 36401 const IconComponentMap = { 36402 [IconMap.success]: circle_check_filled_default, 36403 [IconMap.warning]: warning_filled_default, 36404 [IconMap.error]: circle_close_filled_default, 36405 [IconMap.info]: info_filled_default 36406 }; 36407 const resultProps = buildProps({ 36408 title: { 36409 type: String, 36410 default: "" 36411 }, 36412 subTitle: { 36413 type: String, 36414 default: "" 36415 }, 36416 icon: { 36417 type: String, 36418 values: ["success", "warning", "info", "error"], 36419 default: "info" 36420 } 36421 });
36422 36423 const __default__$u = vue.defineComponent({ 36424 name: "ElResult" 36425 }); 36426 const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({ 36427 ...__default__$u, 36428 props: resultProps, 36429 setup(__props) { 36430 const props = __props; 36431 const ns = useNamespace("result"); 36432 const resultIcon = vue.computed(() => { 36433 const icon = props.icon; 36434 const iconClass = icon && IconMap[icon] ? IconMap[icon] : "icon-info"; 36435 const iconComponent = IconComponentMap[iconClass] || IconComponentMap["icon-info"]; 36436 return { 36437 class: iconClass, 36438 component: iconComponent 36439 }; 36440 }); 36441 return (_ctx, _cache) => { 36442 return vue.openBlock(), vue.createElementBlock("div", { 36443 class: vue.normalizeClass(vue.unref(ns).b()) 36444 }, [ 36445 vue.createElementVNode("div", { 36446 class: vue.normalizeClass(vue.unref(ns).e("icon")) 36447 }, [ 36448 vue.renderSlot(_ctx.$slots, "icon", {}, () => [ 36449 vue.unref(resultIcon).component ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(resultIcon).component), { 36450 key: 0, 36451 class: vue.normalizeClass(vue.unref(resultIcon).class) 36452 }, null, 8, ["class"])) : vue.createCommentVNode("v-if", true) 36453 ]) 36454 ], 2), 36455 _ctx.title || _ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("div", { 36456 key: 0, 36457 class: vue.normalizeClass(vue.unref(ns).e("title")) 36458 }, [ 36459 vue.renderSlot(_ctx.$slots, "title", {}, () => [ 36460 vue.createElementVNode("p", null, vue.toDisplayString(_ctx.title), 1) 36461 ]) 36462 ], 2)) : vue.createCommentVNode("v-if", true), 36463 _ctx.subTitle || _ctx.$slots["sub-title"] ? (vue.openBlock(), vue.createElementBlock("div", { 36464 key: 1, 36465 class: vue.normalizeClass(vue.unref(ns).e("subtitle")) 36466 }, [ 36467 vue.renderSlot(_ctx.$slots, "sub-title", {}, () => [ 36468 vue.createElementVNode("p", null, vue.toDisplayString(_ctx.subTitle), 1) 36469 ]) 36470 ], 2)) : vue.createCommentVNode("v-if", true), 36471 _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", { 36472 key: 2, 36473 class: vue.normalizeClass(vue.unref(ns).e("extra")) 36474 }, [ 36475 vue.renderSlot(_ctx.$slots, "extra") 36476 ], 2)) : vue.createCommentVNode("v-if", true) 36477 ], 2); 36478 }; 36479 } 36480 }); 36481 var Result = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__file", "result.vue"]]); 36482 36483 const ElResult = withInstall(Result); 36484 36485 var safeIsNaN = Number.isNaN || function ponyfill(value) { 36486 return typeof value === "number" && value !== value; 36487 }; 36488 function isEqual(first, second) { 36489 if (first === second) { 36490 return true; 36491 } 36492 if (safeIsNaN(first) && safeIsNaN(second)) { 36493 return true; 36494 } 36495 return false; 36496 } 36497 function areInputsEqual(newInputs, lastInputs) { 36498 if (newInputs.length !== lastInputs.length) { 36499 return false; 36500 } 36501 for (var i = 0; i < newInputs.length; i++) { 36502 if (!isEqual(newInputs[i], lastInputs[i])) { 36503 return false; 36504 } 36505 } 36506 return true; 36507 } 36508 function memoizeOne(resultFn, isEqual2) { 36509 if (isEqual2 === void 0) { 36510 isEqual2 = areInputsEqual; 36511 } 36512 var cache = null; 36513 function memoized() { 36514 var newArgs = []; 36515 for (var _i = 0; _i < arguments.length; _i++) { 36516 newArgs[_i] = arguments[_i]; 36517 } 36518 if (cache && cache.lastThis === this && isEqual2(newArgs, cache.lastArgs)) { 36519 return cache.lastResult; 36520 } 36521 var lastResult = resultFn.apply(this, newArgs); 36522 cache = { 36523 lastResult, 36524 lastArgs: newArgs, 36525 lastThis: this 36526 }; 36527 return lastResult; 36528 } 36529 memoized.clear = function clear() { 36530 cache = null; 36531 }; 36532 return memoized; 36533 } 36534 36535 const useCache = () => { 36536 const vm = vue.getCurrentInstance(); 36537 const props = vm.proxy.$props; 36538 return vue.computed(() => { 36539 const _getItemStyleCache = (_, __, ___) => ({}); 36540 return props.perfMode ? memoize(_getItemStyleCache) : memoizeOne(_getItemStyleCache); 36541 }); 36542 }; 36543 36544 const DEFAULT_DYNAMIC_LIST_ITEM_SIZE = 50; 36545 const ITEM_RENDER_EVT = "itemRendered"; 36546 const SCROLL_EVT = "scroll"; 36547 const FORWARD = "forward"; 36548 const BACKWARD = "backward"; 36549 const AUTO_ALIGNMENT = "auto"; 36550 const SMART_ALIGNMENT = "smart"; 36551 const START_ALIGNMENT = "start"; 36552 const CENTERED_ALIGNMENT = "center"; 36553 const END_ALIGNMENT = "end"; 36554 const HORIZONTAL = "horizontal"; 36555 const VERTICAL = "vertical"; 36556 const LTR = "ltr"; 36557 const RTL = "rtl"; 36558 const RTL_OFFSET_NAG = "negative";
36559 const RTL_OFFSET_POS_ASC = "positive-ascending"; 36560 const RTL_OFFSET_POS_DESC = "positive-descending"; 36561 const ScrollbarDirKey = { 36562 [HORIZONTAL]: "left", 36563 [VERTICAL]: "top" 36564 }; 36565 const SCROLLBAR_MIN_SIZE = 20; 36566 36567 const LayoutKeys = { 36568 [HORIZONTAL]: "deltaX", 36569 [VERTICAL]: "deltaY" 36570 }; 36571 const useWheel = ({ atEndEdge, atStartEdge, layout }, onWheelDelta) => { 36572 let frameHandle; 36573 let offset = 0; 36574 const hasReachedEdge = (offset2) => { 36575 const edgeReached = offset2 < 0 && atStartEdge.value || offset2 > 0 && atEndEdge.value; 36576 return edgeReached; 36577 }; 36578 const onWheel = (e) => { 36579 cAF(frameHandle); 36580 const newOffset = e[LayoutKeys[layout.value]]; 36581 if (hasReachedEdge(offset) && hasReachedEdge(offset + newOffset)) 36582 return; 36583 offset += newOffset; 36584 if (!isFirefox()) { 36585 e.preventDefault(); 36586 } 36587 frameHandle = rAF(() => { 36588 onWheelDelta(offset); 36589 offset = 0; 36590 }); 36591 }; 36592 return { 36593 hasReachedEdge, 36594 onWheel 36595 }; 36596 }; 36597 var useWheel$1 = useWheel; 36598 36599 const itemSize$1 = buildProp({ 36600 type: definePropType([Number, Function]), 36601 required: true 36602 }); 36603 const estimatedItemSize = buildProp({ 36604 type: Number 36605 }); 36606 const cache = buildProp({ 36607 type: Number, 36608 default: 2 36609 }); 36610 const direction = buildProp({ 36611 type: String, 36612 values: ["ltr", "rtl"], 36613 default: "ltr" 36614 }); 36615 const initScrollOffset = buildProp({ 36616 type: Number, 36617 default: 0 36618 }); 36619 const total = buildProp({ 36620 type: Number, 36621 required: true 36622 }); 36623 const layout = buildProp({ 36624 type: String, 36625 values: ["horizontal", "vertical"], 36626 default: VERTICAL 36627 }); 36628 const virtualizedProps = buildProps({ 36629 className: { 36630 type: String, 36631 default: "" 36632 }, 36633 containerElement: { 36634 type: definePropType([String, Object]), 36635 default: "div" 36636 }, 36637 data: { 36638 type: definePropType(Array), 36639 default: () => mutable([]) 36640 }, 36641 direction, 36642 height: { 36643 type: [String, Number], 36644 required: true 36645 }, 36646 innerElement: { 36647 type: [String, Object], 36648 default: "div" 36649 }, 36650 style: { 36651 type: definePropType([Object, String, Array]) 36652 }, 36653 useIsScrolling: { 36654 type: Boolean, 36655 default: false 36656 }, 36657 width: { 36658 type: [Number, String], 36659 required: false 36660 }, 36661 perfMode: { 36662 type: Boolean, 36663 default: true 36664 }, 36665 scrollbarAlwaysOn: { 36666 type: Boolean, 36667 default: false 36668 } 36669 }); 36670 const virtualizedListProps = buildProps({ 36671 cache, 36672 estimatedItemSize, 36673 layout, 36674 initScrollOffset, 36675 total, 36676 itemSize: itemSize$1, 36677 ...virtualizedProps 36678 }); 36679 const scrollbarSize = { 36680 type: Number, 36681 default: 6 36682 }; 36683 const startGap = { type: Number, default: 0 }; 36684 const endGap = { type: Number, default: 2 }; 36685 const virtualizedGridProps = buildProps({ 36686 columnCache: cache, 36687 columnWidth: itemSize$1, 36688 estimatedColumnWidth: estimatedItemSize, 36689 estimatedRowHeight: estimatedItemSize, 36690 initScrollLeft: initScrollOffset, 36691 initScrollTop: initScrollOffset, 36692 itemKey: { 36693 type: definePropType(Function), 36694 default: ({ 36695 columnIndex, 36696 rowIndex 36697 }) => `${rowIndex}:${columnIndex}` 36698 }, 36699 rowCache: cache, 36700 rowHeight: itemSize$1, 36701 totalColumn: total, 36702 totalRow: total, 36703 hScrollbarSize: scrollbarSize, 36704 vScrollbarSize: scrollbarSize, 36705 scrollbarStartGap: startGap, 36706 scrollbarEndGap: endGap, 36707 role: String, 36708 ...virtualizedProps 36709 }); 36710 const virtualizedScrollbarProps = buildProps({ 36711 alwaysOn: Boolean, 36712 class: String, 36713 layout, 36714 total, 36715 ratio: { 36716 type: Number, 36717 required: true 36718 }, 36719 clientSize: { 36720 type: Number, 36721 required: true 36722 }, 36723 scrollFrom: { 36724 type: Number, 36725 required: true 36726 }, 36727 scrollbarSize, 36728 startGap, 36729 endGap, 36730 visible: Boolean 36731 });
36732 36733 const getScrollDir = (prev, cur) => prev < cur ? FORWARD : BACKWARD; 36734 const isHorizontal = (dir) => dir === LTR || dir === RTL || dir === HORIZONTAL; 36735 const isRTL = (dir) => dir === RTL; 36736 let cachedRTLResult = null; 36737 function getRTLOffsetType(recalculate = false) { 36738 if (cachedRTLResult === null || recalculate) { 36739 const outerDiv = document.createElement("div"); 36740 const outerStyle = outerDiv.style; 36741 outerStyle.width = "50px"; 36742 outerStyle.height = "50px"; 36743 outerStyle.overflow = "scroll"; 36744 outerStyle.direction = "rtl"; 36745 const innerDiv = document.createElement("div"); 36746 const innerStyle = innerDiv.style; 36747 innerStyle.width = "100px"; 36748 innerStyle.height = "100px"; 36749 outerDiv.appendChild(innerDiv); 36750 document.body.appendChild(outerDiv); 36751 if (outerDiv.scrollLeft > 0) { 36752 cachedRTLResult = RTL_OFFSET_POS_DESC; 36753 } else { 36754 outerDiv.scrollLeft = 1; 36755 if (outerDiv.scrollLeft === 0) { 36756 cachedRTLResult = RTL_OFFSET_NAG; 36757 } else { 36758 cachedRTLResult = RTL_OFFSET_POS_ASC; 36759 } 36760 } 36761 document.body.removeChild(outerDiv); 36762 return cachedRTLResult; 36763 } 36764 return cachedRTLResult; 36765 } 36766 function renderThumbStyle({ move, size, bar }, layout) { 36767 const style = {}; 36768 const translate = `translate${bar.axis}(${move}px)`; 36769 style[bar.size] = size; 36770 style.transform = translate; 36771 style.msTransform = translate; 36772 style.webkitTransform = translate; 36773 if (layout === "horizontal") { 36774 style.height = "100%"; 36775 } else { 36776 style.width = "100%"; 36777 } 36778 return style; 36779 } 36780 36781 const ScrollBar = vue.defineComponent({ 36782 name: "ElVirtualScrollBar", 36783 props: virtualizedScrollbarProps, 36784 emits: ["scroll", "start-move", "stop-move"], 36785 setup(props, { emit }) { 36786 const GAP = vue.computed(() => props.startGap + props.endGap); 36787 const nsVirtualScrollbar = useNamespace("virtual-scrollbar"); 36788 const nsScrollbar = useNamespace("scrollbar"); 36789 const trackRef = vue.ref(); 36790 const thumbRef = vue.ref(); 36791 let frameHandle = null; 36792 let onselectstartStore = null; 36793 const state = vue.reactive({ 36794 isDragging: false, 36795 traveled: 0 36796 }); 36797 const bar = vue.computed(() => BAR_MAP[props.layout]); 36798 const trackSize = vue.computed(() => props.clientSize - vue.unref(GAP)); 36799 const trackStyle = vue.computed(() => ({ 36800 position: "absolute", 36801 width: `${HORIZONTAL === props.layout ? trackSize.value : props.scrollbarSize}px`, 36802 height: `${HORIZONTAL === props.layout ? props.scrollbarSize : trackSize.value}px`, 36803 [ScrollbarDirKey[props.layout]]: "2px", 36804 right: "2px", 36805 bottom: "2px", 36806 borderRadius: "4px" 36807 })); 36808 const thumbSize = vue.computed(() => { 36809 const ratio = props.ratio; 36810 const clientSize = props.clientSize; 36811 if (ratio >= 100) { 36812 return Number.POSITIVE_INFINITY; 36813 } 36814 if (ratio >= 50) { 36815 return ratio * clientSize / 100; 36816 } 36817 const SCROLLBAR_MAX_SIZE = clientSize / 3; 36818 return Math.floor(Math.min(Math.max(ratio * clientSize, SCROLLBAR_MIN_SIZE), SCROLLBAR_MAX_SIZE)); 36819 }); 36820 const thumbStyle = vue.computed(() => { 36821 if (!Number.isFinite(thumbSize.value)) { 36822 return { 36823 display: "none" 36824 }; 36825 } 36826 const thumb = `${thumbSize.value}px`; 36827 const style = renderThumbStyle({ 36828 bar: bar.value, 36829 size: thumb, 36830 move: state.traveled 36831 }, props.layout); 36832 return style; 36833 }); 36834 const totalSteps = vue.computed(() => Math.floor(props.clientSize - thumbSize.value - vue.unref(GAP))); 36835 const attachEvents = () => { 36836 window.addEventListener("mousemove", onMouseMove); 36837 window.addEventListener("mouseup", onMouseUp); 36838 const thumbEl = vue.unref(thumbRef); 36839 if (!thumbEl) 36840 return; 36841 onselectstartStore = document.onselectstart; 36842 document.onselectstart = () => false; 36843 thumbEl.addEventListener("touchmove", onMouseMove); 36844 thumbEl.addEventListener("touchend", onMouseUp); 36845 }; 36846 const detachEvents = () => { 36847 window.removeEventListener("mousemove", onMouseMove); 36848 window.removeEventListener("mouseup", onMouseUp); 36849 document.onselectstart = onselectstartStore; 36850 onselectstartStore = null; 36851 const thumbEl = vue.unref(thumbRef); 36852 if (!thumbEl) 36853 return; 36854 thumbEl.removeEventListener("touchmove", onMouseMove); 36855 thumbEl.removeEventListener("touchend", onMouseUp); 36856 }; 36857 const onThumbMouseDown = (e) => { 36858 e.stopImmediatePropagation(); 36859 if (e.ctrlKey || [1, 2].includes(e.button)) { 36860 return; 36861 } 36862 state.isDragging = true; 36863 state[bar.value.axis] = e.currentTarget[bar.value.offset] - (e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]); 36864 emit("start-move"); 36865 attachEvents(); 36866 }; 36867 const onMouseUp = () => { 36868 state.isDragging = false; 36869 state[bar.value.axis] = 0; 36870 emit("stop-move"); 36871 detachEvents(); 36872 }; 36873 const onMouseMove = (e) => { 36874 const { isDragging } = state; 36875 if (!isDragging) 36876 return; 36877 if (!thumbRef.value || !trackRef.value) 36878 return; 36879 const prevPage = state[bar.value.axis]; 36880 if (!prevPage) 36881 return; 36882 cAF(frameHandle); 36883 const offset = (trackRef.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1; 36884 const thumbClickPosition = thumbRef.value[bar.value.offset] - prevPage; 36885 const distance = offset - thumbClickPosition; 36886 frameHandle = rAF(() => { 36887 state.traveled = Math.max(props.startGap, Math.min(distance, totalSteps.value)); 36888 emit("scroll", distance, totalSteps.value); 36889 }); 36890 }; 36891 const clickTrackHandler = (e) => { 36892 const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]); 36893 const thumbHalf = thumbRef.value[bar.value.offset] / 2; 36894 const distance = offset - thumbHalf; 36895 state.traveled = Math.max(0, Math.min(distance, totalSteps.value)); 36896 emit("scroll", distance, totalSteps.value); 36897 }; 36898 vue.watch(() => props.scrollFrom, (v) => { 36899 if (state.isDragging) 36900 return; 36901 state.traveled = Math.ceil(v * totalSteps.value); 36902 }); 36903 vue.onBeforeUnmount(() => { 36904 detachEvents(); 36905 }); 36906 return () => { 36907 return vue.h("div", { 36908 role: "presentation", 36909 ref: trackRef, 36910 class: [ 36911 nsVirtualScrollbar.b(), 36912 props.class, 36913 (props.alwaysOn || state.isDragging) && "always-on" 36914 ], 36915 style: trackStyle.value, 36916 onMousedown: vue.withModifiers(clickTrackHandler, ["stop", "prevent"]), 36917 onTouchstartPrevent: onThumbMouseDown 36918 }, vue.h("div", { 36919 ref: thumbRef, 36920 class: nsScrollbar.e("thumb"), 36921 style: thumbStyle.value, 36922 onMousedown: onThumbMouseDown 36923 }, [])); 36924 }; 36925 } 36926 });
36927 var Scrollbar = ScrollBar; 36928 36929 const createList = ({ 36930 name, 36931 getOffset, 36932 getItemSize, 36933 getItemOffset, 36934 getEstimatedTotalSize, 36935 getStartIndexForOffset, 36936 getStopIndexForStartIndex, 36937 initCache, 36938 clearCache, 36939 validateProps 36940 }) => { 36941 return vue.defineComponent({ 36942 name: name != null ? name : "ElVirtualList", 36943 props: virtualizedListProps, 36944 emits: [ITEM_RENDER_EVT, SCROLL_EVT], 36945 setup(props, { emit, expose }) { 36946 validateProps(props); 36947 const instance = vue.getCurrentInstance(); 36948 const ns = useNamespace("vl"); 36949 const dynamicSizeCache = vue.ref(initCache(props, instance)); 36950 const getItemStyleCache = useCache(); 36951 const windowRef = vue.ref(); 36952 const innerRef = vue.ref(); 36953 const scrollbarRef = vue.ref(); 36954 const states = vue.ref({ 36955 isScrolling: false, 36956 scrollDir: "forward", 36957 scrollOffset: isNumber(props.initScrollOffset) ? props.initScrollOffset : 0, 36958 updateRequested: false, 36959 isScrollbarDragging: false, 36960 scrollbarAlwaysOn: props.scrollbarAlwaysOn 36961 }); 36962 const itemsToRender = vue.computed(() => { 36963 const { total, cache } = props; 36964 const { isScrolling, scrollDir, scrollOffset } = vue.unref(states); 36965 if (total === 0) { 36966 return [0, 0, 0, 0]; 36967 } 36968 const startIndex = getStartIndexForOffset(props, scrollOffset, vue.unref(dynamicSizeCache)); 36969 const stopIndex = getStopIndexForStartIndex(props, startIndex, scrollOffset, vue.unref(dynamicSizeCache)); 36970 const cacheBackward = !isScrolling || scrollDir === BACKWARD ? Math.max(1, cache) : 1; 36971 const cacheForward = !isScrolling || scrollDir === FORWARD ? Math.max(1, cache) : 1; 36972 return [ 36973 Math.max(0, startIndex - cacheBackward), 36974 Math.max(0, Math.min(total - 1, stopIndex + cacheForward)), 36975 startIndex, 36976 stopIndex 36977 ]; 36978 }); 36979 const estimatedTotalSize = vue.computed(() => getEstimatedTotalSize(props, vue.unref(dynamicSizeCache))); 36980 const _isHorizontal = vue.computed(() => isHorizontal(props.layout)); 36981 const windowStyle = vue.computed(() => [ 36982 { 36983 position: "relative", 36984 [`overflow-${_isHorizontal.value ? "x" : "y"}`]: "scroll", 36985 WebkitOverflowScrolling: "touch", 36986 willChange: "transform" 36987 }, 36988 { 36989 direction: props.direction, 36990 height: isNumber(props.height) ? `${props.height}px` : props.height, 36991 width: isNumber(props.width) ? `${props.width}px` : props.width 36992 }, 36993 props.style 36994 ]); 36995 const innerStyle = vue.computed(() => { 36996 const size = vue.unref(estimatedTotalSize); 36997 const horizontal = vue.unref(_isHorizontal); 36998 return { 36999 height: horizontal ? "100%" : `${size}px`, 37000 pointerEvents: vue.unref(states).isScrolling ? "none" : void 0, 37001 width: horizontal ? `${size}px` : "100%" 37002 }; 37003 }); 37004 const clientSize = vue.computed(() => _isHorizontal.value ? props.width : props.height); 37005 const { onWheel } = useWheel$1({ 37006 atStartEdge: vue.computed(() => states.value.scrollOffset <= 0), 37007 atEndEdge: vue.computed(() => states.value.scrollOffset >= estimatedTotalSize.value), 37008 layout: vue.computed(() => props.layout) 37009 }, (offset) => { 37010 var _a, _b; 37011 (_b = (_a = scrollbarRef.value).onMouseUp) == null ? void 0 : _b.call(_a); 37012 scrollTo(Math.min(states.value.scrollOffset + offset, estimatedTotalSize.value - clientSize.value)); 37013 }); 37014 const emitEvents = () => { 37015 const { total } = props; 37016 if (total > 0) { 37017 const [cacheStart, cacheEnd, visibleStart, visibleEnd] = vue.unref(itemsToRender);
37018 emit(ITEM_RENDER_EVT, cacheStart, cacheEnd, visibleStart, visibleEnd); 37019 } 37020 const { scrollDir, scrollOffset, updateRequested } = vue.unref(states); 37021 emit(SCROLL_EVT, scrollDir, scrollOffset, updateRequested); 37022 }; 37023 const scrollVertically = (e) => { 37024 const { clientHeight, scrollHeight, scrollTop } = e.currentTarget; 37025 const _states = vue.unref(states); 37026 if (_states.scrollOffset === scrollTop) { 37027 return; 37028 } 37029 const scrollOffset = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight)); 37030 states.value = { 37031 ..._states, 37032 isScrolling: true, 37033 scrollDir: getScrollDir(_states.scrollOffset, scrollOffset), 37034 scrollOffset, 37035 updateRequested: false 37036 }; 37037 vue.nextTick(resetIsScrolling); 37038 }; 37039 const scrollHorizontally = (e) => { 37040 const { clientWidth, scrollLeft, scrollWidth } = e.currentTarget; 37041 const _states = vue.unref(states); 37042 if (_states.scrollOffset === scrollLeft) { 37043 return; 37044 } 37045 const { direction } = props; 37046 let scrollOffset = scrollLeft; 37047 if (direction === RTL) { 37048 switch (getRTLOffsetType()) { 37049 case RTL_OFFSET_NAG: { 37050 scrollOffset = -scrollLeft; 37051 break; 37052 } 37053 case RTL_OFFSET_POS_DESC: { 37054 scrollOffset = scrollWidth - clientWidth - scrollLeft; 37055 break; 37056 } 37057 } 37058 } 37059 scrollOffset = Math.max(0, Math.min(scrollOffset, scrollWidth - clientWidth)); 37060 states.value = { 37061 ..._states, 37062 isScrolling: true, 37063 scrollDir: getScrollDir(_states.scrollOffset, scrollOffset), 37064 scrollOffset, 37065 updateRequested: false 37066 }; 37067 vue.nextTick(resetIsScrolling); 37068 }; 37069 const onScroll = (e) => { 37070 vue.unref(_isHorizontal) ? scrollHorizontally(e) : scrollVertically(e); 37071 emitEvents(); 37072 }; 37073 const onScrollbarScroll = (distanceToGo, totalSteps) => { 37074 const offset = (estimatedTotalSize.value - clientSize.value) / totalSteps * distanceToGo; 37075 scrollTo(Math.min(estimatedTotalSize.value - clientSize.value, offset)); 37076 }; 37077 const scrollTo = (offset) => { 37078 offset = Math.max(offset, 0); 37079 if (offset === vue.unref(states).scrollOffset) { 37080 return; 37081 } 37082 states.value = { 37083 ...vue.unref(states), 37084 scrollOffset: offset, 37085 scrollDir: getScrollDir(vue.unref(states).scrollOffset, offset), 37086 updateRequested: true 37087 }; 37088 vue.nextTick(resetIsScrolling); 37089 }; 37090 const scrollToItem = (idx, alignment = AUTO_ALIGNMENT) => { 37091 const { scrollOffset } = vue.unref(states); 37092 idx = Math.max(0, Math.min(idx, props.total - 1)); 37093 scrollTo(getOffset(props, idx, alignment, scrollOffset, vue.unref(dynamicSizeCache))); 37094 }; 37095 const getItemStyle = (idx) => { 37096 const { direction, itemSize, layout } = props; 37097 const itemStyleCache = getItemStyleCache.value(clearCache && itemSize, clearCache && layout, clearCache && direction); 37098 let style; 37099 if (hasOwn(itemStyleCache, String(idx))) { 37100 style = itemStyleCache[idx]; 37101 } else { 37102 const offset = getItemOffset(props, idx, vue.unref(dynamicSizeCache)); 37103 const size = getItemSize(props, idx, vue.unref(dynamicSizeCache)); 37104 const horizontal = vue.unref(_isHorizontal); 37105 const isRtl = direction === RTL; 37106 const offsetHorizontal = horizontal ? offset : 0; 37107 itemStyleCache[idx] = style = { 37108 position: "absolute",
37109 left: isRtl ? void 0 : `${offsetHorizontal}px`, 37110 right: isRtl ? `${offsetHorizontal}px` : void 0, 37111 top: !horizontal ? `${offset}px` : 0, 37112 height: !horizontal ? `${size}px` : "100%", 37113 width: horizontal ? `${size}px` : "100%" 37114 }; 37115 } 37116 return style; 37117 }; 37118 const resetIsScrolling = () => { 37119 states.value.isScrolling = false; 37120 vue.nextTick(() => { 37121 getItemStyleCache.value(-1, null, null); 37122 }); 37123 }; 37124 const resetScrollTop = () => { 37125 const window = windowRef.value; 37126 if (window) { 37127 window.scrollTop = 0; 37128 } 37129 }; 37130 vue.onMounted(() => { 37131 if (!isClient) 37132 return; 37133 const { initScrollOffset } = props; 37134 const windowElement = vue.unref(windowRef); 37135 if (isNumber(initScrollOffset) && windowElement) { 37136 if (vue.unref(_isHorizontal)) { 37137 windowElement.scrollLeft = initScrollOffset; 37138 } else { 37139 windowElement.scrollTop = initScrollOffset; 37140 } 37141 } 37142 emitEvents(); 37143 }); 37144 vue.onUpdated(() => { 37145 const { direction, layout } = props; 37146 const { scrollOffset, updateRequested } = vue.unref(states); 37147 const windowElement = vue.unref(windowRef); 37148 if (updateRequested && windowElement) { 37149 if (layout === HORIZONTAL) { 37150 if (direction === RTL) { 37151 switch (getRTLOffsetType()) { 37152 case RTL_OFFSET_NAG: { 37153 windowElement.scrollLeft = -scrollOffset; 37154 break; 37155 } 37156 case RTL_OFFSET_POS_ASC: { 37157 windowElement.scrollLeft = scrollOffset; 37158 break; 37159 } 37160 default: { 37161 const { clientWidth, scrollWidth } = windowElement; 37162 windowElement.scrollLeft = scrollWidth - clientWidth - scrollOffset; 37163 break; 37164 } 37165 } 37166 } else { 37167 windowElement.scrollLeft = scrollOffset; 37168 } 37169 } else { 37170 windowElement.scrollTop = scrollOffset; 37171 } 37172 } 37173 }); 37174 const api = { 37175 ns, 37176 clientSize, 37177 estimatedTotalSize, 37178 windowStyle, 37179 windowRef, 37180 innerRef, 37181 innerStyle, 37182 itemsToRender, 37183 scrollbarRef, 37184 states, 37185 getItemStyle, 37186 onScroll, 37187 onScrollbarScroll, 37188 onWheel, 37189 scrollTo, 37190 scrollToItem, 37191 resetScrollTop 37192 }; 37193 expose({ 37194 windowRef, 37195 innerRef, 37196 getItemStyleCache, 37197 scrollTo, 37198 scrollToItem, 37199 resetScrollTop, 37200 states 37201 }); 37202 return api; 37203 }, 37204 render(ctx) { 37205 var _a; 37206 const { 37207 $slots, 37208 className, 37209 clientSize, 37210 containerElement, 37211 data, 37212 getItemStyle, 37213 innerElement, 37214 itemsToRender, 37215 innerStyle, 37216 layout, 37217 total, 37218 onScroll, 37219 onScrollbarScroll, 37220 onWheel, 37221 states, 37222 useIsScrolling, 37223 windowStyle, 37224 ns 37225 } = ctx; 37226 const [start, end] = itemsToRender; 37227 const Container = vue.resolveDynamicComponent(containerElement); 37228 const Inner = vue.resolveDynamicComponent(innerElement); 37229 const children = []; 37230 if (total > 0) { 37231 for (let i = start; i <= end; i++) { 37232 children.push((_a = $slots.default) == null ? void 0 : _a.call($slots, { 37233 data, 37234 key: i, 37235 index: i, 37236 isScrolling: useIsScrolling ? states.isScrolling : void 0, 37237 style: getItemStyle(i) 37238 })); 37239 } 37240 } 37241 const InnerNode = [ 37242 vue.h(Inner, { 37243 style: innerStyle, 37244 ref: "innerRef" 37245 }, !isString$1(Inner) ? { 37246 default: () => children 37247 } : children) 37248 ]; 37249 const scrollbar = vue.h(Scrollbar, { 37250 ref: "scrollbarRef", 37251 clientSize, 37252 layout, 37253 onScroll: onScrollbarScroll, 37254 ratio: clientSize * 100 / this.estimatedTotalSize, 37255 scrollFrom: states.scrollOffset / (this.estimatedTotalSize - clientSize), 37256 total 37257 }); 37258 const listContainer = vue.h(Container, { 37259 class: [ns.e("window"), className], 37260 style: windowStyle, 37261 onScroll, 37262 onWheel, 37263 ref: "windowRef", 37264 key: 0 37265 }, !isString$1(Container) ? { default: () => [InnerNode] } : [InnerNode]); 37266 return vue.h("div", { 37267 key: 0, 37268 class: [ns.e("wrapper"), states.scrollbarAlwaysOn ? "always-on" : ""] 37269 }, [listContainer, scrollbar]);
37270 } 37271 }); 37272 }; 37273 var createList$1 = createList; 37274 37275 const FixedSizeList = createList$1({ 37276 name: "ElFixedSizeList", 37277 getItemOffset: ({ itemSize }, index) => index * itemSize, 37278 getItemSize: ({ itemSize }) => itemSize, 37279 getEstimatedTotalSize: ({ total, itemSize }) => itemSize * total, 37280 getOffset: ({ height, total, itemSize, layout, width }, index, alignment, scrollOffset) => { 37281 const size = isHorizontal(layout) ? width : height; 37282 const lastItemOffset = Math.max(0, total * itemSize - size); 37283 const maxOffset = Math.min(lastItemOffset, index * itemSize); 37284 const minOffset = Math.max(0, (index + 1) * itemSize - size); 37285 if (alignment === SMART_ALIGNMENT) { 37286 if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) { 37287 alignment = AUTO_ALIGNMENT; 37288 } else { 37289 alignment = CENTERED_ALIGNMENT; 37290 } 37291 } 37292 switch (alignment) { 37293 case START_ALIGNMENT: { 37294 return maxOffset; 37295 } 37296 case END_ALIGNMENT: { 37297 return minOffset; 37298 } 37299 case CENTERED_ALIGNMENT: { 37300 const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2); 37301 if (middleOffset < Math.ceil(size / 2)) { 37302 return 0; 37303 } else if (middleOffset > lastItemOffset + Math.floor(size / 2)) { 37304 return lastItemOffset; 37305 } else { 37306 return middleOffset; 37307 } 37308 } 37309 case AUTO_ALIGNMENT: 37310 default: { 37311 if (scrollOffset >= minOffset && scrollOffset <= maxOffset) { 37312 return scrollOffset; 37313 } else if (scrollOffset < minOffset) { 37314 return minOffset; 37315 } else { 37316 return maxOffset; 37317 } 37318 } 37319 } 37320 }, 37321 getStartIndexForOffset: ({ total, itemSize }, offset) => Math.max(0, Math.min(total - 1, Math.floor(offset / itemSize))), 37322 getStopIndexForStartIndex: ({ height, total, itemSize, layout, width }, startIndex, scrollOffset) => { 37323 const offset = startIndex * itemSize; 37324 const size = isHorizontal(layout) ? width : height; 37325 const numVisibleItems = Math.ceil((size + scrollOffset - offset) / itemSize); 37326 return Math.max(0, Math.min(total - 1, startIndex + numVisibleItems - 1)); 37327 }, 37328 initCache() { 37329 return void 0; 37330 }, 37331 clearCache: true, 37332 validateProps() { 37333 } 37334 }); 37335 var FixedSizeList$1 = FixedSizeList; 37336 37337 const getItemFromCache$1 = (props, index, listCache) => { 37338 const { itemSize } = props; 37339 const { items, lastVisitedIndex } = listCache; 37340 if (index > lastVisitedIndex) { 37341 let offset = 0; 37342 if (lastVisitedIndex >= 0) { 37343 const item = items[lastVisitedIndex]; 37344 offset = item.offset + item.size; 37345 } 37346 for (let i = lastVisitedIndex + 1; i <= index; i++) { 37347 const size = itemSize(i); 37348 items[i] = { 37349 offset, 37350 size 37351 }; 37352 offset += size; 37353 } 37354 listCache.lastVisitedIndex = index; 37355 } 37356 return items[index]; 37357 }; 37358 const findItem$1 = (props, listCache, offset) => { 37359 const { items, lastVisitedIndex } = listCache; 37360 const lastVisitedOffset = lastVisitedIndex > 0 ? items[lastVisitedIndex].offset : 0; 37361 if (lastVisitedOffset >= offset) { 37362 return bs$1(props, listCache, 0, lastVisitedIndex, offset); 37363 } 37364 return es$1(props, listCache, Math.max(0, lastVisitedIndex), offset); 37365 }; 37366 const bs$1 = (props, listCache, low, high, offset) => { 37367 while (low <= high) { 37368 const mid = low + Math.floor((high - low) / 2); 37369 const currentOffset = getItemFromCache$1(props, mid, listCache).offset; 37370 if (currentOffset === offset) { 37371 return mid; 37372 } else if (currentOffset < offset) { 37373 low = mid + 1; 37374 } else if (currentOffset > offset) { 37375 high = mid - 1; 37376 } 37377 } 37378 return Math.max(0, low - 1); 37379 }; 37380 const es$1 = (props, listCache, index, offset) => { 37381 const { total } = props; 37382 let exponent = 1; 37383 while (index < total && getItemFromCache$1(props, index, listCache).offset < offset) { 37384 index += exponent; 37385 exponent *= 2; 37386 } 37387 return bs$1(props, listCache, Math.floor(index / 2), Math.min(index, total - 1), offset); 37388 }; 37389 const getEstimatedTotalSize = ({ total }, { items, estimatedItemSize, lastVisitedIndex }) => { 37390 let totalSizeOfMeasuredItems = 0; 37391 if (lastVisitedIndex >= total) { 37392 lastVisitedIndex = total - 1; 37393 } 37394 if (lastVisitedIndex >= 0) { 37395 const item = items[lastVisitedIndex]; 37396 totalSizeOfMeasuredItems = item.offset + item.size; 37397 } 37398 const numUnmeasuredItems = total - lastVisitedIndex - 1; 37399 const totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedItemSize; 37400 return totalSizeOfMeasuredItems + totalSizeOfUnmeasuredItems; 37401 }; 37402 const DynamicSizeList = createList$1({ 37403 name: "ElDynamicSizeList", 37404 getItemOffset: (props, index, listCache) => getItemFromCache$1(props, index, listCache).offset, 37405 getItemSize: (_, index, { items }) => items[index].size, 37406 getEstimatedTotalSize, 37407 getOffset: (props, index, alignment, scrollOffset, listCache) => { 37408 const { height, layout, width } = props; 37409 const size = isHorizontal(layout) ? width : height; 37410 const item = getItemFromCache$1(props, index, listCache); 37411 const estimatedTotalSize = getEstimatedTotalSize(props, listCache); 37412 const maxOffset = Math.max(0, Math.min(estimatedTotalSize - size, item.offset)); 37413 const minOffset = Math.max(0, item.offset - size + item.size); 37414 if (alignment === SMART_ALIGNMENT) { 37415 if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) { 37416 alignment = AUTO_ALIGNMENT; 37417 } else { 37418 alignment = CENTERED_ALIGNMENT; 37419 } 37420 } 37421 switch (alignment) { 37422 case START_ALIGNMENT: { 37423 return maxOffset; 37424 } 37425 case END_ALIGNMENT: { 37426 return minOffset; 37427 } 37428 case CENTERED_ALIGNMENT: { 37429 return Math.round(minOffset + (maxOffset - minOffset) / 2); 37430 } 37431 case AUTO_ALIGNMENT: 37432 default: { 37433 if (scrollOffset >= minOffset && scrollOffset <= maxOffset) { 37434 return scrollOffset; 37435 } else if (scrollOffset < minOffset) { 37436 return minOffset; 37437 } else { 37438 return maxOffset; 37439 } 37440 } 37441 } 37442 }, 37443 getStartIndexForOffset: (props, offset, listCache) => findItem$1(props, listCache, offset), 37444 getStopIndexForStartIndex: (props, startIndex, scrollOffset, listCache) => { 37445 const { height, total, layout, width } = props; 37446 const size = isHorizontal(layout) ? width : height; 37447 const item = getItemFromCache$1(props, startIndex, listCache); 37448 const maxOffset = scrollOffset + size; 37449 let offset = item.offset + item.size; 37450 let stopIndex = startIndex; 37451 while (stopIndex < total - 1 && offset < maxOffset) { 37452 stopIndex++; 37453 offset += getItemFromCache$1(props, stopIndex, listCache).size; 37454 } 37455 return stopIndex; 37456 }, 37457 initCache({ estimatedItemSize = DEFAULT_DYNAMIC_LIST_ITEM_SIZE }, instance) { 37458 const cache = { 37459 items: {}, 37460 estimatedItemSize, 37461 lastVisitedIndex: -1 37462 }; 37463 cache.clearCacheAfterIndex = (index, forceUpdate = true) => { 37464 var _a, _b; 37465 cache.lastVisitedIndex = Math.min(cache.lastVisitedIndex, index - 1); 37466 (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache(-1); 37467 if (forceUpdate) { 37468 (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate(); 37469 } 37470 }; 37471 return cache; 37472 }, 37473 clearCache: false, 37474 validateProps: ({ itemSize }) => { 37475 } 37476 });
37477 var DynamicSizeList$1 = DynamicSizeList; 37478 37479 const useGridWheel = ({ atXEndEdge, atXStartEdge, atYEndEdge, atYStartEdge }, onWheelDelta) => { 37480 let frameHandle = null; 37481 let xOffset = 0; 37482 let yOffset = 0; 37483 const hasReachedEdge = (x, y) => { 37484 const xEdgeReached = x <= 0 && atXStartEdge.value || x >= 0 && atXEndEdge.value; 37485 const yEdgeReached = y <= 0 && atYStartEdge.value || y >= 0 && atYEndEdge.value; 37486 return xEdgeReached && yEdgeReached; 37487 }; 37488 const onWheel = (e) => { 37489 cAF(frameHandle); 37490 let x = e.deltaX; 37491 let y = e.deltaY; 37492 if (Math.abs(x) > Math.abs(y)) { 37493 y = 0; 37494 } else { 37495 x = 0; 37496 } 37497 if (e.shiftKey && y !== 0) { 37498 x = y; 37499 y = 0; 37500 } 37501 if (hasReachedEdge(xOffset, yOffset) && hasReachedEdge(xOffset + x, yOffset + y)) 37502 return; 37503 xOffset += x; 37504 yOffset += y; 37505 e.preventDefault(); 37506 frameHandle = rAF(() => { 37507 onWheelDelta(xOffset, yOffset); 37508 xOffset = 0; 37509 yOffset = 0; 37510 }); 37511 }; 37512 return { 37513 hasReachedEdge, 37514 onWheel 37515 }; 37516 }; 37517 37518 const createGrid = ({ 37519 name, 37520 clearCache, 37521 getColumnPosition, 37522 getColumnStartIndexForOffset, 37523 getColumnStopIndexForStartIndex, 37524 getEstimatedTotalHeight, 37525 getEstimatedTotalWidth, 37526 getColumnOffset, 37527 getRowOffset, 37528 getRowPosition, 37529 getRowStartIndexForOffset, 37530 getRowStopIndexForStartIndex, 37531 initCache, 37532 injectToInstance, 37533 validateProps 37534 }) => { 37535 return vue.defineComponent({ 37536 name: name != null ? name : "ElVirtualList", 37537 props: virtualizedGridProps, 37538 emits: [ITEM_RENDER_EVT, SCROLL_EVT], 37539 setup(props, { emit, expose, slots }) { 37540 const ns = useNamespace("vl"); 37541 validateProps(props); 37542 const instance = vue.getCurrentInstance(); 37543 const cache = vue.ref(initCache(props, instance)); 37544 injectToInstance == null ? void 0 : injectToInstance(instance, cache); 37545 const windowRef = vue.ref(); 37546 const hScrollbar = vue.ref(); 37547 const vScrollbar = vue.ref(); 37548 const innerRef = vue.ref(null); 37549 const states = vue.ref({ 37550 isScrolling: false, 37551 scrollLeft: isNumber(props.initScrollLeft) ? props.initScrollLeft : 0, 37552 scrollTop: isNumber(props.initScrollTop) ? props.initScrollTop : 0, 37553 updateRequested: false, 37554 xAxisScrollDir: FORWARD, 37555 yAxisScrollDir: FORWARD 37556 }); 37557 const getItemStyleCache = useCache(); 37558 const parsedHeight = vue.computed(() => Number.parseInt(`${props.height}`, 10)); 37559 const parsedWidth = vue.computed(() => Number.parseInt(`${props.width}`, 10)); 37560 const columnsToRender = vue.computed(() => { 37561 const { totalColumn, totalRow, columnCache } = props; 37562 const { isScrolling, xAxisScrollDir, scrollLeft } = vue.unref(states); 37563 if (totalColumn === 0 || totalRow === 0) { 37564 return [0, 0, 0, 0]; 37565 } 37566 const startIndex = getColumnStartIndexForOffset(props, scrollLeft, vue.unref(cache)); 37567 const stopIndex = getColumnStopIndexForStartIndex(props, startIndex, scrollLeft, vue.unref(cache)); 37568 const cacheBackward = !isScrolling || xAxisScrollDir === BACKWARD ? Math.max(1, columnCache) : 1; 37569 const cacheForward = !isScrolling || xAxisScrollDir === FORWARD ? Math.max(1, columnCache) : 1; 37570 return [ 37571 Math.max(0, startIndex - cacheBackward), 37572 Math.max(0, Math.min(totalColumn - 1, stopIndex + cacheForward)), 37573 startIndex, 37574 stopIndex 37575 ]; 37576 }); 37577 const rowsToRender = vue.computed(() => { 37578 const { totalColumn, totalRow, rowCache } = props; 37579 const { isScrolling, yAxisScrollDir, scrollTop } = vue.unref(states); 37580 if (totalColumn === 0 || totalRow === 0) { 37581 return [0, 0, 0, 0]; 37582 } 37583 const startIndex = getRowStartIndexForOffset(props, scrollTop, vue.unref(cache)); 37584 const stopIndex = getRowStopIndexForStartIndex(props, startIndex, scrollTop, vue.unref(cache)); 37585 const cacheBackward = !isScrolling || yAxisScrollDir === BACKWARD ? Math.max(1, rowCache) : 1; 37586 const cacheForward = !isScrolling || yAxisScrollDir === FORWARD ? Math.max(1, rowCache) : 1; 37587 return [ 37588 Math.max(0, startIndex - cacheBackward), 37589 Math.max(0, Math.min(totalRow - 1, stopIndex + cacheForward)), 37590 startIndex, 37591 stopIndex 37592 ]; 37593 }); 37594 const estimatedTotalHeight = vue.computed(() => getEstimatedTotalHeight(props, vue.unref(cache))); 37595 const estimatedTotalWidth = vue.computed(() => getEstimatedTotalWidth(props, vue.unref(cache))); 37596 const windowStyle = vue.computed(() => { 37597 var _a; 37598 return [ 37599 { 37600 position: "relative", 37601 overflow: "hidden", 37602 WebkitOverflowScrolling: "touch", 37603 willChange: "transform" 37604 }, 37605 { 37606 direction: props.direction, 37607 height: isNumber(props.height) ? `${props.height}px` : props.height, 37608 width: isNumber(props.width) ? `${props.width}px` : props.width 37609 }, 37610 (_a = props.style) != null ? _a : {} 37611 ]; 37612 }); 37613 const innerStyle = vue.computed(() => { 37614 const width = `${vue.unref(estimatedTotalWidth)}px`; 37615 const height = `${vue.unref(estimatedTotalHeight)}px`; 37616 return { 37617 height, 37618 pointerEvents: vue.unref(states).isScrolling ? "none" : void 0, 37619 width 37620 }; 37621 }); 37622 const emitEvents = () => { 37623 const { totalColumn, totalRow } = props; 37624 if (totalColumn > 0 && totalRow > 0) { 37625 const [ 37626 columnCacheStart, 37627 columnCacheEnd, 37628 columnVisibleStart, 37629 columnVisibleEnd 37630 ] = vue.unref(columnsToRender); 37631 const [rowCacheStart, rowCacheEnd, rowVisibleStart, rowVisibleEnd] = vue.unref(rowsToRender); 37632 emit(ITEM_RENDER_EVT, { 37633 columnCacheStart, 37634 columnCacheEnd, 37635 rowCacheStart, 37636 rowCacheEnd, 37637 columnVisibleStart, 37638 columnVisibleEnd, 37639 rowVisibleStart, 37640 rowVisibleEnd 37641 }); 37642 } 37643 const { 37644 scrollLeft, 37645 scrollTop, 37646 updateRequested, 37647 xAxisScrollDir, 37648 yAxisScrollDir 37649 } = vue.unref(states); 37650 emit(SCROLL_EVT, { 37651 xAxisScrollDir, 37652 scrollLeft, 37653 yAxisScrollDir, 37654 scrollTop, 37655 updateRequested 37656 }); 37657 }; 37658 const onScroll = (e) => { 37659 const { 37660 clientHeight, 37661 clientWidth, 37662 scrollHeight, 37663 scrollLeft, 37664 scrollTop, 37665 scrollWidth 37666 } = e.currentTarget; 37667 const _states = vue.unref(states); 37668 if (_states.scrollTop === scrollTop && _states.scrollLeft === scrollLeft) { 37669 return; 37670 } 37671 let _scrollLeft = scrollLeft; 37672 if (isRTL(props.direction)) { 37673 switch (getRTLOffsetType()) { 37674 case RTL_OFFSET_NAG: 37675 _scrollLeft = -scrollLeft; 37676 break; 37677 case RTL_OFFSET_POS_DESC: 37678 _scrollLeft = scrollWidth - clientWidth - scrollLeft; 37679 break; 37680 } 37681 } 37682 states.value = { 37683 ..._states, 37684 isScrolling: true, 37685 scrollLeft: _scrollLeft, 37686 scrollTop: Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight)), 37687 updateRequested: true, 37688 xAxisScrollDir: getScrollDir(_states.scrollLeft, _scrollLeft), 37689 yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop) 37690 }; 37691 vue.nextTick(() => resetIsScrolling()); 37692 onUpdated(); 37693 emitEvents(); 37694 }; 37695 const onVerticalScroll = (distance, totalSteps) => { 37696 const height = vue.unref(parsedHeight); 37697 const offset = (estimatedTotalHeight.value - height) / totalSteps * distance; 37698 scrollTo({ 37699 scrollTop: Math.min(estimatedTotalHeight.value - height, offset) 37700 }); 37701 }; 37702 const onHorizontalScroll = (distance, totalSteps) => { 37703 const width = vue.unref(parsedWidth); 37704 const offset = (estimatedTotalWidth.value - width) / totalSteps * distance; 37705 scrollTo({ 37706 scrollLeft: Math.min(estimatedTotalWidth.value - width, offset) 37707 }); 37708 }; 37709 const { onWheel } = useGridWheel({ 37710 atXStartEdge: vue.computed(() => states.value.scrollLeft <= 0), 37711 atXEndEdge: vue.computed(() => states.value.scrollLeft >= estimatedTotalWidth.value - vue.unref(parsedWidth)), 37712 atYStartEdge: vue.computed(() => states.value.scrollTop <= 0), 37713 atYEndEdge: vue.computed(() => states.value.scrollTop >= estimatedTotalHeight.value - vue.unref(parsedHeight)) 37714 }, (x, y) => { 37715 var _a, _b, _c, _d; 37716 (_b = (_a = hScrollbar.value) == null ? void 0 : _a.onMouseUp) == null ? void 0 : _b.call(_a); 37717 (_d = (_c = hScrollbar.value) == null ? void 0 : _c.onMouseUp) == null ? void 0 : _d.call(_c); 37718 const width = vue.unref(parsedWidth); 37719 const height = vue.unref(parsedHeight); 37720 scrollTo({ 37721 scrollLeft: Math.min(states.value.scrollLeft + x, estimatedTotalWidth.value - width), 37722 scrollTop: Math.min(states.value.scrollTop + y, estimatedTotalHeight.value - height) 37723 }); 37724 }); 37725 const scrollTo = ({ 37726 scrollLeft = states.value.scrollLeft, 37727 scrollTop = states.value.scrollTop 37728 }) => { 37729 scrollLeft = Math.max(scrollLeft, 0); 37730 scrollTop = Math.max(scrollTop, 0); 37731 const _states = vue.unref(states); 37732 if (scrollTop === _states.scrollTop && scrollLeft === _states.scrollLeft) { 37733 return; 37734 } 37735 states.value = { 37736 ..._states, 37737 xAxisScrollDir: getScrollDir(_states.scrollLeft, scrollLeft), 37738 yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop), 37739 scrollLeft, 37740 scrollTop, 37741 updateRequested: true 37742 }; 37743 vue.nextTick(() => resetIsScrolling()); 37744 onUpdated(); 37745 emitEvents(); 37746 }; 37747 const scrollToItem = (rowIndex = 0, columnIdx = 0, alignment = AUTO_ALIGNMENT) => { 37748 const _states = vue.unref(states); 37749 columnIdx = Math.max(0, Math.min(columnIdx, props.totalColumn - 1)); 37750 rowIndex = Math.max(0, Math.min(rowIndex, props.totalRow - 1)); 37751 const scrollBarWidth = getScrollBarWidth(ns.namespace.value); 37752 const _cache = vue.unref(cache); 37753 const estimatedHeight = getEstimatedTotalHeight(props, _cache); 37754 const estimatedWidth = getEstimatedTotalWidth(props, _cache); 37755 scrollTo({ 37756 scrollLeft: getColumnOffset(props, columnIdx, alignment, _states.scrollLeft, _cache, estimatedWidth > props.width ? scrollBarWidth : 0), 37757 scrollTop: getRowOffset(props, rowIndex, alignment, _states.scrollTop, _cache, estimatedHeight > props.height ? scrollBarWidth : 0) 37758 }); 37759 }; 37760 const getItemStyle = (rowIndex, columnIndex) => { 37761 const { columnWidth, direction, rowHeight } = props; 37762 const itemStyleCache = getItemStyleCache.value(clearCache && columnWidth, clearCache && rowHeight, clearCache && direction);
37763 const key = `${rowIndex},${columnIndex}`; 37764 if (hasOwn(itemStyleCache, key)) { 37765 return itemStyleCache[key]; 37766 } else { 37767 const [, left] = getColumnPosition(props, columnIndex, vue.unref(cache)); 37768 const _cache = vue.unref(cache); 37769 const rtl = isRTL(direction); 37770 const [height, top] = getRowPosition(props, rowIndex, _cache); 37771 const [width] = getColumnPosition(props, columnIndex, _cache); 37772 itemStyleCache[key] = { 37773 position: "absolute", 37774 left: rtl ? void 0 : `${left}px`, 37775 right: rtl ? `${left}px` : void 0, 37776 top: `${top}px`, 37777 height: `${height}px`, 37778 width: `${width}px` 37779 }; 37780 return itemStyleCache[key]; 37781 } 37782 }; 37783 const resetIsScrolling = () => { 37784 states.value.isScrolling = false; 37785 vue.nextTick(() => { 37786 getItemStyleCache.value(-1, null, null); 37787 }); 37788 }; 37789 vue.onMounted(() => { 37790 if (!isClient) 37791 return; 37792 const { initScrollLeft, initScrollTop } = props; 37793 const windowElement = vue.unref(windowRef); 37794 if (windowElement) { 37795 if (isNumber(initScrollLeft)) { 37796 windowElement.scrollLeft = initScrollLeft; 37797 } 37798 if (isNumber(initScrollTop)) { 37799 windowElement.scrollTop = initScrollTop; 37800 } 37801 } 37802 emitEvents(); 37803 }); 37804 const onUpdated = () => { 37805 const { direction } = props; 37806 const { scrollLeft, scrollTop, updateRequested } = vue.unref(states); 37807 const windowElement = vue.unref(windowRef); 37808 if (updateRequested && windowElement) { 37809 if (direction === RTL) { 37810 switch (getRTLOffsetType()) { 37811 case RTL_OFFSET_NAG: { 37812 windowElement.scrollLeft = -scrollLeft; 37813 break; 37814 } 37815 case RTL_OFFSET_POS_ASC: { 37816 windowElement.scrollLeft = scrollLeft; 37817 break; 37818 } 37819 default: { 37820 const { clientWidth, scrollWidth } = windowElement; 37821 windowElement.scrollLeft = scrollWidth - clientWidth - scrollLeft; 37822 break; 37823 } 37824 } 37825 } else { 37826 windowElement.scrollLeft = Math.max(0, scrollLeft); 37827 } 37828 windowElement.scrollTop = Math.max(0, scrollTop); 37829 } 37830 }; 37831 const { resetAfterColumnIndex, resetAfterRowIndex, resetAfter } = instance.proxy; 37832 expose({ 37833 windowRef, 37834 innerRef, 37835 getItemStyleCache, 37836 scrollTo, 37837 scrollToItem, 37838 states, 37839 resetAfterColumnIndex, 37840 resetAfterRowIndex, 37841 resetAfter 37842 }); 37843 const renderScrollbars = () => { 37844 const { 37845 scrollbarAlwaysOn, 37846 scrollbarStartGap, 37847 scrollbarEndGap, 37848 totalColumn, 37849 totalRow 37850 } = props; 37851 const width = vue.unref(parsedWidth); 37852 const height = vue.unref(parsedHeight); 37853 const estimatedWidth = vue.unref(estimatedTotalWidth); 37854 const estimatedHeight = vue.unref(estimatedTotalHeight); 37855 const { scrollLeft, scrollTop } = vue.unref(states); 37856 const horizontalScrollbar = vue.h(Scrollbar, { 37857 ref: hScrollbar, 37858 alwaysOn: scrollbarAlwaysOn, 37859 startGap: scrollbarStartGap, 37860 endGap: scrollbarEndGap, 37861 class: ns.e("horizontal"), 37862 clientSize: width, 37863 layout: "horizontal", 37864 onScroll: onHorizontalScroll, 37865 ratio: width * 100 / estimatedWidth, 37866 scrollFrom: scrollLeft / (estimatedWidth - width), 37867 total: totalRow, 37868 visible: true 37869 }); 37870 const verticalScrollbar = vue.h(Scrollbar, { 37871 ref: vScrollbar, 37872 alwaysOn: scrollbarAlwaysOn, 37873 startGap: scrollbarStartGap, 37874 endGap: scrollbarEndGap, 37875 class: ns.e("vertical"), 37876 clientSize: height, 37877 layout: "vertical", 37878 onScroll: onVerticalScroll, 37879 ratio: height * 100 / estimatedHeight, 37880 scrollFrom: scrollTop / (estimatedHeight - height), 37881 total: totalColumn, 37882 visible: true 37883 }); 37884 return { 37885 horizontalScrollbar, 37886 verticalScrollbar 37887 }; 37888 }; 37889 const renderItems = () => { 37890 var _a; 37891 const [columnStart, columnEnd] = vue.unref(columnsToRender); 37892 const [rowStart, rowEnd] = vue.unref(rowsToRender); 37893 const { data, totalColumn, totalRow, useIsScrolling, itemKey } = props; 37894 const children = []; 37895 if (totalRow > 0 && totalColumn > 0) { 37896 for (let row = rowStart; row <= rowEnd; row++) { 37897 for (let column = columnStart; column <= columnEnd; column++) { 37898 children.push((_a = slots.default) == null ? void 0 : _a.call(slots, { 37899 columnIndex: column, 37900 data, 37901 key: itemKey({ columnIndex: column, data, rowIndex: row }), 37902 isScrolling: useIsScrolling ? vue.unref(states).isScrolling : void 0, 37903 style: getItemStyle(row, column), 37904 rowIndex: row 37905 })); 37906 } 37907 } 37908 } 37909 return children; 37910 }; 37911 const renderInner = () => { 37912 const Inner = vue.resolveDynamicComponent(props.innerElement); 37913 const children = renderItems();
37914 return [ 37915 vue.h(Inner, { 37916 style: vue.unref(innerStyle), 37917 ref: innerRef 37918 }, !isString$1(Inner) ? { 37919 default: () => children 37920 } : children) 37921 ]; 37922 }; 37923 const renderWindow = () => { 37924 const Container = vue.resolveDynamicComponent(props.containerElement); 37925 const { horizontalScrollbar, verticalScrollbar } = renderScrollbars(); 37926 const Inner = renderInner(); 37927 return vue.h("div", { 37928 key: 0, 37929 class: ns.e("wrapper"), 37930 role: props.role 37931 }, [ 37932 vue.h(Container, { 37933 class: props.className, 37934 style: vue.unref(windowStyle), 37935 onScroll, 37936 onWheel, 37937 ref: windowRef 37938 }, !isString$1(Container) ? { default: () => Inner } : Inner), 37939 horizontalScrollbar, 37940 verticalScrollbar 37941 ]); 37942 }; 37943 return renderWindow; 37944 } 37945 }); 37946 }; 37947 var createGrid$1 = createGrid; 37948 37949 const FixedSizeGrid = createGrid$1({ 37950 name: "ElFixedSizeGrid", 37951 getColumnPosition: ({ columnWidth }, index) => [ 37952 columnWidth, 37953 index * columnWidth 37954 ], 37955 getRowPosition: ({ rowHeight }, index) => [ 37956 rowHeight, 37957 index * rowHeight 37958 ], 37959 getEstimatedTotalHeight: ({ totalRow, rowHeight }) => rowHeight * totalRow, 37960 getEstimatedTotalWidth: ({ totalColumn, columnWidth }) => columnWidth * totalColumn, 37961 getColumnOffset: ({ totalColumn, columnWidth, width }, columnIndex, alignment, scrollLeft, _, scrollBarWidth) => { 37962 width = Number(width); 37963 const lastColumnOffset = Math.max(0, totalColumn * columnWidth - width); 37964 const maxOffset = Math.min(lastColumnOffset, columnIndex * columnWidth); 37965 const minOffset = Math.max(0, columnIndex * columnWidth - width + scrollBarWidth + columnWidth); 37966 if (alignment === "smart") { 37967 if (scrollLeft >= minOffset - width && scrollLeft <= maxOffset + width) { 37968 alignment = AUTO_ALIGNMENT; 37969 } else { 37970 alignment = CENTERED_ALIGNMENT; 37971 } 37972 } 37973 switch (alignment) { 37974 case START_ALIGNMENT: 37975 return maxOffset; 37976 case END_ALIGNMENT: 37977 return minOffset; 37978 case CENTERED_ALIGNMENT: { 37979 const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2); 37980 if (middleOffset < Math.ceil(width / 2)) { 37981 return 0; 37982 } else if (middleOffset > lastColumnOffset + Math.floor(width / 2)) { 37983 return lastColumnOffset; 37984 } else { 37985 return middleOffset; 37986 } 37987 } 37988 case AUTO_ALIGNMENT: 37989 default: 37990 if (scrollLeft >= minOffset && scrollLeft <= maxOffset) { 37991 return scrollLeft; 37992 } else if (minOffset > maxOffset) { 37993 return minOffset; 37994 } else if (scrollLeft < minOffset) { 37995 return minOffset; 37996 } else { 37997 return maxOffset; 37998 } 37999 } 38000 }, 38001 getRowOffset: ({ rowHeight, height, totalRow }, rowIndex, align, scrollTop, _, scrollBarWidth) => { 38002 height = Number(height); 38003 const lastRowOffset = Math.max(0, totalRow * rowHeight - height); 38004 const maxOffset = Math.min(lastRowOffset, rowIndex * rowHeight); 38005 const minOffset = Math.max(0, rowIndex * rowHeight - height + scrollBarWidth + rowHeight); 38006 if (align === SMART_ALIGNMENT) { 38007 if (scrollTop >= minOffset - height && scrollTop <= maxOffset + height) { 38008 align = AUTO_ALIGNMENT; 38009 } else { 38010 align = CENTERED_ALIGNMENT; 38011 } 38012 } 38013 switch (align) { 38014 case START_ALIGNMENT: 38015 return maxOffset; 38016 case END_ALIGNMENT: 38017 return minOffset; 38018 case CENTERED_ALIGNMENT: { 38019 const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2); 38020 if (middleOffset < Math.ceil(height / 2)) { 38021 return 0; 38022 } else if (middleOffset > lastRowOffset + Math.floor(height / 2)) { 38023 return lastRowOffset; 38024 } else { 38025 return middleOffset; 38026 } 38027 } 38028 case AUTO_ALIGNMENT: 38029 default: 38030 if (scrollTop >= minOffset && scrollTop <= maxOffset) { 38031 return scrollTop; 38032 } else if (minOffset > maxOffset) { 38033 return minOffset; 38034 } else if (scrollTop < minOffset) { 38035 return minOffset; 38036 } else { 38037 return maxOffset; 38038 } 38039 } 38040 }, 38041 getColumnStartIndexForOffset: ({ columnWidth, totalColumn }, scrollLeft) => Math.max(0, Math.min(totalColumn - 1, Math.floor(scrollLeft / columnWidth))), 38042 getColumnStopIndexForStartIndex: ({ columnWidth, totalColumn, width }, startIndex, scrollLeft) => { 38043 const left = startIndex * columnWidth;
vendor: 4,697 bytes, lines 38044-38157
38044 const visibleColumnsCount = Math.ceil((width + scrollLeft - left) / columnWidth); 38045 return Math.max(0, Math.min(totalColumn - 1, startIndex + visibleColumnsCount - 1)); 38046 }, 38047 getRowStartIndexForOffset: ({ rowHeight, totalRow }, scrollTop) => Math.max(0, Math.min(totalRow - 1, Math.floor(scrollTop / rowHeight))), 38048 getRowStopIndexForStartIndex: ({ rowHeight, totalRow, height }, startIndex, scrollTop) => { 38049 const top = startIndex * rowHeight; 38050 const numVisibleRows = Math.ceil((height + scrollTop - top) / rowHeight); 38051 return Math.max(0, Math.min(totalRow - 1, startIndex + numVisibleRows - 1)); 38052 }, 38053 initCache: () => void 0, 38054 clearCache: true, 38055 validateProps: ({ columnWidth, rowHeight }) => { 38056 } 38057 }); 38058 var FixedSizeGrid$1 = FixedSizeGrid; 38059 38060 const { max, min, floor } = Math; 38061 const ACCESS_SIZER_KEY_MAP = { 38062 column: "columnWidth", 38063 row: "rowHeight" 38064 }; 38065 const ACCESS_LAST_VISITED_KEY_MAP = { 38066 column: "lastVisitedColumnIndex", 38067 row: "lastVisitedRowIndex" 38068 }; 38069 const getItemFromCache = (props, index, gridCache, type) => { 38070 const [cachedItems, sizer, lastVisited] = [ 38071 gridCache[type], 38072 props[ACCESS_SIZER_KEY_MAP[type]], 38073 gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]] 38074 ]; 38075 if (index > lastVisited) { 38076 let offset = 0; 38077 if (lastVisited >= 0) { 38078 const item = cachedItems[lastVisited]; 38079 offset = item.offset + item.size; 38080 } 38081 for (let i = lastVisited + 1; i <= index; i++) { 38082 const size = sizer(i); 38083 cachedItems[i] = { 38084 offset, 38085 size 38086 }; 38087 offset += size; 38088 } 38089 gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]] = index; 38090 } 38091 return cachedItems[index]; 38092 }; 38093 const bs = (props, gridCache, low, high, offset, type) => { 38094 while (low <= high) { 38095 const mid = low + floor((high - low) / 2); 38096 const currentOffset = getItemFromCache(props, mid, gridCache, type).offset; 38097 if (currentOffset === offset) { 38098 return mid; 38099 } else if (currentOffset < offset) { 38100 low = mid + 1; 38101 } else { 38102 high = mid - 1; 38103 } 38104 } 38105 return max(0, low - 1); 38106 }; 38107 const es = (props, gridCache, idx, offset, type) => { 38108 const total = type === "column" ? props.totalColumn : props.totalRow; 38109 let exponent = 1; 38110 while (idx < total && getItemFromCache(props, idx, gridCache, type).offset < offset) { 38111 idx += exponent; 38112 exponent *= 2; 38113 } 38114 return bs(props, gridCache, floor(idx / 2), min(idx, total - 1), offset, type); 38115 }; 38116 const findItem = (props, gridCache, offset, type) => { 38117 const [cache, lastVisitedIndex] = [ 38118 gridCache[type], 38119 gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]] 38120 ]; 38121 const lastVisitedItemOffset = lastVisitedIndex > 0 ? cache[lastVisitedIndex].offset : 0; 38122 if (lastVisitedItemOffset >= offset) { 38123 return bs(props, gridCache, 0, lastVisitedIndex, offset, type); 38124 } 38125 return es(props, gridCache, max(0, lastVisitedIndex), offset, type); 38126 }; 38127 const getEstimatedTotalHeight = ({ totalRow }, { estimatedRowHeight, lastVisitedRowIndex, row }) => { 38128 let sizeOfVisitedRows = 0; 38129 if (lastVisitedRowIndex >= totalRow) { 38130 lastVisitedRowIndex = totalRow - 1; 38131 } 38132 if (lastVisitedRowIndex >= 0) { 38133 const item = row[lastVisitedRowIndex]; 38134 sizeOfVisitedRows = item.offset + item.size; 38135 } 38136 const unvisitedItems = totalRow - lastVisitedRowIndex - 1; 38137 const sizeOfUnvisitedItems = unvisitedItems * estimatedRowHeight; 38138 return sizeOfVisitedRows + sizeOfUnvisitedItems; 38139 }; 38140 const getEstimatedTotalWidth = ({ totalColumn }, { column, estimatedColumnWidth, lastVisitedColumnIndex }) => { 38141 let sizeOfVisitedColumns = 0; 38142 if (lastVisitedColumnIndex > totalColumn) { 38143 lastVisitedColumnIndex = totalColumn - 1; 38144 } 38145 if (lastVisitedColumnIndex >= 0) { 38146 const item = column[lastVisitedColumnIndex]; 38147 sizeOfVisitedColumns = item.offset + item.size; 38148 } 38149 const unvisitedItems = totalColumn - lastVisitedColumnIndex - 1; 38150 const sizeOfUnvisitedItems = unvisitedItems * estimatedColumnWidth; 38151 return sizeOfVisitedColumns + sizeOfUnvisitedItems; 38152 }; 38153 const ACCESS_ESTIMATED_SIZE_KEY_MAP = { 38154 column: getEstimatedTotalWidth, 38155 row: getEstimatedTotalHeight 38156 }; 38157 const getOffset$1 = (props, index, alignment, scrollOffset, cache, t
38157ype, scrollBarWidth) => { 38158 const [size, estimatedSizeAssociates] = [ 38159 type === "row" ? props.height : props.width, 38160 ACCESS_ESTIMATED_SIZE_KEY_MAP[type] 38161 ]; 38162 const item = getItemFromCache(props, index, cache, type); 38163 const estimatedSize = estimatedSizeAssociates(props, cache); 38164 const maxOffset = max(0, min(estimatedSize - size, item.offset)); 38165 const minOffset = max(0, item.offset - size + scrollBarWidth + item.size); 38166 if (alignment === SMART_ALIGNMENT) { 38167 if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) { 38168 alignment = AUTO_ALIGNMENT; 38169 } else { 38170 alignment = CENTERED_ALIGNMENT; 38171 } 38172 } 38173 switch (alignment) { 38174 case START_ALIGNMENT: { 38175 return maxOffset; 38176 } 38177 case END_ALIGNMENT: { 38178 return minOffset; 38179 } 38180 case CENTERED_ALIGNMENT: { 38181 return Math.round(minOffset + (maxOffset - minOffset) / 2); 38182 } 38183 case AUTO_ALIGNMENT: 38184 default: { 38185 if (scrollOffset >= minOffset && scrollOffset <= maxOffset) { 38186 return scrollOffset; 38187 } else if (minOffset > maxOffset) { 38188 return minOffset; 38189 } else if (scrollOffset < minOffset) { 38190 return minOffset; 38191 } else { 38192 return maxOffset; 38193 } 38194 } 38195 } 38196 }; 38197 const DynamicSizeGrid = createGrid$1({ 38198 name: "ElDynamicSizeGrid", 38199 getColumnPosition: (props, idx, cache) => { 38200 const item = getItemFromCache(props, idx, cache, "column"); 38201 return [item.size, item.offset]; 38202 }, 38203 getRowPosition: (props, idx, cache) => { 38204 const item = getItemFromCache(props, idx, cache, "row"); 38205 return [item.size, item.offset]; 38206 }, 38207 getColumnOffset: (props, columnIndex, alignment, scrollLeft, cache, scrollBarWidth) => getOffset$1(props, columnIndex, alignment, scrollLeft, cache, "column", scrollBarWidth), 38208 getRowOffset: (props, rowIndex, alignment, scrollTop, cache, scrollBarWidth) => getOffset$1(props, rowIndex, alignment, scrollTop, cache, "row", scrollBarWidth), 38209 getColumnStartIndexForOffset: (props, scrollLeft, cache) => findItem(props, cache, scrollLeft, "column"), 38210 getColumnStopIndexForStartIndex: (props, startIndex, scrollLeft, cache) => { 38211 const item = getItemFromCache(props, startIndex, cache, "column"); 38212 const maxOffset = scrollLeft + props.width; 38213 let offset = item.offset + item.size; 38214 let stopIndex = startIndex; 38215 while (stopIndex < props.totalColumn - 1 && offset < maxOffset) { 38216 stopIndex++; 38217 offset += getItemFromCache(props, startIndex, cache, "column").size; 38218 } 38219 return stopIndex; 38220 }, 38221 getEstimatedTotalHeight, 38222 getEstimatedTotalWidth, 38223 getRowStartIndexForOffset: (props, scrollTop, cache) => findItem(props, cache, scrollTop, "row"), 38224 getRowStopIndexForStartIndex: (props, startIndex, scrollTop, cache) => { 38225 const { totalRow, height } = props; 38226 const item = getItemFromCache(props, startIndex, cache, "row"); 38227 const maxOffset = scrollTop + height; 38228 let offset = item.size + item.offset; 38229 let stopIndex = startIndex; 38230 while (stopIndex < totalRow - 1 && offset < maxOffset) { 38231 stopIndex++; 38232 offset += getItemFromCache(props, stopIndex, cache, "row").size; 38233 } 38234 return stopIndex; 38235 }, 38236 injectToInstance: (instance, cache) => { 38237 const resetAfter = ({ columnIndex, rowIndex }, forceUpdate) => { 38238 var _a, _b; 38239 forceUpdate = isUndefined(forceUpdate) ? true : forceUpdate; 38240 if (isNumber(columnIndex)) { 38241 cache.value.lastVisitedColumnIndex = Math.min(cache.value.lastVisitedColumnIndex, columnIndex - 1); 38242 } 38243 if (isNumber(rowIndex)) { 38244 cache.value.lastVisitedRowIndex = Math.min(cache.value.lastVisitedRowIndex, rowIndex - 1); 38245 } 38246 (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache.value(-1, null, null); 38247 if (forceUpdate) 38248 (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate(); 38249 }; 38250 const resetAfterColumnIndex = (columnIndex, forceUpdate) => { 38251 resetAfter({ 38252 columnIndex 38253 }, forceUpdate); 38254 }; 38255 const resetAfterRowIndex = (rowIndex, forceUpdate) => { 38256 resetAfter({ 38257 rowIndex 38258 }, forceUpdate); 38259 }; 38260 Object.assign(instance.proxy, { 38261 resetAfterColumnIndex, 38262 resetAfterRowIndex, 38263 resetAfter 38264 }); 38265 }, 38266 initCache: ({ 38267 estimatedColumnWidth = DEFAULT_DYNAMIC_LIST_ITEM_SIZE, 38268 estimatedRowHeight = DEFAULT_DYNAMIC_LIST_ITEM_SIZE 38269 }) => { 38270 const cache = { 38271 column: {}, 38272 estimatedColumnWidth, 38273 estimatedRowHeight, 38274 lastVisitedColumnIndex: -1, 38275 lastVisitedRowIndex: -1, 38276 row: {} 38277 }; 38278 return cache; 38279 }, 38280 clearCache: false, 38281 validateProps: ({ columnWidth, rowHeight }) => { 38282 } 38283 });
38284 var DynamicSizeGrid$1 = DynamicSizeGrid; 38285 38286 const _sfc_main$D = vue.defineComponent({ 38287 props: { 38288 item: { 38289 type: Object, 38290 required: true 38291 }, 38292 style: Object, 38293 height: Number 38294 }, 38295 setup() { 38296 const ns = useNamespace("select"); 38297 return { 38298 ns 38299 }; 38300 } 38301 }); 38302 function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) { 38303 return _ctx.item.isTitle ? (vue.openBlock(), vue.createElementBlock("div", { 38304 key: 0, 38305 class: vue.normalizeClass(_ctx.ns.be("group", "title")), 38306 style: vue.normalizeStyle([_ctx.style, { lineHeight: `${_ctx.height}px` }]) 38307 }, vue.toDisplayString(_ctx.item.label), 7)) : (vue.openBlock(), vue.createElementBlock("div", { 38308 key: 1, 38309 class: vue.normalizeClass(_ctx.ns.be("group", "split")), 38310 style: vue.normalizeStyle(_ctx.style) 38311 }, [ 38312 vue.createElementVNode("span", { 38313 class: vue.normalizeClass(_ctx.ns.be("group", "split-dash")), 38314 style: vue.normalizeStyle({ top: `${_ctx.height / 2}px` }) 38315 }, null, 6) 38316 ], 6)); 38317 } 38318 var GroupItem = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["render", _sfc_render$7], ["__file", "group-item.vue"]]); 38319 38320 function useOption(props, { emit }) { 38321 return { 38322 hoverItem: () => { 38323 if (!props.disabled) { 38324 emit("hover", props.index); 38325 } 38326 }, 38327 selectOptionClick: () => { 38328 if (!props.disabled) { 38329 emit("select", props.item, props.index); 38330 } 38331 } 38332 }; 38333 } 38334 38335 const SelectProps = { 38336 allowCreate: Boolean, 38337 autocomplete: { 38338 type: String, 38339 default: "none" 38340 }, 38341 automaticDropdown: Boolean, 38342 clearable: Boolean, 38343 clearIcon: { 38344 type: [String, Object], 38345 default: circle_close_default 38346 }, 38347 effect: { 38348 type: String, 38349 default: "light" 38350 }, 38351 collapseTags: Boolean, 38352 collapseTagsTooltip: { 38353 type: Boolean, 38354 default: false 38355 }, 38356 maxCollapseTags: { 38357 type: Number, 38358 default: 1 38359 }, 38360 defaultFirstOption: Boolean, 38361 disabled: Boolean, 38362 estimatedOptionHeight: { 38363 type: Number, 38364 default: void 0 38365 }, 38366 filterable: Boolean, 38367 filterMethod: Function, 38368 height: { 38369 type: Number, 38370 default: 170 38371 }, 38372 itemHeight: { 38373 type: Number, 38374 default: 34 38375 }, 38376 id: String, 38377 loading: Boolean, 38378 loadingText: String, 38379 label: String, 38380 modelValue: [Array, String, Number, Boolean, Object], 38381 multiple: Boolean, 38382 multipleLimit: { 38383 type: Number, 38384 default: 0 38385 }, 38386 name: String, 38387 noDataText: String, 38388 noMatchText: String, 38389 remoteMethod: Function, 38390 reserveKeyword: { 38391 type: Boolean, 38392 default: true 38393 }, 38394 options: { 38395 type: Array, 38396 required: true 38397 }, 38398 placeholder: { 38399 type: String 38400 }, 38401 teleported: useTooltipContentProps.teleported, 38402 persistent: { 38403 type: Boolean, 38404 default: true 38405 }, 38406 popperClass: { 38407 type: String, 38408 default: "" 38409 }, 38410 popperOptions: { 38411 type: Object, 38412 default: () => ({}) 38413 }, 38414 remote: Boolean, 38415 size: { 38416 type: String, 38417 validator: isValidComponentSize 38418 }, 38419 valueKey: { 38420 type: String, 38421 default: "value" 38422 }, 38423 scrollbarAlwaysOn: { 38424 type: Boolean, 38425 default: false 38426 }, 38427 validateEvent: { 38428 type: Boolean, 38429 default: true 38430 }, 38431 placement: { 38432 type: definePropType(String), 38433 values: Ee, 38434 default: "bottom-start" 38435 } 38436 }; 38437 const OptionProps = { 38438 data: Array, 38439 disabled: Boolean, 38440 hovering: Boolean, 38441 item: Object, 38442 index: Number, 38443 style: Object, 38444 selected: Boolean, 38445 created: Boolean 38446 }; 38447 38448 const _sfc_main$C = vue.defineComponent({ 38449 props: OptionProps, 38450 emits: ["select", "hover"], 38451 setup(props, { emit }) { 38452 const ns = useNamespace("select"); 38453 const { hoverItem, selectOptionClick } = useOption(props, { emit }); 38454 return { 38455 ns, 38456 hoverItem, 38457 selectOptionClick 38458 }; 38459 } 38460 });
38461 const _hoisted_1$h = ["aria-selected"]; 38462 function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) { 38463 return vue.openBlock(), vue.createElementBlock("li", { 38464 "aria-selected": _ctx.selected, 38465 style: vue.normalizeStyle(_ctx.style), 38466 class: vue.normalizeClass([ 38467 _ctx.ns.be("dropdown", "option-item"), 38468 _ctx.ns.is("selected", _ctx.selected), 38469 _ctx.ns.is("disabled", _ctx.disabled), 38470 _ctx.ns.is("created", _ctx.created), 38471 { hover: _ctx.hovering } 38472 ]), 38473 onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)), 38474 onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"])) 38475 }, [ 38476 vue.renderSlot(_ctx.$slots, "default", { 38477 item: _ctx.item, 38478 index: _ctx.index, 38479 disabled: _ctx.disabled 38480 }, () => [ 38481 vue.createElementVNode("span", null, vue.toDisplayString(_ctx.item.label), 1) 38482 ]) 38483 ], 46, _hoisted_1$h); 38484 } 38485 var OptionItem = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["render", _sfc_render$6], ["__file", "option-item.vue"]]); 38486 38487 const selectV2InjectionKey = Symbol("ElSelectV2Injection"); 38488 38489 var ElSelectMenu = vue.defineComponent({ 38490 name: "ElSelectDropdown", 38491 props: { 38492 data: { 38493 type: Array, 38494 required: true 38495 }, 38496 hoveringIndex: Number, 38497 width: Number 38498 }, 38499 setup(props, { 38500 slots, 38501 expose 38502 }) { 38503 const select = vue.inject(selectV2InjectionKey); 38504 const ns = useNamespace("select"); 38505 const cachedHeights = vue.ref([]); 38506 const listRef = vue.ref(); 38507 const size = vue.computed(() => props.data.length); 38508 vue.watch(() => size.value, () => { 38509 var _a, _b; 38510 (_b = (_a = select.popper.value).updatePopper) == null ? void 0 : _b.call(_a); 38511 }); 38512 const isSized = vue.computed(() => isUndefined(select.props.estimatedOptionHeight)); 38513 const listProps = vue.computed(() => { 38514 if (isSized.value) { 38515 return { 38516 itemSize: select.props.itemHeight 38517 }; 38518 } 38519 return { 38520 estimatedSize: select.props.estimatedOptionHeight, 38521 itemSize: (idx) => cachedHeights.value[idx] 38522 }; 38523 }); 38524 const contains = (arr = [], target) => { 38525 const { 38526 props: { 38527 valueKey 38528 } 38529 } = select; 38530 if (!isObject$1(target)) { 38531 return arr.includes(target); 38532 } 38533 return arr && arr.some((item) => { 38534 return get(item, valueKey) === get(target, valueKey); 38535 }); 38536 }; 38537 const isEqual = (selected, target) => { 38538 if (!isObject$1(target)) { 38539 return selected === target; 38540 } else { 38541 const { 38542 valueKey 38543 } = select.props; 38544 return get(selected, valueKey) === get(target, valueKey); 38545 } 38546 }; 38547 const isItemSelected = (modelValue, target) => { 38548 const { 38549 valueKey 38550 } = select.props; 38551 if (select.props.multiple) { 38552 return contains(modelValue, get(target, valueKey)); 38553 } 38554 return isEqual(modelValue, get(target, valueKey)); 38555 }; 38556 const isItemDisabled = (modelValue, selected) => { 38557 const { 38558 disabled, 38559 multiple, 38560 multipleLimit 38561 } = select.props; 38562 return disabled || !selected && (multiple ? multipleLimit > 0 && modelValue.length >= multipleLimit : false); 38563 }; 38564 const isItemHovering = (target) => props.hoveringIndex === target; 38565 const scrollToItem = (index) => { 38566 const list = listRef.value; 38567 if (list) { 38568 list.scrollToItem(index); 38569 } 38570 }; 38571 const resetScrollTop = () => { 38572 const list = listRef.value; 38573 if (list) { 38574 list.resetScrollTop(); 38575 } 38576 }; 38577 expose({ 38578 listRef, 38579 isSized, 38580 isItemDisabled, 38581 isItemHovering, 38582 isItemSelected, 38583 scrollToItem, 38584 resetScrollTop 38585 }); 38586 const Item = (itemProps) => { 38587 const { 38588 index, 38589 data, 38590 style 38591 } = itemProps; 38592 const sized = vue.unref(isSized); 38593 const { 38594 itemSize, 38595 estimatedSize 38596 } = vue.unref(listProps); 38597 const { 38598 modelValue 38599 } = select.props; 38600 const { 38601 onSelect, 38602 onHover 38603 } = select; 38604 const item = data[index]; 38605 if (item.type === "Group") { 38606 return vue.createVNode(GroupItem, { 38607 "item": item, 38608 "style": style, 38609 "height": sized ? itemSize : estimatedSize 38610 }, null); 38611 } 38612 const isSelected = isItemSelected(modelValue, item); 38613 const isDisabled = isItemDisabled(modelValue, isSelected); 38614 const isHovering = isItemHovering(index); 38615 return vue.createVNode(OptionItem, vue.mergeProps(itemProps, { 38616 "selected": isSelected, 38617 "disabled": item.disabled || isDisabled, 38618 "created": !!item.created, 38619 "hovering": isHovering, 38620 "item": item, 38621 "onSelect": onSelect, 38622 "onHover": onHover 38623 }), { 38624 default: (props2) => { 38625 var _a; 38626 return ((_a = slots.default) == null ? void 0 : _a.call(slots, props2)) || vue.createVNode("span", null, [item.label]); 38627 } 38628 }); 38629 }; 38630 const { 38631 onKeyboardNavigate, 38632 onKeyboardSelect 38633 } = select; 38634 const onForward = () => { 38635 onKeyboardNavigate("forward"); 38636 }; 38637 const onBackward = () => { 38638 onKeyboardNavigate("backward"); 38639 }; 38640 const onEscOrTab = () => { 38641 select.expanded = false; 38642 }; 38643 const onKeydown = (e) => { 38644 const { 38645 code 38646 } = e; 38647 const { 38648 tab, 38649 esc, 38650 down, 38651 up, 38652 enter 38653 } = EVENT_CODE; 38654 if (code !== tab) { 38655 e.preventDefault(); 38656 e.stopPropagation(); 38657 } 38658 switch (code) { 38659 case tab: 38660 case esc: { 38661 onEscOrTab(); 38662 break; 38663 } 38664 case down: { 38665 onForward(); 38666 break; 38667 } 38668 case up: { 38669 onBackward(); 38670 break; 38671 } 38672 case enter: { 38673 onKeyboardSelect(); 38674 break; 38675 } 38676 } 38677 }; 38678 return () => { 38679 var _a; 38680 const { 38681 data, 38682 width 38683 } = props; 38684 const { 38685 height, 38686 multiple, 38687 scrollbarAlwaysOn 38688 } = select.props; 38689 if (data.length === 0) { 38690 return vue.createVNode("div", { 38691 "class": ns.b("dropdown"), 38692 "style": { 38693 width: `${width}px` 38694 } 38695 }, [(_a = slots.empty) == null ? void 0 : _a.call(slots)]); 38696 } 38697 const List = vue.unref(isSized) ? FixedSizeList$1 : DynamicSizeList$1; 38698 return vue.createVNode("div", { 38699 "class": [ns.b("dropdown"), ns.is("multiple", multiple)] 38700 }, [vue.createVNode(List, vue.mergeProps({ 38701 "ref": listRef 38702 }, vue.unref(listProps), { 38703 "className": ns.be("dropdown", "list"), 38704 "scrollbarAlwaysOn": scrollbarAlwaysOn, 38705 "data": data, 38706 "height": height, 38707 "width": width, 38708 "total": data.length, 38709 "onKeydown": onKeydown 38710 }), { 38711 default: (props2) => vue.createVNode(Item, props2, null) 38712 })]); 38713 }; 38714 } 38715 });
38716 38717 function useAllowCreate(props, states) { 38718 const createOptionCount = vue.ref(0); 38719 const cachedSelectedOption = vue.ref(null); 38720 const enableAllowCreateMode = vue.computed(() => { 38721 return props.allowCreate && props.filterable; 38722 }); 38723 function hasExistingOption(query) { 38724 const hasValue = (option) => option.value === query; 38725 return props.options && props.options.some(hasValue) || states.createdOptions.some(hasValue); 38726 } 38727 function selectNewOption(option) { 38728 if (!enableAllowCreateMode.value) { 38729 return; 38730 } 38731 if (props.multiple && option.created) { 38732 createOptionCount.value++; 38733 } else { 38734 cachedSelectedOption.value = option; 38735 } 38736 } 38737 function createNewOption(query) { 38738 if (enableAllowCreateMode.value) { 38739 if (query && query.length > 0 && !hasExistingOption(query)) { 38740 const newOption = { 38741 value: query, 38742 label: query, 38743 created: true, 38744 disabled: false 38745 }; 38746 if (states.createdOptions.length >= createOptionCount.value) { 38747 states.createdOptions[createOptionCount.value] = newOption; 38748 } else { 38749 states.createdOptions.push(newOption); 38750 } 38751 } else { 38752 if (props.multiple) { 38753 states.createdOptions.length = createOptionCount.value; 38754 } else { 38755 const selectedOption = cachedSelectedOption.value; 38756 states.createdOptions.length = 0; 38757 if (selectedOption && selectedOption.created) { 38758 states.createdOptions.push(selectedOption); 38759 } 38760 } 38761 } 38762 } 38763 } 38764 function removeNewOption(option) { 38765 if (!enableAllowCreateMode.value || !option || !option.created || option.created && props.reserveKeyword && states.inputValue === option.label) { 38766 return; 38767 } 38768 const idx = states.createdOptions.findIndex((it) => it.value === option.value); 38769 if (~idx) { 38770 states.createdOptions.splice(idx, 1); 38771 createOptionCount.value--; 38772 } 38773 } 38774 function clearAllNewOption() { 38775 if (enableAllowCreateMode.value) { 38776 states.createdOptions.length = 0; 38777 createOptionCount.value = 0; 38778 } 38779 } 38780 return { 38781 createNewOption, 38782 removeNewOption, 38783 selectNewOption, 38784 clearAllNewOption 38785 }; 38786 } 38787 38788 const flattenOptions = (options) => { 38789 const flattened = []; 38790 options.forEach((option) => { 38791 if (isArray$1(option.options)) { 38792 flattened.push({ 38793 label: option.label, 38794 isTitle: true, 38795 type: "Group" 38796 }); 38797 option.options.forEach((o) => { 38798 flattened.push(o); 38799 }); 38800 flattened.push({ 38801 type: "Group" 38802 }); 38803 } else { 38804 flattened.push(option); 38805 } 38806 }); 38807 return flattened; 38808 }; 38809 38810 function useInput(handleInput) { 38811 const isComposing = vue.ref(false); 38812 const handleCompositionStart = () => { 38813 isComposing.value = true; 38814 }; 38815 const handleCompositionUpdate = (event) => { 38816 const text = event.target.value; 38817 const lastCharacter = text[text.length - 1] || ""; 38818 isComposing.value = !isKorean(lastCharacter); 38819 }; 38820 const handleCompositionEnd = (event) => { 38821 if (isComposing.value) { 38822 isComposing.value = false; 38823 if (isFunction$1(handleInput)) { 38824 handleInput(event); 38825 } 38826 } 38827 }; 38828 return { 38829 handleCompositionStart, 38830 handleCompositionUpdate, 38831 handleCompositionEnd 38832 }; 38833 } 38834 38835 const DEFAULT_INPUT_PLACEHOLDER = ""; 38836 const MINIMUM_INPUT_WIDTH = 11; 38837 const TAG_BASE_WIDTH = { 38838 larget: 51, 38839 default: 42, 38840 small: 33 38841 }; 38842 const useSelect$1 = (props, emit) => { 38843 const { t } = useLocale(); 38844 const nsSelectV2 = useNamespace("select-v2"); 38845 const nsInput = useNamespace("input"); 38846 const { form: elForm, formItem: elFormItem } = useFormItem(); 38847 const states = vue.reactive({ 38848 inputValue: DEFAULT_INPUT_PLACEHOLDER, 38849 displayInputValue: DEFAULT_INPUT_PLACEHOLDER, 38850 calculatedWidth: 0, 38851 cachedPlaceholder: "", 38852 cachedOptions: [], 38853 createdOptions: [], 38854 createdLabel: "", 38855 createdSelected: false, 38856 currentPlaceholder: "", 38857 hoveringIndex: -1, 38858 comboBoxHovering: false, 38859 isOnComposition: false, 38860 isSilentBlur: false, 38861 isComposing: false, 38862 inputLength: 20, 38863 selectWidth: 200, 38864 initialInputHeight: 0, 38865 previousQuery: null, 38866 previousValue: void 0, 38867 query: "", 38868 selectedLabel: "", 38869 softFocus: false, 38870 tagInMultiLine: false 38871 }); 38872 const selectedIndex = vue.ref(-1); 38873 const popperSize = vue.ref(-1); 38874 const controlRef = vue.ref(null); 38875 const inputRef = vue.ref(null); 38876 const menuRef = vue.ref(null); 38877 const popper = vue.ref(null); 38878 const selectRef = vue.ref(null); 38879 const selectionRef = vue.ref(null); 38880 const calculatorRef = vue.ref(null); 38881 const expanded = vue.ref(false); 38882 const selectDisabled = vue.computed(() => props.disabled || (elForm == null ? void 0 : elForm.disabled)); 38883 const popupHeight = vue.computed(() => { 38884 const totalHeight = filteredOptions.value.length * 34; 38885 return totalHeight > props.height ? props.height : totalHeight; 38886 }); 38887 const hasModelValue = vue.computed(() => { 38888 return !isNil(props.modelValue); 38889 }); 38890 const showClearBtn = vue.computed(() => { 38891 const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : hasModelValue.value; 38892 const criteria = props.clearable && !selectDisabled.value && states.comboBoxHovering && hasValue; 38893 return criteria; 38894 }); 38895 const iconComponent = vue.computed(() => props.remote && props.filterable ? "" : arrow_up_default); 38896 const iconReverse = vue.computed(() => iconComponent.value && nsSelectV2.is("reverse", expanded.value)); 38897 const validateState = vue.computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || ""); 38898 const validateIcon = vue.computed(() => ValidateComponentsMap[validateState.value]); 38899 const debounce$1 = vue.computed(() => props.remote ? 300 : 0); 38900 const emptyText = vue.computed(() => { 38901 const options = filteredOptions.value; 38902 if (props.loading) { 38903 return props.loadingText || t("el.select.loading"); 38904 } else { 38905 if (props.remote && states.inputValue === "" && options.length === 0) 38906 return false; 38907 if (props.filterable && states.inputValue && options.length > 0) { 38908 return props.noMatchText || t("el.select.noMatch"); 38909 } 38910 if (options.length === 0) { 38911 return props.noDataText || t("el.select.noData"); 38912 } 38913 } 38914 return null; 38915 }); 38916 const filteredOptions = vue.computed(() => { 38917 const isValidOption = (o) => { 38918 const query = states.inputValue; 38919 const regexp = new RegExp(escapeStringRegexp(query), "i"); 38920 const containsQueryString = query ? regexp.test(o.label || "") : true; 38921 return containsQueryString; 38922 }; 38923 if (props.loading) { 38924 return []; 38925 } 38926 return flattenOptions(props.options.concat(states.createdOptions).map((v) => { 38927 if (isArray$1(v.options)) { 38928 const filtered = v.options.filter(isValidOption); 38929 if (filtered.length > 0) { 38930 return { 38931 ...v, 38932 options: filtered 38933 }; 38934 } 38935 } else { 38936 if (props.remote || isValidOption(v)) { 38937 return v; 38938 } 38939 } 38940 return null; 38941 }).filter((v) => v !== null)); 38942 }); 38943 const optionsAllDisabled = vue.computed(() => filteredOptions.value.every((option) => option.disabled)); 38944 const selectSize = useFormSize(); 38945 const collapseTagSize = vue.computed(() => selectSize.value === "small" ? "small" : "default"); 38946 const tagMaxWidth = vue.computed(() => { 38947 const select = selectionRef.value; 38948 const size = collapseTagSize.value || "default"; 38949 const paddingLeft = select ? Number.parseInt(getComputedStyle(select).paddingLeft) : 0; 38950 const paddingRight = select ? Number.parseInt(getComputedStyle(select).paddingRight) : 0; 38951 return states.selectWidth - paddingRight - paddingLeft - TAG_BASE_WIDTH[size]; 38952 }); 38953 const calculatePopperSize = () => { 38954 var _a; 38955 popperSize.value = ((_a = selectRef.value) == null ? void 0 : _a.offsetWidth) || 200; 38956 }; 38957 const inputWrapperStyle = vue.computed(() => { 38958 return { 38959 width: `${states.calculatedWidth === 0 ? MINIMUM_INPUT_WIDTH : Math.ceil(states.calculatedWidth) + MINIMUM_INPUT_WIDTH}px` 38960 }; 38961 }); 38962 const shouldShowPlaceholder = vue.computed(() => { 38963 if (isArray$1(props.modelValue)) { 38964 return props.modelValue.length === 0 && !states.displayInputValue; 38965 } 38966 return props.filterable ? states.displayInputValue.length === 0 : true; 38967 }); 38968 const currentPlaceholder = vue.computed(() => { 38969 const _placeholder = props.placeholder || t("el.select.placeholder"); 38970 return props.multiple || isNil(props.modelValue) ? _placeholder : states.selectedLabel; 38971 }); 38972 const popperRef = vue.computed(() => { 38973 var _a, _b; 38974 return (_b = (_a = popper.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef; 38975 }); 38976 const indexRef = vue.computed(() => { 38977 if (props.multiple) { 38978 const len = props.modelValue.length; 38979 if (props.modelValue.length > 0) { 38980 return filteredOptions.value.findIndex((o) => o.value === props.modelValue[len - 1]); 38981 } 38982 } else { 38983 if (props.modelValue) { 38984 return filteredOptions.value.findIndex((o) => o.value === props.modelValue); 38985 } 38986 } 38987 return -1; 38988 }); 38989 const dropdownMenuVisible = vue.computed({ 38990 get() { 38991 return expanded.value && emptyText.value !== false; 38992 }, 38993 set(val) { 38994 expanded.value = val; 38995 } 38996 }); 38997 const showTagList = vue.computed(() => states.cachedOptions.slice(0, props.maxCollapseTags)); 38998 const collapseTagList = vue.computed(() => states.cachedOptions.slice(props.maxCollapseTags)); 38999 const { 39000 createNewOption, 39001 removeNewOption, 39002 selectNewOption, 39003 clearAllNewOption 39004 } = useAllowCreate(props, states); 39005 const { 39006 handleCompositionStart, 39007 handleCompositionUpdate, 39008 handleCompositionEnd 39009 } = useInput((e) => onInput(e)); 39010 const focusAndUpdatePopup = () => { 39011 var _a, _b, _c; 39012 (_b = (_a = inputRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a); 39013 (_c = popper.value) == null ? void 0 : _c.updatePopper(); 39014 }; 39015 const toggleMenu = () => { 39016 if (props.automaticDropdown) 39017 return; 39018 if (!selectDisabled.value) { 39019 if (states.isComposing) 39020 states.softFocus = true; 39021 return vue.nextTick(() => { 39022 var _a, _b; 39023 expanded.value = !expanded.value; 39024 (_b = (_a = inputRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a); 39025 }); 39026 } 39027 }; 39028 const onInputChange = () => { 39029 if (props.filterable && states.inputValue !== states.selectedLabel) { 39030 states.query = states.selectedLabel; 39031 } 39032 handleQueryChange(states.inputValue); 39033 return vue.nextTick(() => { 39034 createNewOption(states.inputValue); 39035 }); 39036 }; 39037 const debouncedOnInputChange = debounce(onInputChange, debounce$1.value); 39038 const handleQueryChange = (val) => { 39039 if (states.previousQuery === val) { 39040 return; 39041 } 39042 states.previousQuery = val; 39043 if (props.filterable && isFunction$1(props.filterMethod)) { 39044 props.filterMethod(val); 39045 } else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) { 39046 props.remoteMethod(val); 39047 } 39048 }; 39049 const emitChange = (val) => { 39050 if (!isEqual$1(props.modelValue, val)) { 39051 emit(CHANGE_EVENT, val); 39052 } 39053 }; 39054 const update = (val) => { 39055 emit(UPDATE_MODEL_EVENT, val); 39056 emitChange(val); 39057 states.previousValue = val == null ? void 0 : val.toString(); 39058 }; 39059 const getValueIndex = (arr = [], value) => { 39060 if (!isObject$1(value)) { 39061 return arr.indexOf(value); 39062 } 39063 const valueKey = props.valueKey; 39064 let index = -1; 39065 arr.some((item, i) => { 39066 if (get(item, valueKey) === get(value, valueKey)) { 39067 index = i; 39068 return true; 39069 } 39070 return false; 39071 }); 39072 return index; 39073 }; 39074 const getValueKey = (item) => { 39075 return isObject$1(item) ? get(item, props.valueKey) : item; 39076 }; 39077 const getLabel = (item) => { 39078 return isObject$1(item) ? item.label : item; 39079 }; 39080 const resetInputHeight = () => { 39081 return vue.nextTick(() => { 39082 var _a, _b; 39083 if (!inputRef.value) 39084 return; 39085 const selection = selectionRef.value; 39086 selectRef.value.height = selection.offsetHeight; 39087 if (expanded.value && emptyText.value !== false) { 39088 (_b = (_a = popper.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a); 39089 } 39090 }); 39091 }; 39092 const handleResize = () => { 39093 var _a, _b; 39094 resetInputWidth(); 39095 calculatePopperSize(); 39096 (_b = (_a = popper.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a); 39097 if (props.multiple) { 39098 return resetInputHeight(); 39099 } 39100 }; 39101 const resetInputWidth = () => { 39102 const select = selectionRef.value; 39103 if (select) { 39104 states.selectWidth = select.getBoundingClientRect().width; 39105 } 39106 }; 39107 const onSelect = (option, idx, byClick = true) => { 39108 var _a, _b; 39109 if (props.multiple) { 39110 let selectedOptions = props.modelValue.slice(); 39111 const index = getValueIndex(selectedOptions, getValueKey(option)); 39112 if (index > -1) { 39113 selectedOptions = [ 39114 ...selectedOptions.slice(0, index), 39115 ...selectedOptions.slice(index + 1) 39116 ]; 39117 states.cachedOptions.splice(index, 1); 39118 removeNewOption(option); 39119 } else if (props.multipleLimit <= 0 || selectedOptions.length < props.multipleLimit) { 39120 selectedOptions = [...selectedOptions, getValueKey(option)]; 39121 states.cachedOptions.push(option); 39122 selectNewOption(option); 39123 updateHoveringIndex(idx); 39124 } 39125 update(selectedOptions); 39126 if (option.created) { 39127 states.query = ""; 39128 handleQueryChange(""); 39129 states.inputLength = 20; 39130 } 39131 if (props.filterable && !props.reserveKeyword) { 39132 (_b = (_a = inputRef.value).focus) == null ? void 0 : _b.call(_a); 39133 onUpdateInputValue(""); 39134 } 39135 if (props.filterable) { 39136 states.calculatedWidth = calculatorRef.value.getBoundingClientRect().width; 39137 } 39138 resetInputHeight(); 39139 setSoftFocus(); 39140 } else { 39141 selectedIndex.value = idx; 39142 states.selectedLabel = option.label; 39143 update(getValueKey(option)); 39144 expanded.value = false; 39145 states.isComposing = false; 39146
39146 states.isSilentBlur = byClick; 39147 selectNewOption(option); 39148 if (!option.created) { 39149 clearAllNewOption(); 39150 } 39151 updateHoveringIndex(idx); 39152 } 39153 }; 39154 const deleteTag = (event, tag) => { 39155 const { valueKey } = props; 39156 const index = props.modelValue.indexOf(get(tag, valueKey)); 39157 if (index > -1 && !selectDisabled.value) { 39158 const value = [ 39159 ...props.modelValue.slice(0, index), 39160 ...props.modelValue.slice(index + 1) 39161 ]; 39162 states.cachedOptions.splice(index, 1); 39163 update(value); 39164 emit("remove-tag", get(tag, valueKey)); 39165 states.softFocus = true; 39166 removeNewOption(tag); 39167 return vue.nextTick(focusAndUpdatePopup); 39168 } 39169 event.stopPropagation(); 39170 }; 39171 const handleFocus = (event) => { 39172 const focused = states.isComposing; 39173 states.isComposing = true; 39174 if (!states.softFocus) { 39175 if (!focused) 39176 emit("focus", event); 39177 } else { 39178 states.softFocus = false; 39179 } 39180 }; 39181 const handleBlur = (event) => { 39182 states.softFocus = false; 39183 return vue.nextTick(() => { 39184 var _a, _b; 39185 (_b = (_a = inputRef.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a); 39186 if (calculatorRef.value) { 39187 states.calculatedWidth = calculatorRef.value.getBoundingClientRect().width; 39188 } 39189 if (states.isSilentBlur) { 39190 states.isSilentBlur = false; 39191 } else { 39192 if (states.isComposing) { 39193 emit("blur", event); 39194 } 39195 } 39196 states.isComposing = false; 39197 }); 39198 }; 39199 const handleEsc = () => { 39200 if (states.displayInputValue.length > 0) { 39201 onUpdateInputValue(""); 39202 } else { 39203 expanded.value = false; 39204 } 39205 }; 39206 const handleDel = (e) => { 39207 if (states.displayInputValue.length === 0) { 39208 e.preventDefault(); 39209 const selected = props.modelValue.slice(); 39210 selected.pop(); 39211 removeNewOption(states.cachedOptions.pop()); 39212 update(selected); 39213 } 39214 }; 39215 const handleClear = () => { 39216 let emptyValue; 39217 if (isArray$1(props.modelValue)) { 39218 emptyValue = []; 39219 } else { 39220 emptyValue = void 0; 39221 } 39222 states.softFocus = true; 39223 if (props.multiple) { 39224 states.cachedOptions = []; 39225 } else { 39226 states.selectedLabel = ""; 39227 } 39228 expanded.value = false; 39229 update(emptyValue); 39230 emit("clear"); 39231 clearAllNewOption(); 39232 return vue.nextTick(focusAndUpdatePopup); 39233 }; 39234 const onUpdateInputValue = (val) => { 39235 states.displayInputValue = val; 39236 states.inputValue = val; 39237 }; 39238 const onKeyboardNavigate = (direction, hoveringIndex = void 0) => { 39239 const options = filteredOptions.value; 39240 if (!["forward", "backward"].includes(direction) || selectDisabled.value || options.length <= 0 || optionsAllDisabled.value) { 39241 return; 39242 } 39243 if (!expanded.value) { 39244 return toggleMenu(); 39245 } 39246 if (hoveringIndex === void 0) { 39247 hoveringIndex = states.hoveringIndex; 39248 } 39249 let newIndex = -1; 39250 if (direction === "forward") { 39251 newIndex = hoveringIndex + 1; 39252 if (newIndex >= options.length) { 39253 newIndex = 0; 39254 } 39255 } else if (direction === "backward") { 39256 newIndex = hoveringIndex - 1; 39257 if (newIndex < 0 || newIndex >= options.length) { 39258 newIndex = options.length - 1; 39259 } 39260 } 39261 const option = options[newIndex]; 39262 if (option.disabled || option.type === "Group") { 39263 return onKeyboardNavigate(direction, newIndex); 39264 } else { 39265 updateHoveringIndex(newIndex); 39266 scrollToItem(newIndex); 39267 } 39268 }; 39269 const onKeyboardSelect = () => { 39270 if (!expanded.value) { 39271 return toggleMenu(); 39272 } else if (~states.hoveringIndex && filteredOptions.value[states.hoveringIndex]) { 39273 onSelect(filteredOptions.value[states.hoveringIndex], states.hoveringIndex, false); 39274 } 39275 }; 39276 const updateHoveringIndex = (idx) => { 39277 states.hoveringIndex = idx; 39278 }; 39279 const resetHoveringIndex = () => { 39280 states.hoveringIndex = -1; 39281 }; 39282 const setSoftFocus = () => { 39283 var _a; 39284 const _input = inputRef.value; 39285 if (_input) { 39286 (_a = _input.focus) == null ? void 0 : _a.call(_input); 39287 } 39288 }; 39289 const onInput = (event) => { 39290 const value = event.target.value; 39291 onUpdateInputValue(value); 39292 if (states.displayInputValue.length > 0 && !expanded.value) { 39293 expanded.value = true; 39294 } 39295 states.calculatedWidth = calculatorRef.value.getBoundingClientRect().width; 39296 if (props.multiple) { 39297 resetInputHeight(); 39298 } 39299 if (props.remote) { 39300 debouncedOnInputChange(); 39301 } else { 39302 return onInputChange(); 39303 } 39304 }; 39305 const handleClickOutside = () => { 39306 expanded.value = false; 39307 return handleBlur(); 39308 }; 39309 const handleMenuEnter = () => { 39310 states.inputValue = states.displayInputValue; 39311 return vue.nextTick(() => { 39312 if (~indexRef.value) { 39313 updateHoveringIndex(indexRef.value); 39314 scrollToItem(states.hoveringIndex); 39315 } 39316 }); 39317 }; 39318 const scrollToItem = (index) => { 39319 menuRef.value.scrollToItem(index); 39320 }; 39321 const initStates = () => { 39322 resetHoveringIndex(); 39323 if (props.multiple) { 39324 if (props.modelValue.length > 0) { 39325 let initHovering = false; 39326 states.cachedOptions.length = 0; 39327 states.previousValue = props.modelValue.toString(); 39328 props.modelValue.forEach((selected) => { 39329 const itemIndex = filteredOptions.value.findIndex((option) => getValueKey(option) === selected); 39330 if (~itemIndex) { 39331 states.cachedOptions.push(filteredOptions.value[itemIndex]); 39332 if (!initHovering) { 39333 updateHoveringIndex(itemIndex); 39334 } 39335 initHovering = true; 39336 } 39337 }); 39338 } else { 39339 states.cachedOptions = []; 39340 states.previousValue = void 0; 39341 } 39342 } else { 39343 if (hasModelValue.value) { 39344 states.previousValue = props.modelValue; 39345 const options = filteredOptions.value; 39346 const selectedItemIndex = options.findIndex((option) => getValueKey(option) === getValueKey(props.modelValue)); 39347 if (~selectedItemIndex) { 39348 states.selectedLabel = options[selectedItemIndex].label; 39349 updateHoveringIndex(selectedItemIndex); 39350 } else { 39351 states.selectedLabel = `${props.modelValue}`; 39352 } 39353 } else { 39354 states.selectedLabel = ""; 39355 states.previousValue = void 0; 39356 } 39357 } 39358 clearAllNewOption(); 39359 calculatePopperSize(); 39360 }; 39361 vue.watch(expanded, (val) => { 39362 var _a, _b; 39363 emit("visible-change", val); 39364 if (val) { 39365 (_b = (_a = popper.value).update) == null ? void 0 : _b.call(_a); 39366 } else { 39367 states.displayInputValue = ""; 39368 states.previousQuery = null; 39369 createNewOption(""); 39370 } 39371 }); 39372 vue.watch(() => props.modelValue, (val, oldVal) => { 39373 var _a; 39374 if (!val || val.toString() !== states.previousValue) { 39375 initStates(); 39376 } 39377 if (!isEqual$1(val, oldVal) && props.validateEvent) { 39378 (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn()); 39379 } 39380 }, { 39381 deep: true 39382 }); 39383 vue.watch(() => props.options, () => { 39384 const input = inputRef.value; 39385 if (!input || input && document.activeElement !== input) { 39386 initStates(); 39387 } 39388 }, { 39389 deep: true 39390 }); 39391 vue.watch(filteredOptions, () => { 39392 return vue.nextTick(menuRef.value.resetScrollTop); 39393 }); 39394 vue.watch(() => dropdownMenuVisible.value, (val) => { 39395 if (!val) { 39396 resetHoveringIndex(); 39397 } 39398 }); 39399 vue.onMounted(() => { 39400 initStates(); 39401 }); 39402 useResizeObserver(selectRef, handleResize); 39403 return { 39404 collapseTagSize, 39405 currentPlaceholder, 39406 expanded, 39407 emptyText, 39408 popupHeight, 39409 debounce: debounce$1, 39410 filteredOptions, 39411 iconComponent, 39412 iconReverse, 39413 inputWrapperStyle, 39414 popperSize, 39415 dropdownMenuVisible, 39416 hasModelValue, 39417 shouldShowPlaceholder, 39418 selectDisabled, 39419 selectSize, 39420 showClearBtn, 39421 states, 39422 tagMaxWidth, 39423 nsSelectV2, 39424 nsInput, 39425 calculatorRef, 39426 controlRef, 39427 inputRef, 39428 menuRef, 39429 popper, 39430 selectRef, 39431 selectionRef, 39432 popperRef, 39433 validateState, 39434 validateIcon, 39435 showTagList, 39436 collapseTagList, 39437 debouncedOnInputChange, 39438 deleteTag, 39439 getLabel, 39440 getValueKey, 39441 handleBlur, 39442 handleClear, 39443 handleClickOutside, 39444 handleDel, 39445 handleEsc, 39446 handleFocus, 39447 handleMenuEnter, 39448 handleResize, 39449 toggleMenu, 39450 scrollTo: scrollToItem, 39451 onInput, 39452 onKeyboardNavigate, 39453 onKeyboardSelect, 39454 onSelect, 39455 onHover: updateHoveringIndex, 39456 onUpdateInputValue, 39457 handleCompositionStart, 39458 handleCompositionEnd, 39459 handleCompositionUpdate 39460 }; 39461 }; 39462 var useSelect$2 = useSelect$1; 39463 39464 const _sfc_main$B = vue.defineComponent({ 39465 name: "ElSelectV2", 39466 components: { 39467 ElSelectMenu, 39468 ElTag, 39469 ElTooltip, 39470 ElIcon 39471 }, 39472 directives: { ClickOutside, ModelText: vue.vModelText }, 39473 props: SelectProps, 39474 emits: [ 39475 UPDATE_MODEL_EVENT, 39476 CHANGE_EVENT, 39477 "remove-tag", 39478 "clear", 39479 "visible-change", 39480 "focus", 39481 "blur" 39482 ], 39483 setup(props, { emit }) { 39484 const modelValue = vue.computed(() => { 39485 const { modelValue: rawModelValue, multiple } = props; 39486 const fallback = multiple ? [] : void 0; 39487 if (isArray$1(rawModelValue)) { 39488 return multiple ? rawModelValue : fallback; 39489 } 39490 return multiple ? fallback : rawModelValue; 39491 }); 39492 const API = useSelect$2(vue.reactive({ 39493 ...vue.toRefs(props), 39494 modelValue 39495 }), emit); 39496 vue.provide(selectV2InjectionKey, { 39497 props: vue.reactive({ 39498 ...vue.toRefs(props), 39499 height: API.popupHeight, 39500 modelValue 39501 }), 39502 popper: API.popper, 39503 onSelect: API.onSelect, 39504 onHover: API.onHover, 39505 onKeyboardNavigate: API.onKeyboardNavigate, 39506 onKeyboardSelect: API.onKeyboardSelect 39507 }); 39508 return { 39509 ...API, 39510 modelValue 39511 }; 39512 } 39513 });
39514 const _hoisted_1$g = { key: 0 }; 39515 const _hoisted_2$b = ["id", "autocomplete", "aria-expanded", "aria-labelledby", "disabled", "readonly", "name", "unselectable"]; 39516 const _hoisted_3$5 = ["textContent"]; 39517 const _hoisted_4$3 = ["id", "aria-labelledby", "aria-expanded", "autocomplete", "disabled", "name", "readonly", "unselectable"]; 39518 const _hoisted_5$2 = ["textContent"]; 39519 function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) { 39520 const _component_el_tag = vue.resolveComponent("el-tag"); 39521 const _component_el_tooltip = vue.resolveComponent("el-tooltip"); 39522 const _component_el_icon = vue.resolveComponent("el-icon"); 39523 const _component_el_select_menu = vue.resolveComponent("el-select-menu"); 39524 const _directive_model_text = vue.resolveDirective("model-text"); 39525 const _directive_click_outside = vue.resolveDirective("click-outside"); 39526 return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", { 39527 ref: "selectRef", 39528 class: vue.normalizeClass([_ctx.nsSelectV2.b(), _ctx.nsSelectV2.m(_ctx.selectSize)]), 39529 onClick: _cache[24] || (_cache[24] = vue.withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"])), 39530 onMouseenter: _cache[25] || (_cache[25] = ($event) => _ctx.states.comboBoxHovering = true), 39531 onMouseleave: _cache[26] || (_cache[26] = ($event) => _ctx.states.comboBoxHovering = false) 39532 }, [ 39533 vue.createVNode(_component_el_tooltip, { 39534 ref: "popper", 39535 visible: _ctx.dropdownMenuVisible, 39536 teleported: _ctx.teleported, 39537 "popper-class": [_ctx.nsSelectV2.e("popper"), _ctx.popperClass], 39538 "gpu-acceleration": false, 39539 "stop-popper-mouse-event": false, 39540 "popper-options": _ctx.popperOptions, 39541 "fallback-placements": ["bottom-start", "top-start", "right", "left"], 39542 effect: _ctx.effect, 39543 placement: _ctx.placement, 39544 pure: "", 39545 transition: `${_ctx.nsSelectV2.namespace.value}-zoom-in-top`, 39546 trigger: "click", 39547 persistent: _ctx.persistent, 39548 onBeforeShow: _ctx.handleMenuEnter, 39549 onHide: _cache[23] || (_cache[23] = ($event) => _ctx.states.inputValue = _ctx.states.displayInputValue) 39550 }, { 39551 default: vue.withCtx(() => [ 39552 vue.createElementVNode("div", { 39553 ref: "selectionRef", 39554 class: vue.normalizeClass([ 39555 _ctx.nsSelectV2.e("wrapper"), 39556 _ctx.nsSelectV2.is("focused", _ctx.states.isComposing || _ctx.expanded), 39557 _ctx.nsSelectV2.is("hovering", _ctx.states.comboBoxHovering), 39558 _ctx.nsSelectV2.is("filterable", _ctx.filterable), 39559 _ctx.nsSelectV2.is("disabled", _ctx.selectDisabled) 39560 ]) 39561 }, [ 39562 _ctx.$slots.prefix ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [ 39563 vue.renderSlot(_ctx.$slots, "prefix") 39564 ])) : vue.createCommentVNode("v-if", true), 39565 _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("div", { 39566 key: 1, 39567 class: vue.normalizeClass(_ctx.nsSelectV2.e("selection")) 39568 }, [ 39569 _ctx.collapseTags && _ctx.modelValue.length > 0 ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ 39570 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.showTagList, (item) => { 39571 return vue.openBlock(), vue.createElementBlock("div", { 39572 key: _ctx.getValueKey(item), 39573 class: vue.normalizeClass(_ctx.nsSelectV2.e("selected-item")) 39574 }, [ 39575 vue.createVNode(_component_el_tag, { 39576 closable: !_ctx.selectDisabled && !(item == null ? void 0 : item.disable), 39577 size: _ctx.collapseTagSize, 39578 type: "info", 39579 "disable-transitions": "", 39580 onClose: ($event) => _ctx.deleteTag($event, item) 39581 }, { 39582 default: vue.withCtx(() => [ 39583 vue.createElementVNode("span", { 39584 class: vue.normalizeClass(_ctx.nsSelectV2.e("tags-text")), 39585 style: vue.normalizeStyle({ 39586 maxWidth: `${_ctx.tagMaxWidth}px` 39587 }) 39588 }, vue.toDisplayString(item == null ? void 0 : item.label), 7) 39589 ]), 39590 _: 2 39591 }, 1032, ["closable", "size", "onClose"]) 39592 ], 2); 39593 }), 128)), 39594 vue.createElementVNode("div", { 39595 class: vue.normalizeClass(_ctx.nsSelectV2.e("selected-item")) 39596 }, [ 39597 _ctx.modelValue.length > _ctx.maxCollapseTags ? (vue.openBlock(), vue.createBlock(_component_el_tag, { 39598 key: 0, 39599 closable: false, 39600 size: _ctx.collapseTagSize, 39601 type: "info", 39602 "disable-transitions": "" 39603 }, { 39604 default: vue.withCtx(() => [ 39605 _ctx.collapseTagsTooltip ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, { 39606 key: 0, 39607 disabled: _ctx.dropdownMenuVisible, 39608 "fallback-placements": ["bottom", "top", "right", "left"], 39609 effect: _ctx.effect, 39610 placement: "bottom", 39611 teleported: false 39612 }, { 39613 default: vue.withCtx(() => [ 39614 vue.createElementVNode("span", { 39615 class: vue.normalizeClass(_ctx.nsSelectV2.e("tags-text")), 39616 style: vue.normalizeStyle({ 39617 maxWidth: `${_ctx.tagMaxWidth}px` 39618 }) 39619 }, "+ " + vue.toDisplayString(_ctx.modelValue.length - _ctx.maxCollapseTags), 7) 39620 ]), 39621 content: vue.withCtx(() => [ 39622 vue.createElementVNode("div", { 39623 class: vue.normalizeClass(_ctx.nsSelectV2.e("selection")) 39624 }, [ 39625 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.collapseTagList, (selected) => {
39626 return vue.openBlock(), vue.createElementBlock("div", { 39627 key: _ctx.getValueKey(selected), 39628 class: vue.normalizeClass(_ctx.nsSelectV2.e("selected-item")) 39629 }, [ 39630 vue.createVNode(_component_el_tag, { 39631 closable: !_ctx.selectDisabled && !selected.disabled, 39632 size: _ctx.collapseTagSize, 39633 class: "in-tooltip", 39634 type: "info", 39635 "disable-transitions": "", 39636 onClose: ($event) => _ctx.deleteTag($event, selected) 39637 }, { 39638 default: vue.withCtx(() => [ 39639 vue.createElementVNode("span", { 39640 class: vue.normalizeClass(_ctx.nsSelectV2.e("tags-text")), 39641 style: vue.normalizeStyle({ 39642 maxWidth: `${_ctx.tagMaxWidth}px` 39643 }) 39644 }, vue.toDisplayString(_ctx.getLabel(selected)), 7) 39645 ]), 39646 _: 2 39647 }, 1032, ["closable", "size", "onClose"]) 39648 ], 2); 39649 }), 128)) 39650 ], 2) 39651 ]), 39652 _: 1 39653 }, 8, ["disabled", "effect"])) : (vue.openBlock(), vue.createElementBlock("span", { 39654 key: 1, 39655 class: vue.normalizeClass(_ctx.nsSelectV2.e("tags-text")), 39656 style: vue.normalizeStyle({ 39657 maxWidth: `${_ctx.tagMaxWidth}px` 39658 }) 39659 }, "+ " + vue.toDisplayString(_ctx.modelValue.length - _ctx.maxCollapseTags), 7)) 39660 ]), 39661 _: 1 39662 }, 8, ["size"])) : vue.createCommentVNode("v-if", true) 39663 ], 2) 39664 ], 64)) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(_ctx.states.cachedOptions, (selected) => { 39665 return vue.openBlock(), vue.createElementBlock("div", { 39666 key: _ctx.getValueKey(selected), 39667 class: vue.normalizeClass(_ctx.nsSelectV2.e("selected-item")) 39668 }, [ 39669 vue.createVNode(_component_el_tag, { 39670 closable: !_ctx.selectDisabled && !selected.disabled, 39671 size: _ctx.collapseTagSize, 39672 type: "info", 39673 "disable-transitions": "", 39674 onClose: ($event) => _ctx.deleteTag($event, selected) 39675 }, { 39676 default: vue.withCtx(() => [ 39677 vue.createElementVNode("span", { 39678 class: vue.normalizeClass(_ctx.nsSelectV2.e("tags-text")), 39679 style: vue.normalizeStyle({ 39680 maxWidth: `${_ctx.tagMaxWidth}px` 39681 }) 39682 }, vue.toDisplayString(_ctx.getLabel(selected)), 7) 39683 ]), 39684 _: 2 39685 }, 1032, ["closable", "size", "onClose"]) 39686 ], 2); 39687 }), 128)), 39688 vue.createElementVNode("div", { 39689 class: vue.normalizeClass([ 39690 _ctx.nsSelectV2.e("selected-item"), 39691 _ctx.nsSelectV2.e("input-wrapper") 39692 ]), 39693 style: vue.normalizeStyle(_ctx.inputWrapperStyle) 39694 }, [ 39695 vue.withDirectives(vue.createElementVNode("input", { 39696 id: _ctx.id, 39697 ref: "inputRef", 39698 autocomplete: _ctx.autocomplete, 39699 "aria-autocomplete": "list", 39700 "aria-haspopup": "listbox", 39701 autocapitalize: "off", 39702 "aria-expanded": _ctx.expanded, 39703 "aria-labelledby": _ctx.label, 39704 class: vue.normalizeClass([ 39705 _ctx.nsSelectV2.is(_ctx.selectSize), 39706 _ctx.nsSelectV2.e("combobox-input") 39707 ]), 39708 disabled: _ctx.disabled, 39709 role: "combobox", 39710 readonly: !_ctx.filterable, 39711 spellcheck: "false", 39712 type: "text", 39713 name: _ctx.name, 39714 unselectable: _ctx.expanded ? "on" : void 0, 39715 "onUpdate:modelValue": _cache[0] || (_cache[0] = (...args) => _ctx.onUpdateInputValue && _ctx.onUpdateInputValue(...args)), 39716 onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)), 39717 onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)), 39718 onInput: _cache[3] || (_cache[3] = (...args) => _ctx.onInput && _ctx.onInput(...args)), 39719 onCompositionstart: _cache[4] || (_cache[4] = (...args) => _ctx.handleCompositionStart && _ctx.handleCompositionStart(...args)), 39720 onCompositionupdate: _cache[5] || (_cache[5] = (...args) => _ctx.handleCompositionUpdate && _ctx.handleCompositionUpdate(...args)), 39721 onCompositionend: _cache[6] || (_cache[6] = (...args) => _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...args)), 39722 onKeydown: [ 39723 _cache[7] || (_cache[7] = vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"])), 39724 _cache[8] || (_cache[8] = vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"])), 39725 _cache[9] || (_cache[9] = vue.withKeys(vue.withModifiers((...args) => _ctx.onKeyboardSelect && _ctx.onKeyboardSelect(...args), ["stop", "prevent"]), ["enter"])), 39726 _cache[10] || (_cache[10] = vue.withKeys(vue.withModifiers((...args) => _ctx.handleEsc && _ctx.handleEsc(...args), ["stop", "prevent"]), ["esc"])), 39727 _cache[11] || (_cache[11] = vue.withKeys(vue.withModifiers((...args) => _ctx.handleDel && _ctx.handleDel(...args), ["stop"]), ["delete"])) 39728 ] 39729 }, null, 42, _hoisted_2$b), [ 39730 [_directive_model_text, _ctx.states.displayInputValue] 39731 ]), 39732 _ctx.filterable ? (vue.openBlock(), vue.createElementBlock("span", { 39733 key: 0, 39734 ref: "calculatorRef", 39735 "aria-hidden": "true", 39736 class: vue.normalizeClass(_ctx.nsSelectV2.e("input-calculator")), 39737 textContent: vue.toDisplayString(_ctx.states.displayInputValue) 39738 }, null, 10, _hoisted_3$5)) : vue.createCommentVNode("v-if", true)
39739 ], 6) 39740 ], 2)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [ 39741 vue.createElementVNode("div", { 39742 class: vue.normalizeClass([ 39743 _ctx.nsSelectV2.e("selected-item"), 39744 _ctx.nsSelectV2.e("input-wrapper") 39745 ]) 39746 }, [ 39747 vue.withDirectives(vue.createElementVNode("input", { 39748 id: _ctx.id, 39749 ref: "inputRef", 39750 "aria-autocomplete": "list", 39751 "aria-haspopup": "listbox", 39752 "aria-labelledby": _ctx.label, 39753 "aria-expanded": _ctx.expanded, 39754 autocapitalize: "off", 39755 autocomplete: _ctx.autocomplete, 39756 class: vue.normalizeClass(_ctx.nsSelectV2.e("combobox-input")), 39757 disabled: _ctx.disabled, 39758 name: _ctx.name, 39759 role: "combobox", 39760 readonly: !_ctx.filterable, 39761 spellcheck: "false", 39762 type: "text", 39763 unselectable: _ctx.expanded ? "on" : void 0, 39764 onCompositionstart: _cache[12] || (_cache[12] = (...args) => _ctx.handleCompositionStart && _ctx.handleCompositionStart(...args)), 39765 onCompositionupdate: _cache[13] || (_cache[13] = (...args) => _ctx.handleCompositionUpdate && _ctx.handleCompositionUpdate(...args)), 39766 onCompositionend: _cache[14] || (_cache[14] = (...args) => _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...args)), 39767 onFocus: _cache[15] || (_cache[15] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)), 39768 onBlur: _cache[16] || (_cache[16] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)), 39769 onInput: _cache[17] || (_cache[17] = (...args) => _ctx.onInput && _ctx.onInput(...args)), 39770 onKeydown: [ 39771 _cache[18] || (_cache[18] = vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"])), 39772 _cache[19] || (_cache[19] = vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"])), 39773 _cache[20] || (_cache[20] = vue.withKeys(vue.withModifiers((...args) => _ctx.onKeyboardSelect && _ctx.onKeyboardSelect(...args), ["stop", "prevent"]), ["enter"])), 39774 _cache[21] || (_cache[21] = vue.withKeys(vue.withModifiers((...args) => _ctx.handleEsc && _ctx.handleEsc(...args), ["stop", "prevent"]), ["esc"])) 39775 ], 39776 "onUpdate:modelValue": _cache[22] || (_cache[22] = (...args) => _ctx.onUpdateInputValue && _ctx.onUpdateInputValue(...args)) 39777 }, null, 42, _hoisted_4$3), [ 39778 [_directive_model_text, _ctx.states.displayInputValue] 39779 ]) 39780 ], 2), 39781 _ctx.filterable ? (vue.openBlock(), vue.createElementBlock("span", { 39782 key: 0, 39783 ref: "calculatorRef", 39784 "aria-hidden": "true", 39785 class: vue.normalizeClass([ 39786 _ctx.nsSelectV2.e("selected-item"), 39787 _ctx.nsSelectV2.e("input-calculator") 39788 ]), 39789 textContent: vue.toDisplayString(_ctx.states.displayInputValue) 39790 }, null, 10, _hoisted_5$2)) : vue.createCommentVNode("v-if", true) 39791 ], 64)), 39792 _ctx.shouldShowPlaceholder ? (vue.openBlock(), vue.createElementBlock("span", { 39793 key: 3, 39794 class: vue.normalizeClass([ 39795 _ctx.nsSelectV2.e("placeholder"), 39796 _ctx.nsSelectV2.is("transparent", _ctx.multiple ? _ctx.modelValue.length === 0 : !_ctx.hasModelValue) 39797 ]) 39798 }, vue.toDisplayString(_ctx.currentPlaceholder), 3)) : vue.createCommentVNode("v-if", true), 39799 vue.createElementVNode("span", { 39800 class: vue.normalizeClass(_ctx.nsSelectV2.e("suffix")) 39801 }, [ 39802 _ctx.iconComponent ? vue.withDirectives((vue.openBlock(), vue.createBlock(_component_el_icon, { 39803 key: 0, 39804 class: vue.normalizeClass([_ctx.nsSelectV2.e("caret"), _ctx.nsInput.e("icon"), _ctx.iconReverse]) 39805 }, { 39806 default: vue.withCtx(() => [ 39807 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent))) 39808 ]), 39809 _: 1 39810 }, 8, ["class"])), [ 39811 [vue.vShow, !_ctx.showClearBtn] 39812 ]) : vue.createCommentVNode("v-if", true), 39813 _ctx.showClearBtn && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, { 39814 key: 1, 39815 class: vue.normalizeClass([_ctx.nsSelectV2.e("caret"), _ctx.nsInput.e("icon")]), 39816 onClick: vue.withModifiers(_ctx.handleClear, ["prevent", "stop"]) 39817 }, { 39818 default: vue.withCtx(() => [ 39819 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon))) 39820 ]), 39821 _: 1 39822 }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true), 39823 _ctx.validateState && _ctx.validateIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, { 39824 key: 2, 39825 class: vue.normalizeClass([_ctx.nsInput.e("icon"), _ctx.nsInput.e("validateIcon")]) 39826 }, { 39827 default: vue.withCtx(() => [ 39828 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.validateIcon))) 39829 ]), 39830 _: 1 39831 }, 8, ["class"])) : vue.createCommentVNode("v-if", true) 39832 ], 2) 39833 ], 2) 39834 ]), 39835 content: vue.withCtx(() => [ 39836 vue.createVNode(_component_el_select_menu, { 39837 ref: "menuRef", 39838 data: _ctx.filteredOptions, 39839 width: _ctx.popperSize, 39840 "hovering-index": _ctx.states.hoveringIndex, 39841 "scrollbar-always-on": _ctx.scrollbarAlwaysOn 39842 }, { 39843 default: vue.withCtx((scope) => [
39844 vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps(scope))) 39845 ]), 39846 empty: vue.withCtx(() => [ 39847 vue.renderSlot(_ctx.$slots, "empty", {}, () => [ 39848 vue.createElementVNode("p", { 39849 class: vue.normalizeClass(_ctx.nsSelectV2.e("empty")) 39850 }, vue.toDisplayString(_ctx.emptyText ? _ctx.emptyText : ""), 3) 39851 ]) 39852 ]), 39853 _: 3 39854 }, 8, ["data", "width", "hovering-index", "scrollbar-always-on"]) 39855 ]), 39856 _: 3 39857 }, 8, ["visible", "teleported", "popper-class", "popper-options", "effect", "placement", "transition", "persistent", "onBeforeShow"]) 39858 ], 34)), [ 39859 [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef] 39860 ]); 39861 } 39862 var Select = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["render", _sfc_render$5], ["__file", "select.vue"]]); 39863 39864 Select.install = (app) => { 39865 app.component(Select.name, Select); 39866 }; 39867 const _Select = Select; 39868 const ElSelectV2 = _Select; 39869 39870 const skeletonProps = buildProps({ 39871 animated: { 39872 type: Boolean, 39873 default: false 39874 }, 39875 count: { 39876 type: Number, 39877 default: 1 39878 }, 39879 rows: { 39880 type: Number, 39881 default: 3 39882 }, 39883 loading: { 39884 type: Boolean, 39885 default: true 39886 }, 39887 throttle: { 39888 type: Number 39889 } 39890 }); 39891 39892 const skeletonItemProps = buildProps({ 39893 variant: { 39894 type: String, 39895 values: [ 39896 "circle", 39897 "rect", 39898 "h1", 39899 "h3", 39900 "text", 39901 "caption", 39902 "p", 39903 "image", 39904 "button" 39905 ], 39906 default: "text" 39907 } 39908 }); 39909 39910 const __default__$t = vue.defineComponent({ 39911 name: "ElSkeletonItem" 39912 }); 39913 const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({ 39914 ...__default__$t, 39915 props: skeletonItemProps, 39916 setup(__props) { 39917 const ns = useNamespace("skeleton"); 39918 return (_ctx, _cache) => { 39919 return vue.openBlock(), vue.createElementBlock("div", { 39920 class: vue.normalizeClass([vue.unref(ns).e("item"), vue.unref(ns).e(_ctx.variant)]) 39921 }, [ 39922 _ctx.variant === "image" ? (vue.openBlock(), vue.createBlock(vue.unref(picture_filled_default), { key: 0 })) : vue.createCommentVNode("v-if", true) 39923 ], 2); 39924 }; 39925 } 39926 }); 39927 var SkeletonItem = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__file", "skeleton-item.vue"]]); 39928 39929 const __default__$s = vue.defineComponent({ 39930 name: "ElSkeleton" 39931 }); 39932 const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({ 39933 ...__default__$s, 39934 props: skeletonProps, 39935 setup(__props, { expose }) { 39936 const props = __props; 39937 const ns = useNamespace("skeleton"); 39938 const uiLoading = useThrottleRender(vue.toRef(props, "loading"), props.throttle); 39939 expose({ 39940 uiLoading 39941 }); 39942 return (_ctx, _cache) => { 39943 return vue.unref(uiLoading) ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({ 39944 key: 0, 39945 class: [vue.unref(ns).b(), vue.unref(ns).is("animated", _ctx.animated)] 39946 }, _ctx.$attrs), [ 39947 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.count, (i) => { 39948 return vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: i }, [ 39949 _ctx.loading ? vue.renderSlot(_ctx.$slots, "template", { key: i }, () => [ 39950 vue.createVNode(SkeletonItem, { 39951 class: vue.normalizeClass(vue.unref(ns).is("first")), 39952 variant: "p" 39953 }, null, 8, ["class"]), 39954 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.rows, (item) => { 39955 return vue.openBlock(), vue.createBlock(SkeletonItem, { 39956 key: item, 39957 class: vue.normalizeClass([ 39958 vue.unref(ns).e("paragraph"), 39959 vue.unref(ns).is("last", item === _ctx.rows && _ctx.rows > 1) 39960 ]), 39961 variant: "p" 39962 }, null, 8, ["class"]); 39963 }), 128)) 39964 ]) : vue.createCommentVNode("v-if", true) 39965 ], 64); 39966 }), 128))
vendor: 2,932 bytes, lines 39967-40077
39967 ], 16)) : vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.mergeProps({ key: 1 }, _ctx.$attrs))); 39968 }; 39969 } 39970 }); 39971 var Skeleton = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__file", "skeleton.vue"]]); 39972 39973 const ElSkeleton = withInstall(Skeleton, { 39974 SkeletonItem 39975 }); 39976 const ElSkeletonItem = withNoopInstall(SkeletonItem); 39977 39978 const sliderContextKey = Symbol("sliderContextKey"); 39979 39980 const sliderProps = buildProps({ 39981 modelValue: { 39982 type: definePropType([Number, Array]), 39983 default: 0 39984 }, 39985 id: { 39986 type: String, 39987 default: void 0 39988 }, 39989 min: { 39990 type: Number, 39991 default: 0 39992 }, 39993 max: { 39994 type: Number, 39995 default: 100 39996 }, 39997 step: { 39998 type: Number, 39999 default: 1 40000 }, 40001 showInput: Boolean, 40002 showInputControls: { 40003 type: Boolean, 40004 default: true 40005 }, 40006 size: useSizeProp, 40007 inputSize: useSizeProp, 40008 showStops: Boolean, 40009 showTooltip: { 40010 type: Boolean, 40011 default: true 40012 }, 40013 formatTooltip: { 40014 type: definePropType(Function), 40015 default: void 0 40016 }, 40017 disabled: Boolean, 40018 range: Boolean, 40019 vertical: Boolean, 40020 height: String, 40021 debounce: { 40022 type: Number, 40023 default: 300 40024 }, 40025 label: { 40026 type: String, 40027 default: void 0 40028 }, 40029 rangeStartLabel: { 40030 type: String, 40031 default: void 0 40032 }, 40033 rangeEndLabel: { 40034 type: String, 40035 default: void 0 40036 }, 40037 formatValueText: { 40038 type: definePropType(Function), 40039 default: void 0 40040 }, 40041 tooltipClass: { 40042 type: String, 40043 default: void 0 40044 }, 40045 placement: { 40046 type: String, 40047 values: Ee, 40048 default: "top" 40049 }, 40050 marks: { 40051 type: definePropType(Object) 40052 }, 40053 validateEvent: { 40054 type: Boolean, 40055 default: true 40056 } 40057 }); 40058 const isValidValue$1 = (value) => isNumber(value) || isArray$1(value) && value.every(isNumber); 40059 const sliderEmits = { 40060 [UPDATE_MODEL_EVENT]: isValidValue$1, 40061 [INPUT_EVENT]: isValidValue$1, 40062 [CHANGE_EVENT]: isValidValue$1 40063 }; 40064 40065 const useLifecycle = (props, initData, resetSize) => { 40066 const sliderWrapper = vue.ref(); 40067 vue.onMounted(async () => { 40068 if (props.range) { 40069 if (Array.isArray(props.modelValue)) { 40070 initData.firstValue = Math.max(props.min, props.modelValue[0]); 40071 initData.secondValue = Math.min(props.max, props.modelValue[1]); 40072 } else { 40073 initData.firstValue = props.min; 40074 initData.secondValue = props.max; 40075 } 40076 initData.oldValue = [initData.firstValue, initData.secondValue]; 40077 } else {
40078 if (typeof props.modelValue !== "number" || Number.isNaN(props.modelValue)) { 40079 initData.firstValue = props.min; 40080 } else { 40081 initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue)); 40082 } 40083 initData.oldValue = initData.firstValue; 40084 } 40085 useEventListener(window, "resize", resetSize); 40086 await vue.nextTick(); 40087 resetSize(); 40088 }); 40089 return { 40090 sliderWrapper 40091 }; 40092 }; 40093 40094 const useMarks = (props) => { 40095 return vue.computed(() => { 40096 if (!props.marks) { 40097 return []; 40098 } 40099 const marksKeys = Object.keys(props.marks); 40100 return marksKeys.map(Number.parseFloat).sort((a, b) => a - b).filter((point) => point <= props.max && point >= props.min).map((point) => ({ 40101 point, 40102 position: (point - props.min) * 100 / (props.max - props.min), 40103 mark: props.marks[point] 40104 })); 40105 }); 40106 }; 40107 40108 const useSlide = (props, initData, emit) => { 40109 const { form: elForm, formItem: elFormItem } = useFormItem(); 40110 const slider = vue.shallowRef(); 40111 const firstButton = vue.ref(); 40112 const secondButton = vue.ref(); 40113 const buttonRefs = { 40114 firstButton, 40115 secondButton 40116 }; 40117 const sliderDisabled = vue.computed(() => { 40118 return props.disabled || (elForm == null ? void 0 : elForm.disabled) || false; 40119 }); 40120 const minValue = vue.computed(() => { 40121 return Math.min(initData.firstValue, initData.secondValue); 40122 }); 40123 const maxValue = vue.computed(() => { 40124 return Math.max(initData.firstValue, initData.secondValue); 40125 }); 40126 const barSize = vue.computed(() => { 40127 return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`; 40128 }); 40129 const barStart = vue.computed(() => { 40130 return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%"; 40131 }); 40132 const runwayStyle = vue.computed(() => { 40133 return props.vertical ? { height: props.height } : {}; 40134 }); 40135 const barStyle = vue.computed(() => { 40136 return props.vertical ? { 40137 height: barSize.value, 40138 bottom: barStart.value 40139 } : { 40140 width: barSize.value, 40141 left: barStart.value 40142 }; 40143 }); 40144 const resetSize = () => { 40145 if (slider.value) { 40146 initData.sliderSize = slider.value[`client${props.vertical ? "Height" : "Width"}`]; 40147 } 40148 }; 40149 const getButtonRefByPercent = (percent) => { 40150 const targetValue = props.min + percent * (props.max - props.min) / 100; 40151 if (!props.range) { 40152 return firstButton; 40153 } 40154 let buttonRefName; 40155 if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) { 40156 buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton"; 40157 } else { 40158 buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton"; 40159 } 40160 return buttonRefs[buttonRefName]; 40161 }; 40162 const setPosition = (percent) => { 40163 const buttonRef = getButtonRefByPercent(percent); 40164 buttonRef.value.setPosition(percent); 40165 return buttonRef; 40166 }; 40167 const setFirstValue = (firstValue) => { 40168 initData.firstValue = firstValue; 40169 _emit(props.range ? [minValue.value, maxValue.value] : firstValue); 40170 }; 40171 const setSecondValue = (secondValue) => { 40172 initData.secondValue = secondValue; 40173 if (props.range) { 40174 _emit([minValue.value, maxValue.value]); 40175 } 40176 }; 40177 const _emit = (val) => { 40178 emit(UPDATE_MODEL_EVENT, val); 40179 emit(INPUT_EVENT, val); 40180 }; 40181 const emitChange = async () => { 40182 await vue.nextTick(); 40183 emit(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue); 40184 }; 40185 const handleSliderPointerEvent = (event) => { 40186 var _a, _b, _c, _d, _e, _f; 40187 if (sliderDisabled.value || initData.dragging) 40188 return; 40189 resetSize(); 40190 let newPercent = 0; 40191 if (props.vertical) { 40192 const clientY = (_c = (_b = (_a = event.touches) == null ? void 0 : _a.item(0)) == null ? void 0 : _b.clientY) != null ? _c : event.clientY; 40193 const sliderOffsetBottom = slider.value.getBoundingClientRect().bottom; 40194 newPercent = (sliderOffsetBottom - clientY) / initData.sliderSize * 100; 40195 } else { 40196 const clientX = (_f = (_e = (_d = event.touches) == null ? void 0 : _d.item(0)) == null ? void 0 : _e.clientX) != null ? _f : event.clientX; 40197 const sliderOffsetLeft = slider.value.getBoundingClientRect().left;
40198 newPercent = (clientX - sliderOffsetLeft) / initData.sliderSize * 100; 40199 } 40200 if (newPercent < 0 || newPercent > 100) 40201 return; 40202 return setPosition(newPercent); 40203 }; 40204 const onSliderWrapperPrevent = (event) => { 40205 var _a, _b; 40206 if (((_a = buttonRefs["firstButton"].value) == null ? void 0 : _a.dragging) || ((_b = buttonRefs["secondButton"].value) == null ? void 0 : _b.dragging)) { 40207 event.preventDefault(); 40208 } 40209 }; 40210 const onSliderDown = async (event) => { 40211 const buttonRef = handleSliderPointerEvent(event); 40212 if (buttonRef) { 40213 await vue.nextTick(); 40214 buttonRef.value.onButtonDown(event); 40215 } 40216 }; 40217 const onSliderClick = (event) => { 40218 const buttonRef = handleSliderPointerEvent(event); 40219 if (buttonRef) { 40220 emitChange(); 40221 } 40222 }; 40223 return { 40224 elFormItem, 40225 slider, 40226 firstButton, 40227 secondButton, 40228 sliderDisabled, 40229 minValue, 40230 maxValue, 40231 runwayStyle, 40232 barStyle, 40233 resetSize, 40234 setPosition, 40235 emitChange, 40236 onSliderWrapperPrevent, 40237 onSliderClick, 40238 onSliderDown, 40239 setFirstValue, 40240 setSecondValue 40241 }; 40242 }; 40243 40244 const { left, down, right, up, home, end, pageUp, pageDown } = EVENT_CODE; 40245 const useTooltip = (props, formatTooltip, showTooltip) => { 40246 const tooltip = vue.ref(); 40247 const tooltipVisible = vue.ref(false); 40248 const enableFormat = vue.computed(() => { 40249 return formatTooltip.value instanceof Function; 40250 }); 40251 const formatValue = vue.computed(() => { 40252 return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue; 40253 }); 40254 const displayTooltip = debounce(() => { 40255 showTooltip.value && (tooltipVisible.value = true); 40256 }, 50); 40257 const hideTooltip = debounce(() => { 40258 showTooltip.value && (tooltipVisible.value = false); 40259 }, 50); 40260 return { 40261 tooltip, 40262 tooltipVisible, 40263 formatValue, 40264 displayTooltip, 40265 hideTooltip 40266 }; 40267 }; 40268 const useSliderButton = (props, initData, emit) => { 40269 const { 40270 disabled, 40271 min, 40272 max, 40273 step, 40274 showTooltip, 40275 precision, 40276 sliderSize, 40277 formatTooltip, 40278 emitChange, 40279 resetSize, 40280 updateDragging 40281 } = vue.inject(sliderContextKey); 40282 const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip); 40283 const button = vue.ref(); 40284 const currentPosition = vue.computed(() => { 40285 return `${(props.modelValue - min.value) / (max.value - min.value) * 100}%`; 40286 }); 40287 const wrapperStyle = vue.computed(() => { 40288 return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value }; 40289 }); 40290 const handleMouseEnter = () => { 40291 initData.hovering = true; 40292 displayTooltip(); 40293 }; 40294 const handleMouseLeave = () => { 40295 initData.hovering = false; 40296 if (!initData.dragging) { 40297 hideTooltip(); 40298 } 40299 }; 40300 const onButtonDown = (event) => { 40301 if (disabled.value) 40302 return; 40303 event.preventDefault(); 40304 onDragStart(event); 40305 window.addEventListener("mousemove", onDragging); 40306 window.addEventListener("touchmove", onDragging); 40307 window.addEventListener("mouseup", onDragEnd); 40308 window.addEventListener("touchend", onDragEnd); 40309 window.addEventListener("contextmenu", onDragEnd); 40310 button.value.focus(); 40311 }; 40312 const incrementPosition = (amount) => { 40313 if (disabled.value) 40314 return; 40315 initData.newPosition = Number.parseFloat(currentPosition.value) + amount / (max.value - min.value) * 100; 40316 setPosition(initData.newPosition); 40317 emitChange(); 40318 }; 40319 const onLeftKeyDown = () => { 40320 incrementPosition(-step.value); 40321 }; 40322 const onRightKeyDown = () => { 40323 incrementPosition(step.value); 40324 }; 40325 const onPageDownKeyDown = () => { 40326 incrementPosition(-step.value * 4); 40327 }; 40328 const onPageUpKeyDown = () => { 40329 incrementPosition(step.value * 4); 40330 }; 40331 const onHomeKeyDown = () => { 40332 if (disabled.value) 40333 return; 40334 setPosition(0); 40335 emitChange(); 40336 }; 40337 const onEndKeyDown = () => { 40338 if (disabled.value) 40339 return; 40340 setPosition(100); 40341 emitChange(); 40342 }; 40343 const onKeyDown = (event) => { 40344 let isPreventDefault = true;
40345 if ([left, down].includes(event.key)) { 40346 onLeftKeyDown(); 40347 } else if ([right, up].includes(event.key)) { 40348 onRightKeyDown(); 40349 } else if (event.key === home) { 40350 onHomeKeyDown(); 40351 } else if (event.key === end) { 40352 onEndKeyDown(); 40353 } else if (event.key === pageDown) { 40354 onPageDownKeyDown(); 40355 } else if (event.key === pageUp) { 40356 onPageUpKeyDown(); 40357 } else { 40358 isPreventDefault = false; 40359 } 40360 isPreventDefault && event.preventDefault(); 40361 }; 40362 const getClientXY = (event) => { 40363 let clientX; 40364 let clientY; 40365 if (event.type.startsWith("touch")) { 40366 clientY = event.touches[0].clientY; 40367 clientX = event.touches[0].clientX; 40368 } else { 40369 clientY = event.clientY; 40370 clientX = event.clientX; 40371 } 40372 return { 40373 clientX, 40374 clientY 40375 }; 40376 }; 40377 const onDragStart = (event) => { 40378 initData.dragging = true; 40379 initData.isClick = true; 40380 const { clientX, clientY } = getClientXY(event); 40381 if (props.vertical) { 40382 initData.startY = clientY; 40383 } else { 40384 initData.startX = clientX; 40385 } 40386 initData.startPosition = Number.parseFloat(currentPosition.value); 40387 initData.newPosition = initData.startPosition; 40388 }; 40389 const onDragging = (event) => { 40390 if (initData.dragging) { 40391 initData.isClick = false; 40392 displayTooltip(); 40393 resetSize(); 40394 let diff; 40395 const { clientX, clientY } = getClientXY(event); 40396 if (props.vertical) { 40397 initData.currentY = clientY; 40398 diff = (initData.startY - initData.currentY) / sliderSize.value * 100; 40399 } else { 40400 initData.currentX = clientX; 40401 diff = (initData.currentX - initData.startX) / sliderSize.value * 100; 40402 } 40403 initData.newPosition = initData.startPosition + diff; 40404 setPosition(initData.newPosition); 40405 } 40406 }; 40407 const onDragEnd = () => { 40408 if (initData.dragging) { 40409 setTimeout(() => { 40410 initData.dragging = false; 40411 if (!initData.hovering) { 40412 hideTooltip(); 40413 } 40414 if (!initData.isClick) { 40415 setPosition(initData.newPosition); 40416 } 40417 emitChange(); 40418 }, 0); 40419 window.removeEventListener("mousemove", onDragging); 40420 window.removeEventListener("touchmove", onDragging); 40421 window.removeEventListener("mouseup", onDragEnd); 40422 window.removeEventListener("touchend", onDragEnd); 40423 window.removeEventListener("contextmenu", onDragEnd); 40424 } 40425 }; 40426 const setPosition = async (newPosition) => { 40427 if (newPosition === null || Number.isNaN(+newPosition)) 40428 return; 40429 if (newPosition < 0) { 40430 newPosition = 0; 40431 } else if (newPosition > 100) { 40432 newPosition = 100; 40433 } 40434 const lengthPerStep = 100 / ((max.value - min.value) / step.value); 40435 const steps = Math.round(newPosition / lengthPerStep); 40436 let value = steps * lengthPerStep * (max.value - min.value) * 0.01 + min.value; 40437 value = Number.parseFloat(value.toFixed(precision.value)); 40438 if (value !== props.modelValue) { 40439 emit(UPDATE_MODEL_EVENT, value); 40440 } 40441 if (!initData.dragging && props.modelValue !== initData.oldValue) { 40442 initData.oldValue = props.modelValue; 40443 } 40444 await vue.nextTick(); 40445 initData.dragging && displayTooltip(); 40446 tooltip.value.updatePopper(); 40447 }; 40448 vue.watch(() => initData.dragging, (val) => { 40449 updateDragging(val); 40450 }); 40451 return { 40452 disabled, 40453 button, 40454 tooltip, 40455 tooltipVisible, 40456 showTooltip, 40457 wrapperStyle, 40458 formatValue, 40459 handleMouseEnter, 40460 handleMouseLeave, 40461 onButtonDown, 40462 onKeyDown, 40463 setPosition 40464 }; 40465 }; 40466 40467 const useStops = (props, initData, minValue, maxValue) => { 40468 const stops = vue.computed(() => { 40469 if (!props.showStops || props.min > props.max) 40470 return []; 40471 if (props.step === 0) { 40472 return []; 40473 } 40474 const stopCount = (props.max - props.min) / props.step; 40475 const stepWidth = 100 * props.step / (props.max - props.min); 40476 const result = Array.from({ length: stopCount - 1 }).map((_, index) => (index + 1) * stepWidth); 40477 if (props.range) { 40478 return result.filter((step) => { 40479 return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min); 40480 }); 40481 } else { 40482 return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min)); 40483 } 40484 }); 40485 const getStopStyle = (position) => { 40486 return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` }; 40487 }; 40488 return { 40489 stops, 40490 getStopStyle 40491 }; 40492 }; 40493 40494 const useWatch = (props, initData, minValue, maxValue, emit, elFormItem) => { 40495 const _emit = (val) => { 40496 emit(UPDATE_MODEL_EVENT, val); 40497 emit(INPUT_EVENT, val); 40498 }; 40499 const valueChanged = () => { 40500 if (props.range) { 40501 return ![minValue.value, maxValue.value].every((item, index) => item === initData.oldValue[index]); 40502 } else { 40503 return props.modelValue !== initData.oldValue; 40504 } 40505 }; 40506 const setValues = () => { 40507 var _a, _b; 40508 if (props.min > props.max) { 40509 throwError("Slider", "min should not be greater than max."); 40510 } 40511 const val = props.modelValue; 40512 if (props.range && Array.isArray(val)) { 40513 if (val[1] < props.min) { 40514 _emit([props.min, props.min]); 40515 } else if (val[0] > props.max) { 40516 _emit([props.max, props.max]); 40517 } else if (val[0] < props.min) { 40518 _emit([props.min, val[1]]); 40519 } else if (val[1] > props.max) { 40520 _emit([val[0], props.max]); 40521 } else { 40522 initData.firstValue = val[0]; 40523 initData.secondValue = val[1];
40524 if (valueChanged()) { 40525 if (props.validateEvent) { 40526 (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn()); 40527 } 40528 initData.oldValue = val.slice(); 40529 } 40530 } 40531 } else if (!props.range && typeof val === "number" && !Number.isNaN(val)) { 40532 if (val < props.min) { 40533 _emit(props.min); 40534 } else if (val > props.max) { 40535 _emit(props.max); 40536 } else { 40537 initData.firstValue = val; 40538 if (valueChanged()) { 40539 if (props.validateEvent) { 40540 (_b = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _b.call(elFormItem, "change").catch((err) => debugWarn()); 40541 } 40542 initData.oldValue = val; 40543 } 40544 } 40545 } 40546 }; 40547 setValues(); 40548 vue.watch(() => initData.dragging, (val) => { 40549 if (!val) { 40550 setValues(); 40551 } 40552 }); 40553 vue.watch(() => props.modelValue, (val, oldVal) => { 40554 if (initData.dragging || Array.isArray(val) && Array.isArray(oldVal) && val.every((item, index) => item === oldVal[index]) && initData.firstValue === val[0] && initData.secondValue === val[1]) { 40555 return; 40556 } 40557 setValues(); 40558 }, { 40559 deep: true 40560 }); 40561 vue.watch(() => [props.min, props.max], () => { 40562 setValues(); 40563 }); 40564 }; 40565 40566 const sliderButtonProps = buildProps({ 40567 modelValue: { 40568 type: Number, 40569 default: 0 40570 }, 40571 vertical: Boolean, 40572 tooltipClass: String, 40573 placement: { 40574 type: String, 40575 values: Ee, 40576 default: "top" 40577 } 40578 }); 40579 const sliderButtonEmits = { 40580 [UPDATE_MODEL_EVENT]: (value) => isNumber(value) 40581 }; 40582 40583 const _hoisted_1$f = ["tabindex"]; 40584 const __default__$r = vue.defineComponent({ 40585 name: "ElSliderButton" 40586 }); 40587 const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({ 40588 ...__default__$r, 40589 props: sliderButtonProps, 40590 emits: sliderButtonEmits, 40591 setup(__props, { expose, emit }) { 40592 const props = __props; 40593 const ns = useNamespace("slider"); 40594 const initData = vue.reactive({ 40595 hovering: false, 40596 dragging: false, 40597 isClick: false, 40598 startX: 0, 40599 currentX: 0, 40600 startY: 0, 40601 currentY: 0, 40602 startPosition: 0, 40603 newPosition: 0, 40604 oldValue: props.modelValue 40605 }); 40606 const { 40607 disabled, 40608 button, 40609 tooltip, 40610 showTooltip, 40611 tooltipVisible, 40612 wrapperStyle, 40613 formatValue, 40614 handleMouseEnter, 40615 handleMouseLeave, 40616 onButtonDown, 40617 onKeyDown, 40618 setPosition 40619 } = useSliderButton(props, initData, emit); 40620 const { hovering, dragging } = vue.toRefs(initData); 40621 expose({ 40622 onButtonDown, 40623 onKeyDown, 40624 setPosition, 40625 hovering, 40626 dragging 40627 }); 40628 return (_ctx, _cache) => { 40629 return vue.openBlock(), vue.createElementBlock("div", { 40630 ref_key: "button", 40631 ref: button, 40632 class: vue.normalizeClass([vue.unref(ns).e("button-wrapper"), { hover: vue.unref(hovering), dragging: vue.unref(dragging) }]), 40633 style: vue.normalizeStyle(vue.unref(wrapperStyle)), 40634 tabindex: vue.unref(disabled) ? -1 : 0, 40635 onMouseenter: _cache[0] || (_cache[0] = (...args) => vue.unref(handleMouseEnter) && vue.unref(handleMouseEnter)(...args)), 40636 onMouseleave: _cache[1] || (_cache[1] = (...args) => vue.unref(handleMouseLeave) && vue.unref(handleMouseLeave)(...args)), 40637 onMousedown: _cache[2] || (_cache[2] = (...args) => vue.unref(onButtonDown) && vue.unref(onButtonDown)(...args)), 40638 onTouchstart: _cache[3] || (_cache[3] = (...args) => vue.unref(onButtonDown) && vue.unref(onButtonDown)(...args)), 40639 onFocus: _cache[4] || (_cache[4] = (...args) => vue.unref(handleMouseEnter) && vue.unref(handleMouseEnter)(...args)), 40640 onBlur: _cache[5] || (_cache[5] = (...args) => vue.unref(handleMouseLeave) && vue.unref(handleMouseLeave)(...args)), 40641 onKeydown: _cache[6] || (_cache[6] = (...args) => vue.unref(onKeyDown) && vue.unref(onKeyDown)(...args)) 40642 }, [ 40643 vue.createVNode(vue.unref(ElTooltip), { 40644 ref_key: "tooltip", 40645 ref: tooltip, 40646 visible: vue.unref(tooltipVisible), 40647 placement: _ctx.placement, 40648 "fallback-placements": ["top", "bottom", "right", "left"], 40649 "stop-popper-mouse-event": false, 40650 "popper-class": _ctx.tooltipClass, 40651 disabled: !vue.unref(showTooltip), 40652 persistent: "" 40653 }, { 40654 content: vue.withCtx(() => [ 40655 vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(formatValue)), 1) 40656 ]), 40657 default: vue.withCtx(() => [ 40658 vue.createElementVNode("div", { 40659 class: vue.normalizeClass([vue.unref(ns).e("button"), { hover: vue.unref(hovering), dragging: vue.unref(dragging) }]) 40660 }, null, 2) 40661 ]), 40662 _: 1 40663 }, 8, ["visible", "placement", "popper-class", "disabled"]) 40664 ], 46, _hoisted_1$f); 40665 }; 40666 } 40667 });
40668 var SliderButton = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__file", "button.vue"]]); 40669 40670 const sliderMarkerProps = buildProps({ 40671 mark: { 40672 type: definePropType([String, Object]), 40673 default: void 0 40674 } 40675 }); 40676 var SliderMarker = vue.defineComponent({ 40677 name: "ElSliderMarker", 40678 props: sliderMarkerProps, 40679 setup(props) { 40680 const ns = useNamespace("slider"); 40681 const label = vue.computed(() => { 40682 return isString$1(props.mark) ? props.mark : props.mark.label; 40683 }); 40684 const style = vue.computed(() => isString$1(props.mark) ? void 0 : props.mark.style); 40685 return () => vue.h("div", { 40686 class: ns.e("marks-text"), 40687 style: style.value 40688 }, label.value); 40689 } 40690 }); 40691 40692 const _hoisted_1$e = ["id", "role", "aria-label", "aria-labelledby"]; 40693 const _hoisted_2$a = { key: 1 }; 40694 const __default__$q = vue.defineComponent({ 40695 name: "ElSlider" 40696 }); 40697 const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({ 40698 ...__default__$q, 40699 props: sliderProps, 40700 emits: sliderEmits, 40701 setup(__props, { expose, emit }) { 40702 const props = __props; 40703 const ns = useNamespace("slider"); 40704 const { t } = useLocale(); 40705 const initData = vue.reactive({ 40706 firstValue: 0, 40707 secondValue: 0, 40708 oldValue: 0, 40709 dragging: false, 40710 sliderSize: 1 40711 }); 40712 const { 40713 elFormItem, 40714 slider, 40715 firstButton, 40716 secondButton, 40717 sliderDisabled, 40718 minValue, 40719 maxValue, 40720 runwayStyle, 40721 barStyle, 40722 resetSize, 40723 emitChange, 40724 onSliderWrapperPrevent, 40725 onSliderClick, 40726 onSliderDown, 40727 setFirstValue, 40728 setSecondValue 40729 } = useSlide(props, initData, emit); 40730 const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue); 40731 const { inputId, isLabeledByFormItem } = useFormItemInputId(props, { 40732 formItemContext: elFormItem 40733 }); 40734 const sliderWrapperSize = useFormSize(); 40735 const sliderInputSize = vue.computed(() => props.inputSize || sliderWrapperSize.value); 40736 const groupLabel = vue.computed(() => { 40737 return props.label || t("el.slider.defaultLabel", { 40738 min: props.min, 40739 max: props.max 40740 }); 40741 }); 40742 const firstButtonLabel = vue.computed(() => { 40743 if (props.range) { 40744 return props.rangeStartLabel || t("el.slider.defaultRangeStartLabel"); 40745 } else { 40746 return groupLabel.value; 40747 } 40748 }); 40749 const firstValueText = vue.computed(() => { 40750 return props.formatValueText ? props.formatValueText(firstValue.value) : `${firstValue.value}`; 40751 }); 40752 const secondButtonLabel = vue.computed(() => { 40753 return props.rangeEndLabel || t("el.slider.defaultRangeEndLabel"); 40754 }); 40755 const secondValueText = vue.computed(() => { 40756 return props.formatValueText ? props.formatValueText(secondValue.value) : `${secondValue.value}`; 40757 }); 40758 const sliderKls = vue.computed(() => [ 40759 ns.b(), 40760 ns.m(sliderWrapperSize.value), 40761 ns.is("vertical", props.vertical), 40762 { [ns.m("with-input")]: props.showInput } 40763 ]); 40764 const markList = useMarks(props); 40765 useWatch(props, initData, minValue, maxValue, emit, elFormItem); 40766 const precision = vue.computed(() => { 40767 const precisions = [props.min, props.max, props.step].map((item) => { 40768 const decimal = `${item}`.split(".")[1]; 40769 return decimal ? decimal.length : 0; 40770 }); 40771 return Math.max.apply(null, precisions); 40772 }); 40773 const { sliderWrapper } = useLifecycle(props, initData, resetSize); 40774 const { firstValue, secondValue, sliderSize } = vue.toRefs(initData); 40775 const updateDragging = (val) => { 40776 initData.dragging = val; 40777 }; 40778 vue.provide(sliderContextKey, { 40779 ...vue.toRefs(props), 40780 sliderSize, 40781 disabled: sliderDisabled, 40782 precision, 40783 emitChange, 40784 resetSize, 40785 updateDragging 40786 }); 40787 expose({ 40788 onSliderClick 40789 }); 40790 return (_ctx, _cache) => { 40791 var _a, _b;
40792 return vue.openBlock(), vue.createElementBlock("div", { 40793 id: _ctx.range ? vue.unref(inputId) : void 0, 40794 ref_key: "sliderWrapper", 40795 ref: sliderWrapper, 40796 class: vue.normalizeClass(vue.unref(sliderKls)), 40797 role: _ctx.range ? "group" : void 0, 40798 "aria-label": _ctx.range && !vue.unref(isLabeledByFormItem) ? vue.unref(groupLabel) : void 0, 40799 "aria-labelledby": _ctx.range && vue.unref(isLabeledByFormItem) ? (_a = vue.unref(elFormItem)) == null ? void 0 : _a.labelId : void 0, 40800 onTouchstart: _cache[2] || (_cache[2] = (...args) => vue.unref(onSliderWrapperPrevent) && vue.unref(onSliderWrapperPrevent)(...args)), 40801 onTouchmove: _cache[3] || (_cache[3] = (...args) => vue.unref(onSliderWrapperPrevent) && vue.unref(onSliderWrapperPrevent)(...args)) 40802 }, [ 40803 vue.createElementVNode("div", { 40804 ref_key: "slider", 40805 ref: slider, 40806 class: vue.normalizeClass([ 40807 vue.unref(ns).e("runway"), 40808 { "show-input": _ctx.showInput && !_ctx.range }, 40809 vue.unref(ns).is("disabled", vue.unref(sliderDisabled)) 40810 ]), 40811 style: vue.normalizeStyle(vue.unref(runwayStyle)), 40812 onMousedown: _cache[0] || (_cache[0] = (...args) => vue.unref(onSliderDown) && vue.unref(onSliderDown)(...args)), 40813 onTouchstart: _cache[1] || (_cache[1] = (...args) => vue.unref(onSliderDown) && vue.unref(onSliderDown)(...args)) 40814 }, [ 40815 vue.createElementVNode("div", { 40816 class: vue.normalizeClass(vue.unref(ns).e("bar")), 40817 style: vue.normalizeStyle(vue.unref(barStyle)) 40818 }, null, 6), 40819 vue.createVNode(SliderButton, { 40820 id: !_ctx.range ? vue.unref(inputId) : void 0, 40821 ref_key: "firstButton", 40822 ref: firstButton, 40823 "model-value": vue.unref(firstValue), 40824 vertical: _ctx.vertical, 40825 "tooltip-class": _ctx.tooltipClass, 40826 placement: _ctx.placement, 40827 role: "slider", 40828 "aria-label": _ctx.range || !vue.unref(isLabeledByFormItem) ? vue.unref(firstButtonLabel) : void 0, 40829 "aria-labelledby": !_ctx.range && vue.unref(isLabeledByFormItem) ? (_b = vue.unref(elFormItem)) == null ? void 0 : _b.labelId : void 0, 40830 "aria-valuemin": _ctx.min, 40831 "aria-valuemax": _ctx.range ? vue.unref(secondValue) : _ctx.max, 40832 "aria-valuenow": vue.unref(firstValue), 40833 "aria-valuetext": vue.unref(firstValueText), 40834 "aria-orientation": _ctx.vertical ? "vertical" : "horizontal", 40835 "aria-disabled": vue.unref(sliderDisabled), 40836 "onUpdate:modelValue": vue.unref(setFirstValue) 40837 }, null, 8, ["id", "model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-labelledby", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"]), 40838 _ctx.range ? (vue.openBlock(), vue.createBlock(SliderButton, { 40839 key: 0, 40840 ref_key: "secondButton", 40841 ref: secondButton, 40842 "model-value": vue.unref(secondValue), 40843 vertical: _ctx.vertical, 40844 "tooltip-class": _ctx.tooltipClass, 40845 placement: _ctx.placement, 40846 role: "slider", 40847 "aria-label": vue.unref(secondButtonLabel), 40848 "aria-valuemin": vue.unref(firstValue), 40849 "aria-valuemax": _ctx.max, 40850 "aria-valuenow": vue.unref(secondValue), 40851 "aria-valuetext": vue.unref(secondValueText), 40852 "aria-orientation": _ctx.vertical ? "vertical" : "horizontal", 40853 "aria-disabled": vue.unref(sliderDisabled), 40854 "onUpdate:modelValue": vue.unref(setSecondValue) 40855 }, null, 8, ["model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"])) : vue.createCommentVNode("v-if", true), 40856 _ctx.showStops ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$a, [ 40857 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(stops), (item, key) => {
40858 return vue.openBlock(), vue.createElementBlock("div", { 40859 key, 40860 class: vue.normalizeClass(vue.unref(ns).e("stop")), 40861 style: vue.normalizeStyle(vue.unref(getStopStyle)(item)) 40862 }, null, 6); 40863 }), 128)) 40864 ])) : vue.createCommentVNode("v-if", true), 40865 vue.unref(markList).length > 0 ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [ 40866 vue.createElementVNode("div", null, [ 40867 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(markList), (item, key) => { 40868 return vue.openBlock(), vue.createElementBlock("div", { 40869 key, 40870 style: vue.normalizeStyle(vue.unref(getStopStyle)(item.position)), 40871 class: vue.normalizeClass([vue.unref(ns).e("stop"), vue.unref(ns).e("marks-stop")]) 40872 }, null, 6); 40873 }), 128)) 40874 ]), 40875 vue.createElementVNode("div", { 40876 class: vue.normalizeClass(vue.unref(ns).e("marks")) 40877 }, [ 40878 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(markList), (item, key) => { 40879 return vue.openBlock(), vue.createBlock(vue.unref(SliderMarker), { 40880 key, 40881 mark: item.mark, 40882 style: vue.normalizeStyle(vue.unref(getStopStyle)(item.position)) 40883 }, null, 8, ["mark", "style"]); 40884 }), 128)) 40885 ], 2) 40886 ], 64)) : vue.createCommentVNode("v-if", true) 40887 ], 38), 40888 _ctx.showInput && !_ctx.range ? (vue.openBlock(), vue.createBlock(vue.unref(ElInputNumber), { 40889 key: 0, 40890 ref: "input", 40891 "model-value": vue.unref(firstValue), 40892 class: vue.normalizeClass(vue.unref(ns).e("input")), 40893 step: _ctx.step, 40894 disabled: vue.unref(sliderDisabled), 40895 controls: _ctx.showInputControls, 40896 min: _ctx.min, 40897 max: _ctx.max, 40898 debounce: _ctx.debounce, 40899 size: vue.unref(sliderInputSize), 40900 "onUpdate:modelValue": vue.unref(setFirstValue), 40901 onChange: vue.unref(emitChange) 40902 }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "debounce", "size", "onUpdate:modelValue", "onChange"])) : vue.createCommentVNode("v-if", true) 40903 ], 42, _hoisted_1$e); 40904 }; 40905 } 40906 }); 40907 var Slider = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__file", "slider.vue"]]); 40908 40909 const ElSlider = withInstall(Slider); 40910 40911 const spaceItemProps = buildProps({ 40912 prefixCls: { 40913 type: String 40914 } 40915 }); 40916 const SpaceItem = vue.defineComponent({ 40917 name: "ElSpaceItem", 40918 props: spaceItemProps, 40919 setup(props, { slots }) { 40920 const ns = useNamespace("space"); 40921 const classes = vue.computed(() => `${props.prefixCls || ns.b()}__item`); 40922 return () => vue.h("div", { class: classes.value }, vue.renderSlot(slots, "default")); 40923 } 40924 }); 40925 var Item = SpaceItem; 40926 40927 const SIZE_MAP = { 40928 small: 8, 40929 default: 12, 40930 large: 16 40931 }; 40932 function useSpace(props) { 40933 const ns = useNamespace("space"); 40934 const classes = vue.computed(() => [ns.b(), ns.m(props.direction), props.class]); 40935 const horizontalSize = vue.ref(0);
40936 const verticalSize = vue.ref(0); 40937 const containerStyle = vue.computed(() => { 40938 const wrapKls = props.wrap || props.fill ? { flexWrap: "wrap", marginBottom: `-${verticalSize.value}px` } : {}; 40939 const alignment = { 40940 alignItems: props.alignment 40941 }; 40942 return [wrapKls, alignment, props.style]; 40943 }); 40944 const itemStyle = vue.computed(() => { 40945 const itemBaseStyle = { 40946 paddingBottom: `${verticalSize.value}px`, 40947 marginRight: `${horizontalSize.value}px` 40948 }; 40949 const fillStyle = props.fill ? { flexGrow: 1, minWidth: `${props.fillRatio}%` } : {}; 40950 return [itemBaseStyle, fillStyle]; 40951 }); 40952 vue.watchEffect(() => { 40953 const { size = "small", wrap, direction: dir, fill } = props; 40954 if (isArray$1(size)) { 40955 const [h = 0, v = 0] = size; 40956 horizontalSize.value = h; 40957 verticalSize.value = v; 40958 } else { 40959 let val; 40960 if (isNumber(size)) { 40961 val = size; 40962 } else { 40963 val = SIZE_MAP[size || "small"] || SIZE_MAP.small; 40964 } 40965 if ((wrap || fill) && dir === "horizontal") { 40966 horizontalSize.value = verticalSize.value = val; 40967 } else { 40968 if (dir === "horizontal") { 40969 horizontalSize.value = val; 40970 verticalSize.value = 0; 40971 } else { 40972 verticalSize.value = val; 40973 horizontalSize.value = 0; 40974 } 40975 } 40976 } 40977 }); 40978 return { 40979 classes, 40980 containerStyle, 40981 itemStyle 40982 }; 40983 } 40984 40985 const spaceProps = buildProps({ 40986 direction: { 40987 type: String, 40988 values: ["horizontal", "vertical"], 40989 default: "horizontal" 40990 }, 40991 class: { 40992 type: definePropType([ 40993 String, 40994 Object, 40995 Array 40996 ]), 40997 default: "" 40998 }, 40999 style: { 41000 type: definePropType([String, Array, Object]), 41001 default: "" 41002 }, 41003 alignment: { 41004 type: definePropType(String), 41005 default: "center" 41006 }, 41007 prefixCls: { 41008 type: String 41009 }, 41010 spacer: { 41011 type: definePropType([Object, String, Number, Array]), 41012 default: null, 41013 validator: (val) => vue.isVNode(val) || isNumber(val) || isString$1(val) 41014 }, 41015 wrap: Boolean, 41016 fill: Boolean, 41017 fillRatio: { 41018 type: Number, 41019 default: 100 41020 }, 41021 size: { 41022 type: [String, Array, Number], 41023 values: componentSizes, 41024 validator: (val) => { 41025 return isNumber(val) || isArray$1(val) && val.length === 2 && val.every(isNumber); 41026 } 41027 } 41028 }); 41029 const Space = vue.defineComponent({ 41030 name: "ElSpace", 41031 props: spaceProps, 41032 setup(props, { slots }) { 41033 const { classes, containerStyle, itemStyle } = useSpace(props); 41034 function extractChildren(children, parentKey = "", extractedChildren = []) { 41035 const { prefixCls } = props; 41036 children.forEach((child, loopKey) => { 41037 if (isFragment(child)) { 41038 if (isArray$1(child.children)) { 41039 child.children.forEach((nested, key) => { 41040 if (isFragment(nested) && isArray$1(nested.children)) { 41041 extractChildren(nested.children, `${parentKey + key}-`, extractedChildren); 41042 } else { 41043 extractedChildren.push(vue.createVNode(Item, { 41044 style: itemStyle.value, 41045 prefixCls, 41046 key: `nested-${parentKey + key}` 41047 }, { 41048 default: () => [nested] 41049 }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"])); 41050 } 41051 }); 41052 } 41053 } else if (isValidElementNode(child)) { 41054 extractedChildren.push(vue.createVNode(Item, { 41055 style: itemStyle.value, 41056 prefixCls, 41057 key: `LoopKey${parentKey + loopKey}` 41058 }, { 41059 default: () => [child] 41060 }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"])); 41061 } 41062 }); 41063 return extractedChildren; 41064 } 41065 return () => { 41066 var _a; 41067 const { spacer, direction } = props;
41068 const children = vue.renderSlot(slots, "default", { key: 0 }, () => []); 41069 if (((_a = children.children) != null ? _a : []).length === 0) 41070 return null; 41071 if (isArray$1(children.children)) { 41072 let extractedChildren = extractChildren(children.children); 41073 if (spacer) { 41074 const len = extractedChildren.length - 1; 41075 extractedChildren = extractedChildren.reduce((acc, child, idx) => { 41076 const children2 = [...acc, child]; 41077 if (idx !== len) { 41078 children2.push(vue.createVNode("span", { 41079 style: [ 41080 itemStyle.value, 41081 direction === "vertical" ? "width: 100%" : null 41082 ], 41083 key: idx 41084 }, [ 41085 vue.isVNode(spacer) ? spacer : vue.createTextVNode(spacer, PatchFlags.TEXT) 41086 ], PatchFlags.STYLE)); 41087 } 41088 return children2; 41089 }, []); 41090 } 41091 return vue.createVNode("div", { 41092 class: classes.value, 41093 style: containerStyle.value 41094 }, extractedChildren, PatchFlags.STYLE | PatchFlags.CLASS); 41095 } 41096 return children.children; 41097 }; 41098 } 41099 }); 41100 41101 const ElSpace = withInstall(Space); 41102 41103 const statisticProps = buildProps({ 41104 decimalSeparator: { 41105 type: String, 41106 default: "." 41107 }, 41108 groupSeparator: { 41109 type: String, 41110 default: "," 41111 }, 41112 precision: { 41113 type: Number, 41114 default: 0 41115 }, 41116 formatter: Function, 41117 value: { 41118 type: definePropType([Number, Object]), 41119 default: 0 41120 }, 41121 prefix: String, 41122 suffix: String, 41123 title: String, 41124 valueStyle: { 41125 type: definePropType([String, Object, Array]) 41126 } 41127 }); 41128 41129 const __default__$p = vue.defineComponent({ 41130 name: "ElStatistic" 41131 }); 41132 const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({ 41133 ...__default__$p, 41134 props: statisticProps, 41135 setup(__props, { expose }) { 41136 const props = __props; 41137 const ns = useNamespace("statistic"); 41138 const displayValue = vue.computed(() => { 41139 const { value, formatter, precision, decimalSeparator, groupSeparator } = props; 41140 if (isFunction$1(formatter)) 41141 return formatter(value); 41142 if (!isNumber(value)) 41143 return value; 41144 let [integer, decimal = ""] = String(value).split("."); 41145 decimal = decimal.padEnd(precision, "0").slice(0, precision > 0 ? precision : 0); 41146 integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator); 41147 return [integer, decimal].join(decimal ? decimalSeparator : ""); 41148 }); 41149 expose({ 41150 displayValue 41151 }); 41152 return (_ctx, _cache) => { 41153 return vue.openBlock(), vue.createElementBlock("div", { 41154 class: vue.normalizeClass(vue.unref(ns).b()) 41155 }, [ 41156 _ctx.$slots.title || _ctx.title ? (vue.openBlock(), vue.createElementBlock("div", { 41157 key: 0, 41158 class: vue.normalizeClass(vue.unref(ns).e("head")) 41159 }, [ 41160 vue.renderSlot(_ctx.$slots, "title", {}, () => [ 41161 vue.createTextVNode(vue.toDisplayString(_ctx.title), 1) 41162 ]) 41163 ], 2)) : vue.createCommentVNode("v-if", true), 41164 vue.createElementVNode("div", { 41165 class: vue.normalizeClass(vue.unref(ns).e("content")) 41166 }, [ 41167 _ctx.$slots.prefix || _ctx.prefix ? (vue.openBlock(), vue.createElementBlock("div", { 41168 key: 0, 41169 class: vue.normalizeClass(vue.unref(ns).e("prefix")) 41170 }, [ 41171 vue.renderSlot(_ctx.$slots, "prefix", {}, () => [ 41172 vue.createElementVNode("span", null, vue.toDisplayString(_ctx.prefix), 1) 41173 ]) 41174 ], 2)) : vue.createCommentVNode("v-if", true), 41175 vue.createElementVNode("span", { 41176 class: vue.normalizeClass(vue.unref(ns).e("number")), 41177 style: vue.normalizeStyle(_ctx.valueStyle) 41178 }, vue.toDisplayString(vue.unref(displayValue)), 7), 41179 _ctx.$slots.suffix || _ctx.suffix ? (vue.openBlock(), vue.createElementBlock("div", { 41180 key: 1, 41181 class: vue.normalizeClass(vue.unref(ns).e("suffix")) 41182 }, [
41183 vue.renderSlot(_ctx.$slots, "suffix", {}, () => [ 41184 vue.createElementVNode("span", null, vue.toDisplayString(_ctx.suffix), 1) 41185 ]) 41186 ], 2)) : vue.createCommentVNode("v-if", true) 41187 ], 2) 41188 ], 2); 41189 }; 41190 } 41191 }); 41192 var Statistic = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__file", "statistic.vue"]]); 41193 41194 const ElStatistic = withInstall(Statistic); 41195 41196 const countdownProps = buildProps({ 41197 format: { 41198 type: String, 41199 default: "HH:mm:ss" 41200 }, 41201 prefix: String, 41202 suffix: String, 41203 title: String, 41204 value: { 41205 type: definePropType([Number, Object]), 41206 default: 0 41207 }, 41208 valueStyle: { 41209 type: definePropType([String, Object, Array]) 41210 } 41211 }); 41212 const countdownEmits = { 41213 finish: () => true, 41214 [CHANGE_EVENT]: (value) => isNumber(value) 41215 }; 41216 41217 const timeUnits = [ 41218 ["Y", 1e3 * 60 * 60 * 24 * 365], 41219 ["M", 1e3 * 60 * 60 * 24 * 30], 41220 ["D", 1e3 * 60 * 60 * 24], 41221 ["H", 1e3 * 60 * 60], 41222 ["m", 1e3 * 60], 41223 ["s", 1e3], 41224 ["S", 1] 41225 ]; 41226 const getTime = (value) => { 41227 return isNumber(value) ? new Date(value).getTime() : value.valueOf(); 41228 }; 41229 const formatTime$1 = (timestamp, format) => { 41230 let timeLeft = timestamp; 41231 const escapeRegex = /\[([^\]]*)]/g; 41232 const replacedText = timeUnits.reduce((current, [name, unit]) => { 41233 const replaceRegex = new RegExp(`${name}+(?![^\\[\\]]*\\])`, "g"); 41234 if (replaceRegex.test(current)) { 41235 const value = Math.floor(timeLeft / unit); 41236 timeLeft -= value * unit; 41237 return current.replace(replaceRegex, (match) => String(value).padStart(match.length, "0")); 41238 } 41239 return current; 41240 }, format); 41241 return replacedText.replace(escapeRegex, "$1"); 41242 }; 41243 41244 const __default__$o = vue.defineComponent({ 41245 name: "ElCountdown" 41246 }); 41247 const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({ 41248 ...__default__$o, 41249 props: countdownProps, 41250 emits: countdownEmits, 41251 setup(__props, { expose, emit }) { 41252 const props = __props; 41253 let timer; 41254 const rawValue = vue.ref(getTime(props.value) - Date.now()); 41255 const displayValue = vue.computed(() => formatTime$1(rawValue.value, props.format)); 41256 const formatter = (val) => formatTime$1(val, props.format); 41257 const stopTimer = () => { 41258 if (timer) { 41259 cAF(timer); 41260 timer = void 0; 41261 } 41262 }; 41263 const startTimer = () => { 41264 const timestamp = getTime(props.value); 41265 const frameFunc = () => { 41266 let diff = timestamp - Date.now(); 41267 emit("change", diff); 41268 if (diff <= 0) { 41269 diff = 0; 41270 stopTimer(); 41271 emit("finish"); 41272 } else { 41273 timer = rAF(frameFunc); 41274 } 41275 rawValue.value = diff; 41276 }; 41277 timer = rAF(frameFunc); 41278 }; 41279 vue.watch(() => [props.value, props.format], () => { 41280 stopTimer(); 41281 startTimer(); 41282 }, { 41283 immediate: true 41284 }); 41285 vue.onBeforeUnmount(() => { 41286 stopTimer(); 41287 }); 41288 expose({ 41289 displayValue 41290 }); 41291 return (_ctx, _cache) => { 41292 return vue.openBlock(), vue.createBlock(vue.unref(ElStatistic), { 41293 value: rawValue.value, 41294 title: _ctx.title, 41295 prefix: _ctx.prefix, 41296 suffix: _ctx.suffix, 41297 "value-style": _ctx.valueStyle, 41298 formatter 41299 }, vue.createSlots({ _: 2 }, [ 41300 vue.renderList(_ctx.$slots, (_, name) => { 41301 return { 41302 name, 41303 fn: vue.withCtx(() => [ 41304 vue.renderSlot(_ctx.$slots, name) 41305 ]) 41306 }; 41307 }) 41308 ]), 1032, ["value", "title", "prefix", "suffix", "value-style"]); 41309 }; 41310 } 41311 });
41312 var Countdown = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__file", "countdown.vue"]]); 41313 41314 const ElCountdown = withInstall(Countdown); 41315 41316 const stepsProps = buildProps({ 41317 space: { 41318 type: [Number, String], 41319 default: "" 41320 }, 41321 active: { 41322 type: Number, 41323 default: 0 41324 }, 41325 direction: { 41326 type: String, 41327 default: "horizontal", 41328 values: ["horizontal", "vertical"] 41329 }, 41330 alignCenter: { 41331 type: Boolean 41332 }, 41333 simple: { 41334 type: Boolean 41335 }, 41336 finishStatus: { 41337 type: String, 41338 values: ["wait", "process", "finish", "error", "success"], 41339 default: "finish" 41340 }, 41341 processStatus: { 41342 type: String, 41343 values: ["wait", "process", "finish", "error", "success"], 41344 default: "process" 41345 } 41346 }); 41347 const stepsEmits = { 41348 [CHANGE_EVENT]: (newVal, oldVal) => [newVal, oldVal].every(isNumber) 41349 }; 41350 41351 const __default__$n = vue.defineComponent({ 41352 name: "ElSteps" 41353 }); 41354 const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({ 41355 ...__default__$n, 41356 props: stepsProps, 41357 emits: stepsEmits, 41358 setup(__props, { emit }) { 41359 const props = __props; 41360 const ns = useNamespace("steps"); 41361 const steps = vue.ref([]); 41362 vue.watch(steps, () => { 41363 steps.value.forEach((instance, index) => { 41364 instance.setIndex(index); 41365 }); 41366 }); 41367 vue.provide("ElSteps", { props, steps }); 41368 vue.watch(() => props.active, (newVal, oldVal) => { 41369 emit(CHANGE_EVENT, newVal, oldVal); 41370 }); 41371 return (_ctx, _cache) => { 41372 return vue.openBlock(), vue.createElementBlock("div", { 41373 class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.simple ? "simple" : _ctx.direction)]) 41374 }, [ 41375 vue.renderSlot(_ctx.$slots, "default") 41376 ], 2); 41377 }; 41378 } 41379 }); 41380 var Steps = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__file", "steps.vue"]]); 41381 41382 const stepProps = buildProps({ 41383 title: { 41384 type: String, 41385 default: "" 41386 }, 41387 icon: { 41388 type: iconPropType 41389 }, 41390 description: { 41391 type: String, 41392 default: "" 41393 }, 41394 status: { 41395 type: String, 41396 values: ["", "wait", "process", "finish", "error", "success"], 41397 default: "" 41398 } 41399 }); 41400 41401 const __default__$m = vue.defineComponent({ 41402 name: "ElStep" 41403 }); 41404 const _sfc_main$t = vue.defineComponent({ 41405 ...__default__$m, 41406 props: stepProps, 41407 setup(__props) { 41408 const props = __props; 41409 const ns = useNamespace("step"); 41410 const index = vue.ref(-1); 41411 const lineStyle = vue.ref({}); 41412 const internalStatus = vue.ref(""); 41413 const parent = vue.inject("ElSteps"); 41414 const currentInstance = vue.getCurrentInstance(); 41415 vue.onMounted(() => { 41416 vue.watch([ 41417 () => parent.props.active, 41418 () => parent.props.processStatus, 41419 () => parent.props.finishStatus 41420 ], ([active]) => { 41421 updateStatus(active); 41422 }, { immediate: true }); 41423 }); 41424 vue.onBeforeUnmount(() => { 41425 parent.steps.value = parent.steps.value.filter((instance) => instance.uid !== (currentInstance == null ? void 0 : currentInstance.uid)); 41426 }); 41427 const currentStatus = vue.computed(() => { 41428 return props.status || internalStatus.value; 41429 }); 41430 const prevStatus = vue.computed(() => { 41431 const prevStep = parent.steps.value[index.value - 1]; 41432 return prevStep ? prevStep.currentStatus : "wait"; 41433 }); 41434 const isCenter = vue.computed(() => { 41435 return parent.props.alignCenter; 41436 }); 41437 const isVertical = vue.computed(() => { 41438 return parent.props.direction === "vertical"; 41439 }); 41440 const isSimple = vue.computed(() => { 41441 return parent.props.simple; 41442 }); 41443 const stepsCount = vue.computed(() => { 41444 return parent.steps.value.length; 41445 }); 41446 const isLast = vue.computed(() => { 41447 var _a; 41448 return ((_a = parent.steps.value[stepsCount.value - 1]) == null ? void 0 : _a.uid) === (currentInstance == null ? void 0 : currentInstance.uid); 41449 }); 41450 const space = vue.computed(() => { 41451 return isSimple.value ? "" : parent.props.space; 41452 }); 41453 const containerKls = vue.computed(() => { 41454 return [ 41455 ns.b(), 41456 ns.is(isSimple.value ? "simple" : parent.props.direction), 41457 ns.is("flex", isLast.value && !space.value && !isCenter.value), 41458 ns.is("center", isCenter.value && !isVertical.value && !isSimple.value) 41459 ]; 41460 }); 41461 const style = vue.computed(() => { 41462 const style2 = { 41463 flexBasis: isNumber(space.value) ? `${space.value}px` : space.value ? space.value : `${100 / (stepsCount.value - (isCenter.value ? 0 : 1))}%` 41464 }; 41465 if (isVertical.value) 41466 return style2; 41467 if (isLast.value) { 41468 style2.maxWidth = `${100 / stepsCount.value}%`; 41469 } 41470 return style2; 41471 }); 41472 const setIndex = (val) => { 41473 index.value = val; 41474 }; 41475 const calcProgress = (status) => { 41476 const isWait = status === "wait"; 41477 const style2 = { 41478 transitionDelay: `${isWait ? "-" : ""}${150 * index.value}ms` 41479 }; 41480 const step = status === parent.props.processStatus || isWait ? 0 : 100; 41481 style2.borderWidth = step && !isSimple.value ? "1px" : 0; 41482 style2[parent.props.direction === "vertical" ? "height" : "width"]
41482= `${step}%`; 41483 lineStyle.value = style2; 41484 }; 41485 const updateStatus = (activeIndex) => { 41486 if (activeIndex > index.value) { 41487 internalStatus.value = parent.props.finishStatus; 41488 } else if (activeIndex === index.value && prevStatus.value !== "error") { 41489 internalStatus.value = parent.props.processStatus; 41490 } else { 41491 internalStatus.value = "wait"; 41492 } 41493 const prevChild = parent.steps.value[index.value - 1]; 41494 if (prevChild) 41495 prevChild.calcProgress(internalStatus.value); 41496 }; 41497 const stepItemState = vue.reactive({ 41498 uid: vue.computed(() => currentInstance == null ? void 0 : currentInstance.uid), 41499 currentStatus, 41500 setIndex, 41501 calcProgress 41502 }); 41503 parent.steps.value = [...parent.steps.value, stepItemState]; 41504 return (_ctx, _cache) => { 41505 return vue.openBlock(), vue.createElementBlock("div", { 41506 style: vue.normalizeStyle(vue.unref(style)), 41507 class: vue.normalizeClass(vue.unref(containerKls)) 41508 }, [ 41509 vue.createCommentVNode(" icon & line "), 41510 vue.createElementVNode("div", { 41511 class: vue.normalizeClass([vue.unref(ns).e("head"), vue.unref(ns).is(vue.unref(currentStatus))]) 41512 }, [ 41513 !vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", { 41514 key: 0, 41515 class: vue.normalizeClass(vue.unref(ns).e("line")) 41516 }, [ 41517 vue.createElementVNode("i", { 41518 class: vue.normalizeClass(vue.unref(ns).e("line-inner")), 41519 style: vue.normalizeStyle(lineStyle.value) 41520 }, null, 6) 41521 ], 2)) : vue.createCommentVNode("v-if", true), 41522 vue.createElementVNode("div", { 41523 class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).is(_ctx.icon || _ctx.$slots.icon ? "icon" : "text")]) 41524 }, [ 41525 vue.renderSlot(_ctx.$slots, "icon", {}, () => [ 41526 _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 41527 key: 0, 41528 class: vue.normalizeClass(vue.unref(ns).e("icon-inner")) 41529 }, { 41530 default: vue.withCtx(() => [ 41531 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon))) 41532 ]), 41533 _: 1 41534 }, 8, ["class"])) : vue.unref(currentStatus) === "success" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 41535 key: 1, 41536 class: vue.normalizeClass([vue.unref(ns).e("icon-inner"), vue.unref(ns).is("status")]) 41537 }, { 41538 default: vue.withCtx(() => [ 41539 vue.createVNode(vue.unref(check_default)) 41540 ]), 41541 _: 1 41542 }, 8, ["class"])) : vue.unref(currentStatus) === "error" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 41543 key: 2, 41544 class: vue.normalizeClass([vue.unref(ns).e("icon-inner"), vue.unref(ns).is("status")]) 41545 }, { 41546 default: vue.withCtx(() => [ 41547 vue.createVNode(vue.unref(close_default)) 41548 ]), 41549 _: 1 41550 }, 8, ["class"])) : !vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", { 41551 key: 3, 41552 class: vue.normalizeClass(vue.unref(ns).e("icon-inner")) 41553 }, vue.toDisplayString(index.value + 1), 3)) : vue.createCommentVNode("v-if", true) 41554 ]) 41555 ], 2) 41556 ], 2), 41557 vue.createCommentVNode(" title & description "), 41558 vue.createElementVNode("div", { 41559 class: vue.normalizeClass(vue.unref(ns).e("main")) 41560 }, [ 41561 vue.createElementVNode("div", { 41562 class: vue.normalizeClass([vue.unref(ns).e("title"), vue.unref(ns).is(vue.unref(currentStatus))]) 41563 }, [
41564 vue.renderSlot(_ctx.$slots, "title", {}, () => [ 41565 vue.createTextVNode(vue.toDisplayString(_ctx.title), 1) 41566 ]) 41567 ], 2), 41568 vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", { 41569 key: 0, 41570 class: vue.normalizeClass(vue.unref(ns).e("arrow")) 41571 }, null, 2)) : (vue.openBlock(), vue.createElementBlock("div", { 41572 key: 1, 41573 class: vue.normalizeClass([vue.unref(ns).e("description"), vue.unref(ns).is(vue.unref(currentStatus))]) 41574 }, [ 41575 vue.renderSlot(_ctx.$slots, "description", {}, () => [ 41576 vue.createTextVNode(vue.toDisplayString(_ctx.description), 1) 41577 ]) 41578 ], 2)) 41579 ], 2) 41580 ], 6); 41581 }; 41582 } 41583 }); 41584 var Step = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__file", "item.vue"]]); 41585 41586 const ElSteps = withInstall(Steps, { 41587 Step 41588 }); 41589 const ElStep = withNoopInstall(Step); 41590 41591 const switchProps = buildProps({ 41592 modelValue: { 41593 type: [Boolean, String, Number], 41594 default: false 41595 }, 41596 value: { 41597 type: [Boolean, String, Number], 41598 default: false 41599 }, 41600 disabled: { 41601 type: Boolean, 41602 default: false 41603 }, 41604 width: { 41605 type: [String, Number], 41606 default: "" 41607 }, 41608 inlinePrompt: { 41609 type: Boolean, 41610 default: false 41611 }, 41612 activeIcon: { 41613 type: iconPropType 41614 }, 41615 inactiveIcon: { 41616 type: iconPropType 41617 }, 41618 activeText: { 41619 type: String, 41620 default: "" 41621 }, 41622 inactiveText: { 41623 type: String, 41624 default: "" 41625 }, 41626 activeColor: { 41627 type: String, 41628 default: "" 41629 }, 41630 inactiveColor: { 41631 type: String, 41632 default: "" 41633 }, 41634 borderColor: { 41635 type: String, 41636 default: "" 41637 }, 41638 activeValue: { 41639 type: [Boolean, String, Number], 41640 default: true 41641 }, 41642 inactiveValue: { 41643 type: [Boolean, String, Number], 41644 default: false 41645 }, 41646 name: { 41647 type: String, 41648 default: "" 41649 }, 41650 validateEvent: { 41651 type: Boolean, 41652 default: true 41653 }, 41654 id: String, 41655 loading: { 41656 type: Boolean, 41657 default: false 41658 }, 41659 beforeChange: { 41660 type: definePropType(Function) 41661 }, 41662 size: { 41663 type: String, 41664 validator: isValidComponentSize 41665 }, 41666 tabindex: { 41667 type: [String, Number] 41668 } 41669 }); 41670 const switchEmits = { 41671 [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val), 41672 [CHANGE_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val), 41673 [INPUT_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val) 41674 }; 41675 41676 const _hoisted_1$d = ["onClick"]; 41677 const _hoisted_2$9 = ["id", "aria-checked", "aria-disabled", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"]; 41678 const _hoisted_3$4 = ["aria-hidden"]; 41679 const _hoisted_4$2 = ["aria-hidden"]; 41680 const _hoisted_5$1 = ["aria-hidden"]; 41681 const COMPONENT_NAME$8 = "ElSwitch"; 41682 const __default__$l = vue.defineComponent({ 41683 name: COMPONENT_NAME$8 41684 }); 41685 const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({ 41686 ...__default__$l, 41687 props: switchProps, 41688 emits: switchEmits, 41689 setup(__props, { expose, emit }) { 41690 const props = __props; 41691 const vm = vue.getCurrentInstance(); 41692 const { formItem } = useFormItem(); 41693 const switchSize = useFormSize(); 41694 const ns = useNamespace("switch"); 41695 useDeprecated({ 41696 from: '"value"', 41697 replacement: '"model-value" or "v-model"', 41698 scope: COMPONENT_NAME$8, 41699 version: "2.3.0", 41700 ref: "https://element-plus.org/en-US/component/switch.html#attributes", 41701 type: "Attribute" 41702 }, vue.computed(() => { 41703 var _a; 41704 return !!((_a = vm.vnode.props) == null ? void 0 : _a.value); 41705 })); 41706 const { inputId } = useFormItemInputId(props, { 41707 formItemContext: formItem 41708 }); 41709 const switchDisabled = useFormDisabled(vue.computed(() => props.loading)); 41710 const isControlled = vue.ref(props.modelValue !== false); 41711 const input = vue.ref(); 41712 const core = vue.ref(); 41713 const switchKls = vue.computed(() => [ 41714 ns.b(), 41715 ns.m(switchSize.value), 41716 ns.is("disabled", switchDisabled.value), 41717 ns.is("checked", checked.value) 41718 ]); 41719 const coreStyle = vue.computed(() => ({ 41720 width: addUnit(props.width) 41721 })); 41722 vue.watch(() => props.modelValue, () => { 41723 isControlled.value = true; 41724 }); 41725 vue.watch(() => props.value, () => { 41726 isControlled.value = false; 41727 }); 41728 const actualValue = vue.computed(() => { 41729 return isControlled.value ? props.modelValue : props.value; 41730 }); 41731 const checked = vue.computed(() => actualValue.value === props.activeValue); 41732 if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) { 41733 emit(UPDATE_MODEL_EVENT, props.inactiveValue); 41734 emit(CHANGE_EVENT, props.inactiveValue); 41735 emit(INPUT_EVENT, props.inactiveValue); 41736 } 41737 vue.watch(checked, (val) => { 41738 var _a; 41739 input.value.checked = val; 41740 if (props.validateEvent) { 41741 (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn()); 41742 } 41743 }); 41744 const handleChange = () => { 41745 const val = checked.value ? props.inactiveValue : props.activeValue; 41746 emit(UPDATE_MODEL_EVENT, val); 41747 emit(CHANGE_EVENT, val); 41748 emit(INPUT_EVENT, val); 41749 vue.nextTick(() => { 41750 input.value.checked = checked.value; 41751 }); 41752 }; 41753 const switchValue = () => { 41754 if (switchDisabled.value) 41755 return; 41756 const { beforeChange } = props; 41757 if (!beforeChange) { 41758 handleChange(); 41759 return; 41760 } 41761 const shouldChange = beforeChange(); 41762 const isPromiseOrBool = [ 41763 isPromise(shouldChange), 41764 isBoolean(shouldChange) 41765 ].includes(true); 41766 if (!isPromiseOrBool) { 41767 throwError(COMPONENT_NAME$8, "beforeChange must return type `Promise<boolean>` or `boolean`"); 41768 }
41769 if (isPromise(shouldChange)) { 41770 shouldChange.then((result) => { 41771 if (result) { 41772 handleChange(); 41773 } 41774 }).catch((e) => { 41775 }); 41776 } else if (shouldChange) { 41777 handleChange(); 41778 } 41779 }; 41780 const styles = vue.computed(() => { 41781 return ns.cssVarBlock({ 41782 ...props.activeColor ? { "on-color": props.activeColor } : null, 41783 ...props.inactiveColor ? { "off-color": props.inactiveColor } : null, 41784 ...props.borderColor ? { "border-color": props.borderColor } : null 41785 }); 41786 }); 41787 const focus = () => { 41788 var _a, _b; 41789 (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a); 41790 }; 41791 vue.onMounted(() => { 41792 input.value.checked = checked.value; 41793 }); 41794 expose({ 41795 focus, 41796 checked 41797 }); 41798 return (_ctx, _cache) => { 41799 return vue.openBlock(), vue.createElementBlock("div", { 41800 class: vue.normalizeClass(vue.unref(switchKls)), 41801 style: vue.normalizeStyle(vue.unref(styles)), 41802 onClick: vue.withModifiers(switchValue, ["prevent"]) 41803 }, [ 41804 vue.createElementVNode("input", { 41805 id: vue.unref(inputId), 41806 ref_key: "input", 41807 ref: input, 41808 class: vue.normalizeClass(vue.unref(ns).e("input")), 41809 type: "checkbox", 41810 role: "switch", 41811 "aria-checked": vue.unref(checked), 41812 "aria-disabled": vue.unref(switchDisabled), 41813 name: _ctx.name, 41814 "true-value": _ctx.activeValue, 41815 "false-value": _ctx.inactiveValue, 41816 disabled: vue.unref(switchDisabled), 41817 tabindex: _ctx.tabindex, 41818 onChange: handleChange, 41819 onKeydown: vue.withKeys(switchValue, ["enter"]) 41820 }, null, 42, _hoisted_2$9), 41821 !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (vue.openBlock(), vue.createElementBlock("span", { 41822 key: 0, 41823 class: vue.normalizeClass([ 41824 vue.unref(ns).e("label"), 41825 vue.unref(ns).em("label", "left"), 41826 vue.unref(ns).is("active", !vue.unref(checked)) 41827 ]) 41828 }, [ 41829 _ctx.inactiveIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, { 41830 default: vue.withCtx(() => [ 41831 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.inactiveIcon))) 41832 ]), 41833 _: 1 41834 })) : vue.createCommentVNode("v-if", true), 41835 !_ctx.inactiveIcon && _ctx.inactiveText ? (vue.openBlock(), vue.createElementBlock("span", { 41836 key: 1, 41837 "aria-hidden": vue.unref(checked) 41838 }, vue.toDisplayString(_ctx.inactiveText), 9, _hoisted_3$4)) : vue.createCommentVNode("v-if", true) 41839 ], 2)) : vue.createCommentVNode("v-if", true), 41840 vue.createElementVNode("span", { 41841 ref_key: "core", 41842 ref: core, 41843 class: vue.normalizeClass(vue.unref(ns).e("core")), 41844 style: vue.normalizeStyle(vue.unref(coreStyle)) 41845 }, [ 41846 _ctx.inlinePrompt ? (vue.openBlock(), vue.createElementBlock("div", { 41847 key: 0, 41848 class: vue.normalizeClass(vue.unref(ns).e("inner")) 41849 }, [ 41850 _ctx.activeIcon || _ctx.inactiveIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 41851 key: 0, 41852 class: vue.normalizeClass(vue.unref(ns).is("icon")) 41853 }, { 41854 default: vue.withCtx(() => [ 41855 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(checked) ? _ctx.activeIcon : _ctx.inactiveIcon))) 41856 ]), 41857 _: 1 41858 }, 8, ["class"])) : _ctx.activeText || _ctx.inactiveText ? (vue.openBlock(), vue.createElementBlock("span", { 41859 key: 1, 41860 class: vue.normalizeClass(vue.unref(ns).is("text")), 41861 "aria-hidden": !vue.unref(checked) 41862 }, vue.toDisplayString(vue.unref(checked) ? _ctx.activeText : _ctx.inactiveText), 11, _hoisted_4$2)) : vue.createCommentVNode("v-if", true) 41863 ], 2)) : vue.createCommentVNode("v-if", true), 41864 vue.createElementVNode("div", { 41865 class: vue.normalizeClass(vue.unref(ns).e("action")) 41866 }, [ 41867 _ctx.loading ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 41868 key: 0, 41869 class: vue.normalizeClass(vue.unref(ns).is("loading")) 41870 }, { 41871 default: vue.withCtx(() => [ 41872 vue.createVNode(vue.unref(loading_default)) 41873 ]), 41874 _: 1 41875 }, 8, ["class"])) : vue.createCommentVNode("v-if", true) 41876 ], 2)
41877 ], 6), 41878 !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (vue.openBlock(), vue.createElementBlock("span", { 41879 key: 1, 41880 class: vue.normalizeClass([ 41881 vue.unref(ns).e("label"), 41882 vue.unref(ns).em("label", "right"), 41883 vue.unref(ns).is("active", vue.unref(checked)) 41884 ]) 41885 }, [ 41886 _ctx.activeIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, { 41887 default: vue.withCtx(() => [ 41888 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.activeIcon))) 41889 ]), 41890 _: 1 41891 })) : vue.createCommentVNode("v-if", true), 41892 !_ctx.activeIcon && _ctx.activeText ? (vue.openBlock(), vue.createElementBlock("span", { 41893 key: 1, 41894 "aria-hidden": !vue.unref(checked) 41895 }, vue.toDisplayString(_ctx.activeText), 9, _hoisted_5$1)) : vue.createCommentVNode("v-if", true) 41896 ], 2)) : vue.createCommentVNode("v-if", true) 41897 ], 14, _hoisted_1$d); 41898 }; 41899 } 41900 }); 41901 var Switch = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__file", "switch.vue"]]); 41902 41903 const ElSwitch = withInstall(Switch); 41904 41905 var matchHtmlRegExp = /["'&<>]/; 41906 var escapeHtml_1 = escapeHtml; 41907 function escapeHtml(string) { 41908 var str = "" + string; 41909 var match = matchHtmlRegExp.exec(str); 41910 if (!match) { 41911 return str; 41912 } 41913 var escape; 41914 var html = ""; 41915 var index = 0; 41916 var lastIndex = 0; 41917 for (index = match.index; index < str.length; index++) { 41918 switch (str.charCodeAt(index)) { 41919 case 34: 41920 escape = """; 41921 break; 41922 case 38: 41923 escape = "&"; 41924 break; 41925 case 39: 41926 escape = "'"; 41927 break; 41928 case 60: 41929 escape = "<"; 41930 break; 41931 case 62: 41932 escape = ">"; 41933 break; 41934 default: 41935 continue; 41936 } 41937 if (lastIndex !== index) { 41938 html += str.substring(lastIndex, index); 41939 } 41940 lastIndex = index + 1; 41941 html += escape; 41942 } 41943 return lastIndex !== index ? html + str.substring(lastIndex, index) : html; 41944 } 41945 /*! 41946 * escape-html 41947 * Copyright(c) 2012-2013 TJ Holowaychuk 41948 * Copyright(c) 2015 Andreas Lubbe 41949 * Copyright(c) 2015 Tiancheng "Timothy" Gu 41950 * MIT Licensed 41951 */ 41952 41953 const getCell = function(event) { 41954 var _a; 41955 return (_a = event.target) == null ? void 0 : _a.closest("td"); 41956 }; 41957 const orderBy = function(array, sortKey, reverse, sortMethod, sortBy) { 41958 if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) { 41959 return array; 41960 } 41961 if (typeof reverse === "string") { 41962 reverse = reverse === "descending" ? -1 : 1; 41963 } else { 41964 reverse = reverse && reverse < 0 ? -1 : 1; 41965 } 41966 const getKey = sortMethod ? null : function(value, index) { 41967 if (sortBy) { 41968 if (!Array.isArray(sortBy)) { 41969 sortBy = [sortBy]; 41970 } 41971 return sortBy.map((by) => { 41972 if (typeof by === "string") { 41973 return get(value, by); 41974 } else { 41975 return by(value, index, array); 41976 } 41977 }); 41978 } 41979 if (sortKey !== "$key") { 41980 if (isObject$1(value) && "$value" in value) 41981 value = value.$value; 41982 } 41983 return [isObject$1(value) ? get(value, sortKey) : value]; 41984 }; 41985 const compare = function(a, b) { 41986 if (sortMethod) { 41987 return sortMethod(a.value, b.value); 41988 } 41989 for (let i = 0, len = a.key.length; i < len; i++) { 41990 if (a.key[i] < b.key[i]) { 41991 return -1; 41992 } 41993 if (a.key[i] > b.key[i]) { 41994 return 1; 41995 } 41996 } 41997 return 0; 41998 }; 41999 return array.map((value, index) => { 42000 return { 42001 value, 42002 index, 42003 key: getKey ? getKey(value, index) : null 42004 }; 42005 }).sort((a, b) => { 42006 let order = compare(a, b); 42007 if (!order) { 42008 order = a.index - b.index; 42009 } 42010 return order * +reverse; 42011 }).map((item) => item.value); 42012 }; 42013 const getColumnById = function(table, columnId) { 42014 let column = null; 42015 table.columns.forEach((item) => { 42016 if (item.id === columnId) { 42017 column = item; 42018 } 42019 }); 42020 return column; 42021 }; 42022 const getColumnByKey = function(table, columnKey) { 42023 let column = null; 42024 for (let i = 0; i < table.columns.length; i++) { 42025 const item = table.columns[i]; 42026 if (item.columnKey === columnKey) { 42027 column = item; 42028 break; 42029 } 42030 } 42031 if (!column) 42032 throwError("ElTable", `No column matching with column-key: ${columnKey}`); 42033 return column; 42034 }; 42035 const getColumnByCell = function(table, cell, namespace) { 42036 const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
42037 if (matches) { 42038 return getColumnById(table, matches[0]); 42039 } 42040 return null; 42041 }; 42042 const getRowIdentity = (row, rowKey) => { 42043 if (!row) 42044 throw new Error("Row is required when get row identity"); 42045 if (typeof rowKey === "string") { 42046 if (!rowKey.includes(".")) { 42047 return `${row[rowKey]}`; 42048 } 42049 const key = rowKey.split("."); 42050 let current = row; 42051 for (const element of key) { 42052 current = current[element]; 42053 } 42054 return `${current}`; 42055 } else if (typeof rowKey === "function") { 42056 return rowKey.call(null, row); 42057 } 42058 }; 42059 const getKeysMap = function(array, rowKey) { 42060 const arrayMap = {}; 42061 (array || []).forEach((row, index) => { 42062 arrayMap[getRowIdentity(row, rowKey)] = { row, index }; 42063 }); 42064 return arrayMap; 42065 }; 42066 function mergeOptions(defaults, config) { 42067 const options = {}; 42068 let key; 42069 for (key in defaults) { 42070 options[key] = defaults[key]; 42071 } 42072 for (key in config) { 42073 if (hasOwn(config, key)) { 42074 const value = config[key]; 42075 if (typeof value !== "undefined") { 42076 options[key] = value; 42077 } 42078 } 42079 } 42080 return options; 42081 } 42082 function parseWidth(width) { 42083 if (width === "") 42084 return width; 42085 if (width !== void 0) { 42086 width = Number.parseInt(width, 10); 42087 if (Number.isNaN(width)) { 42088 width = ""; 42089 } 42090 } 42091 return width; 42092 } 42093 function parseMinWidth(minWidth) { 42094 if (minWidth === "") 42095 return minWidth; 42096 if (minWidth !== void 0) { 42097 minWidth = parseWidth(minWidth); 42098 if (Number.isNaN(minWidth)) { 42099 minWidth = 80; 42100 } 42101 } 42102 return minWidth; 42103 } 42104 function parseHeight(height) { 42105 if (typeof height === "number") { 42106 return height; 42107 } 42108 if (typeof height === "string") { 42109 if (/^\d+(?:px)?$/.test(height)) { 42110 return Number.parseInt(height, 10); 42111 } else { 42112 return height; 42113 } 42114 } 42115 return null; 42116 } 42117 function compose(...funcs) { 42118 if (funcs.length === 0) { 42119 return (arg) => arg; 42120 } 42121 if (funcs.length === 1) { 42122 return funcs[0]; 42123 } 42124 return funcs.reduce((a, b) => (...args) => a(b(...args))); 42125 } 42126 function toggleRowStatus(statusArr, row, newVal) { 42127 let changed = false; 42128 const index = statusArr.indexOf(row); 42129 const included = index !== -1; 42130 const toggleStatus = (type) => { 42131 if (type === "add") { 42132 statusArr.push(row); 42133 } else { 42134 statusArr.splice(index, 1); 42135 } 42136 changed = true; 42137 if (isArray$1(row.children)) { 42138 row.children.forEach((item) => { 42139 toggleRowStatus(statusArr, item, newVal != null ? newVal : !included); 42140 }); 42141 } 42142 }; 42143 if (isBoolean(newVal)) { 42144 if (newVal && !included) { 42145 toggleStatus("add"); 42146 } else if (!newVal && included) { 42147 toggleStatus("remove"); 42148 } 42149 } else { 42150 included ? toggleStatus("remove") : toggleStatus("add"); 42151 } 42152 return changed; 42153 } 42154 function walkTreeNode(root, cb, childrenKey = "children", lazyKey = "hasChildren") { 42155 const isNil = (array) => !(Array.isArray(array) && array.length); 42156 function _walker(parent, children, level) { 42157 cb(parent, children, level); 42158 children.forEach((item) => { 42159 if (item[lazyKey]) { 42160 cb(item, null, level + 1); 42161 return; 42162 } 42163 const children2 = item[childrenKey]; 42164 if (!isNil(children2)) { 42165 _walker(item, children2, level + 1); 42166 } 42167 }); 42168 } 42169 root.forEach((item) => { 42170 if (item[lazyKey]) { 42171 cb(item, null, 0); 42172 return; 42173 } 42174 const children = item[childrenKey]; 42175 if (!isNil(children)) { 42176 _walker(item, children, 0); 42177 } 42178 }); 42179 } 42180 let removePopper; 42181 function createTablePopper(parentNode, trigger, popperContent, nextZIndex, tooltipOptions) { 42182 tooltipOptions = merge({ 42183 enterable: true, 42184 showArrow: true 42185 }, tooltipOptions); 42186 const ns = parentNode == null ? void 0 : parentNode.dataset.prefix; 42187 const scrollContainer = parentNode == null ? void 0 : parentNode.querySelector(`.${ns}-scrollbar__wrap`); 42188 function renderContent() { 42189 const isLight = tooltipOptions.effect === "light"; 42190 const content2 = document.createElement("div"); 42191 content2.className = [ 42192 `${ns}-popper`, 42193 isLight ? "is-light" : "is-dark", 42194 tooltipOptions.popperClass || "" 42195 ].join(" "); 42196 popperContent = escapeHtml_1(popperContent); 42197 content2.innerHTML = popperContent; 42198 content2.style.zIndex = String(nextZIndex()); 42199 parentNode == null ? void 0 : parentNode.appendChild(content2); 42200 return content2; 42201 } 42202 function renderArrow() { 42203 const arrow = document.createElement("div"); 42204 arrow.className = `${ns}-popper__arrow`; 42205 return arrow; 42206 } 42207 function showPopper() {
42208 popperInstance && popperInstance.update(); 42209 } 42210 removePopper == null ? void 0 : removePopper(); 42211 removePopper = () => { 42212 try { 42213 popperInstance && popperInstance.destroy(); 42214 content && (parentNode == null ? void 0 : parentNode.removeChild(content)); 42215 trigger.removeEventListener("mouseenter", onOpen); 42216 trigger.removeEventListener("mouseleave", onClose); 42217 scrollContainer == null ? void 0 : scrollContainer.removeEventListener("scroll", removePopper); 42218 removePopper = void 0; 42219 } catch (e) { 42220 } 42221 }; 42222 let popperInstance = null; 42223 let onOpen = showPopper; 42224 let onClose = removePopper; 42225 if (tooltipOptions.enterable) { 42226 ({ onOpen, onClose } = useDelayedToggle({ 42227 showAfter: tooltipOptions.showAfter, 42228 hideAfter: tooltipOptions.hideAfter, 42229 open: showPopper, 42230 close: removePopper 42231 })); 42232 } 42233 const content = renderContent(); 42234 content.onmouseenter = onOpen; 42235 content.onmouseleave = onClose; 42236 const modifiers = []; 42237 if (tooltipOptions.offset) { 42238 modifiers.push({ 42239 name: "offset", 42240 options: { 42241 offset: [0, tooltipOptions.offset] 42242 } 42243 }); 42244 } 42245 if (tooltipOptions.showArrow) { 42246 const arrow = content.appendChild(renderArrow()); 42247 modifiers.push({ 42248 name: "arrow", 42249 options: { 42250 element: arrow, 42251 padding: 10 42252 } 42253 }); 42254 } 42255 const popperOptions = tooltipOptions.popperOptions || {}; 42256 popperInstance = yn(trigger, content, { 42257 placement: tooltipOptions.placement || "top", 42258 strategy: "fixed", 42259 ...popperOptions, 42260 modifiers: popperOptions.modifiers ? modifiers.concat(popperOptions.modifiers) : modifiers 42261 }); 42262 trigger.addEventListener("mouseenter", onOpen); 42263 trigger.addEventListener("mouseleave", onClose); 42264 scrollContainer == null ? void 0 : scrollContainer.addEventListener("scroll", removePopper); 42265 return popperInstance; 42266 } 42267 function getCurrentColumns(column) { 42268 if (column.children) { 42269 return flatMap(column.children, getCurrentColumns); 42270 } else { 42271 return [column]; 42272 } 42273 } 42274 function getColSpan(colSpan, column) { 42275 return colSpan + column.colSpan; 42276 } 42277 const isFixedColumn = (index, fixed, store, realColumns) => { 42278 let start = 0; 42279 let after = index; 42280 const columns = store.states.columns.value; 42281 if (realColumns) { 42282 const curColumns = getCurrentColumns(realColumns[index]); 42283 const preColumns = columns.slice(0, columns.indexOf(curColumns[0])); 42284 start = preColumns.reduce(getColSpan, 0); 42285 after = start + curColumns.reduce(getColSpan, 0) - 1; 42286 } else { 42287 start = index; 42288 } 42289 let fixedLayout; 42290 switch (fixed) { 42291 case "left": 42292 if (after < store.states.fixedLeafColumnsLength.value) { 42293 fixedLayout = "left"; 42294 } 42295 break; 42296 case "right": 42297 if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) { 42298 fixedLayout = "right"; 42299 } 42300 break; 42301 default: 42302 if (after < store.states.fixedLeafColumnsLength.value) { 42303 fixedLayout = "left"; 42304 } else if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) { 42305 fixedLayout = "right"; 42306 } 42307 } 42308 return fixedLayout ? { 42309 direction: fixedLayout, 42310 start, 42311 after 42312 } : {}; 42313 }; 42314 const getFixedColumnsClass = (namespace, index, fixed, store, realColumns, offset = 0) => { 42315 const classes = []; 42316 const { direction, start, after } = isFixedColumn(index, fixed, store, realColumns); 42317 if (direction) { 42318 const isLeft = direction === "left"; 42319 classes.push(`${namespace}-fixed-column--${direction}`); 42320 if (isLeft && after + offset === store.states.fixedLeafColumnsLength.value - 1) { 42321 classes.push("is-last-column"); 42322 } else if (!isLeft && start - offset === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) { 42323 classes.push("is-first-column"); 42324 } 42325 } 42326 return classes; 42327 }; 42328 function getOffset(offset, column) { 42329 return offset + (column.realWidth === null || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
42330 } 42331 const getFixedColumnOffset = (index, fixed, store, realColumns) => { 42332 const { 42333 direction, 42334 start = 0, 42335 after = 0 42336 } = isFixedColumn(index, fixed, store, realColumns); 42337 if (!direction) { 42338 return; 42339 } 42340 const styles = {}; 42341 const isLeft = direction === "left"; 42342 const columns = store.states.columns.value; 42343 if (isLeft) { 42344 styles.left = columns.slice(0, start).reduce(getOffset, 0); 42345 } else { 42346 styles.right = columns.slice(after + 1).reverse().reduce(getOffset, 0); 42347 } 42348 return styles; 42349 }; 42350 const ensurePosition = (style, key) => { 42351 if (!style) 42352 return; 42353 if (!Number.isNaN(style[key])) { 42354 style[key] = `${style[key]}px`; 42355 } 42356 }; 42357 42358 function useExpand(watcherData) { 42359 const instance = vue.getCurrentInstance(); 42360 const defaultExpandAll = vue.ref(false); 42361 const expandRows = vue.ref([]); 42362 const updateExpandRows = () => { 42363 const data = watcherData.data.value || []; 42364 const rowKey = watcherData.rowKey.value; 42365 if (defaultExpandAll.value) { 42366 expandRows.value = data.slice(); 42367 } else if (rowKey) { 42368 const expandRowsMap = getKeysMap(expandRows.value, rowKey); 42369 expandRows.value = data.reduce((prev, row) => { 42370 const rowId = getRowIdentity(row, rowKey); 42371 const rowInfo = expandRowsMap[rowId]; 42372 if (rowInfo) { 42373 prev.push(row); 42374 } 42375 return prev; 42376 }, []); 42377 } else { 42378 expandRows.value = []; 42379 } 42380 }; 42381 const toggleRowExpansion = (row, expanded) => { 42382 const changed = toggleRowStatus(expandRows.value, row, expanded); 42383 if (changed) { 42384 instance.emit("expand-change", row, expandRows.value.slice()); 42385 } 42386 }; 42387 const setExpandRowKeys = (rowKeys) => { 42388 instance.store.assertRowKey(); 42389 const data = watcherData.data.value || []; 42390 const rowKey = watcherData.rowKey.value; 42391 const keysMap = getKeysMap(data, rowKey); 42392 expandRows.value = rowKeys.reduce((prev, cur) => { 42393 const info = keysMap[cur]; 42394 if (info) { 42395 prev.push(info.row); 42396 } 42397 return prev; 42398 }, []); 42399 }; 42400 const isRowExpanded = (row) => { 42401 const rowKey = watcherData.rowKey.value; 42402 if (rowKey) { 42403 const expandMap = getKeysMap(expandRows.value, rowKey); 42404 return !!expandMap[getRowIdentity(row, rowKey)]; 42405 } 42406 return expandRows.value.includes(row); 42407 }; 42408 return { 42409 updateExpandRows, 42410 toggleRowExpansion, 42411 setExpandRowKeys, 42412 isRowExpanded, 42413 states: { 42414 expandRows, 42415 defaultExpandAll 42416 } 42417 }; 42418 } 42419 42420 function useCurrent(watcherData) { 42421 const instance = vue.getCurrentInstance(); 42422 const _currentRowKey = vue.ref(null); 42423 const currentRow = vue.ref(null); 42424 const setCurrentRowKey = (key) => { 42425 instance.store.assertRowKey(); 42426 _currentRowKey.value = key; 42427 setCurrentRowByKey(key); 42428 }; 42429 const restoreCurrentRowKey = () => { 42430 _currentRowKey.value = null; 42431 }; 42432 const setCurrentRowByKey = (key) => { 42433 const { data, rowKey } = watcherData; 42434 let _currentRow = null; 42435 if (rowKey.value) { 42436 _currentRow = (vue.unref(data) || []).find((item) => getRowIdentity(item, rowKey.value) === key); 42437 } 42438 currentRow.value = _currentRow; 42439 instance.emit("current-change", currentRow.value, null); 42440 }; 42441 const updateCurrentRow = (_currentRow) => { 42442 const oldCurrentRow = currentRow.value; 42443 if (_currentRow && _currentRow !== oldCurrentRow) { 42444 currentRow.value = _currentRow; 42445 instance.emit("current-change", currentRow.value, oldCurrentRow); 42446 return; 42447 } 42448 if (!_currentRow && oldCurrentRow) { 42449 currentRow.value = null; 42450 instance.emit("current-change", null, oldCurrentRow); 42451 } 42452 }; 42453 const updateCurrentRowData = () => { 42454 const rowKey = watcherData.rowKey.value; 42455 const data = watcherData.data.value || []; 42456 const oldCurrentRow = currentRow.value; 42457 if (!data.includes(oldCurrentRow) && oldCurrentRow) { 42458 if (rowKey) { 42459 const currentRowKey = getRowIdentity(oldCurrentRow, rowKey); 42460 setCurrentRowByKey(currentRowKey); 42461 } else { 42462 currentRow.value = null; 42463 } 42464 if (currentRow.value === null) { 42465 instance.emit("current-change", null, oldCurrentRow); 42466 } 42467 } else if (_currentRowKey.value) { 42468 setCurrentRowByKey(_currentRowKey.value); 42469 restoreCurrentRowKey(); 42470 } 42471 }; 42472 return { 42473 setCurrentRowKey, 42474 restoreCurrentRowKey, 42475 setCurrentRowByKey, 42476 updateCurrentRow, 42477 updateCurrentRowData, 42478 states: { 42479 _currentRowKey, 42480 currentRow 42481 } 42482 }; 42483 } 42484 42485 function useTree$2(watcherData) { 42486 const expandRowKeys = vue.ref([]);
42487 const treeData = vue.ref({}); 42488 const indent = vue.ref(16); 42489 const lazy = vue.ref(false); 42490 const lazyTreeNodeMap = vue.ref({}); 42491 const lazyColumnIdentifier = vue.ref("hasChildren"); 42492 const childrenColumnName = vue.ref("children"); 42493 const instance = vue.getCurrentInstance(); 42494 const normalizedData = vue.computed(() => { 42495 if (!watcherData.rowKey.value) 42496 return {}; 42497 const data = watcherData.data.value || []; 42498 return normalize(data); 42499 }); 42500 const normalizedLazyNode = vue.computed(() => { 42501 const rowKey = watcherData.rowKey.value; 42502 const keys = Object.keys(lazyTreeNodeMap.value); 42503 const res = {}; 42504 if (!keys.length) 42505 return res; 42506 keys.forEach((key) => { 42507 if (lazyTreeNodeMap.value[key].length) { 42508 const item = { children: [] }; 42509 lazyTreeNodeMap.value[key].forEach((row) => { 42510 const currentRowKey = getRowIdentity(row, rowKey); 42511 item.children.push(currentRowKey); 42512 if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) { 42513 res[currentRowKey] = { children: [] }; 42514 } 42515 }); 42516 res[key] = item; 42517 } 42518 }); 42519 return res; 42520 }); 42521 const normalize = (data) => { 42522 const rowKey = watcherData.rowKey.value; 42523 const res = {}; 42524 walkTreeNode(data, (parent, children, level) => { 42525 const parentId = getRowIdentity(parent, rowKey); 42526 if (Array.isArray(children)) { 42527 res[parentId] = { 42528 children: children.map((row) => getRowIdentity(row, rowKey)), 42529 level 42530 }; 42531 } else if (lazy.value) { 42532 res[parentId] = { 42533 children: [], 42534 lazy: true, 42535 level 42536 }; 42537 } 42538 }, childrenColumnName.value, lazyColumnIdentifier.value); 42539 return res; 42540 }; 42541 const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll = ((_a) => (_a = instance.store) == null ? void 0 : _a.states.defaultExpandAll.value)()) => { 42542 var _a2; 42543 const nested = normalizedData.value; 42544 const normalizedLazyNode_ = normalizedLazyNode.value; 42545 const keys = Object.keys(nested); 42546 const newTreeData = {}; 42547 if (keys.length) { 42548 const oldTreeData = vue.unref(treeData); 42549 const rootLazyRowKeys = []; 42550 const getExpanded = (oldValue, key) => { 42551 if (ifChangeExpandRowKeys) { 42552 if (expandRowKeys.value) { 42553 return ifExpandAll || expandRowKeys.value.includes(key); 42554 } else { 42555 return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded)); 42556 } 42557 } else { 42558 const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key); 42559 return !!((oldValue == null ? void 0 : oldValue.expanded) || included); 42560 } 42561 }; 42562 keys.forEach((key) => { 42563 const oldValue = oldTreeData[key]; 42564 const newValue = { ...nested[key] }; 42565 newValue.expanded = getExpanded(oldValue, key); 42566 if (newValue.lazy) { 42567 const { loaded = false, loading = false } = oldValue || {}; 42568 newValue.loaded = !!loaded; 42569 newValue.loading = !!loading; 42570 rootLazyRowKeys.push(key); 42571 } 42572 newTreeData[key] = newValue; 42573 }); 42574 const lazyKeys = Object.keys(normalizedLazyNode_); 42575 if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) { 42576 lazyKeys.forEach((key) => { 42577 const oldValue = oldTreeData[key]; 42578 const lazyNodeChildren = normalizedLazyNode_[key].children; 42579 if (rootLazyRowKeys.includes(key)) { 42580 if (newTreeData[key].children.length !== 0) { 42581 throw new Error("[ElTable]children must be an empty array."); 42582 } 42583 newTreeData[key].children = lazyNodeChildren; 42584 } else { 42585 const { loaded = false, loading = false } = oldValue || {}; 42586 newTreeData[key] = { 42587 lazy: true, 42588 loaded: !!loaded, 42589 loading: !!loading, 42590 expanded: getExpanded(oldValue, key), 42591 children: lazyNodeChildren, 42592 level: "" 42593 }; 42594 } 42595 }); 42596 } 42597 } 42598 treeData.value = newTreeData; 42599 (_a2 = instance.store) == null ? void 0 : _a2.updateTableScrollY(); 42600 }; 42601 vue.watch(() => expandRowKeys.value, () => { 42602 updateTreeData(true); 42603 }); 42604 vue.watch(() => normalizedData.value, () => { 42605 updateTreeData(); 42606 }); 42607 vue.watch(() => normalizedLazyNode.value, () => { 42608 updateTreeData(); 42609 }); 42610 const updateTreeExpandKeys = (value) => { 42611 expandRowKeys.value = value; 42612 updateTreeData(); 42613 }; 42614 const toggleTreeExpansion = (row, expanded) => { 42615 instance.store.assertRowKey(); 42616 const rowKey = watcherData.rowKey.value; 42617 const id = getRowIdentity(row, rowKey); 42618 const data = id && treeData.value[id]; 42619 if (id && data && "expanded" in data) { 42620 const oldExpanded = data.expanded; 42621 expanded = typeof expanded === "undefined" ? !data.expanded : expanded; 42622 treeData.value[id].expanded = expanded; 42623 if (oldExpanded !== expanded) {
42624 instance.emit("expand-change", row, expanded); 42625 } 42626 instance.store.updateTableScrollY(); 42627 } 42628 }; 42629 const loadOrToggle = (row) => { 42630 instance.store.assertRowKey(); 42631 const rowKey = watcherData.rowKey.value; 42632 const id = getRowIdentity(row, rowKey); 42633 const data = treeData.value[id]; 42634 if (lazy.value && data && "loaded" in data && !data.loaded) { 42635 loadData(row, id, data); 42636 } else { 42637 toggleTreeExpansion(row, void 0); 42638 } 42639 }; 42640 const loadData = (row, key, treeNode) => { 42641 const { load } = instance.props; 42642 if (load && !treeData.value[key].loaded) { 42643 treeData.value[key].loading = true; 42644 load(row, treeNode, (data) => { 42645 if (!Array.isArray(data)) { 42646 throw new TypeError("[ElTable] data must be an array"); 42647 } 42648 treeData.value[key].loading = false; 42649 treeData.value[key].loaded = true; 42650 treeData.value[key].expanded = true; 42651 if (data.length) { 42652 lazyTreeNodeMap.value[key] = data; 42653 } 42654 instance.emit("expand-change", row, true); 42655 }); 42656 } 42657 }; 42658 return { 42659 loadData, 42660 loadOrToggle, 42661 toggleTreeExpansion, 42662 updateTreeExpandKeys, 42663 updateTreeData, 42664 normalize, 42665 states: { 42666 expandRowKeys, 42667 treeData, 42668 indent, 42669 lazy, 42670 lazyTreeNodeMap, 42671 lazyColumnIdentifier, 42672 childrenColumnName 42673 } 42674 }; 42675 } 42676 42677 const sortData = (data, states) => { 42678 const sortingColumn = states.sortingColumn; 42679 if (!sortingColumn || typeof sortingColumn.sortable === "string") { 42680 return data; 42681 } 42682 return orderBy(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy); 42683 }; 42684 const doFlattenColumns = (columns) => { 42685 const result = []; 42686 columns.forEach((column) => { 42687 if (column.children) { 42688 result.push.apply(result, doFlattenColumns(column.children)); 42689 } else { 42690 result.push(column); 42691 } 42692 }); 42693 return result; 42694 }; 42695 function useWatcher$1() { 42696 var _a; 42697 const instance = vue.getCurrentInstance(); 42698 const { size: tableSize } = vue.toRefs((_a = instance.proxy) == null ? void 0 : _a.$props); 42699 const rowKey = vue.ref(null); 42700 const data = vue.ref([]); 42701 const _data = vue.ref([]); 42702 const isComplex = vue.ref(false); 42703 const _columns = vue.ref([]); 42704 const originColumns = vue.ref([]); 42705 const columns = vue.ref([]); 42706 const fixedColumns = vue.ref([]); 42707 const rightFixedColumns = vue.ref([]); 42708 const leafColumns = vue.ref([]); 42709 const fixedLeafColumns = vue.ref([]); 42710 const rightFixedLeafColumns = vue.ref([]); 42711 const updateOrderFns = []; 42712 const leafColumnsLength = vue.ref(0);
42713 const fixedLeafColumnsLength = vue.ref(0); 42714 const rightFixedLeafColumnsLength = vue.ref(0); 42715 const isAllSelected = vue.ref(false); 42716 const selection = vue.ref([]); 42717 const reserveSelection = vue.ref(false); 42718 const selectOnIndeterminate = vue.ref(false); 42719 const selectable = vue.ref(null); 42720 const filters = vue.ref({}); 42721 const filteredData = vue.ref(null); 42722 const sortingColumn = vue.ref(null); 42723 const sortProp = vue.ref(null); 42724 const sortOrder = vue.ref(null); 42725 const hoverRow = vue.ref(null); 42726 vue.watch(data, () => instance.state && scheduleLayout(false), { 42727 deep: true 42728 }); 42729 const assertRowKey = () => { 42730 if (!rowKey.value) 42731 throw new Error("[ElTable] prop row-key is required"); 42732 }; 42733 const updateChildFixed = (column) => { 42734 var _a2; 42735 (_a2 = column.children) == null ? void 0 : _a2.forEach((childColumn) => { 42736 childColumn.fixed = column.fixed; 42737 updateChildFixed(childColumn); 42738 }); 42739 }; 42740 const updateColumns = () => { 42741 _columns.value.forEach((column) => { 42742 updateChildFixed(column); 42743 }); 42744 fixedColumns.value = _columns.value.filter((column) => column.fixed === true || column.fixed === "left"); 42745 rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right"); 42746 if (fixedColumns.value.length > 0 && _columns.value[0] && _columns.value[0].type === "selection" && !_columns.value[0].fixed) { 42747 _columns.value[0].fixed = true; 42748 fixedColumns.value.unshift(_columns.value[0]); 42749 } 42750 const notFixedColumns = _columns.value.filter((column) => !column.fixed); 42751 originColumns.value = [].concat(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value); 42752 const leafColumns2 = doFlattenColumns(notFixedColumns); 42753 const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value); 42754 const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value); 42755 leafColumnsLength.value = leafColumns2.length; 42756 fixedLeafColumnsLength.value = fixedLeafColumns2.length; 42757 rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length; 42758 columns.value = [].concat(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2); 42759 isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0; 42760 }; 42761 const scheduleLayout = (needUpdateColumns, immediate = false) => { 42762 if (needUpdateColumns) { 42763 updateColumns(); 42764 } 42765 if (immediate) { 42766 instance.state.doLayout(); 42767 } else { 42768 instance.state.debouncedUpdateLayout(); 42769 } 42770 }; 42771 const isSelected = (row) => { 42772 return selection.value.includes(row); 42773 }; 42774 const clearSelection = () => { 42775 isAllSelected.value = false; 42776 const oldSelection = selection.value; 42777 if (oldSelection.length) { 42778 selection.value = []; 42779 instance.emit("selection-change", []); 42780 } 42781 }; 42782 const cleanSelection = () => { 42783 let deleted; 42784 if (rowKey.value) { 42785 deleted = []; 42786 const selectedMap = getKeysMap(selection.value, rowKey.value); 42787 const dataMap = getKeysMap(data.value, rowKey.value); 42788 for (const key in selectedMap) { 42789 if (hasOwn(selectedMap, key) && !dataMap[key]) { 42790 deleted.push(selectedMap[key].row); 42791 } 42792 } 42793 } else { 42794 deleted = selection.value.filter((item) => !data.value.includes(item)); 42795 } 42796 if (deleted.length) { 42797 const newSelection = selection.value.filter((item) => !deleted.includes(item)); 42798 selection.value = newSelection; 42799 instance.emit("selection-change", newSelection.slice()); 42800 } 42801 }; 42802 const getSelectionRows = () => { 42803 return (selection.value || []).slice(); 42804 }; 42805 const toggleRowSelection = (row, selected = void 0, emitChange = true) => { 42806 const changed = toggleRowStatus(selection.value, row, selected); 42807 if (changed) { 42808 const newSelection = (selection.value || []).slice(); 42809 if (emitChange) { 42810 instance.emit("select", newSelection, row); 42811 } 42812 instance.emit("selection-change", newSelection); 42813 } 42814 }; 42815 const _toggleAllSelection = () => { 42816 var _a2, _b; 42817 const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length); 42818 isAllSelected.value = value; 42819 let selectionChanged = false; 42820 let childrenCount = 0; 42821 const rowKey2 = (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.rowKey.value; 42822 data.value.forEach((row, index) => { 42823 const rowIndex = index + childrenCount; 42824 if (selectable.value) { 42825 if (selectable.value.call(null, row, rowIndex) && toggleRowStatus(selection.value, row, value)) { 42826 selectionChanged = true; 42827 } 42828 } else { 42829 if (toggleRowStatus(selection.value, row, value)) { 42830 selectionChanged = true; 42831 } 42832 } 42833 childrenCount += getChildrenCount(getRowIdentity(row, rowKey2)); 42834 }); 42835 if (selectionChanged) { 42836 instance.emit("selection-change", selection.value ? selection.value.slice() : []); 42837 } 42838 instance.emit("select-all", selection.value); 42839 }; 42840 const updateSelectionByRowKey = () => { 42841 const selectedMap = getKeysMap(selection.value, rowKey.value); 42842 data.value.forEach((row) => { 42843 const rowId = getRowIdentity(row, rowKey.value); 42844 const rowInfo = selectedMap[rowId]; 42845 if (rowInfo) { 42846 selection.value[rowInfo.index] = row; 42847 } 42848 }); 42849 }; 42850 const updateAllSelected = () => { 42851 var _a2, _b, _c; 42852 if (((_a2 = data.value) == null ? void 0 : _a2.length) === 0) { 42853 isAllSelected.value = false; 42854 return; 42855 } 42856 let selectedMap; 42857 if (rowKey.value) { 42858 selectedMap = getKeysMap(selection.value, rowKey.value); 42859 } 42860 const isSelected2 = function(row) { 42861 if (selectedMap) { 42862 return !!selectedMap[getRowIdentity(row, rowKey.value)]; 42863 } else { 42864 return selection.value.includes(row); 42865 } 42866 }; 42867 let isAllSelected_ = true; 42868 let selectedCount = 0; 42869 let childrenCount = 0; 42870 for (let i = 0, j = (data.value || []).length; i < j; i++) {
42871 const keyProp = (_c = (_b = instance == null ? void 0 : instance.store) == null ? void 0 : _b.states) == null ? void 0 : _c.rowKey.value; 42872 const rowIndex = i + childrenCount; 42873 const item = data.value[i]; 42874 const isRowSelectable = selectable.value && selectable.value.call(null, item, rowIndex); 42875 if (!isSelected2(item)) { 42876 if (!selectable.value || isRowSelectable) { 42877 isAllSelected_ = false; 42878 break; 42879 } 42880 } else { 42881 selectedCount++; 42882 } 42883 childrenCount += getChildrenCount(getRowIdentity(item, keyProp)); 42884 } 42885 if (selectedCount === 0) 42886 isAllSelected_ = false; 42887 isAllSelected.value = isAllSelected_; 42888 }; 42889 const getChildrenCount = (rowKey2) => { 42890 var _a2; 42891 if (!instance || !instance.store) 42892 return 0; 42893 const { treeData } = instance.store.states; 42894 let count = 0; 42895 const children = (_a2 = treeData.value[rowKey2]) == null ? void 0 : _a2.children; 42896 if (children) { 42897 count += children.length; 42898 children.forEach((childKey) => { 42899 count += getChildrenCount(childKey); 42900 }); 42901 } 42902 return count; 42903 }; 42904 const updateFilters = (columns2, values) => { 42905 if (!Array.isArray(columns2)) { 42906 columns2 = [columns2]; 42907 } 42908 const filters_ = {}; 42909 columns2.forEach((col) => { 42910 filters.value[col.id] = values; 42911 filters_[col.columnKey || col.id] = values; 42912 }); 42913 return filters_; 42914 }; 42915 const updateSort = (column, prop, order) => { 42916 if (sortingColumn.value && sortingColumn.value !== column) { 42917 sortingColumn.value.order = null; 42918 } 42919 sortingColumn.value = column; 42920 sortProp.value = prop; 42921 sortOrder.value = order; 42922 }; 42923 const execFilter = () => { 42924 let sourceData = vue.unref(_data); 42925 Object.keys(filters.value).forEach((columnId) => { 42926 const values = filters.value[columnId]; 42927 if (!values || values.length === 0) 42928 return; 42929 const column = getColumnById({ 42930 columns: columns.value 42931 }, columnId); 42932 if (column && column.filterMethod) { 42933 sourceData = sourceData.filter((row) => { 42934 return values.some((value) => column.filterMethod.call(null, value, row, column)); 42935 }); 42936 } 42937 }); 42938 filteredData.value = sourceData; 42939 }; 42940 const execSort = () => { 42941 data.value = sortData(filteredData.value, { 42942 sortingColumn: sortingColumn.value, 42943 sortProp: sortProp.value, 42944 sortOrder: sortOrder.value 42945 }); 42946 }; 42947 const execQuery = (ignore = void 0) => { 42948 if (!(ignore && ignore.filter)) { 42949 execFilter(); 42950 } 42951 execSort(); 42952 }; 42953 const clearFilter = (columnKeys) => { 42954 const { tableHeaderRef } = instance.refs; 42955 if (!tableHeaderRef) 42956 return; 42957 const panels = Object.assign({}, tableHeaderRef.filterPanels); 42958 const keys = Object.keys(panels); 42959 if (!keys.length) 42960 return; 42961 if (typeof columnKeys === "string") { 42962 columnKeys = [columnKeys]; 42963 } 42964 if (Array.isArray(columnKeys)) { 42965 const columns_ = columnKeys.map((key) => getColumnByKey({ 42966 columns: columns.value 42967 }, key)); 42968 keys.forEach((key) => { 42969 const column = columns_.find((col) => col.id === key); 42970 if (column) { 42971 column.filteredValue = []; 42972 } 42973 }); 42974 instance.store.commit("filterChange", { 42975 column: columns_, 42976 values: [], 42977 silent: true, 42978 multi: true 42979 }); 42980 } else { 42981 keys.forEach((key) => { 42982 const column = columns.value.find((col) => col.id === key); 42983 if (column) { 42984 column.filteredValue = []; 42985 } 42986 }); 42987 filters.value = {}; 42988 instance.store.commit("filterChange", { 42989 column: {}, 42990 values: [], 42991 silent: true 42992 }); 42993 } 42994 }; 42995 const clearSort = () => { 42996 if (!sortingColumn.value) 42997 return; 42998 updateSort(null, null, null); 42999 instance.store.commit("changeSortCondition", { 43000 silent: true 43001 }); 43002 }; 43003 const { 43004 setExpandRowKeys, 43005 toggleRowExpansion, 43006 updateExpandRows, 43007 states: expandStates, 43008 isRowExpanded 43009 } = useExpand({ 43010 data, 43011 rowKey 43012 }); 43013 const { 43014 updateTreeExpandKeys, 43015 toggleTreeExpansion, 43016 updateTreeData, 43017 loadOrToggle, 43018 states: treeStates 43019 } = useTree$2({ 43020 data, 43021 rowKey 43022 }); 43023 const { 43024 updateCurrentRowData, 43025 updateCurrentRow, 43026 setCurrentRowKey, 43027 states: currentData 43028 } = useCurrent({ 43029 data, 43030 rowKey 43031 }); 43032 const setExpandRowKeysAdapter = (val) => { 43033 setExpandRowKeys(val); 43034 updateTreeExpandKeys(val); 43035 }; 43036 const toggleRowExpansionAdapter = (row, expanded) => { 43037 const hasExpandColumn = columns.value.some(({ type }) => type === "expand"); 43038 if (hasExpandColumn) { 43039 toggleRowExpansion(row, expanded); 43040 } else { 43041 toggleTreeExpansion(row, expanded); 43042 } 43043 }; 43044 return { 43045 assertRowKey, 43046 updateColumns, 43047 scheduleLayout, 43048 isSelected, 43049 clearSelection, 43050 cleanSelection, 43051 getSelectionRows, 43052 toggleRowSelection, 43053 _toggleAllSelection, 43054 toggleAllSelection: null, 43055 updateSelectionByRowKey, 43056 updateAllSelected, 43057 updateFilters, 43058 updateCurrentRow, 43059 updateSort, 43060 execFilter, 43061 execSort, 43062 execQuery, 43063 clearFilter, 43064 clearSort, 43065 toggleRowExpansion, 43066 setExpandRowKeysAdapter, 43067 setCurrentRowKey, 43068 toggleRowExpansionAdapter, 43069 isRowExpanded, 43070 updateExpandRows, 43071 updateCurrentRowData, 43072 loadOrToggle, 43073 updateTreeData, 43074 states: { 43075 tableSize, 43076 rowKey, 43077 data, 43078 _data, 43079 isComplex, 43080 _columns, 43081 originColumns, 43082 columns, 43083 fixedColumns, 43084 rightFixedColumns, 43085 leafColumns, 43086 fixedLeafColumns, 43087 rightFixedLeafColumns, 43088 updateOrderFns, 43089 leafColumnsLength, 43090 fixedLeafColumnsLength, 43091 rightFixedLeafColumnsLength, 43092 isAllSelected, 43093 selection, 43094 reserveSelection, 43095 selectOnIndeterminate, 43096 selectable, 43097 filters, 43098 filteredData, 43099 sortingColumn, 43100 sortProp, 43101 sortOrder, 43102 hoverRow, 43103 ...expandStates, 43104 ...treeStates, 43105 ...currentData 43106 } 43107 }; 43108 } 43109 43110 function replaceColumn(array, column) { 43111 return array.map((item) => { 43112 var _a; 43113 if (item.id === column.id) { 43114 return column; 43115 } else if ((_a = item.children) == null ? void 0 : _a.length) { 43116 item.children = replaceColumn(item.children, column); 43117 } 43118 return item; 43119 }); 43120 } 43121 function sortColumn(array) { 43122 array.forEach((item) => { 43123 var _a, _b; 43124 item.no = (_a = item.getColumnIndex) == null ? void 0 : _a.call(item); 43125 if ((_b = item.children) == null ? void 0 : _b.length) { 43126 sortColumn(item.children); 43127 } 43128 }); 43129 array.sort((cur, pre) => cur.no - pre.no); 43130 } 43131 function useStore() { 43132 const instance = vue.getCurrentInstance(); 43133 const watcher = useWatcher$1();
43134 const ns = useNamespace("table"); 43135 const mutations = { 43136 setData(states, data) { 43137 const dataInstanceChanged = vue.unref(states._data) !== data; 43138 states.data.value = data; 43139 states._data.value = data; 43140 instance.store.execQuery(); 43141 instance.store.updateCurrentRowData(); 43142 instance.store.updateExpandRows(); 43143 instance.store.updateTreeData(instance.store.states.defaultExpandAll.value); 43144 if (vue.unref(states.reserveSelection)) { 43145 instance.store.assertRowKey(); 43146 instance.store.updateSelectionByRowKey(); 43147 } else { 43148 if (dataInstanceChanged) { 43149 instance.store.clearSelection(); 43150 } else { 43151 instance.store.cleanSelection(); 43152 } 43153 } 43154 instance.store.updateAllSelected(); 43155 if (instance.$ready) { 43156 instance.store.scheduleLayout(); 43157 } 43158 }, 43159 insertColumn(states, column, parent, updateColumnOrder) { 43160 const array = vue.unref(states._columns); 43161 let newColumns = []; 43162 if (!parent) { 43163 array.push(column); 43164 newColumns = array; 43165 } else { 43166 if (parent && !parent.children) { 43167 parent.children = []; 43168 } 43169 parent.children.push(column); 43170 newColumns = replaceColumn(array, parent); 43171 } 43172 sortColumn(newColumns); 43173 states._columns.value = newColumns; 43174 states.updateOrderFns.push(updateColumnOrder); 43175 if (column.type === "selection") { 43176 states.selectable.value = column.selectable; 43177 states.reserveSelection.value = column.reserveSelection; 43178 } 43179 if (instance.$ready) { 43180 instance.store.updateColumns(); 43181 instance.store.scheduleLayout(); 43182 } 43183 }, 43184 updateColumnOrder(states, column) { 43185 var _a; 43186 const newColumnIndex = (_a = column.getColumnIndex) == null ? void 0 : _a.call(column); 43187 if (newColumnIndex === column.no) 43188 return; 43189 sortColumn(states._columns.value); 43190 if (instance.$ready) { 43191 instance.store.updateColumns(); 43192 } 43193 }, 43194 removeColumn(states, column, parent, updateColumnOrder) { 43195 const array = vue.unref(states._columns) || []; 43196 if (parent) { 43197 parent.children.splice(parent.children.findIndex((item) => item.id === column.id), 1); 43198 vue.nextTick(() => { 43199 var _a; 43200 if (((_a = parent.children) == null ? void 0 : _a.length) === 0) { 43201 delete parent.children; 43202 } 43203 }); 43204 states._columns.value = replaceColumn(array, parent); 43205 } else { 43206 const index = array.indexOf(column); 43207 if (index > -1) { 43208 array.splice(index, 1); 43209 states._columns.value = array; 43210 } 43211 } 43212 const updateFnIndex = states.updateOrderFns.indexOf(updateColumnOrder); 43213 updateFnIndex > -1 && states.updateOrderFns.splice(updateFnIndex, 1); 43214 if (instance.$ready) { 43215 instance.store.updateColumns(); 43216 instance.store.scheduleLayout(); 43217 } 43218 }, 43219 sort(states, options) { 43220 const { prop, order, init } = options; 43221 if (prop) { 43222 const column = vue.unref(states.columns).find((column2) => column2.property === prop); 43223 if (column) { 43224 column.order = order; 43225 instance.store.updateSort(column, prop, order); 43226 instance.store.commit("changeSortCondition", { init }); 43227 } 43228 } 43229 }, 43230 changeSortCondition(states, options) { 43231 const { sortingColumn, sortProp, sortOrder } = states; 43232 const columnValue = vue.unref(sortingColumn), propValue = vue.unref(sortProp), orderValue = vue.unref(sortOrder); 43233 if (orderValue === null) { 43234 states.sortingColumn.value = null; 43235 states.sortProp.value = null; 43236 } 43237 const ignore = { filter: true }; 43238 instance.store.execQuery(ignore); 43239 if (!options || !(options.silent || options.init)) { 43240 instance.emit("sort-change", { 43241 column: columnValue, 43242 prop: propValue, 43243 order: orderValue 43244 }); 43245 } 43246 instance.store.updateTableScrollY(); 43247 }, 43248 filterChange(_states, options) { 43249 const { column, values, silent } = options; 43250 const newFilters = instance.store.updateFilters(column, values); 43251 instance.store.execQuery(); 43252 if (!silent) { 43253 instance.emit("filter-change", newFilters); 43254 } 43255 instance.store.updateTableScrollY(); 43256 }, 43257 toggleAllSelection() { 43258 instance.store.toggleAllSelection(); 43259 }, 43260 rowSelectedChanged(_states, row) { 43261 instance.store.toggleRowSelection(row);
43262 instance.store.updateAllSelected(); 43263 }, 43264 setHoverRow(states, row) { 43265 states.hoverRow.value = row; 43266 }, 43267 setCurrentRow(_states, row) { 43268 instance.store.updateCurrentRow(row); 43269 } 43270 }; 43271 const commit = function(name, ...args) { 43272 const mutations2 = instance.store.mutations; 43273 if (mutations2[name]) { 43274 mutations2[name].apply(instance, [instance.store.states].concat(args)); 43275 } else { 43276 throw new Error(`Action not found: ${name}`); 43277 } 43278 }; 43279 const updateTableScrollY = function() { 43280 vue.nextTick(() => instance.layout.updateScrollY.apply(instance.layout)); 43281 }; 43282 return { 43283 ns, 43284 ...watcher, 43285 mutations, 43286 commit, 43287 updateTableScrollY 43288 }; 43289 } 43290 43291 const InitialStateMap = { 43292 rowKey: "rowKey", 43293 defaultExpandAll: "defaultExpandAll", 43294 selectOnIndeterminate: "selectOnIndeterminate", 43295 indent: "indent", 43296 lazy: "lazy", 43297 data: "data", 43298 ["treeProps.hasChildren"]: { 43299 key: "lazyColumnIdentifier", 43300 default: "hasChildren" 43301 }, 43302 ["treeProps.children"]: { 43303 key: "childrenColumnName", 43304 default: "children" 43305 } 43306 }; 43307 function createStore(table, props) { 43308 if (!table) { 43309 throw new Error("Table is required."); 43310 } 43311 const store = useStore(); 43312 store.toggleAllSelection = debounce(store._toggleAllSelection, 10); 43313 Object.keys(InitialStateMap).forEach((key) => {
43314 handleValue(getArrKeysValue(props, key), key, store); 43315 }); 43316 proxyTableProps(store, props); 43317 return store; 43318 } 43319 function proxyTableProps(store, props) { 43320 Object.keys(InitialStateMap).forEach((key) => { 43321 vue.watch(() => getArrKeysValue(props, key), (value) => { 43322 handleValue(value, key, store); 43323 }); 43324 }); 43325 } 43326 function handleValue(value, propsKey, store) { 43327 let newVal = value; 43328 let storeKey = InitialStateMap[propsKey]; 43329 if (typeof InitialStateMap[propsKey] === "object") { 43330 storeKey = storeKey.key; 43331 newVal = newVal || InitialStateMap[propsKey].default; 43332 } 43333 store.states[storeKey].value = newVal; 43334 } 43335 function getArrKeysValue(props, keys) { 43336 if (keys.includes(".")) { 43337 const keyList = keys.split("."); 43338 let value = props; 43339 keyList.forEach((key) => { 43340 value = value[key]; 43341 }); 43342 return value; 43343 } else { 43344 return props[keys]; 43345 } 43346 } 43347 43348 class TableLayout { 43349 constructor(options) { 43350 this.observers = []; 43351 this.table = null; 43352 this.store = null; 43353 this.columns = []; 43354 this.fit = true; 43355 this.showHeader = true; 43356 this.height = vue.ref(null); 43357 this.scrollX = vue.ref(false); 43358 this.scrollY = vue.ref(false); 43359 this.bodyWidth = vue.ref(null); 43360 this.fixedWidth = vue.ref(null); 43361 this.rightFixedWidth = vue.ref(null); 43362 this.gutterWidth = 0; 43363 for (const name in options) { 43364 if (hasOwn(options, name)) { 43365 if (vue.isRef(this[name])) { 43366 this[name].value = options[name]; 43367 } else { 43368 this[name] = options[name]; 43369 } 43370 } 43371 } 43372 if (!this.table) { 43373 throw new Error("Table is required for Table Layout"); 43374 } 43375 if (!this.store) { 43376 throw new Error("Store is required for Table Layout"); 43377 } 43378 } 43379 updateScrollY() { 43380 const height = this.height.value; 43381 if (height === null) 43382 return false; 43383 const scrollBarRef = this.table.refs.scrollBarRef; 43384 if (this.table.vnode.el && (scrollBarRef == null ? void 0 : scrollBarRef.wrapRef)) { 43385 let scrollY = true; 43386 const prevScrollY = this.scrollY.value; 43387 scrollY = scrollBarRef.wrapRef.scrollHeight > scrollBarRef.wrapRef.clientHeight; 43388 this.scrollY.value = scrollY; 43389 return prevScrollY !== scrollY; 43390 } 43391 return false; 43392 } 43393 setHeight(value, prop = "height") { 43394 if (!isClient) 43395 return; 43396 const el = this.table.vnode.el; 43397 value = parseHeight(value); 43398 this.height.value = Number(value); 43399 if (!el && (value || value === 0)) 43400 return vue.nextTick(() => this.setHeight(value, prop)); 43401 if (typeof value === "number") { 43402 el.style[prop] = `${value}px`; 43403 this.updateElsHeight(); 43404 } else if (typeof value === "string") { 43405 el.style[prop] = value; 43406 this.updateElsHeight(); 43407 } 43408 } 43409 setMaxHeight(value) { 43410 this.setHeight(value, "max-height"); 43411 } 43412 getFlattenColumns() { 43413 const flattenColumns = []; 43414 const columns = this.table.store.states.columns.value; 43415 columns.forEach((column) => { 43416 if (column.isColumnGroup) { 43417 flattenColumns.push.apply(flattenColumns, column.columns); 43418 } else { 43419 flattenColumns.push(column); 43420 } 43421 }); 43422 return flattenColumns; 43423 } 43424 updateElsHeight() { 43425 this.updateScrollY(); 43426 this.notifyObservers("scrollable"); 43427 } 43428 headerDisplayNone(elm) { 43429 if (!elm) 43430 return true; 43431 let headerChild = elm; 43432 while (headerChild.tagName !== "DIV") { 43433 if (getComputedStyle(headerChild).display === "none") { 43434 return true; 43435 } 43436 headerChild = headerChild.parentElement; 43437 } 43438 return false; 43439 } 43440 updateColumnsWidth() { 43441 if (!isClient) 43442 return; 43443 const fit = this.fit; 43444 const bodyWidth = this.table.vnode.el.clientWidth; 43445 let bodyMinWidth = 0; 43446 const flattenColumns = this.getFlattenColumns(); 43447 const flexColumns = flattenColumns.filter((column) => typeof column.width !== "number"); 43448 flattenColumns.forEach((column) => { 43449 if (typeof column.width === "number" && column.realWidth) 43450 column.realWidth = null; 43451 }); 43452 if (flexColumns.length > 0 && fit) { 43453 flattenColumns.forEach((column) => { 43454 bodyMinWidth += Number(column.width || column.minWidth || 80); 43455 }); 43456 if (bodyMinWidth <= bodyWidth) { 43457 this.scrollX.value = false; 43458 const totalFlexWidth = bodyWidth - bodyMinWidth; 43459 if (flexColumns.length === 1) { 43460 flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth; 43461 } else { 43462 const allColumnsWidth = flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
43463 const flexWidthPerPixel = totalFlexWidth / allColumnsWidth; 43464 let noneFirstWidth = 0; 43465 flexColumns.forEach((column, index) => { 43466 if (index === 0) 43467 return; 43468 const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel); 43469 noneFirstWidth += flexWidth; 43470 column.realWidth = Number(column.minWidth || 80) + flexWidth; 43471 }); 43472 flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth; 43473 } 43474 } else { 43475 this.scrollX.value = true; 43476 flexColumns.forEach((column) => { 43477 column.realWidth = Number(column.minWidth); 43478 }); 43479 } 43480 this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth); 43481 this.table.state.resizeState.value.width = this.bodyWidth.value; 43482 } else { 43483 flattenColumns.forEach((column) => { 43484 if (!column.width && !column.minWidth) { 43485 column.realWidth = 80; 43486 } else { 43487 column.realWidth = Number(column.width || column.minWidth); 43488 } 43489 bodyMinWidth += column.realWidth; 43490 }); 43491 this.scrollX.value = bodyMinWidth > bodyWidth; 43492 this.bodyWidth.value = bodyMinWidth; 43493 } 43494 const fixedColumns = this.store.states.fixedColumns.value; 43495 if (fixedColumns.length > 0) { 43496 let fixedWidth = 0; 43497 fixedColumns.forEach((column) => { 43498 fixedWidth += Number(column.realWidth || column.width); 43499 }); 43500 this.fixedWidth.value = fixedWidth; 43501 } 43502 const rightFixedColumns = this.store.states.rightFixedColumns.value; 43503 if (rightFixedColumns.length > 0) { 43504 let rightFixedWidth = 0; 43505 rightFixedColumns.forEach((column) => { 43506 rightFixedWidth += Number(column.realWidth || column.width); 43507 }); 43508 this.rightFixedWidth.value = rightFixedWidth; 43509 } 43510 this.notifyObservers("columns"); 43511 } 43512 addObserver(observer) { 43513 this.observers.push(observer); 43514 } 43515 removeObserver(observer) { 43516 const index = this.observers.indexOf(observer); 43517 if (index !== -1) { 43518 this.observers.splice(index, 1); 43519 } 43520 } 43521 notifyObservers(event) { 43522 const observers = this.observers; 43523 observers.forEach((observer) => { 43524 var _a, _b; 43525 switch (event) { 43526 case "columns": 43527 (_a = observer.state) == null ? void 0 : _a.onColumnsChange(this); 43528 break; 43529 case "scrollable": 43530 (_b = observer.state) == null ? void 0 : _b.onScrollableChange(this); 43531 break; 43532 default: 43533 throw new Error(`Table Layout don't have event ${event}.`); 43534 } 43535 }); 43536 } 43537 } 43538 var TableLayout$1 = TableLayout; 43539 43540 const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox; 43541 const _sfc_main$r = vue.defineComponent({ 43542 name: "ElTableFilterPanel", 43543 components: { 43544 ElCheckbox, 43545 ElCheckboxGroup, 43546 ElScrollbar, 43547 ElTooltip, 43548 ElIcon, 43549 ArrowDown: arrow_down_default, 43550 ArrowUp: arrow_up_default 43551 }, 43552 directives: { ClickOutside }, 43553 props: { 43554 placement: { 43555 type: String, 43556 default: "bottom-start" 43557 }, 43558 store: { 43559 type: Object 43560 }, 43561 column: { 43562 type: Object 43563 }, 43564 upDataColumn: { 43565 type: Function 43566 } 43567 }, 43568 setup(props) { 43569 const instance = vue.getCurrentInstance(); 43570 const { t } = useLocale(); 43571 const ns = useNamespace("table-filter"); 43572 const parent = instance == null ? void 0 : instance.parent; 43573 if (!parent.filterPanels.value[props.column.id]) { 43574 parent.filterPanels.value[props.column.id] = instance; 43575 } 43576 const tooltipVisible = vue.ref(false); 43577 const tooltip = vue.ref(null); 43578 const filters = vue.computed(() => { 43579 return props.column && props.column.filters; 43580 }); 43581 const filterValue = vue.computed({ 43582 get: () => { 43583 var _a; 43584 return (((_a = props.column) == null ? void 0 : _a.filteredValue) || [])[0]; 43585 }, 43586 set: (value) => { 43587 if (filteredValue.value) { 43588 if (typeof value !== "undefined" && value !== null) { 43589 filteredValue.value.splice(0, 1, value); 43590 } else { 43591 filteredValue.value.splice(0, 1); 43592 } 43593 } 43594 } 43595 }); 43596 const filteredValue = vue.computed({ 43597 get() { 43598 if (props.column) { 43599 return props.column.filteredValue || []; 43600 } 43601 return []; 43602 }, 43603 set(value) { 43604 if (props.column) { 43605 props.upDataColumn("filteredValue", value); 43606 } 43607 } 43608 }); 43609 const multiple = vue.computed(() => { 43610 if (props.column) { 43611 return props.column.filterMultiple; 43612 } 43613 return true; 43614 }); 43615 const isActive = (filter) => { 43616 return filter.value === filterValue.value; 43617 }; 43618 const hidden = () => { 43619 tooltipVisible.value = false; 43620 }; 43621 const showFilterPanel = (e) => { 43622 e.stopPropagation(); 43623 tooltipVisible.value = !tooltipVisible.value; 43624 }; 43625 const hideFilterPanel = () => { 43626 tooltipVisible.value = false; 43627 }; 43628 const handleConfirm = () => { 43629 confirmFilter(filteredValue.value); 43630 hidden(); 43631 }; 43632 const handleReset = () => { 43633 filteredValue.value = []; 43634 confirmFilter(filteredValue.value); 43635 hidden(); 43636 }; 43637 const handleSelect = (_filterValue) => { 43638 filterValue.value = _filterValue; 43639 if (typeof _filterValue !== "undefined" && _filterValue !== null) { 43640 confirmFilter(filteredValue.value); 43641 } else { 43642 confirmFilter([]); 43643 } 43644 hidden(); 43645 }; 43646 const confirmFilter = (filteredValue2) => { 43647 props.store.commit("filterChange", { 43648 column: props.column, 43649 values: filteredValue2 43650 }); 43651 props.store.updateAllSelected(); 43652 }; 43653 vue.watch(tooltipVisible, (value) => { 43654 if (props.column) { 43655 props.upDataColumn("filterOpened", value); 43656 } 43657 }, { 43658 immediate: true 43659 }); 43660 const popperPaneRef = vue.computed(() => { 43661 var _a, _b; 43662 return (_b = (_a = tooltip.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef; 43663 }); 43664 return { 43665 tooltipVisible, 43666 multiple, 43667 filteredValue, 43668 filterValue, 43669 filters, 43670 handleConfirm, 43671 handleReset, 43672 handleSelect, 43673 isActive, 43674 t, 43675 ns, 43676 showFilterPanel, 43677 hideFilterPanel, 43678 popperPaneRef, 43679 tooltip 43680 }; 43681 } 43682 });
43683 const _hoisted_1$c = { key: 0 }; 43684 const _hoisted_2$8 = ["disabled"]; 43685 const _hoisted_3$3 = ["label", "onClick"]; 43686 function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) { 43687 const _component_el_checkbox = vue.resolveComponent("el-checkbox"); 43688 const _component_el_checkbox_group = vue.resolveComponent("el-checkbox-group"); 43689 const _component_el_scrollbar = vue.resolveComponent("el-scrollbar"); 43690 const _component_arrow_up = vue.resolveComponent("arrow-up"); 43691 const _component_arrow_down = vue.resolveComponent("arrow-down"); 43692 const _component_el_icon = vue.resolveComponent("el-icon"); 43693 const _component_el_tooltip = vue.resolveComponent("el-tooltip"); 43694 const _directive_click_outside = vue.resolveDirective("click-outside"); 43695 return vue.openBlock(), vue.createBlock(_component_el_tooltip, { 43696 ref: "tooltip", 43697 visible: _ctx.tooltipVisible, 43698 offset: 0, 43699 placement: _ctx.placement, 43700 "show-arrow": false, 43701 "stop-popper-mouse-event": false, 43702 teleported: "", 43703 effect: "light", 43704 pure: "", 43705 "popper-class": _ctx.ns.b(), 43706 persistent: "" 43707 }, { 43708 content: vue.withCtx(() => [ 43709 _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [ 43710 vue.createElementVNode("div", { 43711 class: vue.normalizeClass(_ctx.ns.e("content")) 43712 }, [ 43713 vue.createVNode(_component_el_scrollbar, { 43714 "wrap-class": _ctx.ns.e("wrap") 43715 }, { 43716 default: vue.withCtx(() => [ 43717 vue.createVNode(_component_el_checkbox_group, { 43718 modelValue: _ctx.filteredValue, 43719 "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filteredValue = $event), 43720 class: vue.normalizeClass(_ctx.ns.e("checkbox-group")) 43721 }, { 43722 default: vue.withCtx(() => [ 43723 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.filters, (filter) => { 43724 return vue.openBlock(), vue.createBlock(_component_el_checkbox, { 43725 key: filter.value, 43726 label: filter.value 43727 }, { 43728 default: vue.withCtx(() => [ 43729 vue.createTextVNode(vue.toDisplayString(filter.text), 1) 43730 ]), 43731 _: 2 43732 }, 1032, ["label"]); 43733 }), 128)) 43734 ]), 43735 _: 1 43736 }, 8, ["modelValue", "class"]) 43737 ]), 43738 _: 1 43739 }, 8, ["wrap-class"]) 43740 ], 2), 43741 vue.createElementVNode("div", { 43742 class: vue.normalizeClass(_ctx.ns.e("bottom")) 43743 }, [ 43744 vue.createElementVNode("button", { 43745 class: vue.normalizeClass({ [_ctx.ns.is("disabled")]: _ctx.filteredValue.length === 0 }), 43746 disabled: _ctx.filteredValue.length === 0, 43747 type: "button", 43748 onClick: _cache[1] || (_cache[1] = (...args) => _ctx.handleConfirm && _ctx.handleConfirm(...args)) 43749 }, vue.toDisplayString(_ctx.t("el.table.confirmFilter")), 11, _hoisted_2$8), 43750 vue.createElementVNode("button", { 43751 type: "button", 43752 onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleReset && _ctx.handleReset(...args)) 43753 }, vue.toDisplayString(_ctx.t("el.table.resetFilter")), 1) 43754 ], 2) 43755 ])) : (vue.openBlock(), vue.createElementBlock("ul", { 43756 key: 1, 43757 class: vue.normalizeClass(_ctx.ns.e("list")) 43758 }, [ 43759 vue.createElementVNode("li", { 43760 class: vue.normalizeClass([ 43761 _ctx.ns.e("list-item"), 43762 { 43763 [_ctx.ns.is("active")]: _ctx.filterValue === void 0 || _ctx.filterValue === null 43764 } 43765 ]), 43766 onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleSelect(null)) 43767 }, vue.toDisplayString(_ctx.t("el.table.clearFilter")), 3), 43768 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.filters, (filter) => {
43769 return vue.openBlock(), vue.createElementBlock("li", { 43770 key: filter.value, 43771 class: vue.normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]), 43772 label: filter.value, 43773 onClick: ($event) => _ctx.handleSelect(filter.value) 43774 }, vue.toDisplayString(filter.text), 11, _hoisted_3$3); 43775 }), 128)) 43776 ], 2)) 43777 ]), 43778 default: vue.withCtx(() => [ 43779 vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", { 43780 class: vue.normalizeClass([ 43781 `${_ctx.ns.namespace.value}-table__column-filter-trigger`, 43782 `${_ctx.ns.namespace.value}-none-outline` 43783 ]), 43784 onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showFilterPanel && _ctx.showFilterPanel(...args)) 43785 }, [ 43786 vue.createVNode(_component_el_icon, null, { 43787 default: vue.withCtx(() => [ 43788 _ctx.column.filterOpened ? (vue.openBlock(), vue.createBlock(_component_arrow_up, { key: 0 })) : (vue.openBlock(), vue.createBlock(_component_arrow_down, { key: 1 })) 43789 ]), 43790 _: 1 43791 }) 43792 ], 2)), [ 43793 [_directive_click_outside, _ctx.hideFilterPanel, _ctx.popperPaneRef] 43794 ]) 43795 ]), 43796 _: 1 43797 }, 8, ["visible", "placement", "popper-class"]); 43798 } 43799 var FilterPanel = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["render", _sfc_render$4], ["__file", "filter-panel.vue"]]); 43800 43801 function useLayoutObserver(root) { 43802 const instance = vue.getCurrentInstance(); 43803 vue.onBeforeMount(() => { 43804 tableLayout.value.addObserver(instance); 43805 }); 43806 vue.onMounted(() => { 43807 onColumnsChange(tableLayout.value); 43808 onScrollableChange(tableLayout.value); 43809 }); 43810 vue.onUpdated(() => { 43811 onColumnsChange(tableLayout.value); 43812 onScrollableChange(tableLayout.value); 43813 }); 43814 vue.onUnmounted(() => { 43815 tableLayout.value.removeObserver(instance); 43816 }); 43817 const tableLayout = vue.computed(() => { 43818 const layout = root.layout; 43819 if (!layout) { 43820 throw new Error("Can not find table layout."); 43821 } 43822 return layout; 43823 }); 43824 const onColumnsChange = (layout) => { 43825 var _a; 43826 const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col")) || []; 43827 if (!cols.length) 43828 return; 43829 const flattenColumns = layout.getFlattenColumns(); 43830 const columnsMap = {}; 43831 flattenColumns.forEach((column) => { 43832 columnsMap[column.id] = column; 43833 }); 43834 for (let i = 0, j = cols.length; i < j; i++) { 43835 const col = cols[i]; 43836 const name = col.getAttribute("name"); 43837 const column = columnsMap[name]; 43838 if (column) { 43839 col.setAttribute("width", column.realWidth || column.width); 43840 } 43841 } 43842 }; 43843 const onScrollableChange = (layout) => { 43844 var _a, _b; 43845 const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col[name=gutter]")) || []; 43846 for (let i = 0, j = cols.length; i < j; i++) { 43847 const col = cols[i]; 43848 col.setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0"); 43849 } 43850 const ths = ((_b = root.vnode.el) == null ? void 0 : _b.querySelectorAll("th.gutter")) || []; 43851 for (let i = 0, j = ths.length; i < j; i++) { 43852 const th = ths[i]; 43853 th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0"; 43854 th.style.display = layout.scrollY.value ? "" : "none"; 43855 } 43856 }; 43857 return { 43858 tableLayout: tableLayout.value, 43859 onColumnsChange, 43860 onScrollableChange 43861 }; 43862 } 43863 43864 const TABLE_INJECTION_KEY = Symbol("ElTable"); 43865 43866 function useEvent(props, emit) { 43867 const instance = vue.getCurrentInstance(); 43868 const parent = vue.inject(TABLE_INJECTION_KEY); 43869 const handleFilterClick = (event) => { 43870 event.stopPropagation(); 43871 return; 43872 }; 43873 const handleHeaderClick = (event, column) => { 43874 if (!column.filters && column.sortable) { 43875 handleSortClick(event, column, false); 43876 } else if (column.filterable && !column.sortable) { 43877 handleFilterClick(event); 43878 } 43879 parent == null ? void 0 : parent.emit("header-click", column, event); 43880 }; 43881 const handleHeaderContextMenu = (event, column) => { 43882 parent == null ? void 0 : parent.emit("header-contextmenu",
43882column, event); 43883 }; 43884 const draggingColumn = vue.ref(null); 43885 const dragging = vue.ref(false); 43886 const dragState = vue.ref({}); 43887 const handleMouseDown = (event, column) => { 43888 if (!isClient) 43889 return; 43890 if (column.children && column.children.length > 0) 43891 return; 43892 if (draggingColumn.value && props.border) { 43893 dragging.value = true; 43894 const table = parent; 43895 emit("set-drag-visible", true); 43896 const tableEl = table == null ? void 0 : table.vnode.el; 43897 const tableLeft = tableEl.getBoundingClientRect().left; 43898 const columnEl = instance.vnode.el.querySelector(`th.${column.id}`); 43899 const columnRect = columnEl.getBoundingClientRect(); 43900 const minLeft = columnRect.left - tableLeft + 30; 43901 addClass(columnEl, "noclick"); 43902 dragState.value = { 43903 startMouseLeft: event.clientX, 43904 startLeft: columnRect.right - tableLeft, 43905 startColumnLeft: columnRect.left - tableLeft, 43906 tableLeft 43907 }; 43908 const resizeProxy = table == null ? void 0 : table.refs.resizeProxy; 43909 resizeProxy.style.left = `${dragState.value.startLeft}px`; 43910 document.onselectstart = function() { 43911 return false; 43912 }; 43913 document.ondragstart = function() { 43914 return false; 43915 }; 43916 const handleMouseMove2 = (event2) => { 43917 const deltaLeft = event2.clientX - dragState.value.startMouseLeft; 43918 const proxyLeft = dragState.value.startLeft + deltaLeft; 43919 resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`; 43920 }; 43921 const handleMouseUp = () => { 43922 if (dragging.value) { 43923 const { startColumnLeft, startLeft } = dragState.value; 43924 const finalLeft = Number.parseInt(resizeProxy.style.left, 10); 43925 const columnWidth = finalLeft - startColumnLeft; 43926 column.width = column.realWidth = columnWidth; 43927 table == null ? void 0 : table.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event); 43928 requestAnimationFrame(() => { 43929 props.store.scheduleLayout(false, true); 43930 }); 43931 document.body.style.cursor = ""; 43932 dragging.value = false; 43933 draggingColumn.value = null; 43934 dragState.value = {}; 43935 emit("set-drag-visible", false); 43936 } 43937 document.removeEventListener("mousemove", handleMouseMove2); 43938 document.removeEventListener("mouseup", handleMouseUp); 43939 document.onselectstart = null; 43940 document.ondragstart = null; 43941 setTimeout(() => { 43942 removeClass(columnEl, "noclick"); 43943 }, 0); 43944 }; 43945 document.addEventListener("mousemove", handleMouseMove2); 43946 document.addEventListener("mouseup", handleMouseUp); 43947 } 43948 }; 43949 const handleMouseMove = (event, column) => { 43950 if (column.children && column.children.length > 0) 43951 return; 43952 const el = event.target; 43953 if (!isElement$1(el)) { 43954 return; 43955 } 43956 const target = el == null ? void 0 : el.closest("th"); 43957 if (!column || !column.resizable) 43958 return; 43959 if (!dragging.value && props.border) { 43960 const rect = target.getBoundingClientRect(); 43961 const bodyStyle = document.body.style; 43962 if (rect.width > 12 && rect.right - event.pageX < 8) { 43963 bodyStyle.cursor = "col-resize"; 43964 if (hasClass(target, "is-sortable")) { 43965 target.style.cursor = "col-resize"; 43966 } 43967 draggingColumn.value = column; 43968 } else if (!dragging.value) { 43969 bodyStyle.cursor = ""; 43970 if (hasClass(target, "is-sortable")) { 43971 target.style.cursor = "pointer"; 43972 } 43973 draggingColumn.value = null; 43974 } 43975 } 43976 }; 43977 const handleMouseOut = () => { 43978 if (!isClient) 43979 return; 43980 document.body.style.cursor = ""; 43981 }; 43982 const toggleOrder = ({ order, sortOrders }) => { 43983 if (order === "") 43984 return sortOrders[0]; 43985 const index = sortOrders.indexOf(order || null); 43986 return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1]; 43987 }; 43988 const handleSortClick = (event, column, givenOrder) => { 43989 var _a; 43990 event.stopPropagation(); 43991 const order = column.order === givenOrder ? null : givenOrder || toggleOrder(column); 43992 const target = (_a = event.target) == null ? void 0 : _a.closest("th"); 43993 if (target) { 43994 if (hasClass(target, "noclick")) { 43995 removeClass(target, "noclick"); 43996 return; 43997 } 43998 } 43999 if (!column.sortable) 44000 return; 44001 const states = props.store.states; 44002 let sortProp = states.sortProp.value; 44003 let sortOrder; 44004 const sortingColumn = states.sortingColumn.value; 44005 if (sortingColumn !== column || sortingColumn === column && sortingColumn.order === null) { 44006 if (sortingColumn) { 44007 sortingColumn.order = null; 44008 } 44009 states.sortingColumn.value = column; 44010 sortProp = column.property; 44011 } 44012 if (!order) { 44013 sortOrder = column.order = null; 44014 } else { 44015 sortOrder = column.order = order; 44016 } 44017 states.sortProp.value = sortProp; 44018 states.sortOrder.value = sortOrder; 44019 parent == null ? void 0 : parent.store.commit("changeSortCondition"); 44020 }; 44021 return { 44022 handleHeaderClick, 44023 handleHeaderContextMenu, 44024 handleMouseDown, 44025 handleMouseMove, 44026 handleMouseOut, 44027 handleSortClick, 44028 handleFilterClick 44029 }; 44030 } 44031 44032 function useStyle$2(props) { 44033 const parent = vue.inject(TABLE_INJECTION_KEY); 44034 const ns = useNamespace("table"); 44035 const getHeaderRowStyle = (rowIndex) => { 44036 const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle; 44037 if (typeof headerRowStyle === "function") { 44038 return headerRowStyle.call(null, { rowIndex }); 44039 } 44040 return headerRowStyle; 44041 }; 44042 const getHeaderRowClass = (rowIndex) => { 44043 const classes = []; 44044 const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName; 44045 if (typeof headerRowClassName === "string") { 44046 classes.push(headerRowClassName); 44047 } else if (typeof headerRowClassName === "function") { 44048 classes.push(headerRowClassName.call(null, { rowIndex })); 44049 } 44050 return classes.join(" "); 44051 };
44052 const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => { 44053 var _a; 44054 let headerCellStyles = (_a = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a : {}; 44055 if (typeof headerCellStyles === "function") { 44056 headerCellStyles = headerCellStyles.call(null, { 44057 rowIndex, 44058 columnIndex, 44059 row, 44060 column 44061 }); 44062 } 44063 const fixedStyle = getFixedColumnOffset(columnIndex, column.fixed, props.store, row); 44064 ensurePosition(fixedStyle, "left"); 44065 ensurePosition(fixedStyle, "right"); 44066 return Object.assign({}, headerCellStyles, fixedStyle); 44067 }; 44068 const getHeaderCellClass = (rowIndex, columnIndex, row, column) => { 44069 const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row); 44070 const classes = [ 44071 column.id, 44072 column.order, 44073 column.headerAlign, 44074 column.className, 44075 column.labelClassName, 44076 ...fixedClasses 44077 ]; 44078 if (!column.children) { 44079 classes.push("is-leaf"); 44080 } 44081 if (column.sortable) { 44082 classes.push("is-sortable"); 44083 } 44084 const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName; 44085 if (typeof headerCellClassName === "string") { 44086 classes.push(headerCellClassName); 44087 } else if (typeof headerCellClassName === "function") { 44088 classes.push(headerCellClassName.call(null, { 44089 rowIndex, 44090 columnIndex, 44091 row, 44092 column 44093 })); 44094 } 44095 classes.push(ns.e("cell")); 44096 return classes.filter((className) => Boolean(className)).join(" "); 44097 }; 44098 return { 44099 getHeaderRowStyle, 44100 getHeaderRowClass, 44101 getHeaderCellStyle, 44102 getHeaderCellClass 44103 }; 44104 } 44105 44106 const getAllColumns = (columns) => { 44107 const result = []; 44108 columns.forEach((column) => { 44109 if (column.children) { 44110 result.push(column); 44111 result.push.apply(result, getAllColumns(column.children)); 44112 } else { 44113 result.push(column); 44114 } 44115 }); 44116 return result; 44117 }; 44118 const convertToRows = (originColumns) => { 44119 let maxLevel = 1; 44120 const traverse = (column, parent) => { 44121 if (parent) { 44122 column.level = parent.level + 1; 44123 if (maxLevel < column.level) { 44124 maxLevel = column.level; 44125 } 44126 } 44127 if (column.children) { 44128 let colSpan = 0; 44129 column.children.forEach((subColumn) => { 44130 traverse(subColumn, column); 44131 colSpan += subColumn.colSpan; 44132 }); 44133 column.colSpan = colSpan; 44134 } else { 44135 column.colSpan = 1; 44136 } 44137 }; 44138 originColumns.forEach((column) => { 44139 column.level = 1; 44140 traverse(column, void 0); 44141 }); 44142 const rows = []; 44143 for (let i = 0; i < maxLevel; i++) { 44144 rows.push([]); 44145 } 44146 const allColumns = getAllColumns(originColumns); 44147 allColumns.forEach((column) => { 44148 if (!column.children) { 44149 column.rowSpan = maxLevel - column.level + 1; 44150 } else { 44151 column.rowSpan = 1; 44152 column.children.forEach((col) => col.isSubColumn = true); 44153 } 44154 rows[column.level - 1].push(column); 44155 }); 44156 return rows; 44157 }; 44158 function useUtils$1(props) { 44159 const parent = vue.inject(TABLE_INJECTION_KEY); 44160 const columnRows = vue.computed(() => { 44161 return convertToRows(props.store.states.originColumns.value); 44162 }); 44163 const isGroup = vue.computed(() => { 44164 const result = columnRows.value.length > 1; 44165 if (result && parent) { 44166 parent.state.isGroup.value = true; 44167 } 44168 return result; 44169 }); 44170 const toggleAllSelection = (event) => { 44171 event.stopPropagation(); 44172 parent == null ? void 0 : parent.store.commit("toggleAllSelection"); 44173 }; 44174 return { 44175 isGroup, 44176 toggleAllSelection, 44177 columnRows 44178 }; 44179 } 44180 44181 var TableHeader = vue.defineComponent({ 44182 name: "ElTableHeader", 44183 components: { 44184 ElCheckbox 44185 }, 44186 props: { 44187 fixed: { 44188 type: String, 44189 default: "" 44190 }, 44191 store: { 44192 required: true, 44193 type: Object 44194 }, 44195 border: Boolean, 44196 defaultSort: { 44197 type: Object, 44198 default: () => { 44199 return { 44200 prop: "", 44201 order: "" 44202 }; 44203 } 44204 } 44205 }, 44206 setup(props, { emit }) { 44207 const instance = vue.getCurrentInstance(); 44208 const parent = vue.inject(TABLE_INJECTION_KEY); 44209 const ns = useNamespace("table"); 44210 const filterPanels = vue.ref({}); 44211 const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent); 44212 vue.onMounted(async () => { 44213 await vue.nextTick(); 44214 await vue.nextTick(); 44215 const { prop, order } = props.defaultSort; 44216 parent == null ? void 0 : parent.store.commit("sort", { prop, order, init: true });
44217 }); 44218 const { 44219 handleHeaderClick, 44220 handleHeaderContextMenu, 44221 handleMouseDown, 44222 handleMouseMove, 44223 handleMouseOut, 44224 handleSortClick, 44225 handleFilterClick 44226 } = useEvent(props, emit); 44227 const { 44228 getHeaderRowStyle, 44229 getHeaderRowClass, 44230 getHeaderCellStyle, 44231 getHeaderCellClass 44232 } = useStyle$2(props); 44233 const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props); 44234 instance.state = { 44235 onColumnsChange, 44236 onScrollableChange 44237 }; 44238 instance.filterPanels = filterPanels; 44239 return { 44240 ns, 44241 filterPanels, 44242 onColumnsChange, 44243 onScrollableChange, 44244 columnRows, 44245 getHeaderRowClass, 44246 getHeaderRowStyle, 44247 getHeaderCellClass, 44248 getHeaderCellStyle, 44249 handleHeaderClick, 44250 handleHeaderContextMenu, 44251 handleMouseDown, 44252 handleMouseMove, 44253 handleMouseOut, 44254 handleSortClick, 44255 handleFilterClick, 44256 isGroup, 44257 toggleAllSelection 44258 }; 44259 }, 44260 render() { 44261 const { 44262 ns, 44263 isGroup, 44264 columnRows, 44265 getHeaderCellStyle, 44266 getHeaderCellClass, 44267 getHeaderRowClass, 44268 getHeaderRowStyle, 44269 handleHeaderClick, 44270 handleHeaderContextMenu, 44271 handleMouseDown, 44272 handleMouseMove, 44273 handleSortClick, 44274 handleMouseOut, 44275 store, 44276 $parent 44277 } = this; 44278 let rowSpan = 1; 44279 return vue.h("thead", { 44280 class: { [ns.is("group")]: isGroup } 44281 }, columnRows.map((subColumns, rowIndex) => vue.h("tr", { 44282 class: getHeaderRowClass(rowIndex), 44283 key: rowIndex, 44284 style: getHeaderRowStyle(rowIndex) 44285 }, subColumns.map((column, cellIndex) => { 44286 if (column.rowSpan > rowSpan) { 44287 rowSpan = column.rowSpan; 44288 } 44289 return vue.h("th", { 44290 class: getHeaderCellClass(rowIndex, cellIndex, subColumns, column), 44291 colspan: column.colSpan, 44292 key: `${column.id}-thead`, 44293 rowspan: column.rowSpan, 44294 style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column), 44295 onClick: ($event) => handleHeaderClick($event, column), 44296 onContextmenu: ($event) => handleHeaderContextMenu($event, column), 44297 onMousedown: ($event) => handleMouseDown($event, column), 44298 onMousemove: ($event) => handleMouseMove($event, column), 44299 onMouseout: handleMouseOut 44300 }, [ 44301 vue.h("div", { 44302 class: [ 44303 "cell", 44304 column.filteredValue && column.filteredValue.length > 0 ? "highlight" : "" 44305 ] 44306 }, [ 44307 column.renderHeader ? column.renderHeader({ 44308 column, 44309 $index: cellIndex, 44310 store, 44311 _self: $parent 44312 }) : column.label, 44313 column.sortable && vue.h("span", { 44314 onClick: ($event) => handleSortClick($event, column), 44315 class: "caret-wrapper" 44316 }, [ 44317 vue.h("i", { 44318 onClick: ($event) => handleSortClick($event, column, "ascending"), 44319 class: "sort-caret ascending" 44320 }), 44321 vue.h("i", { 44322 onClick: ($event) => handleSortClick($event, column, "descending"), 44323 class: "sort-caret descending" 44324 }) 44325 ]), 44326 column.filterable && vue.h(FilterPanel, { 44327 store, 44328 placement: column.filterPlacement || "bottom-start", 44329 column, 44330 upDataColumn: (key, value) => { 44331 column[key] = value; 44332 } 44333 }) 44334 ]) 44335 ]); 44336 })))); 44337 } 44338 });
44339 44340 function useEvents(props) { 44341 const parent = vue.inject(TABLE_INJECTION_KEY); 44342 const tooltipContent = vue.ref(""); 44343 const tooltipTrigger = vue.ref(vue.h("div")); 44344 const { nextZIndex } = useZIndex(); 44345 const handleEvent = (event, row, name) => { 44346 var _a; 44347 const table = parent; 44348 const cell = getCell(event); 44349 let column; 44350 const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix; 44351 if (cell) { 44352 column = getColumnByCell({ 44353 columns: props.store.states.columns.value 44354 }, cell, namespace); 44355 if (column) { 44356 table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event); 44357 } 44358 } 44359 table == null ? void 0 : table.emit(`row-${name}`, row, column, event); 44360 }; 44361 const handleDoubleClick = (event, row) => { 44362 handleEvent(event, row, "dblclick"); 44363 }; 44364 const handleClick = (event, row) => { 44365 props.store.commit("setCurrentRow", row); 44366 handleEvent(event, row, "click"); 44367 }; 44368 const handleContextMenu = (event, row) => { 44369 handleEvent(event, row, "contextmenu"); 44370 }; 44371 const handleMouseEnter = debounce((index) => { 44372 props.store.commit("setHoverRow", index); 44373 }, 30); 44374 const handleMouseLeave = debounce(() => { 44375 props.store.commit("setHoverRow", null); 44376 }, 30); 44377 const handleCellMouseEnter = (event, row, tooltipOptions) => { 44378 var _a; 44379 const table = parent; 44380 const cell = getCell(event); 44381 const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix; 44382 if (cell) { 44383 const column = getColumnByCell({ 44384 columns: props.store.states.columns.value 44385 }, cell, namespace); 44386 const hoverState = table.hoverState = { cell, column, row }; 44387 table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event); 44388 } 44389 if (!tooltipOptions) { 44390 return; 44391 } 44392 const cellChild = event.target.querySelector(".cell"); 44393 if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) { 44394 return; 44395 } 44396 const range = document.createRange(); 44397 range.setStart(cellChild, 0); 44398 range.setEnd(cellChild, cellChild.childNodes.length); 44399 const rangeWidth = Math.round(range.getBoundingClientRect().width); 44400 const padding = (Number.parseInt(getStyle(cellChild, "paddingLeft"), 10) || 0) + (Number.parseInt(getStyle(cellChild, "paddingRight"), 10) || 0); 44401 if (rangeWidth + padding > cellChild.offsetWidth || cellChild.scrollWidth > cellChild.offsetWidth) { 44402 createTablePopper(parent == null ? void 0 : parent.refs.tableWrapper, cell, cell.innerText || cell.textContent, nextZIndex, tooltipOptions); 44403 } 44404 }; 44405 const handleCellMouseLeave = (event) => { 44406 const cell = getCell(event); 44407 if (!cell) 44408 return; 44409 const oldHoverState = parent == null ? void 0 : parent.hoverState; 44410 parent == null ? void 0 : parent.emit("cell-mouse-leave", oldHoverState == null ? void 0 : oldHoverState.row, oldHoverState == null ? void 0 : oldHoverState.column, oldHoverState == null ? void 0 : oldHoverState.cell, event); 44411 }; 44412 return { 44413 handleDoubleClick, 44414 handleClick, 44415 handleContextMenu, 44416 handleMouseEnter, 44417 handleMouseLeave, 44418 handleCellMouseEnter, 44419 handleCellMouseLeave, 44420 tooltipContent, 44421 tooltipTrigger 44422 }; 44423 } 44424 44425 function useStyles$1(props) { 44426 const parent = vue.inject(TABLE_INJECTION_KEY); 44427 const ns = useNamespace("table"); 44428 const getRowStyle = (row, rowIndex) => { 44429 const rowStyle = parent == null ? void 0 : parent.props.rowStyle; 44430 if (typeof rowStyle === "function") { 44431 return rowStyle.call(null, { 44432 row, 44433 rowIndex 44434 }); 44435 } 44436 return rowStyle || null; 44437 }; 44438 const getRowClass = (row, rowIndex) => { 44439 const classes = [ns.e("row")]; 44440 if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === props.store.states.currentRow.value) { 44441 classes.push("current-row"); 44442 } 44443 if (props.stripe && rowIndex % 2 === 1) { 44444 classes.push(ns.em("row", "striped")); 44445 } 44446 const rowClassName = parent == null ? void 0 : parent.props.rowClassName; 44447 if (typeof rowClassName === "string") { 44448 classes.push(rowClassName); 44449 } else if (typeof rowClassName === "function") { 44450 classes.push(rowClassName.call(null, { 44451 row, 44452 rowIndex 44453 })); 44454 } 44455 return classes; 44456 };
44457 const getCellStyle = (rowIndex, columnIndex, row, column) => { 44458 const cellStyle = parent == null ? void 0 : parent.props.cellStyle; 44459 let cellStyles = cellStyle != null ? cellStyle : {}; 44460 if (typeof cellStyle === "function") { 44461 cellStyles = cellStyle.call(null, { 44462 rowIndex, 44463 columnIndex, 44464 row, 44465 column 44466 }); 44467 } 44468 const fixedStyle = getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store); 44469 ensurePosition(fixedStyle, "left"); 44470 ensurePosition(fixedStyle, "right"); 44471 return Object.assign({}, cellStyles, fixedStyle); 44472 }; 44473 const getCellClass = (rowIndex, columnIndex, row, column, offset) => { 44474 const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store, void 0, offset); 44475 const classes = [column.id, column.align, column.className, ...fixedClasses]; 44476 const cellClassName = parent == null ? void 0 : parent.props.cellClassName; 44477 if (typeof cellClassName === "string") { 44478 classes.push(cellClassName); 44479 } else if (typeof cellClassName === "function") { 44480 classes.push(cellClassName.call(null, { 44481 rowIndex, 44482 columnIndex, 44483 row, 44484 column 44485 })); 44486 } 44487 classes.push(ns.e("cell")); 44488 return classes.filter((className) => Boolean(className)).join(" "); 44489 }; 44490 const getSpan = (row, column, rowIndex, columnIndex) => { 44491 let rowspan = 1; 44492 let colspan = 1; 44493 const fn = parent == null ? void 0 : parent.props.spanMethod; 44494 if (typeof fn === "function") { 44495 const result = fn({ 44496 row, 44497 column, 44498 rowIndex, 44499 columnIndex 44500 }); 44501 if (Array.isArray(result)) { 44502 rowspan = result[0]; 44503 colspan = result[1]; 44504 } else if (typeof result === "object") { 44505 rowspan = result.rowspan; 44506 colspan = result.colspan; 44507 } 44508 } 44509 return { rowspan, colspan }; 44510 }; 44511 const getColspanRealWidth = (columns, colspan, index) => { 44512 if (colspan < 1) { 44513 return columns[index].realWidth; 44514 } 44515 const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan); 44516 return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1)); 44517 }; 44518 return { 44519 getRowStyle, 44520 getRowClass, 44521 getCellStyle, 44522 getCellClass, 44523 getSpan, 44524 getColspanRealWidth 44525 }; 44526 } 44527 44528 function useRender$1(props) { 44529 const parent = vue.inject(TABLE_INJECTION_KEY); 44530 const ns = useNamespace("table"); 44531 const { 44532 handleDoubleClick, 44533 handleClick, 44534 handleContextMenu, 44535 handleMouseEnter, 44536 handleMouseLeave, 44537 handleCellMouseEnter, 44538 handleCellMouseLeave, 44539 tooltipContent, 44540 tooltipTrigger 44541 } = useEvents(props); 44542 const { 44543 getRowStyle, 44544 getRowClass, 44545 getCellStyle, 44546 getCellClass, 44547 getSpan, 44548 getColspanRealWidth 44549 } = useStyles$1(props); 44550 const firstDefaultColumnIndex = vue.computed(() => { 44551 return props.store.states.columns.value.findIndex(({ type }) => type === "default"); 44552 }); 44553 const getKeyOfRow = (row, index) => { 44554 const rowKey = parent.props.rowKey; 44555 if (rowKey) { 44556 return getRowIdentity(row, rowKey); 44557 } 44558 return index; 44559 }; 44560 const rowRender = (row, $index, treeRowData, expanded = false) => { 44561 const { tooltipEffect, tooltipOptions, store } = props; 44562 const { indent, columns } = store.states; 44563 const rowClasses = getRowClass(row, $index); 44564 let display = true; 44565 if (treeRowData) { 44566 rowClasses.push(ns.em("row", `level-${treeRowData.level}`)); 44567 display = treeRowData.display; 44568 } 44569 const displayStyle = display ? null : { 44570 display: "none" 44571 }; 44572 return vue.h("tr", { 44573 style: [displayStyle, getRowStyle(row, $index)],
44574 class: rowClasses, 44575 key: getKeyOfRow(row, $index), 44576 onDblclick: ($event) => handleDoubleClick($event, row), 44577 onClick: ($event) => handleClick($event, row), 44578 onContextmenu: ($event) => handleContextMenu($event, row), 44579 onMouseenter: () => handleMouseEnter($index), 44580 onMouseleave: handleMouseLeave 44581 }, columns.value.map((column, cellIndex) => { 44582 const { rowspan, colspan } = getSpan(row, column, $index, cellIndex); 44583 if (!rowspan || !colspan) { 44584 return null; 44585 } 44586 const columnData = { ...column }; 44587 columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex); 44588 const data = { 44589 store: props.store, 44590 _self: props.context || parent, 44591 column: columnData, 44592 row, 44593 $index, 44594 cellIndex, 44595 expanded 44596 }; 44597 if (cellIndex === firstDefaultColumnIndex.value && treeRowData) { 44598 data.treeNode = { 44599 indent: treeRowData.level * indent.value, 44600 level: treeRowData.level 44601 }; 44602 if (typeof treeRowData.expanded === "boolean") { 44603 data.treeNode.expanded = treeRowData.expanded; 44604 if ("loading" in treeRowData) { 44605 data.treeNode.loading = treeRowData.loading; 44606 } 44607 if ("noLazyChildren" in treeRowData) { 44608 data.treeNode.noLazyChildren = treeRowData.noLazyChildren; 44609 } 44610 } 44611 } 44612 const baseKey = `${$index},${cellIndex}`; 44613 const patchKey = columnData.columnKey || columnData.rawColumnKey || ""; 44614 const tdChildren = cellChildren(cellIndex, column, data); 44615 const mergedTooltipOptions = column.showOverflowTooltip && merge({ 44616 effect: tooltipEffect 44617 }, tooltipOptions, column.showOverflowTooltip); 44618 return vue.h("td", { 44619 style: getCellStyle($index, cellIndex, row, column), 44620 class: getCellClass($index, cellIndex, row, column, colspan - 1), 44621 key: `${patchKey}${baseKey}`, 44622 rowspan, 44623 colspan, 44624 onMouseenter: ($event) => handleCellMouseEnter($event, row, mergedTooltipOptions), 44625 onMouseleave: handleCellMouseLeave 44626 }, [tdChildren]); 44627 })); 44628 }; 44629 const cellChildren = (cellIndex, column, data) => { 44630 return column.renderCell(data); 44631 }; 44632 const wrappedRowRender = (row, $index) => { 44633 const store = props.store; 44634 const { isRowExpanded, assertRowKey } = store; 44635 const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states; 44636 const columns = store.states.columns.value; 44637 const hasExpandColumn = columns.some(({ type }) => type === "expand"); 44638 if (hasExpandColumn) { 44639 const expanded = isRowExpanded(row); 44640 const tr = rowRender(row, $index, void 0, expanded); 44641 const renderExpanded = parent.renderExpanded; 44642 if (expanded) { 44643 if (!renderExpanded) { 44644 console.error("[Element Error]renderExpanded is required."); 44645 return tr; 44646 } 44647 return [ 44648 [ 44649 tr, 44650 vue.h("tr", { 44651 key: `expanded-row__${tr.key}` 44652 }, [ 44653 vue.h("td", { 44654 colspan: columns.length, 44655 class: `${ns.e("cell")} ${ns.e("expanded-cell")}` 44656 }, [renderExpanded({ row, $index, store, expanded })]) 44657 ]) 44658 ] 44659 ]; 44660 } else { 44661 return [[tr]]; 44662 } 44663 } else if (Object.keys(treeData.value).length) { 44664 assertRowKey(); 44665 const key = getRowIdentity(row, rowKey.value); 44666 let cur = treeData.value[key]; 44667 let treeRowData = null; 44668 if (cur) { 44669 treeRowData = { 44670 expanded: cur.expanded, 44671 level: cur.level, 44672 display: true 44673 }; 44674 if (typeof cur.lazy === "boolean") { 44675 if (typeof cur.loaded === "boolean" && cur.loaded) { 44676 treeRowData.noLazyChildren = !(cur.children && cur.children.length); 44677 } 44678 treeRowData.loading = cur.loading; 44679 } 44680 } 44681 const tmp = [rowRender(row, $index, treeRowData)]; 44682 if (cur) { 44683 let i = 0; 44684 const traverse = (children, parent2) => { 44685 if (!(children && children.length && parent2)) 44686 return;
44687 children.forEach((node) => { 44688 const innerTreeRowData = { 44689 display: parent2.display && parent2.expanded, 44690 level: parent2.level + 1, 44691 expanded: false, 44692 noLazyChildren: false, 44693 loading: false 44694 }; 44695 const childKey = getRowIdentity(node, rowKey.value); 44696 if (childKey === void 0 || childKey === null) { 44697 throw new Error("For nested data item, row-key is required."); 44698 } 44699 cur = { ...treeData.value[childKey] }; 44700 if (cur) { 44701 innerTreeRowData.expanded = cur.expanded; 44702 cur.level = cur.level || innerTreeRowData.level; 44703 cur.display = !!(cur.expanded && innerTreeRowData.display); 44704 if (typeof cur.lazy === "boolean") { 44705 if (typeof cur.loaded === "boolean" && cur.loaded) { 44706 innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length); 44707 } 44708 innerTreeRowData.loading = cur.loading; 44709 } 44710 } 44711 i++; 44712 tmp.push(rowRender(node, $index + i, innerTreeRowData)); 44713 if (cur) { 44714 const nodes2 = lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value]; 44715 traverse(nodes2, cur); 44716 } 44717 }); 44718 }; 44719 cur.display = true; 44720 const nodes = lazyTreeNodeMap.value[key] || row[childrenColumnName.value]; 44721 traverse(nodes, cur); 44722 } 44723 return tmp; 44724 } else { 44725 return rowRender(row, $index, void 0); 44726 } 44727 }; 44728 return { 44729 wrappedRowRender, 44730 tooltipContent, 44731 tooltipTrigger 44732 }; 44733 } 44734 44735 const defaultProps$2 = { 44736 store: { 44737 required: true, 44738 type: Object 44739 }, 44740 stripe: Boolean, 44741 tooltipEffect: String, 44742 tooltipOptions: { 44743 type: Object 44744 }, 44745 context: { 44746 default: () => ({}), 44747 type: Object 44748 }, 44749 rowClassName: [String, Function], 44750 rowStyle: [Object, Function], 44751 fixed: { 44752 type: String, 44753 default: "" 44754 }, 44755 highlight: Boolean 44756 }; 44757 var defaultProps$3 = defaultProps$2; 44758 44759 var TableBody = vue.defineComponent({ 44760 name: "ElTableBody", 44761 props: defaultProps$3, 44762 setup(props) { 44763 const instance = vue.getCurrentInstance(); 44764 const parent = vue.inject(TABLE_INJECTION_KEY); 44765 const ns = useNamespace("table"); 44766 const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props); 44767 const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent); 44768 vue.watch(props.store.states.hoverRow, (newVal, oldVal) => { 44769 if (!props.store.states.isComplex.value || !isClient) 44770 return; 44771 let raf = window.requestAnimationFrame; 44772 if (!raf) { 44773 raf = (fn) => window.setTimeout(fn, 16); 44774 } 44775 raf(() => { 44776 const el = instance == null ? void 0 : instance.vnode.el; 44777 const rows = Array.from((el == null ? void 0 : el.children) || []).filter((e) => e == null ? void 0 : e.classList.contains(`${ns.e("row")}`)); 44778 const oldRow = rows[oldVal]; 44779 const newRow = rows[newVal]; 44780 if (oldRow) { 44781 removeClass(oldRow, "hover-row"); 44782 } 44783 if (newRow) { 44784 addClass(newRow, "hover-row"); 44785 } 44786 }); 44787 }); 44788 vue.onUnmounted(() => { 44789 var _a; 44790 (_a = removePopper) == null ? void 0 : _a(); 44791 }); 44792 return { 44793 ns, 44794 onColumnsChange, 44795 onScrollableChange, 44796 wrappedRowRender, 44797 tooltipContent, 44798 tooltipTrigger 44799 }; 44800 }, 44801 render() { 44802 const { wrappedRowRender, store } = this; 44803 const data = store.states.data.value || []; 44804 return vue.h("tbody", {}, [ 44805 data.reduce((acc, row) => { 44806 return acc.concat(wrappedRowRender(row, acc.length)); 44807 }, []) 44808 ]); 44809 } 44810 });
44811 44812 function hColgroup(props) { 44813 const isAuto = props.tableLayout === "auto"; 44814 let columns = props.columns || []; 44815 if (isAuto) { 44816 if (columns.every((column) => column.width === void 0)) { 44817 columns = []; 44818 } 44819 } 44820 const getPropsData = (column) => { 44821 const propsData = { 44822 key: `${props.tableLayout}_${column.id}`, 44823 style: {}, 44824 name: void 0 44825 }; 44826 if (isAuto) { 44827 propsData.style = { 44828 width: `${column.width}px` 44829 }; 44830 } else { 44831 propsData.name = column.id; 44832 } 44833 return propsData; 44834 }; 44835 return vue.h("colgroup", {}, columns.map((column) => vue.h("col", getPropsData(column)))); 44836 } 44837 hColgroup.props = ["columns", "tableLayout"]; 44838 44839 function useMapState() { 44840 const table = vue.inject(TABLE_INJECTION_KEY); 44841 const store = table == null ? void 0 : table.store; 44842 const leftFixedLeafCount = vue.computed(() => { 44843 return store.states.fixedLeafColumnsLength.value; 44844 }); 44845 const rightFixedLeafCount = vue.computed(() => { 44846 return store.states.rightFixedColumns.value.length; 44847 }); 44848 const columnsCount = vue.computed(() => { 44849 return store.states.columns.value.length; 44850 }); 44851 const leftFixedCount = vue.computed(() => { 44852 return store.states.fixedColumns.value.length; 44853 }); 44854 const rightFixedCount = vue.computed(() => { 44855 return store.states.rightFixedColumns.value.length; 44856 }); 44857 return { 44858 leftFixedLeafCount, 44859 rightFixedLeafCount, 44860 columnsCount, 44861 leftFixedCount, 44862 rightFixedCount, 44863 columns: store.states.columns 44864 }; 44865 } 44866 44867 function useStyle$1(props) { 44868 const { columns } = useMapState(); 44869 const ns = useNamespace("table"); 44870 const getCellClasses = (columns2, cellIndex) => { 44871 const column = columns2[cellIndex]; 44872 const classes = [ 44873 ns.e("cell"), 44874 column.id, 44875 column.align, 44876 column.labelClassName, 44877 ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store) 44878 ]; 44879 if (column.className) { 44880 classes.push(column.className); 44881 } 44882 if (!column.children) { 44883 classes.push(ns.is("leaf")); 44884 } 44885 return classes; 44886 }; 44887 const getCellStyles = (column, cellIndex) => { 44888 const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store); 44889 ensurePosition(fixedStyle, "left"); 44890 ensurePosition(fixedStyle, "right"); 44891 return fixedStyle; 44892 }; 44893 return { 44894 getCellClasses, 44895 getCellStyles, 44896 columns 44897 }; 44898 } 44899 44900 var TableFooter = vue.defineComponent({ 44901 name: "ElTableFooter", 44902 props: { 44903 fixed: { 44904 type: String, 44905 default: "" 44906 }, 44907 store: { 44908 required: true, 44909 type: Object 44910 }, 44911 summaryMethod: Function, 44912 sumText: String, 44913 border: Boolean, 44914 defaultSort: { 44915 type: Object, 44916 default: () => { 44917 return { 44918 prop: "", 44919 order: "" 44920 }; 44921 } 44922 } 44923 }, 44924 setup(props) { 44925 const { getCellClasses, getCellStyles, columns } = useStyle$1(props); 44926 const ns = useNamespace("table"); 44927 return { 44928 ns, 44929 getCellClasses, 44930 getCellStyles, 44931 columns 44932 }; 44933 }, 44934 render() { 44935 const { 44936 columns, 44937 getCellStyles, 44938 getCellClasses, 44939 summaryMethod, 44940 sumText, 44941 ns 44942 } = this; 44943 const data = this.store.states.data.value; 44944 let sums = []; 44945 if (summaryMethod) { 44946 sums = summaryMethod({ 44947 columns, 44948 data 44949 }); 44950 } else { 44951 columns.forEach((column, index) => { 44952 if (index === 0) { 44953 sums[index] = sumText; 44954 return; 44955 } 44956 const values = data.map((item) => Number(item[column.property])); 44957 const precisions = []; 44958 let notNumber = true;
44959 values.forEach((value) => { 44960 if (!Number.isNaN(+value)) { 44961 notNumber = false; 44962 const decimal = `${value}`.split(".")[1]; 44963 precisions.push(decimal ? decimal.length : 0); 44964 } 44965 }); 44966 const precision = Math.max.apply(null, precisions); 44967 if (!notNumber) { 44968 sums[index] = values.reduce((prev, curr) => { 44969 const value = Number(curr); 44970 if (!Number.isNaN(+value)) { 44971 return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20))); 44972 } else { 44973 return prev; 44974 } 44975 }, 0); 44976 } else { 44977 sums[index] = ""; 44978 } 44979 }); 44980 } 44981 return vue.h("table", { 44982 class: ns.e("footer"), 44983 cellspacing: "0", 44984 cellpadding: "0", 44985 border: "0" 44986 }, [ 44987 hColgroup({ 44988 columns 44989 }), 44990 vue.h("tbody", [ 44991 vue.h("tr", {}, [ 44992 ...columns.map((column, cellIndex) => vue.h("td", { 44993 key: cellIndex, 44994 colspan: column.colSpan, 44995 rowspan: column.rowSpan, 44996 class: getCellClasses(columns, cellIndex), 44997 style: getCellStyles(column, cellIndex) 44998 }, [ 44999 vue.h("div", { 45000 class: ["cell", column.labelClassName] 45001 }, [sums[cellIndex]]) 45002 ])) 45003 ]) 45004 ]) 45005 ]); 45006 } 45007 }); 45008 45009 function useUtils(store) { 45010 const setCurrentRow = (row) => { 45011 store.commit("setCurrentRow", row); 45012 }; 45013 const getSelectionRows = () => { 45014 return store.getSelectionRows(); 45015 }; 45016 const toggleRowSelection = (row, selected) => { 45017 store.toggleRowSelection(row, selected, false); 45018 store.updateAllSelected(); 45019 }; 45020 const clearSelection = () => { 45021 store.clearSelection(); 45022 }; 45023 const clearFilter = (columnKeys) => { 45024 store.clearFilter(columnKeys); 45025 }; 45026 const toggleAllSelection = () => { 45027 store.commit("toggleAllSelection"); 45028 }; 45029 const toggleRowExpansion = (row, expanded) => { 45030 store.toggleRowExpansionAdapter(row, expanded); 45031 }; 45032 const clearSort = () => { 45033 store.clearSort(); 45034 }; 45035 const sort = (prop, order) => { 45036 store.commit("sort", { prop, order }); 45037 }; 45038 return { 45039 setCurrentRow, 45040 getSelectionRows, 45041 toggleRowSelection, 45042 clearSelection, 45043 clearFilter, 45044 toggleAllSelection, 45045 toggleRowExpansion, 45046 clearSort, 45047 sort 45048 }; 45049 } 45050 45051 function useStyle(props, layout, store, table) { 45052 const isHidden = vue.ref(false); 45053 const renderExpanded = vue.ref(null); 45054 const resizeProxyVisible = vue.ref(false); 45055 const setDragVisible = (visible) => { 45056 resizeProxyVisible.value = visible; 45057 }; 45058 const resizeState = vue.ref({ 45059 width: null, 45060 height: null, 45061 headerHeight: null 45062 }); 45063 const isGroup = vue.ref(false); 45064 const scrollbarViewStyle = { 45065 display: "inline-block", 45066 verticalAlign: "middle" 45067 }; 45068 const tableWidth = vue.ref(); 45069 const tableScrollHeight = vue.ref(0);
45070 const bodyScrollHeight = vue.ref(0); 45071 const headerScrollHeight = vue.ref(0); 45072 const footerScrollHeight = vue.ref(0); 45073 vue.watchEffect(() => { 45074 layout.setHeight(props.height); 45075 }); 45076 vue.watchEffect(() => { 45077 layout.setMaxHeight(props.maxHeight); 45078 }); 45079 vue.watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => { 45080 if (!vue.unref(rowKey) || !vue.unref(currentRowKey)) 45081 return; 45082 store.setCurrentRowKey(`${currentRowKey}`); 45083 }, { 45084 immediate: true 45085 }); 45086 vue.watch(() => props.data, (data) => { 45087 table.store.commit("setData", data); 45088 }, { 45089 immediate: true, 45090 deep: true 45091 }); 45092 vue.watchEffect(() => { 45093 if (props.expandRowKeys) { 45094 store.setExpandRowKeysAdapter(props.expandRowKeys); 45095 } 45096 }); 45097 const handleMouseLeave = () => { 45098 table.store.commit("setHoverRow", null); 45099 if (table.hoverState) 45100 table.hoverState = null; 45101 }; 45102 const handleHeaderFooterMousewheel = (event, data) => { 45103 const { pixelX, pixelY } = data; 45104 if (Math.abs(pixelX) >= Math.abs(pixelY)) { 45105 table.refs.bodyWrapper.scrollLeft += data.pixelX / 5; 45106 } 45107 }; 45108 const shouldUpdateHeight = vue.computed(() => { 45109 return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0; 45110 }); 45111 const tableBodyStyles = vue.computed(() => { 45112 return { 45113 width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : "" 45114 }; 45115 }); 45116 const doLayout = () => { 45117 if (shouldUpdateHeight.value) { 45118 layout.updateElsHeight(); 45119 } 45120 layout.updateColumnsWidth(); 45121 requestAnimationFrame(syncPosition); 45122 }; 45123 vue.onMounted(async () => { 45124 await vue.nextTick(); 45125 store.updateColumns(); 45126 bindEvents(); 45127 requestAnimationFrame(doLayout); 45128 const el = table.vnode.el; 45129 const tableHeader = table.refs.headerWrapper; 45130 if (props.flexible && el && el.parentElement) { 45131 el.parentElement.style.minWidth = "0"; 45132 } 45133 resizeState.value = { 45134 width: tableWidth.value = el.offsetWidth, 45135 height: el.offsetHeight, 45136 headerHeight: props.showHeader && tableHeader ? tableHeader.offsetHeight : null 45137 }; 45138 store.states.columns.value.forEach((column) => { 45139 if (column.filteredValue && column.filteredValue.length) { 45140 table.store.commit("filterChange", { 45141 column, 45142 values: column.filteredValue, 45143 silent: true 45144 }); 45145 } 45146 }); 45147 table.$ready = true; 45148 }); 45149 const setScrollClassByEl = (el, className) => { 45150 if (!el) 45151 return; 45152 const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-")); 45153 classList.push(layout.scrollX.value ? className : "is-scrolling-none"); 45154 el.className = classList.join(" "); 45155 }; 45156 const setScrollClass = (className) => { 45157 const { tableWrapper }
45157 = table.refs; 45158 setScrollClassByEl(tableWrapper, className); 45159 }; 45160 const hasScrollClass = (className) => { 45161 const { tableWrapper } = table.refs; 45162 return !!(tableWrapper && tableWrapper.classList.contains(className)); 45163 }; 45164 const syncPosition = function() { 45165 if (!table.refs.scrollBarRef) 45166 return; 45167 if (!layout.scrollX.value) { 45168 const scrollingNoneClass = "is-scrolling-none"; 45169 if (!hasScrollClass(scrollingNoneClass)) { 45170 setScrollClass(scrollingNoneClass); 45171 } 45172 return; 45173 } 45174 const scrollContainer = table.refs.scrollBarRef.wrapRef; 45175 if (!scrollContainer) 45176 return; 45177 const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer; 45178 const { headerWrapper, footerWrapper } = table.refs; 45179 if (headerWrapper) 45180 headerWrapper.scrollLeft = scrollLeft; 45181 if (footerWrapper) 45182 footerWrapper.scrollLeft = scrollLeft; 45183 const maxScrollLeftPosition = scrollWidth - offsetWidth - 1; 45184 if (scrollLeft >= maxScrollLeftPosition) { 45185 setScrollClass("is-scrolling-right"); 45186 } else if (scrollLeft === 0) { 45187 setScrollClass("is-scrolling-left"); 45188 } else { 45189 setScrollClass("is-scrolling-middle"); 45190 } 45191 }; 45192 const bindEvents = () => { 45193 if (!table.refs.scrollBarRef) 45194 return; 45195 if (table.refs.scrollBarRef.wrapRef) { 45196 useEventListener(table.refs.scrollBarRef.wrapRef, "scroll", syncPosition, { 45197 passive: true 45198 }); 45199 } 45200 if (props.fit) { 45201 useResizeObserver(table.vnode.el, resizeListener); 45202 } else { 45203 useEventListener(window, "resize", resizeListener); 45204 } 45205 useResizeObserver(table.refs.bodyWrapper, () => { 45206 var _a, _b; 45207 resizeListener(); 45208 (_b = (_a = table.refs) == null ? void 0 : _a.scrollBarRef) == null ? void 0 : _b.update(); 45209 }); 45210 }; 45211 const resizeListener = () => { 45212 var _a, _b, _c; 45213 const el = table.vnode.el; 45214 if (!table.$ready || !el) 45215 return; 45216 let shouldUpdateLayout = false; 45217 const { 45218 width: oldWidth, 45219 height: oldHeight, 45220 headerHeight: oldHeaderHeight 45221 } = resizeState.value; 45222 const width = tableWidth.value = el.offsetWidth; 45223 if (oldWidth !== width) { 45224 shouldUpdateLayout = true; 45225 } 45226 const height = el.offsetHeight; 45227 if ((props.height || shouldUpdateHeight.value) && oldHeight !== height) { 45228 shouldUpdateLayout = true; 45229 } 45230 const tableHeader = props.tableLayout === "fixed" ? table.refs.headerWrapper : (_a = table.refs.tableHeaderRef) == null ? void 0 : _a.$el; 45231 if (props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) !== oldHeaderHeight) { 45232 shouldUpdateLayout = true; 45233 } 45234 tableScrollHeight.value = ((_b = table.refs.tableWrapper) == null ? void 0 : _b.scrollHeight) || 0; 45235 headerScrollHeight.value = (tableHeader == null ? void 0 : tableHeader.scrollHeight) || 0; 45236 footerScrollHeight.value = ((_c = table.refs.footerWrapper) == null ? void 0 : _c.offsetHeight) || 0; 45237 bodyScrollHeight.value = tableScrollHeight.value - headerScrollHeight.value - footerScrollHeight.value; 45238 if (shouldUpdateLayout) { 45239 resizeState.value = { 45240 width, 45241 height, 45242 headerHeight: props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) || 0 45243 }; 45244 doLayout(); 45245 } 45246 }; 45247 const tableSize = useFormSize(); 45248 const bodyWidth = vue.computed(() => { 45249 const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout; 45250 return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : ""; 45251 }); 45252 const tableLayout = vue.computed(() => { 45253 if (props.maxHeight) 45254 return "fixed"; 45255 return props.tableLayout; 45256 }); 45257 const emptyBlockStyle = vue.computed(() => { 45258 if (props.data && props.data.length) 45259 return null; 45260 let height = "100%"; 45261 if (props.height && bodyScrollHeight.value) { 45262 height = `${bodyScrollHeight.value}px`; 45263 } 45264 const width = tableWidth.value; 45265 return { 45266 width: width ? `${width}px` : "", 45267 height 45268 }; 45269 }); 45270 const tableInnerStyle = vue.computed(() => { 45271 if (props.height) { 45272 return { 45273 height: !Number.isNaN(Number(props.height)) ? `${props.height}px` : props.height 45274 }; 45275 } 45276 if (props.maxHeight) { 45277 return { 45278 maxHeight: !Number.isNaN(Number(props.maxHeight)) ? `${props.maxHeight}px` : props.maxHeight 45279 }; 45280 } 45281 return {}; 45282 }); 45283 const scrollbarStyle = vue.computed(() => { 45284 if (props.height) { 45285 return { 45286 height: "100%" 45287 }; 45288 } 45289 if (props.maxHeight) { 45290 if (!Number.isNaN(Number(props.maxHeight))) { 45291 const maxHeight = props.maxHeight; 45292 const reachMaxHeight = tableScrollHeight.value >= Number(maxHeight); 45293 if (reachMaxHeight) { 45294 return { 45295 maxHeight: `${tableScrollHeight.value - headerScrollHeight.value - footerScrollHeight.value}px` 45296 }; 45297 } 45298 } else { 45299 return { 45300 maxHeight: `calc(${props.maxHeight} - ${headerScrollHeight.value + footerScrollHeight.value}px)` 45301 }; 45302 } 45303 } 45304 return {}; 45305 }); 45306 const handleFixedMousewheel = (event, data) => { 45307 const bodyWrapper = table.refs.bodyWrapper; 45308 if (Math.abs(data.spinY) > 0) { 45309 const currentScrollTop = bodyWrapper.scrollTop; 45310 if (data.pixelY < 0 && currentScrollTop !== 0) { 45311 event.preventDefault(); 45312 } 45313 if (data.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) { 45314 event.preventDefault(); 45315 } 45316 bodyWrapper.scrollTop += Math.ceil(data.pixelY / 5); 45317 } else { 45318 bodyWrapper.scrollLeft += Math.ceil(data.pixelX / 5); 45319 } 45320 }; 45321 return { 45322 isHidden, 45323 renderExpanded, 45324 setDragVisible, 45325 isGroup, 45326 handleMouseLeave, 45327 handleHeaderFooterMousewheel, 45328 tableSize, 45329 emptyBlockStyle, 45330 handleFixedMousewheel, 45331 resizeProxyVisible, 45332 bodyWidth, 45333 resizeState, 45334 doLayout, 45335 tableBodyStyles, 45336 tableLayout, 45337 scrollbarViewStyle, 45338 tableInnerStyle, 45339 scrollbarStyle 45340 }; 45341 } 45342 45343 function useKeyRender(table) { 45344 const observer = vue.ref(); 45345 const initWatchDom = () => { 45346 const el = table.vnode.el; 45347 const columnsWrapper = el.querySelector(".hidden-columns"); 45348 const config = { childList: true, subtree: true }; 45349 const updateOrderFns = table.store.states.updateOrderFns; 45350 observer.value = new MutationObserver(() => { 45351 updateOrderFns.forEach((fn) => fn()); 45352 }); 45353 observer.value.observe(columnsWrapper, config); 45354 }; 45355 vue.onMounted(() => { 45356 initWatchDom(); 45357 }); 45358 vue.onUnmounted(() => { 45359 var _a; 45360 (_a = observer.value) == null ? void 0 : _a.disconnect(); 45361 }); 45362 } 45363 45364 var defaultProps$1 = { 45365 data: { 45366 type: Array, 45367 default: () => [] 45368 }, 45369 size: useSizeProp, 45370 width: [String, Number], 45371 height: [String, Number], 45372 maxHeight: [String, Number], 45373 fit: { 45374 type: Boolean, 45375 default: true 45376 },
45377 stripe: Boolean, 45378 border: Boolean, 45379 rowKey: [String, Function], 45380 showHeader: { 45381 type: Boolean, 45382 default: true 45383 }, 45384 showSummary: Boolean, 45385 sumText: String, 45386 summaryMethod: Function, 45387 rowClassName: [String, Function], 45388 rowStyle: [Object, Function], 45389 cellClassName: [String, Function], 45390 cellStyle: [Object, Function], 45391 headerRowClassName: [String, Function], 45392 headerRowStyle: [Object, Function], 45393 headerCellClassName: [String, Function], 45394 headerCellStyle: [Object, Function], 45395 highlightCurrentRow: Boolean, 45396 currentRowKey: [String, Number], 45397 emptyText: String, 45398 expandRowKeys: Array, 45399 defaultExpandAll: Boolean, 45400 defaultSort: Object, 45401 tooltipEffect: String, 45402 tooltipOptions: Object, 45403 spanMethod: Function, 45404 selectOnIndeterminate: { 45405 type: Boolean, 45406 default: true 45407 }, 45408 indent: { 45409 type: Number, 45410 default: 16 45411 }, 45412 treeProps: { 45413 type: Object, 45414 default: () => { 45415 return { 45416 hasChildren: "hasChildren", 45417 children: "children" 45418 }; 45419 } 45420 }, 45421 lazy: Boolean, 45422 load: Function, 45423 style: { 45424 type: Object, 45425 default: () => ({}) 45426 }, 45427 className: { 45428 type: String, 45429 default: "" 45430 }, 45431 tableLayout: { 45432 type: String, 45433 default: "fixed" 45434 }, 45435 scrollbarAlwaysOn: { 45436 type: Boolean, 45437 default: false 45438 }, 45439 flexible: Boolean 45440 }; 45441 45442 const useScrollbar$1 = () => { 45443 const scrollBarRef = vue.ref(); 45444 const scrollTo = (options, yCoord) => { 45445 const scrollbar = scrollBarRef.value; 45446 if (scrollbar) { 45447 scrollbar.scrollTo(options, yCoord); 45448 } 45449 }; 45450 const setScrollPosition = (position, offset) => { 45451 const scrollbar = scrollBarRef.value; 45452 if (scrollbar && isNumber(offset) && ["Top", "Left"].includes(position)) { 45453 scrollbar[`setScroll${position}`](offset); 45454 } 45455 }; 45456 const setScrollTop = (top) => setScrollPosition("Top", top); 45457 const setScrollLeft = (left) => setScrollPosition("Left", left); 45458 return { 45459 scrollBarRef, 45460 scrollTo, 45461 setScrollTop, 45462 setScrollLeft 45463 }; 45464 }; 45465 45466 let tableIdSeed = 1; 45467 const _sfc_main$q = vue.defineComponent({ 45468 name: "ElTable", 45469 directives: { 45470 Mousewheel 45471 }, 45472 components: { 45473 TableHeader, 45474 TableBody, 45475 TableFooter, 45476 ElScrollbar, 45477 hColgroup 45478 }, 45479 props: defaultProps$1, 45480 emits: [ 45481 "select", 45482 "select-all", 45483 "selection-change", 45484 "cell-mouse-enter", 45485 "cell-mouse-leave", 45486 "cell-contextmenu", 45487 "cell-click", 45488 "cell-dblclick", 45489 "row-click", 45490 "row-contextmenu", 45491 "row-dblclick", 45492 "header-click", 45493 "header-contextmenu", 45494 "sort-change", 45495 "filter-change", 45496 "current-change", 45497 "header-dragend", 45498 "expand-change" 45499 ], 45500 setup(props) { 45501 const { t } = useLocale(); 45502 const ns = useNamespace("table"); 45503 const table = vue.getCurrentInstance(); 45504 vue.provide(TABLE_INJECTION_KEY, table); 45505 const store = createStore(table, props); 45506 table.store = store; 45507 const layout = new TableLayout$1({ 45508 store: table.store, 45509 table, 45510 fit: props.fit, 45511 showHeader: props.showHeader 45512 }); 45513 table.layout = layout; 45514 const isEmpty = vue.computed(() => (store.states.data.value || []).length === 0); 45515 const { 45516 setCurrentRow, 45517 getSelectionRows, 45518 toggleRowSelection, 45519 clearSelection, 45520 clearFilter, 45521 toggleAllSelection, 45522 toggleRowExpansion, 45523 clearSort, 45524 sort 45525 } = useUtils(store); 45526 const { 45527 isHidden, 45528 renderExpanded, 45529 setDragVisible, 45530 isGroup, 45531 handleMouseLeave, 45532 handleHeaderFooterMousewheel, 45533 tableSize, 45534 emptyBlockStyle, 45535 handleFixedMousewheel, 45536 resizeProxyVisible, 45537 bodyWidth, 45538 resizeState, 45539 doLayout, 45540 tableBodyStyles, 45541 tableLayout, 45542 scrollbarViewStyle, 45543 tableInnerStyle, 45544 scrollbarStyle 45545 } = useStyle(props, layout, store, table); 45546 const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar$1(); 45547 const debouncedUpdateLayout = debounce(doLayout, 50); 45548 const tableId = `${ns.namespace.value}-table_${tableIdSeed++}`; 45549 table.tableId = tableId; 45550 table.state = { 45551 isGroup, 45552 resizeState, 45553 doLayout, 45554 debouncedUpdateLayout 45555 }; 45556 const computedSumText = vue.computed(() => props.sumText || t("el.table.sumText")); 45557 const computedEmptyText = vue.computed(() => { 45558 return props.emptyText || t("el.table.emptyText"); 45559 }); 45560 useKeyRender(table); 45561 return { 45562 ns, 45563 layout, 45564 store, 45565 handleHeaderFooterMousewheel, 45566 handleMouseLeave, 45567 tableId, 45568 tableSize, 45569 isHidden, 45570 isEmpty, 45571 renderExpanded, 45572 resizeProxyVisible, 45573 resizeState, 45574 isGroup, 45575 bodyWidth, 45576 tableBodyStyles, 45577 emptyBlockStyle, 45578 debouncedUpdateLayout, 45579 handleFixedMousewheel, 45580 setCurrentRow, 45581 getSelectionRows, 45582 toggleRowSelection, 45583 clearSelection, 45584 clearFilter, 45585 toggleAllSelection, 45586 toggleRowExpansion, 45587 clearSort, 45588 doLayout, 45589 sort, 45590 t, 45591 setDragVisible, 45592 context: table, 45593 computedSumText, 45594 computedEmptyText, 45595 tableLayout, 45596 scrollbarViewStyle, 45597 tableInnerStyle, 45598 scrollbarStyle, 45599 scrollBarRef, 45600 scrollTo, 45601 setScrollLeft, 45602 setScrollTop 45603 }; 45604 } 45605 });
45606 const _hoisted_1$b = ["data-prefix"]; 45607 const _hoisted_2$7 = { 45608 ref: "hiddenColumns", 45609 class: "hidden-columns" 45610 }; 45611 function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) { 45612 const _component_hColgroup = vue.resolveComponent("hColgroup"); 45613 const _component_table_header = vue.resolveComponent("table-header"); 45614 const _component_table_body = vue.resolveComponent("table-body"); 45615 const _component_el_scrollbar = vue.resolveComponent("el-scrollbar"); 45616 const _component_table_footer = vue.resolveComponent("table-footer"); 45617 const _directive_mousewheel = vue.resolveDirective("mousewheel"); 45618 return vue.openBlock(), vue.createElementBlock("div", { 45619 ref: "tableWrapper", 45620 class: vue.normalizeClass([ 45621 { 45622 [_ctx.ns.m("fit")]: _ctx.fit, 45623 [_ctx.ns.m("striped")]: _ctx.stripe, 45624 [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup, 45625 [_ctx.ns.m("hidden")]: _ctx.isHidden, 45626 [_ctx.ns.m("group")]: _ctx.isGroup, 45627 [_ctx.ns.m("fluid-height")]: _ctx.maxHeight, 45628 [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value, 45629 [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value, 45630 [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value, 45631 [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100, 45632 "has-footer": _ctx.showSummary 45633 }, 45634 _ctx.ns.m(_ctx.tableSize), 45635 _ctx.className, 45636 _ctx.ns.b(), 45637 _ctx.ns.m(`layout-${_ctx.tableLayout}`) 45638 ]), 45639 style: vue.normalizeStyle(_ctx.style), 45640 "data-prefix": _ctx.ns.namespace.value, 45641 onMouseleave: _cache[0] || (_cache[0] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)) 45642 }, [ 45643 vue.createElementVNode("div", { 45644 class: vue.normalizeClass(_ctx.ns.e("inner-wrapper")), 45645 style: vue.normalizeStyle(_ctx.tableInnerStyle) 45646 }, [ 45647 vue.createElementVNode("div", _hoisted_2$7, [ 45648 vue.renderSlot(_ctx.$slots, "default") 45649 ], 512), 45650 _ctx.showHeader && _ctx.tableLayout === "fixed" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", { 45651 key: 0, 45652 ref: "headerWrapper", 45653 class: vue.normalizeClass(_ctx.ns.e("header-wrapper")) 45654 }, [ 45655 vue.createElementVNode("table", { 45656 ref: "tableHeader", 45657 class: vue.normalizeClass(_ctx.ns.e("header")), 45658 style: vue.normalizeStyle(_ctx.tableBodyStyles), 45659 border: "0", 45660 cellpadding: "0", 45661 cellspacing: "0" 45662 }, [ 45663 vue.createVNode(_component_hColgroup, { 45664 columns: _ctx.store.states.columns.value, 45665 "table-layout": _ctx.tableLayout 45666 }, null, 8, ["columns", "table-layout"]), 45667 vue.createVNode(_component_table_header, { 45668 ref: "tableHeaderRef", 45669 border: _ctx.border, 45670 "default-sort": _ctx.defaultSort, 45671 store: _ctx.store, 45672 onSetDragVisible: _ctx.setDragVisible 45673 }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"]) 45674 ], 6) 45675 ], 2)), [ 45676 [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel] 45677 ]) : vue.createCommentVNode("v-if", true), 45678 vue.createElementVNode("div", { 45679 ref: "bodyWrapper", 45680 class: vue.normalizeClass(_ctx.ns.e("body-wrapper")) 45681 }, [ 45682 vue.createVNode(_component_el_scrollbar, { 45683 ref: "scrollBarRef", 45684 "view-style": _ctx.scrollbarViewStyle, 45685 "wrap-style": _ctx.scrollbarStyle, 45686 always: _ctx.scrollbarAlwaysOn 45687 }, { 45688 default: vue.withCtx(() => [ 45689 vue.createElementVNode("table", { 45690 ref: "tableBody", 45691 class: vue.normalizeClass(_ctx.ns.e("body")), 45692 cellspacing: "0", 45693 cellpadding: "0", 45694 border: "0", 45695 style: vue.normalizeStyle({ 45696 width: _ctx.bodyWidth, 45697 tableLayout: _ctx.tableLayout 45698 }) 45699 }, [ 45700 vue.createVNode(_component_hColgroup, { 45701 columns: _ctx.store.states.columns.value, 45702 "table-layout": _ctx.tableLayout 45703 }, null, 8, ["columns", "table-layout"]), 45704 _ctx.showHeader && _ctx.tableLayout === "auto" ? (vue.openBlock(), vue.createBlock(_component_table_header, { 45705 key: 0, 45706 ref: "tableHeaderRef", 45707 border: _ctx.border, 45708 "default-sort": _ctx.defaultSort,
45709 store: _ctx.store, 45710 onSetDragVisible: _ctx.setDragVisible 45711 }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])) : vue.createCommentVNode("v-if", true), 45712 vue.createVNode(_component_table_body, { 45713 context: _ctx.context, 45714 highlight: _ctx.highlightCurrentRow, 45715 "row-class-name": _ctx.rowClassName, 45716 "tooltip-effect": _ctx.tooltipEffect, 45717 "tooltip-options": _ctx.tooltipOptions, 45718 "row-style": _ctx.rowStyle, 45719 store: _ctx.store, 45720 stripe: _ctx.stripe 45721 }, null, 8, ["context", "highlight", "row-class-name", "tooltip-effect", "tooltip-options", "row-style", "store", "stripe"]) 45722 ], 6), 45723 _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", { 45724 key: 0, 45725 ref: "emptyBlock", 45726 style: vue.normalizeStyle(_ctx.emptyBlockStyle), 45727 class: vue.normalizeClass(_ctx.ns.e("empty-block")) 45728 }, [ 45729 vue.createElementVNode("span", { 45730 class: vue.normalizeClass(_ctx.ns.e("empty-text")) 45731 }, [ 45732 vue.renderSlot(_ctx.$slots, "empty", {}, () => [ 45733 vue.createTextVNode(vue.toDisplayString(_ctx.computedEmptyText), 1) 45734 ]) 45735 ], 2) 45736 ], 6)) : vue.createCommentVNode("v-if", true), 45737 _ctx.$slots.append ? (vue.openBlock(), vue.createElementBlock("div", { 45738 key: 1, 45739 ref: "appendWrapper", 45740 class: vue.normalizeClass(_ctx.ns.e("append-wrapper")) 45741 }, [ 45742 vue.renderSlot(_ctx.$slots, "append") 45743 ], 2)) : vue.createCommentVNode("v-if", true) 45744 ]), 45745 _: 3 45746 }, 8, ["view-style", "wrap-style", "always"]) 45747 ], 2), 45748 _ctx.showSummary ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", { 45749 key: 1, 45750 ref: "footerWrapper", 45751 class: vue.normalizeClass(_ctx.ns.e("footer-wrapper")) 45752 }, [ 45753 vue.createVNode(_component_table_footer, { 45754 border: _ctx.border, 45755 "default-sort": _ctx.defaultSort, 45756 store: _ctx.store, 45757 style: vue.normalizeStyle(_ctx.tableBodyStyles), 45758 "sum-text": _ctx.computedSumText, 45759 "summary-method": _ctx.summaryMethod 45760 }, null, 8, ["border", "default-sort", "store", "style", "sum-text", "summary-method"]) 45761 ], 2)), [ 45762 [vue.vShow, !_ctx.isEmpty], 45763 [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel] 45764 ]) : vue.createCommentVNode("v-if", true), 45765 _ctx.border || _ctx.isGroup ? (vue.openBlock(), vue.createElementBlock("div", { 45766 key: 2, 45767 class: vue.normalizeClass(_ctx.ns.e("border-left-patch")) 45768 }, null, 2)) : vue.createCommentVNode("v-if", true) 45769 ], 6), 45770 vue.withDirectives(vue.createElementVNode("div", { 45771 ref: "resizeProxy", 45772 class: vue.normalizeClass(_ctx.ns.e("column-resize-proxy")) 45773 }, null, 2), [ 45774 [vue.vShow, _ctx.resizeProxyVisible] 45775 ]) 45776 ], 46, _hoisted_1$b); 45777 } 45778 var Table = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["render", _sfc_render$3], ["__file", "table.vue"]]); 45779 45780 const defaultClassNames = { 45781 selection: "table-column--selection", 45782 expand: "table__expand-column" 45783 }; 45784 const cellStarts = { 45785 default: { 45786 order: "" 45787 }, 45788 selection: { 45789 width: 48, 45790 minWidth: 48, 45791 realWidth: 48, 45792 order: "" 45793 }, 45794 expand: { 45795 width: 48, 45796 minWidth: 48, 45797 realWidth: 48, 45798 order: "" 45799 }, 45800 index: { 45801 width: 48, 45802 minWidth: 48, 45803 realWidth: 48, 45804 order: "" 45805 } 45806 }; 45807 const getDefaultClassName = (type) => { 45808 return defaultClassNames[type] || ""; 45809 }; 45810 const cellForced = { 45811 selection: { 45812 renderHeader({ store }) { 45813 function isDisabled() { 45814 return store.states.data.value && store.states.data.value.length === 0; 45815 } 45816 return vue.h(ElCheckbox, { 45817 disabled: isDisabled(), 45818 size: store.states.tableSize.value, 45819 indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value, 45820 "onUpdate:modelValue": store.toggleAllSelection, 45821 modelValue: store.states.isAllSelected.value 45822 }); 45823 }, 45824 renderCell({ 45825 row, 45826 column, 45827 store, 45828 $index 45829 }) { 45830 return vue.h(ElCheckbox, { 45831 disabled: column.selectable ? !column.selectable.call(null, row, $index) : false, 45832 size: store.states.tableSize.value, 45833 onChange: () => { 45834 store.commit("rowSelectedChanged", row); 45835 }, 45836 onClick: (event) => event.stopPropagation(), 45837 modelValue: store.isSelected(row) 45838 }); 45839 }, 45840 sortable: false, 45841 resizable: false 45842 }, 45843 index: { 45844 renderHeader({ column }) { 45845 return column.label || "#"; 45846 }, 45847 renderCell({ 45848 column, 45849 $index 45850 }) { 45851 let i = $index + 1; 45852 const index = column.index; 45853 if (typeof index === "number") { 45854 i = $index + index; 45855 } else if (typeof index === "function") { 45856 i = index($index); 45857 } 45858 return vue.h("div", {}, [i]); 45859 }, 45860 sortable: false 45861 }, 45862 expand: { 45863 renderHeader({ column }) { 45864 return column.label || ""; 45865 }, 45866 renderCell({ 45867 row, 45868 store, 45869 expanded 45870 }) { 45871 const { ns } = store; 45872 const classes = [ns.e("expand-icon")]; 45873 if (expanded) { 45874 classes.push(ns.em("expand-icon", "expanded")); 45875 } 45876 const callback = function(e) { 45877 e.stopPropagation(); 45878 store.toggleRowExpansion(row);
45879 }; 45880 return vue.h("div", { 45881 class: classes, 45882 onClick: callback 45883 }, { 45884 default: () => { 45885 return [ 45886 vue.h(ElIcon, null, { 45887 default: () => { 45888 return [vue.h(arrow_right_default)]; 45889 } 45890 }) 45891 ]; 45892 } 45893 }); 45894 }, 45895 sortable: false, 45896 resizable: false 45897 } 45898 }; 45899 function defaultRenderCell({ 45900 row, 45901 column, 45902 $index 45903 }) { 45904 var _a; 45905 const property = column.property; 45906 const value = property && getProp(row, property).value; 45907 if (column && column.formatter) { 45908 return column.formatter(row, column, value, $index); 45909 } 45910 return ((_a = value == null ? void 0 : value.toString) == null ? void 0 : _a.call(value)) || ""; 45911 } 45912 function treeCellPrefix({ 45913 row, 45914 treeNode, 45915 store 45916 }, createPlaceholder = false) { 45917 const { ns } = store; 45918 if (!treeNode) { 45919 if (createPlaceholder) { 45920 return [ 45921 vue.h("span", { 45922 class: ns.e("placeholder") 45923 }) 45924 ]; 45925 } 45926 return null; 45927 } 45928 const ele = []; 45929 const callback = function(e) { 45930 e.stopPropagation(); 45931 if (treeNode.loading) { 45932 return; 45933 } 45934 store.loadOrToggle(row); 45935 }; 45936 if (treeNode.indent) { 45937 ele.push(vue.h("span", { 45938 class: ns.e("indent"), 45939 style: { "padding-left": `${treeNode.indent}px` } 45940 })); 45941 } 45942 if (typeof treeNode.expanded === "boolean" && !treeNode.noLazyChildren) { 45943 const expandClasses = [ 45944 ns.e("expand-icon"), 45945 treeNode.expanded ? ns.em("expand-icon", "expanded") : "" 45946 ]; 45947 let icon = arrow_right_default; 45948 if (treeNode.loading) { 45949 icon = loading_default; 45950 } 45951 ele.push(vue.h("div", { 45952 class: expandClasses, 45953 onClick: callback 45954 }, { 45955 default: () => { 45956 return [ 45957 vue.h(ElIcon, { class: { [ns.is("loading")]: treeNode.loading } }, { 45958 default: () => [vue.h(icon)] 45959 }) 45960 ]; 45961 } 45962 })); 45963 } else { 45964 ele.push(vue.h("span", { 45965 class: ns.e("placeholder") 45966 })); 45967 } 45968 return ele; 45969 } 45970 45971 function getAllAliases(props, aliases) { 45972 return props.reduce((prev, cur) => { 45973 prev[cur] = cur; 45974 return prev; 45975 }, aliases); 45976 } 45977 function useWatcher(owner, props_) { 45978 const instance = vue.getCurrentInstance(); 45979 const registerComplexWatchers = () => { 45980 const props = ["fixed"]; 45981 const aliases = { 45982 realWidth: "width", 45983 realMinWidth: "minWidth" 45984 }; 45985 const allAliases = getAllAliases(props, aliases); 45986 Object.keys(allAliases).forEach((key) => { 45987 const columnKey = aliases[key]; 45988 if (hasOwn(props_, columnKey)) { 45989 vue.watch(() => props_[columnKey], (newVal) => { 45990 let value = newVal; 45991 if (columnKey === "width" && key === "realWidth") { 45992 value = parseWidth(newVal); 45993 } 45994 if (columnKey === "minWidth" && key === "realMinWidth") { 45995 value = parseMinWidth(newVal); 45996 } 45997 instance.columnConfig.value[columnKey] = value; 45998 instance.columnConfig.value[key] = value; 45999 const updateColumns = columnKey === "fixed"; 46000 owner.value.store.scheduleLayout(updateColumns); 46001 }); 46002 } 46003 }); 46004 }; 46005 const registerNormalWatchers = () => { 46006 const props = [ 46007 "label", 46008 "filters", 46009 "filterMultiple", 46010 "sortable", 46011 "index", 46012 "formatter", 46013 "className", 46014 "labelClassName", 46015 "showOverflowTooltip" 46016 ]; 46017 const aliases = { 46018 property: "prop", 46019 align: "realAlign", 46020 headerAlign: "realHeaderAlign" 46021 }; 46022 const allAliases = getAllAliases(props, aliases);
46023 Object.keys(allAliases).forEach((key) => { 46024 const columnKey = aliases[key]; 46025 if (hasOwn(props_, columnKey)) { 46026 vue.watch(() => props_[columnKey], (newVal) => { 46027 instance.columnConfig.value[key] = newVal; 46028 }); 46029 } 46030 }); 46031 }; 46032 return { 46033 registerComplexWatchers, 46034 registerNormalWatchers 46035 }; 46036 } 46037 46038 function useRender(props, slots, owner) { 46039 const instance = vue.getCurrentInstance(); 46040 const columnId = vue.ref(""); 46041 const isSubColumn = vue.ref(false); 46042 const realAlign = vue.ref(); 46043 const realHeaderAlign = vue.ref(); 46044 const ns = useNamespace("table"); 46045 vue.watchEffect(() => { 46046 realAlign.value = props.align ? `is-${props.align}` : null; 46047 realAlign.value; 46048 }); 46049 vue.watchEffect(() => { 46050 realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value; 46051 realHeaderAlign.value; 46052 }); 46053 const columnOrTableParent = vue.computed(() => { 46054 let parent = instance.vnode.vParent || instance.parent; 46055 while (parent && !parent.tableId && !parent.columnId) { 46056 parent = parent.vnode.vParent || parent.parent; 46057 } 46058 return parent; 46059 }); 46060 const hasTreeColumn = vue.computed(() => { 46061 const { store } = instance.parent; 46062 if (!store) 46063 return false; 46064 const { treeData } = store.states; 46065 const treeDataValue = treeData.value; 46066 return treeDataValue && Object.keys(treeDataValue).length > 0; 46067 }); 46068 const realWidth = vue.ref(parseWidth(props.width)); 46069 const realMinWidth = vue.ref(parseMinWidth(props.minWidth)); 46070 const setColumnWidth = (column) => { 46071 if (realWidth.value) 46072 column.width = realWidth.value; 46073 if (realMinWidth.value) { 46074 column.minWidth = realMinWidth.value; 46075 } 46076 if (!realWidth.value && realMinWidth.value) { 46077 column.width = void 0; 46078 } 46079 if (!column.minWidth) { 46080 column.minWidth = 80; 46081 } 46082 column.realWidth = Number(column.width === void 0 ? column.minWidth : column.width); 46083 return column; 46084 }; 46085 const setColumnForcedProps = (column) => { 46086 const type = column.type; 46087 const source = cellForced[type] || {}; 46088 Object.keys(source).forEach((prop) => { 46089 const value = source[prop]; 46090 if (prop !== "className" && value !== void 0) { 46091 column[prop] = value; 46092 } 46093 }); 46094 const className = getDefaultClassName(type); 46095 if (className) { 46096 const forceClass = `${vue.unref(ns.namespace)}-${className}`; 46097 column.className = column.className ? `${column.className} ${forceClass}` : forceClass; 46098 } 46099 return column; 46100 }; 46101 const checkSubColumn = (children) => { 46102 if (Array.isArray(children)) { 46103 children.forEach((child) => check(child)); 46104 } else { 46105 check(children); 46106 } 46107 function check(item) { 46108 var _a; 46109 if (((_a = item == null ? void 0 : item.type) == null ? void 0 : _a.name) === "ElTableColumn") { 46110 item.vParent = instance; 46111 } 46112 } 46113 }; 46114 const setColumnRenders = (column) => { 46115 if (props.renderHeader) ; else if (column.type !== "selection") { 46116 column.renderHeader = (scope) => { 46117 instance.columnConfig.value["label"]; 46118 const renderHeader = slots.header; 46119 return renderHeader ? renderHeader(scope) : column.label; 46120 }; 46121 } 46122 let originRenderCell = column.renderCell; 46123 if (column.type === "expand") { 46124 column.renderCell = (data) => vue.h("div", { 46125 class: "cell" 46126 }, [originRenderCell(data)]); 46127 owner.value.renderExpanded = (data) => { 46128 return slots.default ? slots.default(data) : slots.default; 46129 }; 46130 } else { 46131 originRenderCell = originRenderCell || defaultRenderCell; 46132 column.renderCell = (data) => { 46133 let children = null; 46134 if (slots.default) { 46135 const vnodes = slots.default(data); 46136 children = vnodes.some((v) => v.type !== vue.Comment) ? vnodes : originRenderCell(data); 46137 } else { 46138 children = originRenderCell(data); 46139 } 46140 const { columns } = owner.value.store.states; 46141 const firstUserColumnIndex = columns.value.findIndex((item) => item.type === "default"); 46142 const shouldCreatePlaceholder = hasTreeColumn.value && data.cellIndex === firstUserColumnIndex; 46143 const prefix = treeCellPrefix(data, shouldCreatePlaceholder); 46144 const props2 = { 46145 class: "cell", 46146 style: {} 46147 }; 46148 if (column.showOverflowTooltip) { 46149 props2.class = `${props2.class} ${vue.unref(ns.namespace)}-tooltip`; 46150 props2.style = { 46151 width: `${(data.column.realWidth || Number(data.column.width)) - 1}px` 46152 }; 46153 } 46154 checkSubColumn(children); 46155 return vue.h("div", props2, [prefix, children]); 46156 }; 46157 } 46158 return column; 46159 }; 46160 const getPropsData = (...propsKey) => { 46161 return propsKey.reduce((prev, cur) => { 46162 if (Array.isArray(cur)) { 46163 cur.forEach((key) => { 46164 prev[key] = props[key]; 46165 }); 46166 } 46167 return prev; 46168 }, {}); 46169 }; 46170 const getColumnElIndex = (children, child) => { 46171 return Array.prototype.indexOf.call(children, child); 46172 }; 46173 const updateColumnOrder = () => { 46174 owner.value.store.commit("updateColumnOrder", instance.columnConfig.value); 46175 }; 46176 return { 46177 columnId, 46178 realAlign, 46179 isSubColumn, 46180 realHeaderAlign, 46181 columnOrTableParent, 46182 setColumnWidth, 46183 setColumnForcedProps, 46184 setColumnRenders, 46185 getPropsData, 46186 getColumnElIndex, 46187 updateColumnOrder 46188 }; 46189 } 46190 46191 var defaultProps = { 46192 type: { 46193 type: String, 46194 default: "default" 46195 }, 46196 label: String, 46197 className: String, 46198 labelClassName: String, 46199 property: String, 46200 prop: String, 46201 width: { 46202 type: [String, Number], 46203 default: "" 46204 }, 46205 minWidth: { 46206 type: [String, Number], 46207 default: "" 46208 }, 46209 renderHeader: Function, 46210 sortable: { 46211 type: [Boolean, String], 46212 default: false 46213 }, 46214 sortMethod: Function, 46215 sortBy: [String, Function, Array], 46216 resizable: { 46217 type: Boolean, 46218 default: true 46219 }, 46220 columnKey: String, 46221 align: String, 46222 headerAlign: String, 46223 showOverflowTooltip: [Boolean, Object], 46224 fixed: [Boolean, String], 46225 formatter: Function, 46226 selectable: Function, 46227 reserveSelection: Boolean, 46228 filterMethod: Function, 46229 filteredValue: Array, 46230 filters: Array, 46231 filterPlacement: String, 46232 filterMultiple: { 46233 type: Boolean, 46234 default: true 46235 }, 46236 index: [Number, Function], 46237 sortOrders: { 46238 type: Array, 46239 default: () => { 46240 return ["ascending", "descending", null]; 46241 }, 46242 validator: (val) => { 46243 return val.every((order) => ["ascending", "descending", null].includes(order)); 46244 } 46245 } 46246 }; 46247
46248 let columnIdSeed = 1; 46249 var ElTableColumn$1 = vue.defineComponent({ 46250 name: "ElTableColumn", 46251 components: { 46252 ElCheckbox 46253 }, 46254 props: defaultProps, 46255 setup(props, { slots }) { 46256 const instance = vue.getCurrentInstance(); 46257 const columnConfig = vue.ref({}); 46258 const owner = vue.computed(() => { 46259 let parent2 = instance.parent; 46260 while (parent2 && !parent2.tableId) { 46261 parent2 = parent2.parent; 46262 } 46263 return parent2; 46264 }); 46265 const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props); 46266 const { 46267 columnId, 46268 isSubColumn, 46269 realHeaderAlign, 46270 columnOrTableParent, 46271 setColumnWidth, 46272 setColumnForcedProps, 46273 setColumnRenders, 46274 getPropsData, 46275 getColumnElIndex, 46276 realAlign, 46277 updateColumnOrder 46278 } = useRender(props, slots, owner); 46279 const parent = columnOrTableParent.value; 46280 columnId.value = `${parent.tableId || parent.columnId}_column_${columnIdSeed++}`; 46281 vue.onBeforeMount(() => { 46282 isSubColumn.value = owner.value !== parent; 46283 const type = props.type || "default"; 46284 const sortable = props.sortable === "" ? true : props.sortable; 46285 const defaults = { 46286 ...cellStarts[type], 46287 id: columnId.value, 46288 type, 46289 property: props.prop || props.property, 46290 align: realAlign, 46291 headerAlign: realHeaderAlign, 46292 showOverflowTooltip: props.showOverflowTooltip, 46293 filterable: props.filters || props.filterMethod, 46294 filteredValue: [], 46295 filterPlacement: "", 46296 isColumnGroup: false, 46297 isSubColumn: false, 46298 filterOpened: false, 46299 sortable, 46300 index: props.index, 46301 rawColumnKey: instance.vnode.key 46302 }; 46303 const basicProps = [ 46304 "columnKey", 46305 "label", 46306 "className", 46307 "labelClassName", 46308 "type", 46309 "renderHeader", 46310 "formatter", 46311 "fixed", 46312 "resizable" 46313 ]; 46314 const sortProps = ["sortMethod", "sortBy", "sortOrders"]; 46315 const selectProps = ["selectable", "reserveSelection"]; 46316 const filterProps = [ 46317 "filterMethod", 46318 "filters", 46319 "filterMultiple", 46320 "filterOpened", 46321 "filteredValue", 46322 "filterPlacement" 46323 ]; 46324 let column = getPropsData(basicProps, sortProps, selectProps, filterProps); 46325 column = mergeOptions(defaults, column); 46326 const chains = compose(setColumnRenders, setColumnWidth, setColumnForcedProps); 46327 column = chains(column); 46328 columnConfig.value = column; 46329 registerNormalWatchers(); 46330 registerComplexWatchers(); 46331 }); 46332 vue.onMounted(() => { 46333 var _a; 46334 const parent2 = columnOrTableParent.value; 46335 const children = isSubColumn.value ? parent2.vnode.el.children : (_a = parent2.refs.hiddenColumns) == null ? void 0 : _a.children; 46336 const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el); 46337 columnConfig.value.getColumnIndex = getColumnIndex; 46338 const columnIndex = getColumnIndex(); 46339 columnIndex > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? parent2.columnConfig.value : null, updateColumnOrder); 46340 }); 46341 vue.onBeforeUnmount(() => { 46342 owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? parent.columnConfig.value : null, updateColumnOrder); 46343 }); 46344 instance.columnId = columnId.value; 46345 instance.columnConfig = columnConfig; 46346 return; 46347 }, 46348 render() { 46349 var _a, _b, _c; 46350 try { 46351 const renderDefault = (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a, { 46352 row: {}, 46353 column: {}, 46354 $index: -1 46355 }); 46356 const children = []; 46357 if (Array.isArray(renderDefault)) { 46358 for (const childNode of renderDefault) { 46359 if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) { 46360 children.push(childNode); 46361 } else if (childNode.type === vue.Fragment && Array.isArray(childNode.children)) {
46362 childNode.children.forEach((vnode2) => { 46363 if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString$1(vnode2 == null ? void 0 : vnode2.children)) { 46364 children.push(vnode2); 46365 } 46366 }); 46367 } 46368 } 46369 } 46370 const vnode = vue.h("div", children); 46371 return vnode; 46372 } catch (e) { 46373 return vue.h("div", []); 46374 } 46375 } 46376 }); 46377 46378 const ElTable = withInstall(Table, { 46379 TableColumn: ElTableColumn$1 46380 }); 46381 const ElTableColumn = withNoopInstall(ElTableColumn$1); 46382 46383 var SortOrder = /* @__PURE__ */ ((SortOrder2) => { 46384 SortOrder2["ASC"] = "asc"; 46385 SortOrder2["DESC"] = "desc"; 46386 return SortOrder2; 46387 })(SortOrder || {}); 46388 var Alignment = /* @__PURE__ */ ((Alignment2) => { 46389 Alignment2["CENTER"] = "center"; 46390 Alignment2["RIGHT"] = "right"; 46391 return Alignment2; 46392 })(Alignment || {}); 46393 var FixedDir = /* @__PURE__ */ ((FixedDir2) => { 46394 FixedDir2["LEFT"] = "left"; 46395 FixedDir2["RIGHT"] = "right"; 46396 return FixedDir2; 46397 })(FixedDir || {}); 46398 const oppositeOrderMap = { 46399 ["asc" /* ASC */]: "desc" /* DESC */, 46400 ["desc" /* DESC */]: "asc" /* ASC */ 46401 }; 46402 46403 const placeholderSign = Symbol("placeholder"); 46404 46405 const calcColumnStyle = (column, fixedColumn, fixed) => { 46406 var _a; 46407 const flex = { 46408 flexGrow: 0, 46409 flexShrink: 0, 46410 ...fixed ? {} : { 46411 flexGrow: column.flexGrow || 0, 46412 flexShrink: column.flexShrink || 1 46413 } 46414 }; 46415 if (!fixed) { 46416 flex.flexShrink = 1; 46417 } 46418 const style = { 46419 ...(_a = column.style) != null ? _a : {}, 46420 ...flex, 46421 flexBasis: "auto", 46422 width: column.width 46423 }; 46424 if (!fixedColumn) { 46425 if (column.maxWidth) 46426 style.maxWidth = column.maxWidth; 46427 if (column.minWidth) 46428 style.minWidth = column.minWidth; 46429 } 46430 return style; 46431 }; 46432 46433 function useColumns(props, columns, fixed) { 46434 const visibleColumns = vue.computed(() => { 46435 return vue.unref(columns).filter((column) => !column.hidden); 46436 }); 46437 const fixedColumnsOnLeft = vue.computed(() => vue.unref(visibleColumns).filter((column) => column.fixed === "left" || column.fixed === true)); 46438 const fixedColumnsOnRight = vue.computed(() => vue.unref(visibleColumns).filter((column) => column.fixed === "right")); 46439 const normalColumns = vue.computed(() => vue.unref(visibleColumns).filter((column) => !column.fixed)); 46440 const mainColumns = vue.computed(() => { 46441 const ret = []; 46442 vue.unref(fixedColumnsOnLeft).forEach((column) => { 46443 ret.push({ 46444 ...column, 46445 placeholderSign 46446 }); 46447 }); 46448 vue.unref(normalColumns).forEach((column) => { 46449 ret.push(column); 46450 }); 46451 vue.unref(fixedColumnsOnRight).forEach((column) => { 46452 ret.push({ 46453 ...column, 46454 placeholderSign 46455 }); 46456 }); 46457 return ret; 46458 }); 46459 const hasFixedColumns = vue.computed(() => { 46460 return vue.unref(fixedColumnsOnLeft).length || vue.unref(fixedColumnsOnRight).length; 46461 }); 46462 const columnsStyles = vue.computed(() => { 46463 const _columns = vue.unref(columns); 46464 return _columns.reduce((style, column) => { 46465 style[column.key] = calcColumnStyle(column, vue.unref(fixed), props.fixed); 46466 return style; 46467 }, {}); 46468 }); 46469 const columnsTotalWidth = vue.computed(() => { 46470 return vue.unref(visibleColumns).reduce((width, column) => width + column.width, 0); 46471 }); 46472 const getColumn = (key) => { 46473 return vue.unref(columns).find((column) => column.key === key); 46474 }; 46475 const getColumnStyle = (key) => { 46476 return vue.unref(columnsStyles)[key]; 46477 }; 46478 const updateColumnWidth = (column, width) => { 46479 column.width = width; 46480 }; 46481 function onColumnSorted(e) { 46482 var _a; 46483 const { key } = e.currentTarget.dataset; 46484 if (!key) 46485 return; 46486 const { sortState, sortBy } = props; 46487 let order = SortOrder.ASC; 46488 if (isObject$1(sortState)) { 46489 order = oppositeOrderMap[sortState[key]]; 46490 } else { 46491 order = oppositeOrderMap[sortBy.order]; 46492 } 46493 (_a = props.onColumnSort) == null ? void 0 : _a.call(props, { column: getColumn(key), key, order }); 46494 } 46495 return { 46496 columns, 46497 columnsStyles, 46498 columnsTotalWidth, 46499 fixedColumnsOnLeft, 46500 fixedColumnsOnRight, 46501 hasFixedColumns, 46502 mainColumns, 46503 normalColumns, 46504 visibleColumns, 46505 getColumn, 46506 getColumnStyle, 46507 updateColumnWidth, 46508 onColumnSorted 46509 }; 46510 } 46511 46512 const useScrollbar = (props, { 46513 mainTableRef, 46514 leftTableRef, 46515 rightTableRef, 46516 onMaybeEndReached 46517 }) => { 46518 const scrollPos = vue.ref({ scrollLeft: 0, scrollTop: 0 }); 46519 function doScroll(params) { 46520 var _a, _b, _c; 46521 const { scrollTop } = params; 46522 (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo(p
46522arams); 46523 (_b = leftTableRef.value) == null ? void 0 : _b.scrollToTop(scrollTop); 46524 (_c = rightTableRef.value) == null ? void 0 : _c.scrollToTop(scrollTop); 46525 } 46526 function scrollTo(params) { 46527 scrollPos.value = params; 46528 doScroll(params); 46529 } 46530 function scrollToTop(scrollTop) { 46531 scrollPos.value.scrollTop = scrollTop; 46532 doScroll(vue.unref(scrollPos)); 46533 } 46534 function scrollToLeft(scrollLeft) { 46535 var _a, _b; 46536 scrollPos.value.scrollLeft = scrollLeft; 46537 (_b = (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, vue.unref(scrollPos)); 46538 } 46539 function onScroll(params) { 46540 var _a; 46541 scrollTo(params); 46542 (_a = props.onScroll) == null ? void 0 : _a.call(props, params); 46543 } 46544 function onVerticalScroll({ scrollTop }) { 46545 const { scrollTop: currentScrollTop } = vue.unref(scrollPos); 46546 if (scrollTop !== currentScrollTop) 46547 scrollToTop(scrollTop); 46548 } 46549 function scrollToRow(row, strategy = "auto") { 46550 var _a; 46551 (_a = mainTableRef.value) == null ? void 0 : _a.scrollToRow(row, strategy); 46552 } 46553 vue.watch(() => vue.unref(scrollPos).scrollTop, (cur, prev) => { 46554 if (cur > prev) 46555 onMaybeEndReached(); 46556 }); 46557 return { 46558 scrollPos, 46559 scrollTo, 46560 scrollToLeft, 46561 scrollToTop, 46562 scrollToRow, 46563 onScroll, 46564 onVerticalScroll 46565 }; 46566 }; 46567 46568 const useRow = (props, { mainTableRef, leftTableRef, rightTableRef }) => { 46569 const vm = vue.getCurrentInstance(); 46570 const { emit } = vm; 46571 const isResetting = vue.shallowRef(false); 46572 const hoveringRowKey = vue.shallowRef(null); 46573 const expandedRowKeys = vue.ref(props.defaultExpandedRowKeys || []); 46574 const lastRenderedRowIndex = vue.ref(-1); 46575 const resetIndex = vue.shallowRef(null); 46576 const rowHeights = vue.ref({}); 46577 const pendingRowHeights = vue.ref({}); 46578 const leftTableHeights = vue.shallowRef({}); 46579 const mainTableHeights = vue.shallowRef({}); 46580 const rightTableHeights = vue.shallowRef({}); 46581 const isDynamic = vue.computed(() => isNumber(props.estimatedRowHeight)); 46582 function onRowsRendered(params) { 46583 var _a; 46584 (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, params); 46585 if (params.rowCacheEnd > vue.unref(lastRenderedRowIndex)) { 46586 lastRenderedRowIndex.value = params.rowCacheEnd; 46587 } 46588 } 46589 function onRowHovered({ hovered, rowKey }) { 46590 hoveringRowKey.value = hovered ? rowKey : null; 46591 } 46592 function onRowExpanded({ 46593 expanded, 46594 rowData, 46595 rowIndex, 46596 rowKey 46597 }) { 46598 var _a, _b; 46599 const _expandedRowKeys = [...vue.unref(expandedRowKeys)]; 46600 const currentKeyIndex = _expandedRowKeys.indexOf(rowKey); 46601 if (expanded) { 46602 if (currentKeyIndex === -1) 46603 _expandedRowKeys.push(rowKey); 46604 } else { 46605 if (currentKeyIndex > -1) 46606 _expandedRowKeys.splice(currentKeyIndex, 1); 46607 } 46608 expandedRowKeys.value = _expandedRowKeys; 46609 emit("update:expandedRowKeys", _expandedRowKeys); 46610 (_a = props.onRowExpand) == null ? void 0 : _a.call(props, { 46611 expanded, 46612 rowData, 46613 rowIndex, 46614 rowKey 46615 }); 46616 (_b = props.onExpandedRowsChange) == null ? void 0 : _b.call(props, _expandedRowKeys); 46617 } 46618 const flushingRowHeights = debounce(() => { 46619 var _a, _b, _c, _d; 46620 isResetting.value = true; 46621 rowHeights.value = { ...vue.unref(rowHeights), ...vue.unref(pendingRowHeights) }; 46622 resetAfterIndex(vue.unref(resetIndex), false); 46623 pendingRowHeights.value = {}; 46624 resetIndex.value = null; 46625 (_a = mainTableRef.value) == null ? void 0 : _a.forceUpdate(); 46626 (_b = leftTableRef.value) == null ? void 0 : _b.forceUpdate();
46627 (_c = rightTableRef.value) == null ? void 0 : _c.forceUpdate(); 46628 (_d = vm.proxy) == null ? void 0 : _d.$forceUpdate(); 46629 isResetting.value = false; 46630 }, 0); 46631 function resetAfterIndex(index, forceUpdate = false) { 46632 if (!vue.unref(isDynamic)) 46633 return; 46634 [mainTableRef, leftTableRef, rightTableRef].forEach((tableRef) => { 46635 const table = vue.unref(tableRef); 46636 if (table) 46637 table.resetAfterRowIndex(index, forceUpdate); 46638 }); 46639 } 46640 function resetHeights(rowKey, height, rowIdx) { 46641 const resetIdx = vue.unref(resetIndex); 46642 if (resetIdx === null) { 46643 resetIndex.value = rowIdx; 46644 } else { 46645 if (resetIdx > rowIdx) { 46646 resetIndex.value = rowIdx; 46647 } 46648 } 46649 pendingRowHeights.value[rowKey] = height; 46650 } 46651 function onRowHeightChange({ rowKey, height, rowIndex }, fixedDir) { 46652 if (!fixedDir) { 46653 mainTableHeights.value[rowKey] = height; 46654 } else { 46655 if (fixedDir === FixedDir.RIGHT) { 46656 rightTableHeights.value[rowKey] = height; 46657 } else { 46658 leftTableHeights.value[rowKey] = height; 46659 } 46660 } 46661 const maximumHeight = Math.max(...[leftTableHeights, rightTableHeights, mainTableHeights].map((records) => records.value[rowKey] || 0)); 46662 if (vue.unref(rowHeights)[rowKey] !== maximumHeight) { 46663 resetHeights(rowKey, maximumHeight, rowIndex); 46664 flushingRowHeights(); 46665 } 46666 } 46667 return { 46668 hoveringRowKey, 46669 expandedRowKeys, 46670 lastRenderedRowIndex, 46671 isDynamic, 46672 isResetting, 46673 rowHeights, 46674 resetAfterIndex, 46675 onRowExpanded, 46676 onRowHovered, 46677 onRowsRendered, 46678 onRowHeightChange 46679 }; 46680 }; 46681 46682 const useData = (props, { expandedRowKeys, lastRenderedRowIndex, resetAfterIndex }) => { 46683 const depthMap = vue.ref({}); 46684 const flattenedData = vue.computed(() => { 46685 const depths = {}; 46686 const { data: data2, rowKey } = props; 46687 const _expandedRowKeys = vue.unref(expandedRowKeys); 46688 if (!_expandedRowKeys || !_expandedRowKeys.length) 46689 return data2; 46690 const array = []; 46691 const keysSet = /* @__PURE__ */ new Set(); 46692 _expandedRowKeys.forEach((x) => keysSet.add(x)); 46693 let copy = data2.slice(); 46694 copy.forEach((x) => depths[x[rowKey]] = 0); 46695 while (copy.length > 0) { 46696 const item = copy.shift(); 46697 array.push(item); 46698 if (keysSet.has(item[rowKey]) && Array.isArray(item.children) && item.children.length > 0) { 46699 copy = [...item.children, ...copy]; 46700 item.children.forEach((child) => depths[child[rowKey]] = depths[item[rowKey]] + 1); 46701 } 46702 } 46703 depthMap.value = depths; 46704 return array; 46705 }); 46706 const data = vue.computed(() => { 46707 const { data: data2, expandColumnKey } = props; 46708 return expandColumnKey ? vue.unref(flattenedData) : data2; 46709 }); 46710 vue.watch(data, (val, prev) => { 46711 if (val !== prev) { 46712 lastRenderedRowIndex.value = -1; 46713 resetAfterIndex(0, true); 46714 } 46715 }); 46716 return { 46717 data, 46718 depthMap 46719 }; 46720 }; 46721 46722 const sumReducer = (sum2, num) => sum2 + num; 46723 const sum = (listLike) => { 46724 return isArray$1(listLike) ? listLike.reduce(sumReducer, 0) : listLike; 46725 }; 46726 const tryCall = (fLike, params, defaultRet = {}) => { 46727 return isFunction$1(fLike) ? fLike(params) : fLike != null ? fLike : defaultRet; 46728 }; 46729 const enforceUnit = (style) => { 46730 ["width", "maxWidth", "minWidth", "height"].forEach((key) => { 46731 style[key] = addUnit(style[key]); 46732 }); 46733 return style; 46734 }; 46735 const componentToSlot = (ComponentLike) => vue.isVNode(ComponentLike) ? (props) => vue.h(ComponentLike, props) : ComponentLike; 46736 46737 const useStyles = (props, { 46738 columnsTotalWidth, 46739 data, 46740 fixedColumnsOnLeft, 46741 fixedColumnsOnRight 46742 }) => { 46743 const bodyWidth = vue.computed(() => { 46744 const { fixed, width, vScrollbarSize } = props; 46745 const ret = width - vScrollbarSize; 46746 return fixed ? Math.max(Math.round(vue.unref(columnsTotalWidth)), ret) : ret; 46747 }); 46748 const headerWidth = vue.computed(() => vue.unref(bodyWidth) + (props.fixed ? props.vScrollbarSize : 0)); 46749 const mainTableHeight = vue.computed(() => { 46750 const { height = 0, maxHeight = 0, footerHeight: footerHeight2, hScrollbarSize } = props; 46751 if (maxHeight > 0) { 46752 const _fixedRowsHeight = vue.unref(fixedRowsHeight); 46753 const _rowsHeight = vue.unref(rowsHeight); 46754 const _headerHeight = vue.unref(headerHeight); 46755 const total = _headerHeight + _fixedRowsHeight + _rowsHeight + hScrollbarSize; 46756 return Math.min(total, maxHeight - footerHeight2); 46757 } 46758 return height - footerHeight2; 46759 }); 46760 const rowsHeight = vue.computed(() => { 46761 const { rowHeight, estimatedRowHeight } = props; 46762 const _data = vue.unref(data); 46763 if (isNumber(estimatedRowHeight)) { 46764 return _data.length * estimatedRowHeight; 46765 } 46766 return _data.length * rowHeight; 46767 }); 46768 const fixedTableHeight = vue.computed(() => { 46769 const { maxHeight } = props; 46770 const tableHeight = vue.unref(mainTableHeight); 46771 if (isNumber(maxHeight) && maxHeight > 0) 46772 return tableHeight; 46773 const totalHeight = vue.unref(rowsHeight) + vue.unref(headerHeight) + vue.unref(fixedRowsHeight); 46774 return Math.min(tableHeight, totalHeight); 46775 }); 46776 const mapColumn = (column) => column.width; 46777 const leftTableWidth = vue.computed(() => sum(vue.unref(fixedColumnsOnLeft).map(mapColumn))); 46778 const rightTableWidth = vue.computed(() => sum(vue.unref(fixedColumnsOnRight).map(mapColumn))); 46779 const headerHeight = vue.computed(() => sum(props.headerHeight)); 46780 const fixedRowsHeight = vue.computed(() => { 46781 var _a; 46782 return (((_a = props.fixedData) == null ? void 0 : _a.length) || 0) * props.rowHeight; 46783 }); 46784 const windowHeight = vue.computed(() => { 46785 return vue.unref(mainTableHeight) - vue.unref(headerHeight) - vue.unref(fixedRowsHeight); 46786 }); 46787 const rootStyle = vue.computed(() => { 46788 const { style = {}, height, width } = props; 46789 return enforceUnit({ 46790 ...style, 46791 height, 46792 width 46793 }); 46794 }); 46795 const footerHeight = vue.computed(() => enforceUnit({ height: props.footerHeight })); 46796 const emptyStyle = vue.computed(() => ({ 46797 top: addUnit(vue.unref(headerHeight)), 46798 bottom: addUnit(props.footerHeight), 46799 width: addUnit(props.width) 46800 })); 46801 return { 46802 bodyWidth, 46803 fixedTableHeight, 46804 mainTableHeight, 46805 leftTableWidth, 46806 rightTableWidth, 46807 headerWidth, 46808 rowsHeight, 46809 windowHeight, 46810 footerHeight, 46811 emptyStyle, 46812 rootStyle, 46813 headerHeight 46814 }; 46815 }; 46816 46817 const useAutoResize = (props) => { 46818 const sizer = vue.ref(); 46819 const width$ = vue.ref(0);
46820 const height$ = vue.ref(0); 46821 let resizerStopper; 46822 vue.onMounted(() => { 46823 resizerStopper = useResizeObserver(sizer, ([entry]) => { 46824 const { width, height } = entry.contentRect; 46825 const { paddingLeft, paddingRight, paddingTop, paddingBottom } = getComputedStyle(entry.target); 46826 const left = Number.parseInt(paddingLeft) || 0; 46827 const right = Number.parseInt(paddingRight) || 0; 46828 const top = Number.parseInt(paddingTop) || 0; 46829 const bottom = Number.parseInt(paddingBottom) || 0; 46830 width$.value = width - left - right; 46831 height$.value = height - top - bottom; 46832 }).stop; 46833 }); 46834 vue.onBeforeUnmount(() => { 46835 resizerStopper == null ? void 0 : resizerStopper(); 46836 }); 46837 vue.watch([width$, height$], ([width, height]) => { 46838 var _a; 46839 (_a = props.onResize) == null ? void 0 : _a.call(props, { 46840 width, 46841 height 46842 }); 46843 }); 46844 return { 46845 sizer, 46846 width: width$, 46847 height: height$ 46848 }; 46849 }; 46850 46851 function useTable(props) { 46852 const mainTableRef = vue.ref(); 46853 const leftTableRef = vue.ref(); 46854 const rightTableRef = vue.ref(); 46855 const { 46856 columns, 46857 columnsStyles, 46858 columnsTotalWidth, 46859 fixedColumnsOnLeft, 46860 fixedColumnsOnRight, 46861 hasFixedColumns, 46862 mainColumns, 46863 onColumnSorted 46864 } = useColumns(props, vue.toRef(props, "columns"), vue.toRef(props, "fixed")); 46865 const { 46866 scrollTo, 46867 scrollToLeft, 46868 scrollToTop, 46869 scrollToRow, 46870 onScroll, 46871 onVerticalScroll, 46872 scrollPos 46873 } = useScrollbar(props, { 46874 mainTableRef, 46875 leftTableRef, 46876 rightTableRef, 46877 onMaybeEndReached 46878 }); 46879 const { 46880 expandedRowKeys, 46881 hoveringRowKey, 46882 lastRenderedRowIndex, 46883 isDynamic, 46884 isResetting, 46885 rowHeights, 46886 resetAfterIndex, 46887 onRowExpanded, 46888 onRowHeightChange, 46889 onRowHovered, 46890 onRowsRendered 46891 } = useRow(props, { 46892 mainTableRef, 46893 leftTableRef, 46894 rightTableRef 46895 }); 46896 const { data, depthMap } = useData(props, { 46897 expandedRowKeys, 46898 lastRenderedRowIndex, 46899 resetAfterIndex 46900 }); 46901 const { 46902 bodyWidth, 46903 fixedTableHeight, 46904 mainTableHeight, 46905 leftTableWidth, 46906 rightTableWidth, 46907 headerWidth, 46908 rowsHeight, 46909 windowHeight, 46910 footerHeight, 46911 emptyStyle, 46912 rootStyle, 46913 headerHeight 46914 } = useStyles(props, { 46915 columnsTotalWidth, 46916 data, 46917 fixedColumnsOnLeft, 46918 fixedColumnsOnRight 46919 }); 46920 const isScrolling = vue.shallowRef(false); 46921 const containerRef = vue.ref(); 46922 const showEmpty = vue.computed(() => { 46923 const noData = vue.unref(data).length === 0; 46924 return isArray$1(props.fixedData) ? props.fixedData.length === 0 && noData : noData; 46925 }); 46926 function getRowHeight(rowIndex) { 46927 const { estimatedRowHeight, rowHeight, rowKey } = props; 46928 if (!estimatedRowHeight) 46929 return rowHeight; 46930 return vue.unref(rowHeights)[vue.unref(data)[rowIndex][rowKey]] || estimatedRowHeight; 46931 } 46932 function onMaybeEndReached() { 46933 const { onEndReached } = props; 46934 if (!onEndReached) 46935 return; 46936 const { scrollTop } = vue.unref(scrollPos); 46937 const _totalHeight = vue.unref(rowsHeight); 46938 const clientHeight = vue.unref(windowHeight); 46939 const heightUntilEnd = _totalHeight - (scrollTop + clientHeight) + props.hScrollbarSize; 46940 if (vue.unref(lastRenderedRowIndex) >= 0 && _totalHeight === scrollTop + vue.unref(mainTableHeight) - vue.unref(headerHeight)) { 46941 onEndReached(heightUntilEnd); 46942 } 46943 } 46944 vue.watch(() => props.expandedRowKeys, (val) => expandedRowKeys.value = val, { 46945 deep: true 46946 }); 46947 return { 46948 columns, 46949 containerRef, 46950 mainTableRef, 46951 leftTableRef, 46952 rightTableRef, 46953 isDynamic, 46954 isResetting, 46955 isScrolling, 46956 hoveringRowKey, 46957 hasFixedColumns, 46958 columnsStyles, 46959 columnsTotalWidth, 46960 data, 46961 expandedRowKeys, 46962 depthMap, 46963 fixedColumnsOnLeft, 46964 fixedColumnsOnRight, 46965 mainColumns, 46966 bodyWidth, 46967 emptyStyle, 46968 rootStyle, 46969 headerWidth, 46970 footerHeight, 46971 mainTableHeight, 46972 fixedTableHeight, 46973 leftTableWidth, 46974 rightTableWidth, 46975 showEmpty, 46976 getRowHeight, 46977 onColumnSorted, 46978 onRowHovered, 46979 onRowExpanded, 46980 onRowsRendered, 46981 onRowHeightChange, 46982 scrollTo, 46983 scrollToLeft, 46984 scrollToTop, 46985 scrollToRow, 46986 onScroll, 46987 onVerticalScroll 46988 }; 46989 } 46990 46991 const TableV2InjectionKey = Symbol("tableV2"); 46992 46993 const classType = String; 46994 const columns = { 46995 type: definePropType(Array), 46996 required: true 46997 }; 46998 const fixedDataType = { 46999 type: definePropType(Array) 47000 }; 47001 const dataType = { 47002 ...fixedDataType, 47003 required: true 47004 }; 47005 const expandColumnKey = String; 47006 const expandKeys = { 47007 type: definePropType(Array), 47008 default: () => mutable([]) 47009 }; 47010 const requiredNumber = { 47011 type: Number, 47012 required: true 47013 }; 47014 const rowKey = { 47015 type: definePropType([String, Number, Symbol]), 47016 default: "id" 47017 }; 47018 const styleType = { 47019 type: definePropType(Object) 47020 }; 47021 47022 const tableV2RowProps = buildProps({ 47023 class: String, 47024 columns, 47025 columnsStyles: { 47026 type: definePropType(Object), 47027 required: true 47028 }, 47029 depth: Number, 47030 expandColumnKey, 47031 estimatedRowHeight: { 47032 ...virtualizedGridProps.estimatedRowHeight, 47033 default: void 0 47034 }, 47035 isScrolling: Boolean, 47036 onRowExpand: { 47037 type: definePropType(Function) 47038 }, 47039 onRowHover: { 47040 type: definePropType(Function) 47041 }, 47042 onRowHeightChange: { 47043 type: definePropType(Function) 47044 }, 47045 rowData: { 47046 type: definePropType(Object), 47047 required: true 47048 }, 47049 rowEventHandlers: { 47050 type: definePropType(Object) 47051 }, 47052 rowIndex: { 47053 type: Number, 47054 required: true 47055 }, 47056 rowKey, 47057 style: { 47058 type: definePropType(Object) 47059 } 47060 });
vendor: 4,125 bytes, lines 47061-47214
47061 47062 const requiredNumberType = { 47063 type: Number, 47064 required: true 47065 }; 47066 const tableV2HeaderProps = buildProps({ 47067 class: String, 47068 columns, 47069 fixedHeaderData: { 47070 type: definePropType(Array) 47071 }, 47072 headerData: { 47073 type: definePropType(Array), 47074 required: true 47075 }, 47076 headerHeight: { 47077 type: definePropType([Number, Array]), 47078 default: 50 47079 }, 47080 rowWidth: requiredNumberType, 47081 rowHeight: { 47082 type: Number, 47083 default: 50 47084 }, 47085 height: requiredNumberType, 47086 width: requiredNumberType 47087 }); 47088 47089 const tableV2GridProps = buildProps({ 47090 columns, 47091 data: dataType, 47092 fixedData: fixedDataType, 47093 estimatedRowHeight: tableV2RowProps.estimatedRowHeight, 47094 width: requiredNumber, 47095 height: requiredNumber, 47096 headerWidth: requiredNumber, 47097 headerHeight: tableV2HeaderProps.headerHeight, 47098 bodyWidth: requiredNumber, 47099 rowHeight: requiredNumber, 47100 cache: virtualizedListProps.cache, 47101 useIsScrolling: Boolean, 47102 scrollbarAlwaysOn: virtualizedGridProps.scrollbarAlwaysOn, 47103 scrollbarStartGap: virtualizedGridProps.scrollbarStartGap, 47104 scrollbarEndGap: virtualizedGridProps.scrollbarEndGap, 47105 class: classType, 47106 style: styleType, 47107 containerStyle: styleType, 47108 getRowHeight: { 47109 type: definePropType(Function), 47110 required: true 47111 }, 47112 rowKey: tableV2RowProps.rowKey, 47113 onRowsRendered: { 47114 type: definePropType(Function) 47115 }, 47116 onScroll: { 47117 type: definePropType(Function) 47118 } 47119 }); 47120 47121 const tableV2Props = buildProps({ 47122 cache: tableV2GridProps.cache, 47123 estimatedRowHeight: tableV2RowProps.estimatedRowHeight, 47124 rowKey, 47125 headerClass: { 47126 type: definePropType([ 47127 String, 47128 Function 47129 ]) 47130 }, 47131 headerProps: { 47132 type: definePropType([ 47133 Object, 47134 Function 47135 ]) 47136 }, 47137 headerCellProps: { 47138 type: definePropType([ 47139 Object, 47140 Function 47141 ]) 47142 }, 47143 headerHeight: tableV2HeaderProps.headerHeight, 47144 footerHeight: { 47145 type: Number, 47146 default: 0 47147 }, 47148 rowClass: { 47149 type: definePropType([String, Function]) 47150 }, 47151 rowProps: { 47152 type: definePropType([Object, Function]) 47153 }, 47154 rowHeight: { 47155 type: Number, 47156 default: 50 47157 }, 47158 cellProps: { 47159 type: definePropType([ 47160 Object, 47161 Function 47162 ]) 47163 }, 47164 columns, 47165 data: dataType, 47166 dataGetter: { 47167 type: definePropType(Function) 47168 }, 47169 fixedData: fixedDataType, 47170 expandColumnKey: tableV2RowProps.expandColumnKey, 47171 expandedRowKeys: expandKeys, 47172 defaultExpandedRowKeys: expandKeys, 47173 class: classType, 47174 fixed: Boolean, 47175 style: { 47176 type: definePropType(Object) 47177 }, 47178 width: requiredNumber, 47179 height: requiredNumber, 47180 maxHeight: Number, 47181 useIsScrolling: Boolean, 47182 indentSize: { 47183 type: Number, 47184 default: 12 47185 }, 47186 iconSize: { 47187 type: Number, 47188 default: 12 47189 }, 47190 hScrollbarSize: virtualizedGridProps.hScrollbarSize, 47191 vScrollbarSize: virtualizedGridProps.vScrollbarSize, 47192 scrollbarAlwaysOn: virtualizedScrollbarProps.alwaysOn, 47193 sortBy: { 47194 type: definePropType(Object), 47195 default: () => ({}) 47196 }, 47197 sortState: { 47198 type: definePropType(Object), 47199 default: void 0 47200 }, 47201 onColumnSort: { 47202 type: definePropType(Function) 47203 }, 47204 onExpandedRowsChange: { 47205 type: definePropType(Function) 47206 }, 47207 onEndReached: { 47208 type: definePropType(Function) 47209 }, 47210 onRowExpand: tableV2RowProps.onRowExpand, 47211 onScroll: tableV2GridProps.onScroll, 47212 onRowsRendered: tableV2GridProps.onRowsRendered, 47213 rowEventHandlers: tableV2RowProps.rowEventHandlers 47214 });
47215 47216 const TableV2Cell = (props, { 47217 slots 47218 }) => { 47219 var _a; 47220 const { 47221 cellData, 47222 style 47223 } = props; 47224 const displayText = ((_a = cellData == null ? void 0 : cellData.toString) == null ? void 0 : _a.call(cellData)) || ""; 47225 return vue.createVNode("div", { 47226 "class": props.class, 47227 "title": displayText, 47228 "style": style 47229 }, [slots.default ? slots.default(props) : displayText]); 47230 }; 47231 TableV2Cell.displayName = "ElTableV2Cell"; 47232 TableV2Cell.inheritAttrs = false; 47233 var TableCell = TableV2Cell; 47234 47235 const HeaderCell = (props, { 47236 slots 47237 }) => { 47238 var _a, _b; 47239 return slots.default ? slots.default(props) : vue.createVNode("div", { 47240 "class": props.class, 47241 "title": (_a = props.column) == null ? void 0 : _a.title 47242 }, [(_b = props.column) == null ? void 0 : _b.title]); 47243 }; 47244 HeaderCell.displayName = "ElTableV2HeaderCell"; 47245 HeaderCell.inheritAttrs = false; 47246 var HeaderCell$1 = HeaderCell; 47247 47248 const tableV2HeaderRowProps = buildProps({ 47249 class: String, 47250 columns, 47251 columnsStyles: { 47252 type: definePropType(Object), 47253 required: true 47254 }, 47255 headerIndex: Number, 47256 style: { type: definePropType(Object) } 47257 }); 47258 47259 const TableV2HeaderRow = vue.defineComponent({ 47260 name: "ElTableV2HeaderRow", 47261 props: tableV2HeaderRowProps, 47262 setup(props, { 47263 slots 47264 }) { 47265 return () => { 47266 const { 47267 columns, 47268 columnsStyles, 47269 headerIndex, 47270 style 47271 } = props; 47272 let Cells = columns.map((column, columnIndex) => { 47273 return slots.cell({ 47274 columns, 47275 column, 47276 columnIndex, 47277 headerIndex, 47278 style: columnsStyles[column.key] 47279 }); 47280 }); 47281 if (slots.header) { 47282 Cells = slots.header({ 47283 cells: Cells.map((node) => { 47284 if (isArray$1(node) && node.length === 1) { 47285 return node[0]; 47286 } 47287 return node; 47288 }), 47289 columns, 47290 headerIndex 47291 }); 47292 } 47293 return vue.createVNode("div", { 47294 "class": props.class, 47295 "style": style, 47296 "role": "row" 47297 }, [Cells]); 47298 }; 47299 } 47300 }); 47301 var HeaderRow = TableV2HeaderRow; 47302 47303 const COMPONENT_NAME$7 = "ElTableV2Header"; 47304 const TableV2Header = vue.defineComponent({ 47305 name: COMPONENT_NAME$7, 47306 props: tableV2HeaderProps, 47307 setup(props, { 47308 slots, 47309 expose 47310 }) { 47311 const ns = useNamespace("table-v2"); 47312 const headerRef = vue.ref(); 47313 const headerStyle = vue.computed(() => enforceUnit({ 47314 width: props.width, 47315 height: props.height 47316 })); 47317 const rowStyle = vue.computed(() => enforceUnit({ 47318 width: props.rowWidth, 47319 height: props.height 47320 })); 47321 const headerHeights = vue.computed(() => castArray$1(vue.unref(props.headerHeight))); 47322 const scrollToLeft = (left) => { 47323 const headerEl = vue.unref(headerRef); 47324 vue.nextTick(() => { 47325 (headerEl == null ? void 0 : headerEl.scroll) && headerEl.scroll({ 47326 left 47327 }); 47328 }); 47329 }; 47330 const renderFixedRows = () => { 47331 const fixedRowClassName = ns.e("fixed-header-row"); 47332 const { 47333 columns, 47334 fixedHeaderData, 47335 rowHeight 47336 } = props; 47337 return fixedHeaderData == null ? void 0 : fixedHeaderData.map((fixedRowData, fixedRowIndex) => { 47338 var _a; 47339 const style = enforceUnit({ 47340 height: rowHeight, 47341 width: "100%" 47342 }); 47343 return (_a = slots.fixed) == null ? void 0 : _a.call(slots, { 47344 class: fixedRowClassName, 47345 columns, 47346 rowData: fixedRowData, 47347 rowIndex: -(fixedRowIndex + 1), 47348 style 47349 }); 47350 }); 47351 }; 47352 const renderDynamicRows = () => { 47353 const dynamicRowClassName = ns.e("dynamic-header-row"); 47354 const { 47355 columns 47356 } = props; 47357 return vue.unref(headerHeights).map((rowHeight, rowIndex) => { 47358 var _a; 47359 const style = enforceUnit({ 47360 width: "100%", 47361 height: rowHeight 47362 }); 47363 return (_a = slots.dynamic) == null ? void 0 : _a.call(slots, { 47364 class: dynamicRowClassName, 47365 columns, 47366 headerIndex: rowIndex, 47367 style 47368 }); 47369 }); 47370 }; 47371 expose({ 47372 scrollToLeft 47373 }); 47374 return () => { 47375 if (props.height <= 0) 47376 return; 47377 return vue.createVNode("div", { 47378 "ref": headerRef, 47379 "class": props.class, 47380 "style": vue.unref(headerStyle), 47381 "role": "rowgroup" 47382 }, [vue.createVNode("div", { 47383 "style": vue.unref(rowStyle), 47384 "class": ns.e("header") 47385 }, [renderDynamicRows(), renderFixedRows()])]); 47386 }; 47387 } 47388 });
47389 var Header = TableV2Header; 47390 47391 const useTableRow = (props) => { 47392 const { 47393 isScrolling 47394 } = vue.inject(TableV2InjectionKey); 47395 const measured = vue.ref(false); 47396 const rowRef = vue.ref(); 47397 const measurable = vue.computed(() => { 47398 return isNumber(props.estimatedRowHeight) && props.rowIndex >= 0; 47399 }); 47400 const doMeasure = (isInit = false) => { 47401 const $rowRef = vue.unref(rowRef); 47402 if (!$rowRef) 47403 return; 47404 const { 47405 columns, 47406 onRowHeightChange, 47407 rowKey, 47408 rowIndex, 47409 style 47410 } = props; 47411 const { 47412 height 47413 } = $rowRef.getBoundingClientRect(); 47414 measured.value = true; 47415 vue.nextTick(() => { 47416 if (isInit || height !== Number.parseInt(style.height)) { 47417 const firstColumn = columns[0]; 47418 const isPlaceholder = (firstColumn == null ? void 0 : firstColumn.placeholderSign) === placeholderSign; 47419 onRowHeightChange == null ? void 0 : onRowHeightChange({ 47420 rowKey, 47421 height, 47422 rowIndex 47423 }, firstColumn && !isPlaceholder && firstColumn.fixed); 47424 } 47425 }); 47426 }; 47427 const eventHandlers = vue.computed(() => { 47428 const { 47429 rowData, 47430 rowIndex, 47431 rowKey, 47432 onRowHover 47433 } = props; 47434 const handlers = props.rowEventHandlers || {}; 47435 const eventHandlers2 = {}; 47436 Object.entries(handlers).forEach(([eventName, handler]) => { 47437 if (isFunction$1(handler)) { 47438 eventHandlers2[eventName] = (event) => { 47439 handler({ 47440 event, 47441 rowData, 47442 rowIndex, 47443 rowKey 47444 }); 47445 }; 47446 } 47447 }); 47448 if (onRowHover) { 47449 [{ 47450 name: "onMouseleave", 47451 hovered: false 47452 }, { 47453 name: "onMouseenter", 47454 hovered: true 47455 }].forEach(({ 47456 name, 47457 hovered 47458 }) => { 47459 const existedHandler = eventHandlers2[name]; 47460 eventHandlers2[name] = (event) => { 47461 onRowHover({ 47462 event, 47463 hovered, 47464 rowData, 47465 rowIndex, 47466 rowKey 47467 }); 47468 existedHandler == null ? void 0 : existedHandler(event); 47469 }; 47470 }); 47471 } 47472 return eventHandlers2; 47473 }); 47474 const onExpand = (expanded) => { 47475 const { 47476 onRowExpand, 47477 rowData, 47478 rowIndex, 47479 rowKey 47480 } = props; 47481 onRowExpand == null ? void 0 : onRowExpand({ 47482 expanded, 47483 rowData, 47484 rowIndex, 47485 rowKey 47486 }); 47487 }; 47488 vue.onMounted(() => { 47489 if (vue.unref(measurable)) { 47490 doMeasure(true); 47491 } 47492 }); 47493 return { 47494 isScrolling, 47495 measurable, 47496 measured, 47497 rowRef, 47498 eventHandlers, 47499 onExpand 47500 }; 47501 }; 47502 const COMPONENT_NAME$6 = "ElTableV2TableRow"; 47503 const TableV2Row = vue.defineComponent({ 47504 name: COMPONENT_NAME$6, 47505 props: tableV2RowProps, 47506 setup(props, { 47507 expose, 47508 slots, 47509 attrs 47510 }) { 47511 const { 47512 eventHandlers, 47513 isScrolling, 47514 measurable, 47515 measured, 47516 rowRef, 47517 onExpand 47518 } = useTableRow(props); 47519 expose({ 47520 onExpand 47521 }); 47522 return () => { 47523 const { 47524 columns, 47525 columnsStyles, 47526 expandColumnKey, 47527 depth, 47528 rowData, 47529 rowIndex, 47530 style 47531 } = props; 47532 let ColumnCells = columns.map((column, columnIndex) => { 47533 const expandable = isArray$1(rowData.children) && rowData.children.length > 0 && column.key === expandColumnKey; 47534 return slots.cell({ 47535 column, 47536 columns, 47537 columnIndex, 47538 depth, 47539 style: columnsStyles[column.key], 47540 rowData, 47541 rowIndex, 47542 isScrolling: vue.unref(isScrolling), 47543 expandIconProps: expandable ? { 47544 rowData, 47545 rowIndex, 47546 onExpand 47547 } : void 0 47548 }); 47549 }); 47550 if (slots.row) { 47551 ColumnCells = slots.row({ 47552 cells: ColumnCells.map((node) => { 47553 if (isArray$1(node) && node.length === 1) { 47554 return node[0]; 47555 } 47556 return node; 47557 }), 47558 style, 47559 columns, 47560 depth, 47561 rowData, 47562 rowIndex, 47563 isScrolling: vue.unref(isScrolling) 47564 }); 47565 } 47566 if (vue.unref(measurable)) { 47567 const { 47568 height, 47569 ...exceptHeightStyle 47570 } = style || {}; 47571 const _measured = vue.unref(measured); 47572 return vue.createVNode("div", vue.mergeProps({ 47573 "ref": rowRef, 47574 "class": props.class, 47575 "style": _measured ? style : exceptHeightStyle, 47576 "role": "row" 47577 }, attrs, vue.unref(eventHandlers)), [ColumnCells]); 47578 } 47579 return vue.createVNode("div", vue.mergeProps(attrs, { 47580 "ref": rowRef, 47581 "class": props.class, 47582 "style": style, 47583 "role": "row" 47584 }, vue.unref(eventHandlers)), [ColumnCells]); 47585 }; 47586 } 47587 });
47588 var Row = TableV2Row; 47589 47590 const SortIcon = (props) => { 47591 const { 47592 sortOrder 47593 } = props; 47594 return vue.createVNode(ElIcon, { 47595 "size": 14, 47596 "class": props.class 47597 }, { 47598 default: () => [sortOrder === SortOrder.ASC ? vue.createVNode(sort_up_default, null, null) : vue.createVNode(sort_down_default, null, null)] 47599 }); 47600 }; 47601 var SortIcon$1 = SortIcon; 47602 47603 const ExpandIcon = (props) => { 47604 const { 47605 expanded, 47606 expandable, 47607 onExpand, 47608 style, 47609 size 47610 } = props; 47611 const expandIconProps = { 47612 onClick: expandable ? () => onExpand(!expanded) : void 0, 47613 class: props.class 47614 }; 47615 return vue.createVNode(ElIcon, vue.mergeProps(expandIconProps, { 47616 "size": size, 47617 "style": style 47618 }), { 47619 default: () => [vue.createVNode(arrow_right_default, null, null)] 47620 }); 47621 }; 47622 var ExpandIcon$1 = ExpandIcon; 47623 47624 const COMPONENT_NAME$5 = "ElTableV2Grid"; 47625 const useTableGrid = (props) => { 47626 const headerRef = vue.ref(); 47627 const bodyRef = vue.ref(); 47628 const totalHeight = vue.computed(() => { 47629 const { 47630 data, 47631 rowHeight, 47632 estimatedRowHeight 47633 } = props; 47634 if (estimatedRowHeight) { 47635 return; 47636 } 47637 return data.length * rowHeight; 47638 }); 47639 const fixedRowHeight = vue.computed(() => { 47640 const { 47641 fixedData, 47642 rowHeight 47643 } = props; 47644 return ((fixedData == null ? void 0 : fixedData.length) || 0) * rowHeight; 47645 }); 47646 const headerHeight = vue.computed(() => sum(props.headerHeight)); 47647 const gridHeight = vue.computed(() => { 47648 const { 47649 height 47650 } = props; 47651 return Math.max(0, height - vue.unref(headerHeight) - vue.unref(fixedRowHeight)); 47652 }); 47653 const hasHeader = vue.computed(() => { 47654 return vue.unref(headerHeight) + vue.unref(fixedRowHeight) > 0; 47655 }); 47656 const itemKey = ({ 47657 data, 47658 rowIndex 47659 }) => data[rowIndex][props.rowKey]; 47660 function onItemRendered({ 47661 rowCacheStart, 47662 rowCacheEnd, 47663 rowVisibleStart, 47664 rowVisibleEnd 47665 }) { 47666 var _a; 47667 (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, { 47668 rowCacheStart, 47669 rowCacheEnd, 47670 rowVisibleStart, 47671 rowVisibleEnd 47672 }); 47673 } 47674 function resetAfterRowIndex(index, forceUpdate2) { 47675 var _a; 47676 (_a = bodyRef.value) == null ? void 0 : _a.resetAfterRowIndex(index, forceUpdate2); 47677 } 47678 function scrollTo(leftOrOptions, top) { 47679 const header$ = vue.unref(headerRef); 47680 const body$ = vue.unref(bodyRef); 47681 if (!header$ || !body$) 47682 return; 47683 if (isObject$1(leftOrOptions)) { 47684 header$.scrollToLeft(leftOrOptions.scrollLeft); 47685 body$.scrollTo(leftOrOptions); 47686 } else { 47687 header$.scrollToLeft(leftOrOptions); 47688 body$.scrollTo({ 47689 scrollLeft: leftOrOptions, 47690 scrollTop: top 47691 }); 47692 } 47693 } 47694 function scrollToTop(scrollTop) { 47695 var _a; 47696 (_a = vue.unref(bodyRef)) == null ? void 0 : _a.scrollTo({ 47697 scrollTop 47698 }); 47699 } 47700 function scrollToRow(row, strategy) { 47701 var _a; 47702 (_a = vue.unref(bodyRef)) == null ? void 0 : _a.scrollToItem(row, 1, strategy); 47703 } 47704 function forceUpdate() { 47705 var _a, _b; 47706 (_a = vue.unref(bodyRef)) == null ? void 0 : _a.$forceUpdate(); 47707 (_b = vue.unref(headerRef)) == null ? void 0 : _b.$forceUpdate(); 47708 } 47709 return { 47710 bodyRef, 47711 forceUpdate, 47712 fixedRowHeight, 47713 gridHeight, 47714 hasHeader, 47715 headerHeight, 47716 headerRef, 47717 totalHeight, 47718 itemKey, 47719 onItemRendered, 47720 resetAfterRowIndex, 47721 scrollTo, 47722 scrollToTop, 47723 scrollToRow 47724 }; 47725 }; 47726 const TableGrid = vue.defineComponent({ 47727 name: COMPONENT_NAME$5, 47728 props: tableV2GridProps, 47729 setup(props, { 47730 slots, 47731 expose 47732 }) { 47733 const { 47734 ns 47735 } = vue.inject(TableV2InjectionKey); 47736 const { 47737 bodyRef, 47738 fixedRowHeight, 47739 gridHeight, 47740 hasHeader, 47741 headerRef, 47742 headerHeight, 47743 totalHeight,
47744 forceUpdate, 47745 itemKey, 47746 onItemRendered, 47747 resetAfterRowIndex, 47748 scrollTo, 47749 scrollToTop, 47750 scrollToRow 47751 } = useTableGrid(props); 47752 expose({ 47753 forceUpdate, 47754 totalHeight, 47755 scrollTo, 47756 scrollToTop, 47757 scrollToRow, 47758 resetAfterRowIndex 47759 }); 47760 const getColumnWidth = () => props.bodyWidth; 47761 return () => { 47762 const { 47763 cache, 47764 columns, 47765 data, 47766 fixedData, 47767 useIsScrolling, 47768 scrollbarAlwaysOn, 47769 scrollbarEndGap, 47770 scrollbarStartGap, 47771 style, 47772 rowHeight, 47773 bodyWidth, 47774 estimatedRowHeight, 47775 headerWidth, 47776 height, 47777 width, 47778 getRowHeight, 47779 onScroll 47780 } = props; 47781 const isDynamicRowEnabled = isNumber(estimatedRowHeight); 47782 const Grid = isDynamicRowEnabled ? DynamicSizeGrid$1 : FixedSizeGrid$1; 47783 const _headerHeight = vue.unref(headerHeight); 47784 return vue.createVNode("div", { 47785 "role": "table", 47786 "class": [ns.e("table"), props.class], 47787 "style": style 47788 }, [vue.createVNode(Grid, { 47789 "ref": bodyRef, 47790 "data": data, 47791 "useIsScrolling": useIsScrolling, 47792 "itemKey": itemKey, 47793 "columnCache": 0, 47794 "columnWidth": isDynamicRowEnabled ? getColumnWidth : bodyWidth, 47795 "totalColumn": 1, 47796 "totalRow": data.length, 47797 "rowCache": cache, 47798 "rowHeight": isDynamicRowEnabled ? getRowHeight : rowHeight, 47799 "width": width, 47800 "height": vue.unref(gridHeight), 47801 "class": ns.e("body"), 47802 "role": "rowgroup", 47803 "scrollbarStartGap": scrollbarStartGap, 47804 "scrollbarEndGap": scrollbarEndGap, 47805 "scrollbarAlwaysOn": scrollbarAlwaysOn, 47806 "onScroll": onScroll, 47807 "onItemRendered": onItemRendered, 47808 "perfMode": false 47809 }, { 47810 default: (params) => { 47811 var _a; 47812 const rowData = data[params.rowIndex]; 47813 return (_a = slots.row) == null ? void 0 : _a.call(slots, { 47814 ...params, 47815 columns, 47816 rowData 47817 }); 47818 } 47819 }), vue.unref(hasHeader) && vue.createVNode(Header, { 47820 "ref": headerRef, 47821 "class": ns.e("header-wrapper"), 47822 "columns": columns, 47823 "headerData": data, 47824 "headerHeight": props.headerHeight, 47825 "fixedHeaderData": fixedData, 47826 "rowWidth": headerWidth, 47827 "rowHeight": rowHeight, 47828 "width": width, 47829 "height": Math.min(_headerHeight + vue.unref(fixedRowHeight), height) 47830 }, { 47831 dynamic: slots.header, 47832 fixed: slots.row 47833 })]); 47834 }; 47835 } 47836 }); 47837 47838 function _isSlot$5(s) { 47839 return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s); 47840 } 47841 const MainTable = (props, { 47842 slots 47843 }) => { 47844 const { 47845 mainTableRef, 47846 ...rest 47847 } = props; 47848 return vue.createVNode(TableGrid, vue.mergeProps({ 47849 "ref": mainTableRef 47850 }, rest), _isSlot$5(slots) ? slots : { 47851 default: () => [slots] 47852 }); 47853 }; 47854 47855 function _isSlot$4(s) { 47856 return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s); 47857 } 47858 const LeftTable$1 = (props, { 47859 slots 47860 }) => { 47861 if (!props.columns.length) 47862 return; 47863 const { 47864 leftTableRef, 47865 ...rest 47866 } = props; 47867 return vue.createVNode(TableGrid, vue.mergeProps({ 47868 "ref": leftTableRef 47869 }, rest), _isSlot$4(slots) ? slots : { 47870 default: () => [slots] 47871 }); 47872 }; 47873 47874 function _isSlot$3(s) {
47875 return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s); 47876 } 47877 const LeftTable = (props, { 47878 slots 47879 }) => { 47880 if (!props.columns.length) 47881 return; 47882 const { 47883 rightTableRef, 47884 ...rest 47885 } = props; 47886 return vue.createVNode(TableGrid, vue.mergeProps({ 47887 "ref": rightTableRef 47888 }, rest), _isSlot$3(slots) ? slots : { 47889 default: () => [slots] 47890 }); 47891 }; 47892 47893 function _isSlot$2(s) { 47894 return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s); 47895 } 47896 const RowRenderer = (props, { 47897 slots 47898 }) => { 47899 const { 47900 columns, 47901 columnsStyles, 47902 depthMap, 47903 expandColumnKey, 47904 expandedRowKeys, 47905 estimatedRowHeight, 47906 hasFixedColumns, 47907 hoveringRowKey, 47908 rowData, 47909 rowIndex, 47910 style, 47911 isScrolling, 47912 rowProps, 47913 rowClass, 47914 rowKey, 47915 rowEventHandlers, 47916 ns, 47917 onRowHovered, 47918 onRowExpanded 47919 } = props; 47920 const rowKls = tryCall(rowClass, { 47921 columns, 47922 rowData, 47923 rowIndex 47924 }, ""); 47925 const additionalProps = tryCall(rowProps, { 47926 columns, 47927 rowData, 47928 rowIndex 47929 }); 47930 const _rowKey = rowData[rowKey]; 47931 const depth = depthMap[_rowKey] || 0; 47932 const canExpand = Boolean(expandColumnKey); 47933 const isFixedRow = rowIndex < 0; 47934 const kls = [ns.e("row"), rowKls, { 47935 [ns.e(`row-depth-${depth}`)]: canExpand && rowIndex >= 0, 47936 [ns.is("expanded")]: canExpand && expandedRowKeys.includes(_rowKey), 47937 [ns.is("hovered")]: !isScrolling && _rowKey === hoveringRowKey, 47938 [ns.is("fixed")]: !depth && isFixedRow, 47939 [ns.is("customized")]: Boolean(slots.row) 47940 }]; 47941 const onRowHover = hasFixedColumns ? onRowHovered : void 0; 47942 const _rowProps = { 47943 ...additionalProps, 47944 columns, 47945 columnsStyles, 47946 class: kls, 47947 depth, 47948 expandColumnKey, 47949 estimatedRowHeight: isFixedRow ? void 0 : estimatedRowHeight, 47950 isScrolling, 47951 rowIndex, 47952 rowData, 47953 rowKey: _rowKey, 47954 rowEventHandlers, 47955 style 47956 }; 47957 return vue.createVNode(Row, vue.mergeProps(_rowProps, { 47958 "onRowHover": onRowHover, 47959 "onRowExpand": onRowExpanded 47960 }), _isSlot$2(slots) ? slots : { 47961 default: () => [slots] 47962 }); 47963 }; 47964 47965 const CellRenderer = ({ 47966 columns, 47967 column, 47968 columnIndex, 47969 depth, 47970 expandIconProps, 47971 isScrolling, 47972 rowData, 47973 rowIndex, 47974 style, 47975 expandedRowKeys, 47976 ns, 47977 cellProps: _cellProps, 47978 expandColumnKey, 47979 indentSize, 47980 iconSize, 47981 rowKey 47982 }, { 47983 slots 47984 }) => { 47985 const cellStyle = enforceUnit(style); 47986 if (column.placeholderSign === placeholderSign) { 47987 return vue.createVNode("div", { 47988 "class": ns.em("row-cell", "placeholder"), 47989 "style": cellStyle 47990 }, null); 47991 } 47992 const { 47993 cellRenderer, 47994 dataKey, 47995 dataGetter 47996 } = column; 47997 const columnCellRenderer = componentToSlot(cellRenderer); 47998 const CellComponent = columnCellRenderer || slots.default || ((props) => vue.createVNode(TableCell, props, null)); 47999 const cellData = isFunction$1(dataGetter) ? dataGetter({ 48000 columns, 48001 column, 48002 columnIndex, 48003 rowData, 48004 rowIndex 48005 }) : get(rowData, dataKey != null ? dataKey : ""); 48006 const extraCellProps = tryCall(_cellProps, { 48007 cellData, 48008 columns, 48009 column, 48010 columnIndex, 48011 rowIndex, 48012 rowData 48013 }); 48014 const cellProps = { 48015 class: ns.e("cell-text"), 48016 columns, 48017 column, 48018 columnIndex, 48019 cellData, 48020 isScrolling, 48021 rowData, 48022 rowIndex 48023 }; 48024 const Cell = CellComponent(cellProps);
48025 const kls = [ns.e("row-cell"), column.class, column.align === Alignment.CENTER && ns.is("align-center"), column.align === Alignment.RIGHT && ns.is("align-right")]; 48026 const expandable = rowIndex >= 0 && expandColumnKey && column.key === expandColumnKey; 48027 const expanded = rowIndex >= 0 && expandedRowKeys.includes(rowData[rowKey]); 48028 let IconOrPlaceholder; 48029 const iconStyle = `margin-inline-start: ${depth * indentSize}px;`; 48030 if (expandable) { 48031 if (isObject$1(expandIconProps)) { 48032 IconOrPlaceholder = vue.createVNode(ExpandIcon$1, vue.mergeProps(expandIconProps, { 48033 "class": [ns.e("expand-icon"), ns.is("expanded", expanded)], 48034 "size": iconSize, 48035 "expanded": expanded, 48036 "style": iconStyle, 48037 "expandable": true 48038 }), null); 48039 } else { 48040 IconOrPlaceholder = vue.createVNode("div", { 48041 "style": [iconStyle, `width: ${iconSize}px; height: ${iconSize}px;`].join(" ") 48042 }, null); 48043 } 48044 } 48045 return vue.createVNode("div", vue.mergeProps({ 48046 "class": kls, 48047 "style": cellStyle 48048 }, extraCellProps, { 48049 "role": "cell" 48050 }), [IconOrPlaceholder, Cell]); 48051 }; 48052 CellRenderer.inheritAttrs = false; 48053 48054 function _isSlot$1(s) { 48055 return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s); 48056 } 48057 const HeaderRenderer = ({ 48058 columns, 48059 columnsStyles, 48060 headerIndex, 48061 style, 48062 headerClass, 48063 headerProps, 48064 ns 48065 }, { 48066 slots 48067 }) => { 48068 const param = { 48069 columns, 48070 headerIndex 48071 }; 48072 const kls = [ns.e("header-row"), tryCall(headerClass, param, ""), { 48073 [ns.is("customized")]: Boolean(slots.header) 48074 }]; 48075 const extraProps = { 48076 ...tryCall(headerProps, param), 48077 columnsStyles, 48078 class: kls, 48079 columns, 48080 headerIndex, 48081 style 48082 }; 48083 return vue.createVNode(HeaderRow, extraProps, _isSlot$1(slots) ? slots : { 48084 default: () => [slots] 48085 }); 48086 }; 48087 48088 const HeaderCellRenderer = (props, { 48089 slots 48090 }) => { 48091 const { 48092 column, 48093 ns, 48094 style, 48095 onColumnSorted 48096 } = props; 48097 const cellStyle = enforceUnit(style); 48098 if (column.placeholderSign === placeholderSign) { 48099 return vue.createVNode("div", { 48100 "class": ns.em("header-row-cell", "placeholder"), 48101 "style": cellStyle 48102 }, null); 48103 } 48104 const { 48105 headerCellRenderer, 48106 headerClass, 48107 sortable 48108 } = column; 48109 const cellProps = { 48110 ...props, 48111 class: ns.e("header-cell-text") 48112 }; 48113 const cellRenderer = componentToSlot(headerCellRenderer) || slots.default || ((props2) => vue.createVNode(HeaderCell$1, props2, null)); 48114 const Cell = cellRenderer(cellProps); 48115 const { 48116 sortBy, 48117 sortState, 48118 headerCellProps 48119 } = props; 48120 let sorting, sortOrder; 48121 if (sortState) { 48122 const order = sortState[column.key]; 48123 sorting = Boolean(oppositeOrderMap[order]); 48124 sortOrder = sorting ? order : SortOrder.ASC; 48125 } else { 48126 sorting = column.key === sortBy.key; 48127 sortOrder = sorting ? sortBy.order : SortOrder.ASC; 48128 } 48129 const cellKls = [ns.e("header-cell"), tryCall(headerClass, props, ""), column.align === Alignment.CENTER && ns.is("align-center"), column.align === Alignment.RIGHT && ns.is("align-right"), sortable && ns.is("sortable")]; 48130 const cellWrapperProps = { 48131 ...tryCall(headerCellProps, props), 48132 onClick: column.sortable ? onColumnSorted : void 0, 48133 class: cellKls, 48134 style: cellStyle, 48135 ["data-key"]: column.key 48136 }; 48137 return vue.createVNode("div", vue.mergeProps(cellWrapperProps, { 48138 "role": "columnheader" 48139 }), [Cell, sortable && vue.createVNode(SortIcon$1, { 48140 "class": [ns.e("sort-icon"), sorting && ns.is("sorting")], 48141 "sortOrder": sortOrder 48142 }, null)]); 48143 }; 48144 48145 const Footer$1 = (props, { 48146 slots 48147 }) => { 48148 var _a; 48149 return vue.createVNode("div", { 48150 "class": props.class, 48151 "style": props.style 48152 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]); 48153 }; 48154 Footer$1.displayName = "ElTableV2Footer"; 48155 48156 const Footer = (props, { 48157 slots 48158 }) => { 48159 return vue.createVNode("div", { 48160 "class": props.class, 48161 "style": props.style 48162 }, [slots.default ? slots.default() : vue.createVNode(ElEmpty, null, null)]); 48163 }; 48164 Footer.displayName = "ElTableV2Empty"; 48165 48166 const Overlay = (props, { 48167 slots 48168 }) => { 48169 var _a; 48170 return vue.createVNode("div", { 48171 "class": props.class, 48172 "style": props.style 48173 }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]); 48174 }; 48175 Overlay.displayName = "ElTableV2Overlay"; 48176 48177 function _isSlot(s) {
48178 return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s); 48179 } 48180 const COMPONENT_NAME$4 = "ElTableV2"; 48181 const TableV2 = vue.defineComponent({ 48182 name: COMPONENT_NAME$4, 48183 props: tableV2Props, 48184 setup(props, { 48185 slots, 48186 expose 48187 }) { 48188 const ns = useNamespace("table-v2"); 48189 const { 48190 columnsStyles, 48191 fixedColumnsOnLeft, 48192 fixedColumnsOnRight, 48193 mainColumns, 48194 mainTableHeight, 48195 fixedTableHeight, 48196 leftTableWidth, 48197 rightTableWidth, 48198 data, 48199 depthMap, 48200 expandedRowKeys, 48201 hasFixedColumns, 48202 hoveringRowKey, 48203 mainTableRef, 48204 leftTableRef, 48205 rightTableRef, 48206 isDynamic, 48207 isResetting, 48208 isScrolling, 48209 bodyWidth, 48210 emptyStyle, 48211 rootStyle, 48212 headerWidth, 48213 footerHeight, 48214 showEmpty, 48215 scrollTo, 48216 scrollToLeft, 48217 scrollToTop, 48218 scrollToRow, 48219 getRowHeight, 48220 onColumnSorted, 48221 onRowHeightChange, 48222 onRowHovered, 48223 onRowExpanded, 48224 onRowsRendered, 48225 onScroll, 48226 onVerticalScroll 48227 } = useTable(props); 48228 expose({ 48229 scrollTo, 48230 scrollToLeft, 48231 scrollToTop, 48232 scrollToRow 48233 }); 48234 vue.provide(TableV2InjectionKey, { 48235 ns, 48236 isResetting, 48237 hoveringRowKey, 48238 isScrolling 48239 }); 48240 return () => { 48241 const { 48242 cache, 48243 cellProps, 48244 estimatedRowHeight, 48245 expandColumnKey, 48246 fixedData, 48247 headerHeight, 48248 headerClass, 48249 headerProps, 48250 headerCellProps, 48251 sortBy, 48252 sortState, 48253 rowHeight, 48254 rowClass, 48255 rowEventHandlers, 48256 rowKey, 48257 rowProps, 48258 scrollbarAlwaysOn, 48259 indentSize, 48260 iconSize, 48261 useIsScrolling, 48262 vScrollbarSize, 48263 width 48264 } = props; 48265 const _data = vue.unref(data); 48266 const mainTableProps = { 48267 cache, 48268 class: ns.e("main"), 48269 columns: vue.unref(mainColumns), 48270 data: _data, 48271 fixedData, 48272 estimatedRowHeight, 48273 bodyWidth: vue.unref(bodyWidth), 48274 headerHeight, 48275 headerWidth: vue.unref(headerWidth), 48276 height: vue.unref(mainTableHeight), 48277 mainTableRef, 48278 rowKey, 48279 rowHeight, 48280 scrollbarAlwaysOn, 48281 scrollbarStartGap: 2, 48282 scrollbarEndGap: vScrollbarSize, 48283 useIsScrolling, 48284 width, 48285 getRowHeight, 48286 onRowsRendered, 48287 onScroll 48288 }; 48289 const leftColumnsWidth = vue.unref(leftTableWidth); 48290 const _fixedTableHeight = vue.unref(fixedTableHeight); 48291 const leftTableProps = { 48292 cache, 48293 class: ns.e("left"), 48294 columns: vue.unref(fixedColumnsOnLeft), 48295 data: _data, 48296 estimatedRowHeight, 48297 leftTableRef, 48298 rowHeight, 48299 bodyWidth: leftColumnsWidth, 48300 headerWidth: leftColumnsWidth, 48301 headerHeight, 48302 height: _fixedTableHeight, 48303 rowKey, 48304 scrollbarAlwaysOn, 48305 scrollbarStartGap: 2, 48306 scrollbarEndGap: vScrollbarSize, 48307 useIsScrolling, 48308 width: leftColumnsWidth, 48309 getRowHeight, 48310 onScroll: onVerticalScroll 48311 }; 48312 const rightColumnsWidth = vue.unref(rightTableWidth); 48313 const rightColumnsWidthWithScrollbar = rightColumnsWidth + vScrollbarSize; 48314 const rightTableProps = { 48315 cache, 48316 class: ns.e("right"), 48317 columns: vue.unref(fixedColumnsOnRight), 48318 data: _data, 48319 estimatedRowHeight, 48320 rightTableRef, 48321 rowHeight, 48322 bodyWidth: rightColumnsWidthWithScrollbar, 48323 headerWidth: rightColumnsWidthWithScrollbar, 48324 headerHeight, 48325 height: _fixedTableHeight, 48326 rowKey, 48327 scrollbarAlwaysOn, 48328 scrollbarStartGap: 2, 48329 scrollbarEndGap: vScrollbarSize, 48330 width: rightColumnsWidthWithScrollbar, 48331 style: `--${vue.unref(ns.namespace)}-table-scrollbar-size: ${vScrollbarSize}px`, 48332 useIsScrolling, 48333 getRowHeight, 48334 onScroll: onVerticalScroll 48335 }; 48336 const _columnsStyles = vue.unref(columnsStyles); 48337 const tableRowProps = { 48338 ns, 48339 depthMap: vue.unref(depthMap), 48340 columnsStyles: _columnsStyles, 48341 expandColumnKey, 48342 expandedRowKeys: vue.unref(expandedRowKeys), 48343 estimatedRowHeight, 48344 hasFixedColumns: vue.unref(hasFixedColumns), 48345 hoveringRowKey: vue.unref(hoveringRowKey), 48346 rowProps, 48347 rowClass, 48348 rowKey, 48349 rowEventHandlers, 48350 onRowHovered, 48351 onRowExpanded, 48352 onRowHeightChange 48353 }; 48354 const tableCellProps = { 48355 cellProps, 48356 expandColumnKey, 48357 indentSize, 48358 iconSize, 48359 rowKey, 48360 expandedRowKeys: vue.unref(expandedRowKeys), 48361 ns 48362 }; 48363 const tableHeaderProps = { 48364 ns, 48365 headerClass, 48366 headerProps, 48367 columnsStyles: _columnsStyles 48368 }; 48369 const tableHeaderCellProps = { 48370 ns, 48371 sortBy, 48372 sortState, 48373 headerCellProps, 48374 onColumnSorted 48375 }; 48376 const tableSlots = { 48377 row: (props2) => vue.createVNode(RowRenderer, vue.mergeProps(props2, tableRowProps), { 48378 row: slots.row, 48379 cell: (props3) => { 48380 let _slot; 48381 return slots.cell ? vue.createVNode(CellRenderer, vue.mergeProps(props3, tableCellProps, { 48382 "style": _columnsStyles[props3.column.key] 48383 }), _isSlot(_slot = slots.cell(props3)) ? _slot : { 48384 default: () => [_slot] 48385 }) : vue.createVNode(CellRenderer, vue.mergeProps(props3, tableCellProps, { 48386 "style": _columnsStyles[props3.column.key] 48387 }), null); 48388 } 48389 }), 48390 header: (props2) => vue.createVNode(HeaderRenderer, vue.mergeProps(props2, tableHeaderProps), { 48391 header: slots.header, 48392 cell: (props3) => { 48393 let _slot2; 48394 return slots["header-cell"] ? vue.createVNode(HeaderCellRenderer, vue.mergeProps(props3, tableHeaderCellProps, { 48395 "style": _columnsStyles[props3.column.key] 48396 }), _isSlot(_slot2 = slots["header-cell"](props3)) ? _slot2 : { 48397 default: () => [_slot2] 48398 }) : vue.createVNode(HeaderCellRenderer, vue.mergeProps(props3, tableHeaderCellProps, { 48399 "style": _columnsStyles[props3.column.key] 48400 }), null); 48401 } 48402 }) 48403 }; 48404 const rootKls = [props.class, ns.b(), ns.e("root"), { 48405 [ns.is("dynamic")]: vue.unref(isDynamic) 48406 }]; 48407 const footerProps = { 48408 class: ns.e("footer"), 48409 style: vue.unref(footerHeight) 48410 }; 48411 return vue.createVNode("div", { 48412 "class": rootKls, 48413 "style": vue.unref(rootStyle) 48414 }, [vue.createVNode(MainTable, mainTableProps, _isSlot(tableSlots) ? tableSlots : { 48415 default: () => [tableSlots] 48416 }), vue.createVNode(LeftTable$1, leftTableProps, _isSlot(tableSlots) ? tableSlots : { 48417 default: () => [tableSlots] 48418 }), vue.createVNode(LeftTable, rightTableProps, _isSlot(tableSlots) ? tableSlots : { 48419 default: () => [tableSlots] 48420 }), slots.footer && vue.createVNode(Footer$1, footerProps, { 48421 default: slots.footer 48422 }), vue.unref(showEmpty) && vue.createVNode(Footer, { 48423 "class": ns.e("empty"), 48424 "style": vue.unref(emptyStyle) 48425 }, { 48426 default: slots.empty 48427 }), slots.overlay && vue.createVNode(Overlay, { 48428 "class": ns.e("overlay") 48429 }, { 48430 default: slots.overlay 48431 })]); 48432 }; 48433 } 48434 });
48435 var TableV2$1 = TableV2; 48436 48437 const autoResizerProps = buildProps({ 48438 disableWidth: Boolean, 48439 disableHeight: Boolean, 48440 onResize: { 48441 type: definePropType(Function) 48442 } 48443 }); 48444 48445 const AutoResizer = vue.defineComponent({ 48446 name: "ElAutoResizer", 48447 props: autoResizerProps, 48448 setup(props, { 48449 slots 48450 }) { 48451 const ns = useNamespace("auto-resizer"); 48452 const { 48453 height, 48454 width, 48455 sizer 48456 } = useAutoResize(props); 48457 const style = { 48458 width: "100%", 48459 height: "100%" 48460 }; 48461 return () => { 48462 var _a; 48463 return vue.createVNode("div", { 48464 "ref": sizer, 48465 "class": ns.b(), 48466 "style": style 48467 }, [(_a = slots.default) == null ? void 0 : _a.call(slots, { 48468 height: height.value, 48469 width: width.value 48470 })]); 48471 }; 48472 } 48473 }); 48474 48475 const ElTableV2 = withInstall(TableV2$1); 48476 const ElAutoResizer = withInstall(AutoResizer); 48477 48478 const tabsRootContextKey = Symbol("tabsRootContextKey"); 48479 48480 const tabBarProps = buildProps({ 48481 tabs: { 48482 type: definePropType(Array), 48483 default: () => mutable([]) 48484 } 48485 }); 48486 48487 const COMPONENT_NAME$3 = "ElTabBar"; 48488 const __default__$k = vue.defineComponent({ 48489 name: COMPONENT_NAME$3 48490 }); 48491 const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({ 48492 ...__default__$k, 48493 props: tabBarProps, 48494 setup(__props, { expose }) { 48495 const props = __props; 48496 const instance = vue.getCurrentInstance(); 48497 const rootTabs = vue.inject(tabsRootContextKey); 48498 if (!rootTabs) 48499 throwError(COMPONENT_NAME$3, "<el-tabs><el-tab-bar /></el-tabs>"); 48500 const ns = useNamespace("tabs"); 48501 const barRef = vue.ref(); 48502 const barStyle = vue.ref(); 48503 const getBarStyle = () => { 48504 let offset = 0; 48505 let tabSize = 0; 48506 const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height"; 48507 const sizeDir = sizeName === "width" ? "x" : "y"; 48508 const position = sizeDir === "x" ? "left" : "top"; 48509 props.tabs.every((tab) => { 48510 var _a, _b; 48511 const $el = (_b = (_a = instance.parent) == null ? void 0 : _a.refs) == null ? void 0 : _b[`tab-${tab.uid}`]; 48512 if (!$el) 48513 return false; 48514 if (!tab.active) { 48515 return true; 48516 } 48517 offset = $el[`offset${capitalize(position)}`]; 48518 tabSize = $el[`client${capitalize(sizeName)}`]; 48519 const tabStyles = window.getComputedStyle($el); 48520 if (sizeName === "width") { 48521 if (props.tabs.length > 1) { 48522 tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight); 48523 } 48524 offset += Number.parseFloat(tabStyles.paddingLeft); 48525 } 48526 return false; 48527 }); 48528 return { 48529 [sizeName]: `${tabSize}px`, 48530 transform: `translate${capitalize(sizeDir)}(${offset}px)` 48531 }; 48532 }; 48533 const update = () => barStyle.value = getBarStyle(); 48534 vue.watch(() => props.tabs, async () => { 48535 await vue.nextTick(); 48536 update(); 48537 }, { immediate: true }); 48538 useResizeObserver(barRef, () => update()); 48539 expose({ 48540 ref: barRef, 48541 update 48542 }); 48543 return (_ctx, _cache) => { 48544 return vue.openBlock(), vue.createElementBlock("div", { 48545 ref_key: "barRef", 48546 ref: barRef, 48547 class: vue.normalizeClass([vue.unref(ns).e("active-bar"), vue.unref(ns).is(vue.unref(rootTabs).props.tabPosition)]), 48548 style: vue.normalizeStyle(barStyle.value) 48549 }, null, 6); 48550 }; 48551 } 48552 }); 48553 var TabBar = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__file", "tab-bar.vue"]]); 48554 48555 const tabNavProps = buildProps({ 48556 panes: { 48557 type: definePropType(Array), 48558 default: () => mutable([]) 48559 }, 48560 currentName: { 48561 type: [String, Number], 48562 default: "" 48563 }, 48564 editable: Boolean, 48565 type: { 48566 type: String, 48567 values: ["card", "border-card", ""], 48568 default: "" 48569 }, 48570 stretch: Boolean 48571 });
48572 const tabNavEmits = { 48573 tabClick: (tab, tabName, ev) => ev instanceof Event, 48574 tabRemove: (tab, ev) => ev instanceof Event 48575 }; 48576 const COMPONENT_NAME$2 = "ElTabNav"; 48577 const TabNav = vue.defineComponent({ 48578 name: COMPONENT_NAME$2, 48579 props: tabNavProps, 48580 emits: tabNavEmits, 48581 setup(props, { 48582 expose, 48583 emit 48584 }) { 48585 const vm = vue.getCurrentInstance(); 48586 const rootTabs = vue.inject(tabsRootContextKey); 48587 if (!rootTabs) 48588 throwError(COMPONENT_NAME$2, `<el-tabs><tab-nav /></el-tabs>`); 48589 const ns = useNamespace("tabs"); 48590 const visibility = useDocumentVisibility(); 48591 const focused = useWindowFocus(); 48592 const navScroll$ = vue.ref(); 48593 const nav$ = vue.ref(); 48594 const el$ = vue.ref(); 48595 const tabBarRef = vue.ref(); 48596 const scrollable = vue.ref(false); 48597 const navOffset = vue.ref(0); 48598 const isFocus = vue.ref(false); 48599 const focusable = vue.ref(true); 48600 const sizeName = vue.computed(() => ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height"); 48601 const navStyle = vue.computed(() => { 48602 const dir = sizeName.value === "width" ? "X" : "Y"; 48603 return { 48604 transform: `translate${dir}(-${navOffset.value}px)` 48605 }; 48606 }); 48607 const scrollPrev = () => { 48608 if (!navScroll$.value) 48609 return; 48610 const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`]; 48611 const currentOffset = navOffset.value; 48612 if (!currentOffset) 48613 return; 48614 const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0; 48615 navOffset.value = newOffset; 48616 }; 48617 const scrollNext = () => { 48618 if (!navScroll$.value || !nav$.value) 48619 return; 48620 const navSize = nav$.value[`offset${capitalize(sizeName.value)}`]; 48621 const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`]; 48622 const currentOffset = navOffset.value; 48623 if (navSize - currentOffset <= containerSize) 48624 return; 48625 const newOffset = navSize - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize - containerSize; 48626 navOffset.value = newOffset; 48627 }; 48628 const scrollToActiveTab = async () => { 48629 const nav = nav$.value; 48630 if (!scrollable.value || !el$.value || !navScroll$.value || !nav) 48631 return; 48632 await vue.nextTick(); 48633 const activeTab = el$.value.querySelector(".is-active"); 48634 if (!activeTab) 48635 return; 48636 const navScroll = navScroll$.value; 48637 const isHorizontal = ["top", "bottom"].includes(rootTabs.props.tabPosition); 48638 const activeTabBounding = activeTab.getBoundingClientRect(); 48639 const navScrollBounding = navScroll.getBoundingClientRect(); 48640 const maxOffset = isHorizontal ? nav.offsetWidth - navScrollBounding.width : nav.offsetHeight - navScrollBounding.height; 48641 const currentOffset = navOffset.value; 48642 let newOffset = currentOffset; 48643 if (isHorizontal) { 48644 if (activeTabBounding.left < navScrollBounding.left) { 48645 newOffset = currentOffset - (navScrollBounding.left - activeTabBounding.left); 48646 } 48647 if (activeTabBounding.right > navScrollBounding.right) { 48648 newOffset = currentOffset + activeTabBounding.right - navScrollBounding.right; 48649 } 48650 } else { 48651 if (activeTabBounding.top < navScrollBounding.top) { 48652 newOffset = currentOffset - (navScrollBounding.top - activeTabBounding.top); 48653 } 48654 if (activeTabBounding.bottom > navScrollBounding.bottom) { 48655 newOffset = currentOffset + (activeTabBounding.bottom - navScrollBounding.bottom); 48656 } 48657 } 48658 newOffset = Math.max(newOffset, 0); 48659 navOffset.value = Math.min(newOffset, maxOffset); 48660 }; 48661 const update = () => { 48662 var _a; 48663 if (!nav$.value || !navScroll$.value) 48664 return; 48665 props.stretch && ((_a = tabBarRef.value) == null ? void 0 : _a.update()); 48666 const navSize = nav$.value[`offset${capitalize(sizeName.value)}`]; 48667 const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`]; 48668 const currentOffset = navOffset.value;
48669 if (containerSize < navSize) { 48670 scrollable.value = scrollable.value || {}; 48671 scrollable.value.prev = currentOffset; 48672 scrollable.value.next = currentOffset + containerSize < navSize; 48673 if (navSize - currentOffset < containerSize) { 48674 navOffset.value = navSize - containerSize; 48675 } 48676 } else { 48677 scrollable.value = false; 48678 if (currentOffset > 0) { 48679 navOffset.value = 0; 48680 } 48681 } 48682 }; 48683 const changeTab = (e) => { 48684 const code = e.code; 48685 const { 48686 up, 48687 down, 48688 left, 48689 right 48690 } = EVENT_CODE; 48691 if (![up, down, left, right].includes(code)) 48692 return; 48693 const tabList = Array.from(e.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)")); 48694 const currentIndex = tabList.indexOf(e.target); 48695 let nextIndex; 48696 if (code === left || code === up) { 48697 if (currentIndex === 0) { 48698 nextIndex = tabList.length - 1; 48699 } else { 48700 nextIndex = currentIndex - 1; 48701 } 48702 } else { 48703 if (currentIndex < tabList.length - 1) { 48704 nextIndex = currentIndex + 1; 48705 } else { 48706 nextIndex = 0; 48707 } 48708 } 48709 tabList[nextIndex].focus({ 48710 preventScroll: true 48711 }); 48712 tabList[nextIndex].click(); 48713 setFocus(); 48714 }; 48715 const setFocus = () => { 48716 if (focusable.value) 48717 isFocus.value = true; 48718 }; 48719 const removeFocus = () => isFocus.value = false; 48720 vue.watch(visibility, (visibility2) => { 48721 if (visibility2 === "hidden") { 48722 focusable.value = false; 48723 } else if (visibility2 === "visible") { 48724 setTimeout(() => focusable.value = true, 50); 48725 } 48726 }); 48727 vue.watch(focused, (focused2) => { 48728 if (focused2) { 48729 setTimeout(() => focusable.value = true, 50); 48730 } else { 48731 focusable.value = false; 48732 } 48733 }); 48734 useResizeObserver(el$, update); 48735 vue.onMounted(() => setTimeout(() => scrollToActiveTab(), 0)); 48736 vue.onUpdated(() => update()); 48737 expose({ 48738 scrollToActiveTab, 48739 removeFocus 48740 }); 48741 vue.watch(() => props.panes, () => vm.update(), { 48742 flush: "post", 48743 deep: true 48744 }); 48745 return () => { 48746 const scrollBtn = scrollable.value ? [vue.createVNode("span", { 48747 "class": [ns.e("nav-prev"), ns.is("disabled", !scrollable.value.prev)], 48748 "onClick": scrollPrev 48749 }, [vue.createVNode(ElIcon, null, { 48750 default: () => [vue.createVNode(arrow_left_default, null, null)] 48751 })]), vue.createVNode("span", { 48752 "class": [ns.e("nav-next"), ns.is("disabled", !scrollable.value.next)], 48753 "onClick": scrollNext 48754 }, [vue.createVNode(ElIcon, null, { 48755 default: () => [vue.createVNode(arrow_right_default, null, null)] 48756 })])] : null; 48757 const tabs = props.panes.map((pane, index) => { 48758 var _a, _b, _c, _d; 48759 const uid = pane.uid; 48760 const disabled = pane.props.disabled; 48761 const tabName = (_b = (_a = pane.props.name) != null ? _a : pane.index) != null ? _b : `${index}`; 48762 const closable = !disabled && (pane.isClosable || props.editable); 48763 pane.index = `${index}`; 48764 const btnClose = closable ? vue.createVNode(ElIcon, { 48765 "class": "is-icon-close", 48766 "onClick": (ev) => emit("tabRemove", pane, ev) 48767 }, { 48768 default: () => [vue.createVNode(close_default, null, null)] 48769 }) : null; 48770 const tabLabelContent = ((_d = (_c = pane.slots).label) == null ? void 0 : _d.call(_c)) || pane.props.label; 48771 const tabindex = !disabled && pane.active ? 0 : -1; 48772 return vue.createVNode("div", { 48773 "ref": `tab-${uid}`, 48774 "class": [ns.e("item"), ns.is(rootTabs.props.tabPosition), ns.is("active", pane.active), ns.is("disabled", disabled), ns.is("closable", closable), ns.is("focus", isFocus.value)], 48775 "id": `tab-${tabName}`, 48776 "key": `tab-${uid}`, 48777 "aria-controls": `pane-${tabName}`, 48778 "role": "tab", 48779 "aria-selected": pane.active, 48780 "tabindex": tabindex, 48781 "onFocus": () => setFocus(), 48782 "onBlur": () => removeFocus(), 48783 "onClick": (ev) => { 48784 removeFocus(); 48785 emit("tabClick", pane, tabName, ev); 48786 }, 48787 "onKeydown": (ev) => { 48788 if (closable && (ev.code === EVENT_CODE.delete || ev.code === EVENT_CODE.backspace)) { 48789 emit("tabRemove", pane, ev); 48790 } 48791 } 48792 }, [...[tabLabelContent, btnClose]]); 48793 }); 48794 return vue.createVNode("div", { 48795 "ref": el$, 48796 "class": [ns.e("nav-wrap"), ns.is("scrollable", !!scrollable.value), ns.is(rootTabs.props.tabPosition)] 48797 }, [scrollBtn, vue.createVNode("div", { 48798 "class": ns.e("nav-scroll"), 48799 "ref": navScroll$ 48800 }, [vue.createVNode("div", { 48801 "class": [ns.e("nav"), ns.is(rootTabs.props.tabPosition), ns.is("stretch", props.stretch && ["top", "bottom"].includes(rootTabs.props.tabPosition))], 48802 "ref": nav$, 48803 "style": navStyle.value, 48804 "role": "tablist", 48805 "onKeydown": changeTab 48806 }, [...[!props.type ? vue.createVNode(TabBar, { 48807 "ref": tabBarRef, 48808 "tabs": [...props.panes] 48809 }, null) : null, tabs]])])]); 48810 }; 48811 } 48812 });
48813 48814 const tabsProps = buildProps({ 48815 type: { 48816 type: String, 48817 values: ["card", "border-card", ""], 48818 default: "" 48819 }, 48820 activeName: { 48821 type: [String, Number] 48822 }, 48823 closable: Boolean, 48824 addable: Boolean, 48825 modelValue: { 48826 type: [String, Number] 48827 }, 48828 editable: Boolean, 48829 tabPosition: { 48830 type: String, 48831 values: ["top", "right", "bottom", "left"], 48832 default: "top" 48833 }, 48834 beforeLeave: { 48835 type: definePropType(Function), 48836 default: () => true 48837 }, 48838 stretch: Boolean 48839 }); 48840 const isPaneName = (value) => isString$1(value) || isNumber(value); 48841 const tabsEmits = { 48842 [UPDATE_MODEL_EVENT]: (name) => isPaneName(name), 48843 tabClick: (pane, ev) => ev instanceof Event, 48844 tabChange: (name) => isPaneName(name), 48845 edit: (paneName, action) => ["remove", "add"].includes(action), 48846 tabRemove: (name) => isPaneName(name), 48847 tabAdd: () => true 48848 }; 48849 var Tabs = vue.defineComponent({ 48850 name: "ElTabs", 48851 props: tabsProps, 48852 emits: tabsEmits, 48853 setup(props, { 48854 emit, 48855 slots, 48856 expose 48857 }) { 48858 var _a, _b; 48859 const ns = useNamespace("tabs"); 48860 const { 48861 children: panes, 48862 addChild: registerPane, 48863 removeChild: unregisterPane 48864 } = useOrderedChildren(vue.getCurrentInstance(), "ElTabPane"); 48865 const nav$ = vue.ref(); 48866 const currentName = vue.ref((_b = (_a = props.modelValue) != null ? _a : props.activeName) != null ? _b : "0"); 48867 const changeCurrentName = (value) => { 48868 currentName.value = value; 48869 emit(UPDATE_MODEL_EVENT, value); 48870 emit("tabChange", value); 48871 }; 48872 const setCurrentName = async (value) => { 48873 var _a2, _b2, _c; 48874 if (currentName.value === value || isUndefined(value)) 48875 return; 48876 try { 48877 const canLeave = await ((_a2 = props.beforeLeave) == null ? void 0 : _a2.call(props, value, currentName.value)); 48878 if (canLeave !== false) { 48879 changeCurrentName(value); 48880 (_c = (_b2 = nav$.value) == null ? void 0 : _b2.removeFocus) == null ? void 0 : _c.call(_b2); 48881 } 48882 } catch (e) { 48883 } 48884 }; 48885 const handleTabClick = (tab, tabName, event) => { 48886 if (tab.props.disabled) 48887 return; 48888 setCurrentName(tabName); 48889 emit("tabClick", tab, event); 48890 }; 48891 const handleTabRemove = (pane, ev) => { 48892 if (pane.props.disabled || isUndefined(pane.props.name)) 48893 return; 48894 ev.stopPropagation(); 48895 emit("edit", pane.props.name, "remove"); 48896 emit("tabRemove", pane.props.name); 48897 }; 48898 const handleTabAdd = () => { 48899 emit("edit", void 0, "add"); 48900 emit("tabAdd"); 48901 }; 48902 useDeprecated({ 48903 from: '"activeName"', 48904 replacement: '"model-value" or "v-model"', 48905 scope: "ElTabs", 48906 version: "2.3.0", 48907 ref: "https://element-plus.org/en-US/component/tabs.html#attributes", 48908 type: "Attribute" 48909 }, vue.computed(() => !!props.activeName)); 48910 vue.watch(() => props.activeName, (modelValue) => setCurrentName(modelValue)); 48911 vue.watch(() => props.modelValue, (modelValue) => setCurrentName(modelValue)); 48912 vue.watch(currentName, async () => { 48913 var _a2; 48914 await vue.nextTick(); 48915 (_a2 = nav$.value) == null ? void 0 : _a2.scrollToActiveTab(); 48916 }); 48917 vue.provide(tabsRootContextKey, { 48918 props, 48919 currentName, 48920 registerPane, 48921 unregisterPane 48922 }); 48923 expose({ 48924 currentName 48925 }); 48926 return () => { 48927 const newButton = props.editable || props.addable ? vue.createVNode("span", { 48928 "class": ns.e("new-tab"), 48929 "tabindex": "0", 48930 "onClick": handleTabAdd, 48931 "onKeydown": (ev) => { 48932 if (ev.code === EVENT_CODE.enter) 48933 handleTabAdd(); 48934 } 48935 }, [vue.createVNode(ElIcon, { 48936 "class": ns.is("icon-plus") 48937 }, { 48938 default: () => [vue.createVNode(plus_default, null, null)] 48939 })]) : null; 48940 const header = vue.createVNode("div", { 48941 "class": [ns.e("header"), ns.is(props.tabPosition)] 48942 }, [newButton, vue.createVNode(TabNav, { 48943 "ref": nav$, 48944 "currentName": currentName.value, 48945 "editable": props.editable, 48946 "type": props.type, 48947 "panes": panes.value, 48948 "stretch": props.stretch, 48949 "onTabClick": handleTabClick, 48950 "onTabRemove": handleTabRemove 48951 }, null)]); 48952 const panels = vue.createVNode("div", { 48953 "class": ns.e("content") 48954 }
48954, [vue.renderSlot(slots, "default")]); 48955 return vue.createVNode("div", { 48956 "class": [ns.b(), ns.m(props.tabPosition), { 48957 [ns.m("card")]: props.type === "card", 48958 [ns.m("border-card")]: props.type === "border-card" 48959 }] 48960 }, [...props.tabPosition !== "bottom" ? [header, panels] : [panels, header]]); 48961 }; 48962 } 48963 }); 48964 48965 const tabPaneProps = buildProps({ 48966 label: { 48967 type: String, 48968 default: "" 48969 }, 48970 name: { 48971 type: [String, Number] 48972 }, 48973 closable: Boolean, 48974 disabled: Boolean, 48975 lazy: Boolean 48976 }); 48977 48978 const _hoisted_1$a = ["id", "aria-hidden", "aria-labelledby"]; 48979 const COMPONENT_NAME$1 = "ElTabPane"; 48980 const __default__$j = vue.defineComponent({ 48981 name: COMPONENT_NAME$1 48982 }); 48983 const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({ 48984 ...__default__$j, 48985 props: tabPaneProps, 48986 setup(__props) { 48987 const props = __props; 48988 const instance = vue.getCurrentInstance(); 48989 const slots = vue.useSlots(); 48990 const tabsRoot = vue.inject(tabsRootContextKey); 48991 if (!tabsRoot) 48992 throwError(COMPONENT_NAME$1, "usage: <el-tabs><el-tab-pane /></el-tabs/>"); 48993 const ns = useNamespace("tab-pane"); 48994 const index = vue.ref(); 48995 const isClosable = vue.computed(() => props.closable || tabsRoot.props.closable); 48996 const active = computedEager(() => { 48997 var _a; 48998 return tabsRoot.currentName.value === ((_a = props.name) != null ? _a : index.value); 48999 }); 49000 const loaded = vue.ref(active.value); 49001 const paneName = vue.computed(() => { 49002 var _a; 49003 return (_a = props.name) != null ? _a : index.value; 49004 }); 49005 const shouldBeRender = computedEager(() => !props.lazy || loaded.value || active.value); 49006 vue.watch(active, (val) => { 49007 if (val) 49008 loaded.value = true; 49009 }); 49010 const pane = vue.reactive({ 49011 uid: instance.uid, 49012 slots, 49013 props, 49014 paneName, 49015 active, 49016 index, 49017 isClosable 49018 }); 49019 vue.onMounted(() => { 49020 tabsRoot.registerPane(pane); 49021 }); 49022 vue.onUnmounted(() => { 49023 tabsRoot.unregisterPane(pane.uid); 49024 }); 49025 return (_ctx, _cache) => { 49026 return vue.unref(shouldBeRender) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", { 49027 key: 0, 49028 id: `pane-${vue.unref(paneName)}`, 49029 class: vue.normalizeClass(vue.unref(ns).b()), 49030 role: "tabpanel", 49031 "aria-hidden": !vue.unref(active), 49032 "aria-labelledby": `tab-${vue.unref(paneName)}` 49033 }, [ 49034 vue.renderSlot(_ctx.$slots, "default") 49035 ], 10, _hoisted_1$a)), [ 49036 [vue.vShow, vue.unref(active)] 49037 ]) : vue.createCommentVNode("v-if", true); 49038 }; 49039 } 49040 }); 49041 var TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__file", "tab-pane.vue"]]); 49042 49043 const ElTabs = withInstall(Tabs, { 49044 TabPane 49045 }); 49046 const ElTabPane = withNoopInstall(TabPane); 49047 49048 const textProps = buildProps({ 49049 type: { 49050 type: String, 49051 values: ["primary", "success", "info", "warning", "danger", ""], 49052 default: "" 49053 }, 49054 size: { 49055 type: String, 49056 values: componentSizes, 49057 default: "" 49058 }, 49059 truncated: { 49060 type: Boolean 49061 }, 49062 tag: { 49063 type: String, 49064 default: "span" 49065 } 49066 }); 49067 49068 const __default__$i = vue.defineComponent({ 49069 name: "ElText" 49070 }); 49071 const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({ 49072 ...__default__$i, 49073 props: textProps, 49074 setup(__props) { 49075 const props = __props; 49076 const textSize = useFormSize(); 49077 const ns = useNamespace("text"); 49078 const textKls = vue.computed(() => [ 49079 ns.b(), 49080 ns.m(props.type), 49081 ns.m(textSize.value), 49082 ns.is("truncated", props.truncated) 49083 ]); 49084 return (_ctx, _cache) => {
49085 return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), { 49086 class: vue.normalizeClass(vue.unref(textKls)) 49087 }, { 49088 default: vue.withCtx(() => [ 49089 vue.renderSlot(_ctx.$slots, "default") 49090 ]), 49091 _: 3 49092 }, 8, ["class"]); 49093 }; 49094 } 49095 }); 49096 var Text = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__file", "text.vue"]]); 49097 49098 const ElText = withInstall(Text); 49099 49100 const timeSelectProps = buildProps({ 49101 format: { 49102 type: String, 49103 default: "HH:mm" 49104 }, 49105 modelValue: String, 49106 disabled: Boolean, 49107 editable: { 49108 type: Boolean, 49109 default: true 49110 }, 49111 effect: { 49112 type: String, 49113 default: "light" 49114 }, 49115 clearable: { 49116 type: Boolean, 49117 default: true 49118 }, 49119 size: useSizeProp, 49120 placeholder: String, 49121 start: { 49122 type: String, 49123 default: "09:00" 49124 }, 49125 end: { 49126 type: String, 49127 default: "18:00" 49128 }, 49129 step: { 49130 type: String, 49131 default: "00:30" 49132 }, 49133 minTime: String, 49134 maxTime: String, 49135 name: String, 49136 prefixIcon: { 49137 type: definePropType([String, Object]), 49138 default: () => clock_default 49139 }, 49140 clearIcon: { 49141 type: definePropType([String, Object]), 49142 default: () => circle_close_default 49143 } 49144 }); 49145 49146 const parseTime = (time) => { 49147 const values = (time || "").split(":"); 49148 if (values.length >= 2) { 49149 let hours = Number.parseInt(values[0], 10); 49150 const minutes = Number.parseInt(values[1], 10); 49151 const timeUpper = time.toUpperCase(); 49152 if (timeUpper.includes("AM") && hours === 12) { 49153 hours = 0; 49154 } else if (timeUpper.includes("PM") && hours !== 12) { 49155 hours += 12; 49156 } 49157 return { 49158 hours, 49159 minutes 49160 }; 49161 } 49162 return null; 49163 }; 49164 const compareTime = (time1, time2) => { 49165 const value1 = parseTime(time1); 49166 if (!value1) 49167 return -1; 49168 const value2 = parseTime(time2); 49169 if (!value2) 49170 return -1; 49171 const minutes1 = value1.minutes + value1.hours * 60; 49172 const minutes2 = value2.minutes + value2.hours * 60; 49173 if (minutes1 === minutes2) { 49174 return 0; 49175 } 49176 return minutes1 > minutes2 ? 1 : -1; 49177 }; 49178 const padTime = (time) => { 49179 return `${time}`.padStart(2, "0"); 49180 }; 49181 const formatTime = (time) => { 49182 return `${padTime(time.hours)}:${padTime(time.minutes)}`; 49183 }; 49184 const nextTime = (time, step) => { 49185 const timeValue = parseTime(time); 49186 if (!timeValue) 49187 return ""; 49188 const stepValue = parseTime(step); 49189 if (!stepValue) 49190 return ""; 49191 const next = { 49192 hours: timeValue.hours, 49193 minutes: timeValue.minutes 49194 }; 49195 next.minutes += stepValue.minutes; 49196 next.hours += stepValue.hours; 49197 next.hours += Math.floor(next.minutes / 60); 49198 next.minutes = next.minutes % 60; 49199 return formatTime(next); 49200 }; 49201 49202 const __default__$h = vue.defineComponent({ 49203 name: "ElTimeSelect" 49204 }); 49205 const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({ 49206 ...__default__$h, 49207 props: timeSelectProps, 49208 emits: ["change", "blur", "focus", "update:modelValue"], 49209 setup(__props, { expose }) { 49210 const props = __props; 49211 dayjs.extend(customParseFormat); 49212 const { Option: ElOption } = ElSelect; 49213 const nsInput = useNamespace("input"); 49214 const select = vue.ref(); 49215 const _disabled = useFormDisabled(); 49216 const value = vue.computed(() => props.modelValue); 49217 const start = vue.computed(() => { 49218 const time = parseTime(props.start); 49219 return time ? formatTime(time) : null; 49220 }); 49221 const end = vue.computed(() => { 49222 const time = parseTime(props.end); 49223 return time ? formatTime(time) : null; 49224 }); 49225 const step = vue.computed(() => { 49226 const time = parseTime(props.step); 49227 return time ? formatTime(time) : null; 49228 }); 49229 const minTime = vue.computed(() => { 49230 const time = parseTime(props.minTime || ""); 49231 return time ? formatTime(time) : null; 49232 }); 49233 const maxTime = vue.computed(() => { 49234 const time = parseTime(props.maxTime || ""); 49235 return time ? formatTime(time) : null; 49236 }); 49237 const items = vue.computed(() => { 49238 const result = []; 49239 if (props.start && props.end && props.step) { 49240 let current = start.value; 49241 let currentTime; 49242 while (current && end.value && compareTime(current, end.value) <= 0) { 49243 currentTime = dayjs(current, "HH:mm").format(props.format); 49244 result.push({ 49245 value: currentTime, 49246 disabled: compareTime(current, minTime.value || "-1:-1") <= 0 || compareTime(current, maxTime.value || "100:100") >= 0 49247 }); 49248 current = nextTime(current, step.value); 49249 } 49250 } 49251 return result; 49252 }); 49253 const blur = () => { 49254 var _a, _b; 49255 (_b = (_a = select.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a); 49256 }; 49257 const focus = () => { 49258 var _a, _b; 49259 (_b = (_a = select.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a); 49260 }; 49261 expose({ 49262 blur, 49263 focus 49264 }); 49265 return (_ctx, _cache) => {
49266 return vue.openBlock(), vue.createBlock(vue.unref(ElSelect), { 49267 ref_key: "select", 49268 ref: select, 49269 "model-value": vue.unref(value), 49270 disabled: vue.unref(_disabled), 49271 clearable: _ctx.clearable, 49272 "clear-icon": _ctx.clearIcon, 49273 size: _ctx.size, 49274 effect: _ctx.effect, 49275 placeholder: _ctx.placeholder, 49276 "default-first-option": "", 49277 filterable: _ctx.editable, 49278 "onUpdate:modelValue": _cache[0] || (_cache[0] = (event) => _ctx.$emit("update:modelValue", event)), 49279 onChange: _cache[1] || (_cache[1] = (event) => _ctx.$emit("change", event)), 49280 onBlur: _cache[2] || (_cache[2] = (event) => _ctx.$emit("blur", event)), 49281 onFocus: _cache[3] || (_cache[3] = (event) => _ctx.$emit("focus", event)) 49282 }, { 49283 prefix: vue.withCtx(() => [ 49284 _ctx.prefixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 49285 key: 0, 49286 class: vue.normalizeClass(vue.unref(nsInput).e("prefix-icon")) 49287 }, { 49288 default: vue.withCtx(() => [ 49289 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prefixIcon))) 49290 ]), 49291 _: 1 49292 }, 8, ["class"])) : vue.createCommentVNode("v-if", true) 49293 ]), 49294 default: vue.withCtx(() => [ 49295 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(items), (item) => { 49296 return vue.openBlock(), vue.createBlock(vue.unref(ElOption), { 49297 key: item.value, 49298 label: item.value, 49299 value: item.value, 49300 disabled: item.disabled 49301 }, null, 8, ["label", "value", "disabled"]); 49302 }), 128)) 49303 ]), 49304 _: 1 49305 }, 8, ["model-value", "disabled", "clearable", "clear-icon", "size", "effect", "placeholder", "filterable"]); 49306 }; 49307 } 49308 }); 49309 var TimeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__file", "time-select.vue"]]); 49310 49311 TimeSelect.install = (app) => { 49312 app.component(TimeSelect.name, TimeSelect); 49313 }; 49314 const _TimeSelect = TimeSelect; 49315 const ElTimeSelect = _TimeSelect; 49316 49317 const Timeline = vue.defineComponent({ 49318 name: "ElTimeline", 49319 setup(_, { slots }) { 49320 const ns = useNamespace("timeline"); 49321 vue.provide("timeline", slots); 49322 return () => { 49323 return vue.h("ul", { class: [ns.b()] }, [vue.renderSlot(slots, "default")]); 49324 }; 49325 } 49326 }); 49327 var Timeline$1 = Timeline; 49328 49329 const timelineItemProps = buildProps({ 49330 timestamp: { 49331 type: String, 49332 default: "" 49333 }, 49334 hideTimestamp: { 49335 type: Boolean, 49336 default: false 49337 }, 49338 center: { 49339 type: Boolean, 49340 default: false 49341 }, 49342 placement: { 49343 type: String, 49344 values: ["top", "bottom"], 49345 default: "bottom" 49346 }, 49347 type: { 49348 type: String, 49349 values: ["primary", "success", "warning", "danger", "info"], 49350 default: "" 49351 }, 49352 color: { 49353 type: String, 49354 default: "" 49355 }, 49356 size: { 49357 type: String, 49358 values: ["normal", "large"], 49359 default: "normal" 49360 }, 49361 icon: { 49362 type: iconPropType 49363 }, 49364 hollow: { 49365 type: Boolean, 49366 default: false 49367 } 49368 }); 49369 49370 const __default__$g = vue.defineComponent({ 49371 name: "ElTimelineItem" 49372 }); 49373 const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({ 49374 ...__default__$g, 49375 props: timelineItemProps, 49376 setup(__props) { 49377 const props = __props; 49378 const ns = useNamespace("timeline-item"); 49379 const defaultNodeKls = vue.computed(() => [ 49380 ns.e("node"), 49381 ns.em("node", props.size || ""), 49382 ns.em("node", props.type || ""), 49383 ns.is("hollow", props.hollow) 49384 ]); 49385 return (_ctx, _cache) => {
49386 return vue.openBlock(), vue.createElementBlock("li", { 49387 class: vue.normalizeClass([vue.unref(ns).b(), { [vue.unref(ns).e("center")]: _ctx.center }]) 49388 }, [ 49389 vue.createElementVNode("div", { 49390 class: vue.normalizeClass(vue.unref(ns).e("tail")) 49391 }, null, 2), 49392 !_ctx.$slots.dot ? (vue.openBlock(), vue.createElementBlock("div", { 49393 key: 0, 49394 class: vue.normalizeClass(vue.unref(defaultNodeKls)), 49395 style: vue.normalizeStyle({ 49396 backgroundColor: _ctx.color 49397 }) 49398 }, [ 49399 _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 49400 key: 0, 49401 class: vue.normalizeClass(vue.unref(ns).e("icon")) 49402 }, { 49403 default: vue.withCtx(() => [ 49404 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon))) 49405 ]), 49406 _: 1 49407 }, 8, ["class"])) : vue.createCommentVNode("v-if", true) 49408 ], 6)) : vue.createCommentVNode("v-if", true), 49409 _ctx.$slots.dot ? (vue.openBlock(), vue.createElementBlock("div", { 49410 key: 1, 49411 class: vue.normalizeClass(vue.unref(ns).e("dot")) 49412 }, [ 49413 vue.renderSlot(_ctx.$slots, "dot") 49414 ], 2)) : vue.createCommentVNode("v-if", true), 49415 vue.createElementVNode("div", { 49416 class: vue.normalizeClass(vue.unref(ns).e("wrapper")) 49417 }, [ 49418 !_ctx.hideTimestamp && _ctx.placement === "top" ? (vue.openBlock(), vue.createElementBlock("div", { 49419 key: 0, 49420 class: vue.normalizeClass([vue.unref(ns).e("timestamp"), vue.unref(ns).is("top")]) 49421 }, vue.toDisplayString(_ctx.timestamp), 3)) : vue.createCommentVNode("v-if", true), 49422 vue.createElementVNode("div", { 49423 class: vue.normalizeClass(vue.unref(ns).e("content")) 49424 }, [ 49425 vue.renderSlot(_ctx.$slots, "default") 49426 ], 2), 49427 !_ctx.hideTimestamp && _ctx.placement === "bottom" ? (vue.openBlock(), vue.createElementBlock("div", { 49428 key: 1, 49429 class: vue.normalizeClass([vue.unref(ns).e("timestamp"), vue.unref(ns).is("bottom")]) 49430 }, vue.toDisplayString(_ctx.timestamp), 3)) : vue.createCommentVNode("v-if", true) 49431 ], 2) 49432 ], 2); 49433 }; 49434 } 49435 }); 49436 var TimelineItem = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__file", "timeline-item.vue"]]); 49437 49438 const ElTimeline = withInstall(Timeline$1, { 49439 TimelineItem 49440 }); 49441 const ElTimelineItem = withNoopInstall(TimelineItem); 49442 49443 const tooltipV2CommonProps = buildProps({ 49444 nowrap: Boolean 49445 }); 49446 var TooltipV2Sides = /* @__PURE__ */ ((TooltipV2Sides2) => { 49447 TooltipV2Sides2["top"] = "top"; 49448 TooltipV2Sides2["bottom"] = "bottom"; 49449 TooltipV2Sides2["left"] = "left"; 49450 TooltipV2Sides2["right"] = "right"; 49451 return TooltipV2Sides2; 49452 })(TooltipV2Sides || {}); 49453 const tooltipV2Sides = Object.values(TooltipV2Sides); 49454 49455 const tooltipV2ArrowProps = buildProps({ 49456 width: { 49457 type: Number, 49458 default: 10 49459 }, 49460 height: { 49461 type: Number, 49462 default: 10 49463 }, 49464 style: { 49465 type: definePropType(Object), 49466 default: null 49467 } 49468 }); 49469 const tooltipV2ArrowSpecialProps = buildProps({ 49470 side: { 49471 type: definePropType(String), 49472 values: tooltipV2Sides, 49473 required: true 49474 } 49475 }); 49476 49477 const tooltipV2Strategies = ["absolute", "fixed"]; 49478 const tooltipV2Placements = [ 49479 "top-start", 49480 "top-end", 49481 "top", 49482 "bottom-start", 49483 "bottom-end", 49484 "bottom", 49485 "left-start", 49486 "left-end", 49487 "left", 49488 "right-start", 49489 "right-end", 49490 "right" 49491 ]; 49492 const tooltipV2ContentProps = buildProps({ 49493 ariaLabel: String, 49494 arrowPadding: { 49495 type: definePropType(Number), 49496 default: 5 49497 }, 49498 effect: { 49499 type: String, 49500 default: "" 49501 }, 49502 contentClass: String, 49503 placement: { 49504 type: definePropType(String), 49505 values: tooltipV2Placements, 49506 default: "bottom" 49507 }, 49508 reference: { 49509 type: definePropType(Object), 49510 default: null 49511 }, 49512 offset: { 49513 type: Number, 49514 default: 8 49515 }, 49516 strategy: { 49517 type: definePropType(String), 49518 values: tooltipV2Strategies, 49519 default: "absolute" 49520 }, 49521 showArrow: { 49522 type: Boolean, 49523 default: false 49524 } 49525 });
49526 49527 const tooltipV2RootProps = buildProps({ 49528 delayDuration: { 49529 type: Number, 49530 default: 300 49531 }, 49532 defaultOpen: Boolean, 49533 open: { 49534 type: Boolean, 49535 default: void 0 49536 }, 49537 onOpenChange: { 49538 type: definePropType(Function) 49539 }, 49540 "onUpdate:open": { 49541 type: definePropType(Function) 49542 } 49543 }); 49544 49545 const EventHandler = { 49546 type: definePropType(Function) 49547 }; 49548 const tooltipV2TriggerProps = buildProps({ 49549 onBlur: EventHandler, 49550 onClick: EventHandler, 49551 onFocus: EventHandler, 49552 onMouseDown: EventHandler, 49553 onMouseEnter: EventHandler, 49554 onMouseLeave: EventHandler 49555 }); 49556 49557 const tooltipV2Props = buildProps({ 49558 ...tooltipV2RootProps, 49559 ...tooltipV2ArrowProps, 49560 ...tooltipV2TriggerProps, 49561 ...tooltipV2ContentProps, 49562 alwaysOn: Boolean, 49563 fullTransition: Boolean, 49564 transitionProps: { 49565 type: definePropType(Object), 49566 default: null 49567 }, 49568 teleported: Boolean, 49569 to: { 49570 type: definePropType(String), 49571 default: "body" 49572 } 49573 }); 49574 49575 const tooltipV2RootKey = Symbol("tooltipV2"); 49576 const tooltipV2ContentKey = Symbol("tooltipV2Content"); 49577 const TOOLTIP_V2_OPEN = "tooltip_v2.open"; 49578 49579 const __default__$f = vue.defineComponent({ 49580 name: "ElTooltipV2Root" 49581 }); 49582 const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({ 49583 ...__default__$f, 49584 props: tooltipV2RootProps, 49585 setup(__props, { expose }) { 49586 const props = __props; 49587 const _open = vue.ref(props.defaultOpen); 49588 const triggerRef = vue.ref(null); 49589 const open = vue.computed({ 49590 get: () => isPropAbsent(props.open) ? _open.value : props.open, 49591 set: (open2) => { 49592 var _a; 49593 _open.value = open2; 49594 (_a = props["onUpdate:open"]) == null ? void 0 : _a.call(props, open2); 49595 } 49596 }); 49597 const isOpenDelayed = vue.computed(() => isNumber(props.delayDuration) && props.delayDuration > 0); 49598 const { start: onDelayedOpen, stop: clearTimer } = useTimeoutFn(() => { 49599 open.value = true; 49600 }, vue.computed(() => props.delayDuration), { 49601 immediate: false 49602 }); 49603 const ns = useNamespace("tooltip-v2"); 49604 const contentId = useId(); 49605 const onNormalOpen = () => { 49606 clearTimer(); 49607 open.value = true; 49608 }; 49609 const onDelayOpen = () => { 49610 vue.unref(isOpenDelayed) ? onDelayedOpen() : onNormalOpen(); 49611 }; 49612 const onOpen = onNormalOpen; 49613 const onClose = () => { 49614 clearTimer(); 49615 open.value = false; 49616 }; 49617 const onChange = (open2) => { 49618 var _a; 49619 if (open2) { 49620 document.dispatchEvent(new CustomEvent(TOOLTIP_V2_OPEN)); 49621 onOpen(); 49622 } 49623 (_a = props.onOpenChange) == null ? void 0 : _a.call(props, open2); 49624 }; 49625 vue.watch(open, onChange); 49626 vue.onMounted(() => { 49627 document.addEventListener(TOOLTIP_V2_OPEN, onClose); 49628 }); 49629 vue.onBeforeUnmount(() => { 49630 clearTimer(); 49631 document.removeEventListener(TOOLTIP_V2_OPEN, onClose); 49632 }); 49633 vue.provide(tooltipV2RootKey, { 49634 contentId, 49635 triggerRef, 49636 ns, 49637 onClose, 49638 onDelayOpen, 49639 onOpen 49640 }); 49641 expose({ 49642 onOpen, 49643 onClose 49644 }); 49645 return (_ctx, _cache) => { 49646 return vue.renderSlot(_ctx.$slots, "default", { open: vue.unref(open) }); 49647 }; 49648 } 49649 }); 49650 var TooltipV2Root = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__file", "root.vue"]]); 49651 49652 const __default__$e = vue.defineComponent({ 49653 name: "ElTooltipV2Arrow" 49654 }); 49655 const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({ 49656 ...__default__$e, 49657 props: { 49658 ...tooltipV2ArrowProps, 49659 ...tooltipV2ArrowSpecialProps 49660 }, 49661 setup(__props) { 49662 const props = __props; 49663 const { ns } = vue.inject(tooltipV2RootKey); 49664 const { arrowRef } = vue.inject(tooltipV2ContentKey); 49665 const arrowStyle = vue.computed(() => { 49666 const { style, width, height } = props; 49667 const namespace = ns.namespace.value; 49668 return { 49669 [`--${namespace}-tooltip-v2-arrow-width`]: `${width}px`, 49670 [`--${namespace}-tooltip-v2-arrow-height`]: `${height}px`, 49671 [`--${namespace}-tooltip-v2-arrow-border-width`]: `${width / 2}px`, 49672 [`--${namespace}-tooltip-v2-arrow-cover-width`]: width / 2 - 1, 49673 ...style || {} 49674 }; 49675 }); 49676 return (_ctx, _cache) => {
49677 return vue.openBlock(), vue.createElementBlock("span", { 49678 ref_key: "arrowRef", 49679 ref: arrowRef, 49680 style: vue.normalizeStyle(vue.unref(arrowStyle)), 49681 class: vue.normalizeClass(vue.unref(ns).e("arrow")) 49682 }, null, 6); 49683 }; 49684 } 49685 }); 49686 var TooltipV2Arrow = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__file", "arrow.vue"]]); 49687 49688 const visualHiddenProps = buildProps({ 49689 style: { 49690 type: definePropType([String, Object, Array]), 49691 default: () => ({}) 49692 } 49693 }); 49694 49695 const __default__$d = vue.defineComponent({ 49696 name: "ElVisuallyHidden" 49697 }); 49698 const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({ 49699 ...__default__$d, 49700 props: visualHiddenProps, 49701 setup(__props) { 49702 const props = __props; 49703 const computedStyle = vue.computed(() => { 49704 return [ 49705 props.style, 49706 { 49707 position: "absolute", 49708 border: 0, 49709 width: 1, 49710 height: 1, 49711 padding: 0, 49712 margin: -1, 49713 overflow: "hidden", 49714 clip: "rect(0, 0, 0, 0)", 49715 whiteSpace: "nowrap", 49716 wordWrap: "normal" 49717 } 49718 ]; 49719 }); 49720 return (_ctx, _cache) => { 49721 return vue.openBlock(), vue.createElementBlock("span", vue.mergeProps(_ctx.$attrs, { style: vue.unref(computedStyle) }), [ 49722 vue.renderSlot(_ctx.$slots, "default") 49723 ], 16); 49724 }; 49725 } 49726 }); 49727 var ElVisuallyHidden = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__file", "visual-hidden.vue"]]); 49728 49729 const _hoisted_1$9 = ["data-side"]; 49730 const __default__$c = vue.defineComponent({ 49731 name: "ElTooltipV2Content" 49732 }); 49733 const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({ 49734 ...__default__$c, 49735 props: { ...tooltipV2ContentProps, ...tooltipV2CommonProps }, 49736 setup(__props) { 49737 const props = __props; 49738 const { triggerRef, contentId } = vue.inject(tooltipV2RootKey); 49739 const placement = vue.ref(props.placement); 49740 const strategy = vue.ref(props.strategy); 49741 const arrowRef = vue.ref(null); 49742 const { referenceRef, contentRef, middlewareData, x, y, update } = useFloating({ 49743 placement, 49744 strategy, 49745 middleware: vue.computed(() => { 49746 const middleware = [offset(props.offset)]; 49747 if (props.showArrow) { 49748 middleware.push(arrowMiddleware({ 49749 arrowRef 49750 })); 49751 } 49752 return middleware; 49753 }) 49754 }); 49755 const zIndex = useZIndex().nextZIndex(); 49756 const ns = useNamespace("tooltip-v2"); 49757 const side = vue.computed(() => { 49758 return placement.value.split("-")[0]; 49759 }); 49760 const contentStyle = vue.computed(() => { 49761 return { 49762 position: vue.unref(strategy), 49763 top: `${vue.unref(y) || 0}px`, 49764 left: `${vue.unref(x) || 0}px`, 49765 zIndex 49766 }; 49767 }); 49768 const arrowStyle = vue.computed(() => { 49769 if (!props.showArrow) 49770 return {}; 49771 const { arrow } = vue.unref(middlewareData); 49772 return { 49773 [`--${ns.namespace.value}-tooltip-v2-arrow-x`]: `${arrow == null ? void 0 : arrow.x}px` || "", 49774 [`--${ns.namespace.value}-tooltip-v2-arrow-y`]: `${arrow == null ? void 0 : arrow.y}px` || "" 49775 }; 49776 }); 49777 const contentClass = vue.computed(() => [ 49778 ns.e("content"), 49779 ns.is("dark", props.effect === "dark"), 49780 ns.is(vue.unref(strategy)), 49781 props.contentClass 49782 ]); 49783 vue.watch(arrowRef, () => update()); 49784 vue.watch(() => props.placement, (val) => placement.value = val); 49785 vue.onMounted(() => { 49786 vue.watch(() => props.reference || triggerRef.value, (el) => { 49787 referenceRef.value = el || void 0; 49788 }, { 49789 immediate: true 49790 }); 49791 }); 49792 vue.provide(tooltipV2ContentKey, { arrowRef }); 49793 return (_ctx, _cache) => {
49794 return vue.openBlock(), vue.createElementBlock("div", { 49795 ref_key: "contentRef", 49796 ref: contentRef, 49797 style: vue.normalizeStyle(vue.unref(contentStyle)), 49798 "data-tooltip-v2-root": "" 49799 }, [ 49800 !_ctx.nowrap ? (vue.openBlock(), vue.createElementBlock("div", { 49801 key: 0, 49802 "data-side": vue.unref(side), 49803 class: vue.normalizeClass(vue.unref(contentClass)) 49804 }, [ 49805 vue.renderSlot(_ctx.$slots, "default", { 49806 contentStyle: vue.unref(contentStyle), 49807 contentClass: vue.unref(contentClass) 49808 }), 49809 vue.createVNode(vue.unref(ElVisuallyHidden), { 49810 id: vue.unref(contentId), 49811 role: "tooltip" 49812 }, { 49813 default: vue.withCtx(() => [ 49814 _ctx.ariaLabel ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ 49815 vue.createTextVNode(vue.toDisplayString(_ctx.ariaLabel), 1) 49816 ], 64)) : vue.renderSlot(_ctx.$slots, "default", { key: 1 }) 49817 ]), 49818 _: 3 49819 }, 8, ["id"]), 49820 vue.renderSlot(_ctx.$slots, "arrow", { 49821 style: vue.normalizeStyle(vue.unref(arrowStyle)), 49822 side: vue.unref(side) 49823 }) 49824 ], 10, _hoisted_1$9)) : vue.createCommentVNode("v-if", true) 49825 ], 4); 49826 }; 49827 } 49828 }); 49829 var TooltipV2Content = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__file", "content.vue"]]); 49830 49831 const forwardRefProps = buildProps({ 49832 setRef: { 49833 type: definePropType(Function), 49834 required: true 49835 }, 49836 onlyChild: Boolean 49837 }); 49838 var ForwardRef = vue.defineComponent({ 49839 props: forwardRefProps, 49840 setup(props, { 49841 slots 49842 }) { 49843 const fragmentRef = vue.ref(); 49844 const setRef = composeRefs(fragmentRef, (el) => { 49845 if (el) { 49846 props.setRef(el.nextElementSibling); 49847 } else { 49848 props.setRef(null); 49849 } 49850 }); 49851 return () => { 49852 var _a; 49853 const [firstChild] = ((_a = slots.default) == null ? void 0 : _a.call(slots)) || []; 49854 const child = props.onlyChild ? ensureOnlyChild(firstChild.children) : firstChild.children; 49855 return vue.createVNode(vue.Fragment, { 49856 "ref": setRef 49857 }, [child]); 49858 }; 49859 } 49860 }); 49861 49862 const __default__$b = vue.defineComponent({ 49863 name: "ElTooltipV2Trigger" 49864 }); 49865 const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({ 49866 ...__default__$b, 49867 props: { 49868 ...tooltipV2CommonProps, 49869 ...tooltipV2TriggerProps 49870 }, 49871 setup(__props) { 49872 const props = __props; 49873 const { onClose, onOpen, onDelayOpen, triggerRef, contentId } = vue.inject(tooltipV2RootKey); 49874 let isMousedown = false; 49875 const setTriggerRef = (el) => { 49876 triggerRef.value = el; 49877 }; 49878 const onMouseup = () => { 49879 isMousedown = false; 49880 }; 49881 const onMouseenter = composeEventHandlers(props.onMouseEnter, onDelayOpen); 49882 const onMouseleave = composeEventHandlers(props.onMouseLeave, onClose); 49883 const onMousedown = composeEventHandlers(props.onMouseDown, () => { 49884 onClose(); 49885 isMousedown = true; 49886 document.addEventListener("mouseup", onMouseup, { once: true }); 49887 }); 49888 const onFocus = composeEventHandlers(props.onFocus, () => { 49889 if (!isMousedown) 49890 onOpen(); 49891 }); 49892 const onBlur = composeEventHandlers(props.onBlur, onClose); 49893 const onClick = composeEventHandlers(props.onClick, (e) => { 49894 if (e.detail === 0) 49895 onClose(); 49896 }); 49897 const events = { 49898 blur: onBlur, 49899 click: onClick, 49900 focus: onFocus, 49901 mousedown: onMousedown, 49902 mouseenter: onMouseenter, 49903 mouseleave: onMouseleave 49904 }; 49905 const setEvents = (el, events2, type) => { 49906 if (el) { 49907 Object.entries(events2).forEach(([name, handler]) => { 49908 el[type](name, handler); 49909 }); 49910 } 49911 }; 49912 vue.watch(triggerRef, (triggerEl, previousTriggerEl) => { 49913 setEvents(triggerEl, events, "addEventListener"); 49914 setEvents(previousTriggerEl, events, "removeEventListener"); 49915 if (triggerEl) { 49916 triggerEl.setAttribute("aria-describedby", contentId.value); 49917 } 49918 }); 49919 vue.onBeforeUnmount(() => { 49920 setEvents(triggerRef.value, events, "removeEventListener"); 49921 document.removeEventListener("mouseup", onMouseup); 49922 }); 49923 return (_ctx, _cache) => { 49924 return _ctx.nowrap ? (vue.openBlock(), vue.createBlock(vue.unref(ForwardRef), { 49925 key: 0, 49926 "set-ref": setTriggerRef, 49927 "only-child": "" 49928 }, { 49929 default: vue.withCtx(() => [
49930 vue.renderSlot(_ctx.$slots, "default") 49931 ]), 49932 _: 3 49933 })) : (vue.openBlock(), vue.createElementBlock("button", vue.mergeProps({ 49934 key: 1, 49935 ref_key: "triggerRef", 49936 ref: triggerRef 49937 }, _ctx.$attrs), [ 49938 vue.renderSlot(_ctx.$slots, "default") 49939 ], 16)); 49940 }; 49941 } 49942 }); 49943 var TooltipV2Trigger = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__file", "trigger.vue"]]); 49944 49945 const __default__$a = vue.defineComponent({ 49946 name: "ElTooltipV2" 49947 }); 49948 const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({ 49949 ...__default__$a, 49950 props: tooltipV2Props, 49951 setup(__props) { 49952 const props = __props; 49953 const refedProps = vue.toRefs(props); 49954 const arrowProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2ArrowProps))); 49955 const contentProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2ContentProps))); 49956 const rootProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2RootProps))); 49957 const triggerProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2TriggerProps))); 49958 return (_ctx, _cache) => { 49959 return vue.openBlock(), vue.createBlock(TooltipV2Root, vue.normalizeProps(vue.guardReactiveProps(rootProps)), { 49960 default: vue.withCtx(({ open }) => [ 49961 vue.createVNode(TooltipV2Trigger, vue.mergeProps(triggerProps, { nowrap: "" }), { 49962 default: vue.withCtx(() => [ 49963 vue.renderSlot(_ctx.$slots, "trigger") 49964 ]), 49965 _: 3 49966 }, 16), 49967 (vue.openBlock(), vue.createBlock(vue.Teleport, { 49968 to: _ctx.to, 49969 disabled: !_ctx.teleported 49970 }, [ 49971 _ctx.fullTransition ? (vue.openBlock(), vue.createBlock(vue.Transition, vue.normalizeProps(vue.mergeProps({ key: 0 }, _ctx.transitionProps)), { 49972 default: vue.withCtx(() => [ 49973 _ctx.alwaysOn || open ? (vue.openBlock(), vue.createBlock(TooltipV2Content, vue.normalizeProps(vue.mergeProps({ key: 0 }, contentProps)), { 49974 arrow: vue.withCtx(({ style, side }) => [ 49975 _ctx.showArrow ? (vue.openBlock(), vue.createBlock(TooltipV2Arrow, vue.mergeProps({ key: 0 }, arrowProps, { 49976 style, 49977 side 49978 }), null, 16, ["style", "side"])) : vue.createCommentVNode("v-if", true) 49979 ]), 49980 default: vue.withCtx(() => [ 49981 vue.renderSlot(_ctx.$slots, "default") 49982 ]), 49983 _: 3 49984 }, 16)) : vue.createCommentVNode("v-if", true) 49985 ]), 49986 _: 2 49987 }, 1040)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [ 49988 _ctx.alwaysOn || open ? (vue.openBlock(), vue.createBlock(TooltipV2Content, vue.normalizeProps(vue.mergeProps({ key: 0 }, contentProps)), { 49989 arrow: vue.withCtx(({ style, side }) => [ 49990 _ctx.showArrow ? (vue.openBlock(), vue.createBlock(TooltipV2Arrow, vue.mergeProps({ key: 0 }, arrowProps, { 49991 style, 49992 side 49993 }), null, 16, ["style", "side"])) : vue.createCommentVNode("v-if", true) 49994 ]), 49995 default: vue.withCtx(() => [ 49996 vue.renderSlot(_ctx.$slots, "default") 49997 ]), 49998 _: 3 49999 }, 16)) : vue.createCommentVNode("v-if", true) 50000 ], 64)) 50001 ], 8, ["to", "disabled"])) 50002 ]), 50003 _: 3 50004 }, 16); 50005 }; 50006 } 50007 }); 50008 var TooltipV2 = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__file", "tooltip.vue"]]); 50009 50010 const ElTooltipV2 = withInstall(TooltipV2); 50011 50012 const LEFT_CHECK_CHANGE_EVENT = "left-check-change"; 50013 const RIGHT_CHECK_CHANGE_EVENT = "right-check-change"; 50014 const transferProps = buildProps({ 50015 data: { 50016 type: definePropType(Array), 50017 default: () => [] 50018 }, 50019 titles: { 50020 type: definePropType(Array), 50021 default: () => [] 50022 }, 50023 buttonTexts: { 50024 type: definePropType(Array), 50025 default: () => [] 50026 }, 50027 filterPlaceholder: String, 50028 filterMethod: { 50029 type: definePropType(Function) 50030 }, 50031 leftDefaultChecked: { 50032 type: definePropType(Array), 50033 default: () => [] 50034 }, 50035 rightDefaultChecked: { 50036 type: definePropType(Array), 50037 default: () => [] 50038 }, 50039 renderContent: { 50040 type: definePropType(Function) 50041 }, 50042 modelValue: { 50043 type: definePropType(Array), 50044 default: () => [] 50045 }, 50046 format: { 50047 type: definePropType(Object), 50048 default: () => ({}) 50049 }, 50050 filterable: Boolean, 50051 props: { 50052 type: definePropType(Object), 50053 default: () => mutable({ 50054 label: "label", 50055 key: "key", 50056 disabled: "disabled" 50057 }) 50058 }, 50059 targetOrder: { 50060 type: String, 50061 values: ["original", "push", "unshift"], 50062 default: "original" 50063 }, 50064 validateEvent: { 50065 type: Boolean, 50066 default: true 50067 } 50068 });
vendor: 7,928 bytes, lines 50069-50268
50069 const transferCheckedChangeFn = (value, movedKeys) => [value, movedKeys].every(isArray$1) || isArray$1(value) && isNil(movedKeys); 50070 const transferEmits = { 50071 [CHANGE_EVENT]: (value, direction, movedKeys) => [value, movedKeys].every(isArray$1) && ["left", "right"].includes(direction), 50072 [UPDATE_MODEL_EVENT]: (value) => isArray$1(value), 50073 [LEFT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn, 50074 [RIGHT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn 50075 }; 50076 50077 const CHECKED_CHANGE_EVENT = "checked-change"; 50078 const transferPanelProps = buildProps({ 50079 data: transferProps.data, 50080 optionRender: { 50081 type: definePropType(Function) 50082 }, 50083 placeholder: String, 50084 title: String, 50085 filterable: Boolean, 50086 format: transferProps.format, 50087 filterMethod: transferProps.filterMethod, 50088 defaultChecked: transferProps.leftDefaultChecked, 50089 props: transferProps.props 50090 }); 50091 const transferPanelEmits = { 50092 [CHECKED_CHANGE_EVENT]: transferCheckedChangeFn 50093 }; 50094 50095 const usePropsAlias = (props) => { 50096 const initProps = { 50097 label: "label", 50098 key: "key", 50099 disabled: "disabled" 50100 }; 50101 return vue.computed(() => ({ 50102 ...initProps, 50103 ...props.props 50104 })); 50105 }; 50106 50107 const useCheck$1 = (props, panelState, emit) => { 50108 const propsAlias = usePropsAlias(props); 50109 const filteredData = vue.computed(() => { 50110 return props.data.filter((item) => { 50111 if (isFunction$1(props.filterMethod)) { 50112 return props.filterMethod(panelState.query, item); 50113 } else { 50114 const label = String(item[propsAlias.value.label] || item[propsAlias.value.key]); 50115 return label.toLowerCase().includes(panelState.query.toLowerCase()); 50116 } 50117 }); 50118 }); 50119 const checkableData = vue.computed(() => filteredData.value.filter((item) => !item[propsAlias.value.disabled])); 50120 const checkedSummary = vue.computed(() => { 50121 const checkedLength = panelState.checked.length; 50122 const dataLength = props.data.length; 50123 const { noChecked, hasChecked } = props.format; 50124 if (noChecked && hasChecked) { 50125 return checkedLength > 0 ? hasChecked.replace(/\${checked}/g, checkedLength.toString()).replace(/\${total}/g, dataLength.toString()) : noChecked.replace(/\${total}/g, dataLength.toString()); 50126 } else { 50127 return `${checkedLength}/${dataLength}`; 50128 } 50129 }); 50130 const isIndeterminate = vue.computed(() => { 50131 const checkedLength = panelState.checked.length; 50132 return checkedLength > 0 && checkedLength < checkableData.value.length; 50133 }); 50134 const updateAllChecked = () => { 50135 const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]); 50136 panelState.allChecked = checkableDataKeys.length > 0 && checkableDataKeys.every((item) => panelState.checked.includes(item)); 50137 }; 50138 const handleAllCheckedChange = (value) => { 50139 panelState.checked = value ? checkableData.value.map((item) => item[propsAlias.value.key]) : []; 50140 }; 50141 vue.watch(() => panelState.checked, (val, oldVal) => { 50142 updateAllChecked(); 50143 if (panelState.checkChangeByUser) { 50144 const movedKeys = val.concat(oldVal).filter((v) => !val.includes(v) || !oldVal.includes(v)); 50145 emit(CHECKED_CHANGE_EVENT, val, movedKeys); 50146 } else { 50147 emit(CHECKED_CHANGE_EVENT, val); 50148 panelState.checkChangeByUser = true; 50149 } 50150 }); 50151 vue.watch(checkableData, () => { 50152 updateAllChecked(); 50153 }); 50154 vue.watch(() => props.data, () => { 50155 const checked = []; 50156 const filteredDataKeys = filteredData.value.map((item) => item[propsAlias.value.key]); 50157 panelState.checked.forEach((item) => { 50158 if (filteredDataKeys.includes(item)) { 50159 checked.push(item); 50160 } 50161 }); 50162 panelState.checkChangeByUser = false; 50163 panelState.checked = checked; 50164 }); 50165 vue.watch(() => props.defaultChecked, (val, oldVal) => { 50166 if (oldVal && val.length === oldVal.length && val.every((item) => oldVal.includes(item))) 50167 return; 50168 const checked = []; 50169 const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]); 50170 val.forEach((item) => { 50171 if (checkableDataKeys.includes(item)) { 50172 checked.push(item); 50173 } 50174 }); 50175 panelState.checkChangeByUser = false; 50176 panelState.checked = checked; 50177 }, { 50178 immediate: true 50179 }); 50180 return { 50181 filteredData, 50182 checkableData, 50183 checkedSummary, 50184 isIndeterminate, 50185 updateAllChecked, 50186 handleAllCheckedChange 50187 }; 50188 }; 50189 50190 const useCheckedChange = (checkedState, emit) => { 50191 const onSourceCheckedChange = (val, movedKeys) => { 50192 checkedState.leftChecked = val; 50193 if (!movedKeys) 50194 return; 50195 emit(LEFT_CHECK_CHANGE_EVENT, val, movedKeys); 50196 }; 50197 const onTargetCheckedChange = (val, movedKeys) => { 50198 checkedState.rightChecked = val; 50199 if (!movedKeys) 50200 return; 50201 emit(RIGHT_CHECK_CHANGE_EVENT, val, movedKeys); 50202 }; 50203 return { 50204 onSourceCheckedChange, 50205 onTargetCheckedChange 50206 }; 50207 }; 50208 50209 const useComputedData = (props) => { 50210 const propsAlias = usePropsAlias(props); 50211 const dataObj = vue.computed(() => props.data.reduce((o, cur) => (o[cur[propsAlias.value.key]] = cur) && o, {})); 50212 const sourceData = vue.computed(() => props.data.filter((item) => !props.modelValue.includes(item[propsAlias.value.key]))); 50213 const targetData = vue.computed(() => { 50214 if (props.targetOrder === "original") { 50215 return props.data.filter((item) => props.modelValue.includes(item[propsAlias.value.key])); 50216 } else { 50217 return props.modelValue.reduce((arr, cur) => { 50218 const val = dataObj.value[cur]; 50219 if (val) { 50220 arr.push(val); 50221 } 50222 return arr; 50223 }, []); 50224 } 50225 }); 50226 return { 50227 sourceData, 50228 targetData 50229 }; 50230 }; 50231 50232 const useMove = (props, checkedState, emit) => { 50233 const propsAlias = usePropsAlias(props); 50234 const _emit = (value, direction, movedKeys) => { 50235 emit(UPDATE_MODEL_EVENT, value); 50236 emit(CHANGE_EVENT, value, direction, movedKeys); 50237 }; 50238 const addToLeft = () => { 50239 const currentValue = props.modelValue.slice(); 50240 checkedState.rightChecked.forEach((item) => { 50241 const index = currentValue.indexOf(item); 50242 if (index > -1) { 50243 currentValue.splice(index, 1); 50244 } 50245 }); 50246 _emit(currentValue, "left", checkedState.rightChecked); 50247 }; 50248 const addToRight = () => { 50249 let currentValue = props.modelValue.slice(); 50250 const itemsToBeMoved = props.data.filter((item) => { 50251 const itemKey = item[propsAlias.value.key]; 50252 return checkedState.leftChecked.includes(itemKey) && !props.modelValue.includes(itemKey); 50253 }).map((item) => item[propsAlias.value.key]); 50254 currentValue = props.targetOrder === "unshift" ? itemsToBeMoved.concat(currentValue) : currentValue.concat(itemsToBeMoved); 50255 if (props.targetOrder === "original") { 50256 currentValue = props.data.filter((item) => currentValue.includes(item[propsAlias.value.key])).map((item) => item[propsAlias.value.key]); 50257 } 50258 _emit(currentValue, "right", checkedState.leftChecked); 50259 }; 50260 return { 50261 addToLeft, 50262 addToRight 50263 }; 50264 }; 50265 50266 const __default__$9 = vue.defineComponent({ 50267 name: "ElTransferPanel" 50268 });
50269 const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({ 50270 ...__default__$9, 50271 props: transferPanelProps, 50272 emits: transferPanelEmits, 50273 setup(__props, { expose, emit }) { 50274 const props = __props; 50275 const slots = vue.useSlots(); 50276 const OptionContent = ({ option }) => option; 50277 const { t } = useLocale(); 50278 const ns = useNamespace("transfer"); 50279 const panelState = vue.reactive({ 50280 checked: [], 50281 allChecked: false, 50282 query: "", 50283 checkChangeByUser: true 50284 }); 50285 const propsAlias = usePropsAlias(props); 50286 const { 50287 filteredData, 50288 checkedSummary, 50289 isIndeterminate, 50290 handleAllCheckedChange 50291 } = useCheck$1(props, panelState, emit); 50292 const hasNoMatch = vue.computed(() => !isEmpty(panelState.query) && isEmpty(filteredData.value)); 50293 const hasFooter = vue.computed(() => !isEmpty(slots.default()[0].children)); 50294 const { checked, allChecked, query } = vue.toRefs(panelState); 50295 expose({ 50296 query 50297 }); 50298 return (_ctx, _cache) => { 50299 return vue.openBlock(), vue.createElementBlock("div", { 50300 class: vue.normalizeClass(vue.unref(ns).b("panel")) 50301 }, [ 50302 vue.createElementVNode("p", { 50303 class: vue.normalizeClass(vue.unref(ns).be("panel", "header")) 50304 }, [ 50305 vue.createVNode(vue.unref(ElCheckbox), { 50306 modelValue: vue.unref(allChecked), 50307 "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(allChecked) ? allChecked.value = $event : null), 50308 indeterminate: vue.unref(isIndeterminate), 50309 "validate-event": false, 50310 onChange: vue.unref(handleAllCheckedChange) 50311 }, { 50312 default: vue.withCtx(() => [ 50313 vue.createTextVNode(vue.toDisplayString(_ctx.title) + " ", 1), 50314 vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(checkedSummary)), 1) 50315 ]), 50316 _: 1 50317 }, 8, ["modelValue", "indeterminate", "onChange"]) 50318 ], 2), 50319 vue.createElementVNode("div", { 50320 class: vue.normalizeClass([vue.unref(ns).be("panel", "body"), vue.unref(ns).is("with-footer", vue.unref(hasFooter))]) 50321 }, [ 50322 _ctx.filterable ? (vue.openBlock(), vue.createBlock(vue.unref(ElInput), { 50323 key: 0, 50324 modelValue: vue.unref(query), 50325 "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.isRef(query) ? query.value = $event : null), 50326 class: vue.normalizeClass(vue.unref(ns).be("panel", "filter")), 50327 size: "default", 50328 placeholder: _ctx.placeholder, 50329 "prefix-icon": vue.unref(search_default), 50330 clearable: "", 50331 "validate-event": false 50332 }, null, 8, ["modelValue", "class", "placeholder", "prefix-icon"])) : vue.createCommentVNode("v-if", true), 50333 vue.withDirectives(vue.createVNode(vue.unref(ElCheckboxGroup$1), { 50334 modelValue: vue.unref(checked), 50335 "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(checked) ? checked.value = $event : null), 50336 "validate-event": false, 50337 class: vue.normalizeClass([vue.unref(ns).is("filterable", _ctx.filterable), vue.unref(ns).be("panel", "list")]) 50338 }, { 50339 default: vue.withCtx(() => [ 50340 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(filteredData), (item) => { 50341 return vue.openBlock(), vue.createBlock(vue.unref(ElCheckbox), { 50342 key: item[vue.unref(propsAlias).key], 50343 class: vue.normalizeClass(vue.unref(ns).be("panel", "item")), 50344 label: item[vue.unref(propsAlias).key], 50345 disabled: item[vue.unref(propsAlias).disabled], 50346 "validate-event": false 50347 }, { 50348 default: vue.withCtx(() => { 50349 var _a; 50350 return [ 50351 vue.createVNode(OptionContent, { 50352 option: (_a = _ctx.optionRender) == null ? void 0 : _a.call(_ctx, item) 50353 }, null, 8, ["option"]) 50354 ]; 50355 }), 50356 _: 2 50357 }, 1032, ["class", "label", "disabled"]); 50358 }), 128)) 50359 ]), 50360 _: 1 50361 }, 8, ["modelValue", "class"]), [ 50362 [vue.vShow, !vue.unref(hasNoMatch) && !vue.unref(isEmpty)(_ctx.data)] 50363 ]), 50364 vue.withDirectives(vue.createElementVNode("p", { 50365 class: vue.normalizeClass(vue.unref(ns).be("panel", "empty")) 50366 }, vue.toDisplayString(vue.unref(hasNoMatch) ? vue.unref(t)("el.transfer.noMatch") : vue.unref(t)("el.transfer.noData")), 3), [ 50367 [vue.vShow, vue.unref(hasNoMatch) || vue.unref(isEmpty)(_ctx.data)] 50368 ]) 50369 ], 2), 50370 vue.unref(hasFooter) ? (vue.openBlock(), vue.createElementBlock("p", { 50371 key: 0, 50372 class: vue.normalizeClass(vue.unref(ns).be("panel", "footer")) 50373 }, [
50374 vue.renderSlot(_ctx.$slots, "default") 50375 ], 2)) : vue.createCommentVNode("v-if", true) 50376 ], 2); 50377 }; 50378 } 50379 }); 50380 var TransferPanel = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__file", "transfer-panel.vue"]]); 50381 50382 const _hoisted_1$8 = { key: 0 }; 50383 const _hoisted_2$6 = { key: 0 }; 50384 const __default__$8 = vue.defineComponent({ 50385 name: "ElTransfer" 50386 }); 50387 const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({ 50388 ...__default__$8, 50389 props: transferProps, 50390 emits: transferEmits, 50391 setup(__props, { expose, emit }) { 50392 const props = __props; 50393 const slots = vue.useSlots(); 50394 const { t } = useLocale(); 50395 const ns = useNamespace("transfer"); 50396 const { formItem } = useFormItem(); 50397 const checkedState = vue.reactive({ 50398 leftChecked: [], 50399 rightChecked: [] 50400 }); 50401 const propsAlias = usePropsAlias(props); 50402 const { sourceData, targetData } = useComputedData(props); 50403 const { onSourceCheckedChange, onTargetCheckedChange } = useCheckedChange(checkedState, emit); 50404 const { addToLeft, addToRight } = useMove(props, checkedState, emit); 50405 const leftPanel = vue.ref(); 50406 const rightPanel = vue.ref(); 50407 const clearQuery = (which) => { 50408 switch (which) { 50409 case "left": 50410 leftPanel.value.query = ""; 50411 break; 50412 case "right": 50413 rightPanel.value.query = ""; 50414 break; 50415 } 50416 }; 50417 const hasButtonTexts = vue.computed(() => props.buttonTexts.length === 2); 50418 const leftPanelTitle = vue.computed(() => props.titles[0] || t("el.transfer.titles.0")); 50419 const rightPanelTitle = vue.computed(() => props.titles[1] || t("el.transfer.titles.1")); 50420 const panelFilterPlaceholder = vue.computed(() => props.filterPlaceholder || t("el.transfer.filterPlaceholder")); 50421 vue.watch(() => props.modelValue, () => { 50422 var _a; 50423 if (props.validateEvent) { 50424 (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn()); 50425 } 50426 }); 50427 const optionRender = vue.computed(() => (option) => { 50428 if (props.renderContent) 50429 return props.renderContent(vue.h, option); 50430 if (slots.default) 50431 return slots.default({ option }); 50432 return vue.h("span", option[propsAlias.value.label] || option[propsAlias.value.key]); 50433 }); 50434 expose({ 50435 clearQuery, 50436 leftPanel, 50437 rightPanel 50438 }); 50439 return (_ctx, _cache) => { 50440 return vue.openBlock(), vue.createElementBlock("div", { 50441 class: vue.normalizeClass(vue.unref(ns).b()) 50442 }, [ 50443 vue.createVNode(TransferPanel, { 50444 ref_key: "leftPanel", 50445 ref: leftPanel, 50446 data: vue.unref(sourceData), 50447 "option-render": vue.unref(optionRender), 50448 placeholder: vue.unref(panelFilterPlaceholder), 50449 title: vue.unref(leftPanelTitle), 50450 filterable: _ctx.filterable, 50451 format: _ctx.format, 50452 "filter-method": _ctx.filterMethod, 50453 "default-checked": _ctx.leftDefaultChecked, 50454 props: props.props, 50455 onCheckedChange: vue.unref(onSourceCheckedChange) 50456 }, { 50457 default: vue.withCtx(() => [ 50458 vue.renderSlot(_ctx.$slots, "left-footer") 50459 ]), 50460 _: 3 50461 }, 8, ["data", "option-render", "placeholder", "title", "filterable", "format", "filter-method", "default-checked", "props", "onCheckedChange"]), 50462 vue.createElementVNode("div", { 50463 class: vue.normalizeClass(vue.unref(ns).e("buttons")) 50464 }, [ 50465 vue.createVNode(vue.unref(ElButton), { 50466 type: "primary", 50467 class: vue.normalizeClass([vue.unref(ns).e("button"), vue.unref(ns).is("with-texts", vue.unref(hasButtonTexts))]), 50468 disabled: vue.unref(isEmpty)(checkedState.rightChecked), 50469 onClick: vue.unref(addToLeft) 50470 }, { 50471 default: vue.withCtx(() => [ 50472 vue.createVNode(vue.unref(ElIcon), null, { 50473 default: vue.withCtx(() => [ 50474 vue.createVNode(vue.unref(arrow_left_default)) 50475 ]), 50476 _: 1 50477 }), 50478 !vue.unref(isUndefined)(_ctx.buttonTexts[0]) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$8, vue.toDisplayString(_ctx.buttonTexts[0]), 1)) : vue.createCommentVNode("v-if", true) 50479 ]), 50480 _: 1 50481 }, 8, ["class", "disabled", "onClick"]), 50482 vue.createVNode(vue.unref(ElButton), { 50483 type: "primary", 50484 class: vue.normalizeClass([vue.unref(ns).e("button"), vue.unref(ns).is("with-texts", vue.unref(hasButtonTexts))]), 50485 disabled: vue.unref(isEmpty)(checkedState.leftChecked), 50486 onClick: vue.unref(addToRight) 50487 }, { 50488 default: vue.withCtx(() => [ 50489 !vue.unref(isUndefined)(_ctx.buttonTexts[1]) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$6, vue.toDisplayString(_ctx.buttonTexts[1]), 1)) : vue.createCommentVNode("v-if", true), 50490 vue.createVNode(vue.unref(ElIcon), null, { 50491 default: vue.withCtx(() => [ 50492 vue.createVNode(vue.unref(arrow_right_default)) 50493 ]), 50494 _: 1 50495 }) 50496 ]), 50497 _: 1 50498 }, 8, ["class", "disabled", "onClick"]) 50499 ], 2), 50500 vue.createVNode(TransferPanel, { 50501 ref_key: "rightPanel", 50502 ref: rightPanel, 50503 data: vue.unref(targetData), 50504 "option-render": vue.unref(optionRender), 50505 placeholder: vue.unref(panelFilterPlaceholder), 50506 filterable: _ctx.filterable, 50507 format: _ctx.format, 50508 "filter-method": _ctx.filterMethod, 50509 title: vue.unref(rightPanelTitle), 50510 "default-checked": _ctx.rightDefaultChecked, 50511 props: props.props, 50512 onCheckedChange: vue.unref(onTargetCheckedChange) 50513 }, { 50514 default: vue.withCtx(() => [
50515 vue.renderSlot(_ctx.$slots, "right-footer") 50516 ]), 50517 _: 3 50518 }, 8, ["data", "option-render", "placeholder", "filterable", "format", "filter-method", "title", "default-checked", "props", "onCheckedChange"]) 50519 ], 2); 50520 }; 50521 } 50522 }); 50523 var Transfer = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__file", "transfer.vue"]]); 50524 50525 const ElTransfer = withInstall(Transfer); 50526 50527 const NODE_KEY = "$treeNodeId"; 50528 const markNodeData = function(node, data) { 50529 if (!data || data[NODE_KEY]) 50530 return; 50531 Object.defineProperty(data, NODE_KEY, { 50532 value: node.id, 50533 enumerable: false, 50534 configurable: false, 50535 writable: false 50536 }); 50537 }; 50538 const getNodeKey = function(key, data) { 50539 if (!key) 50540 return data[NODE_KEY]; 50541 return data[key]; 50542 }; 50543 const handleCurrentChange = (store, emit, setCurrent) => { 50544 const preCurrentNode = store.value.currentNode; 50545 setCurrent(); 50546 const currentNode = store.value.currentNode; 50547 if (preCurrentNode === currentNode) 50548 return; 50549 emit("current-change", currentNode ? currentNode.data : null, currentNode); 50550 }; 50551 50552 const getChildState = (node) => { 50553 let all = true; 50554 let none = true; 50555 let allWithoutDisable = true; 50556 for (let i = 0, j = node.length; i < j; i++) { 50557 const n = node[i]; 50558 if (n.checked !== true || n.indeterminate) { 50559 all = false; 50560 if (!n.disabled) { 50561 allWithoutDisable = false; 50562 } 50563 } 50564 if (n.checked !== false || n.indeterminate) { 50565 none = false; 50566 } 50567 } 50568 return { all, none, allWithoutDisable, half: !all && !none }; 50569 }; 50570 const reInitChecked = function(node) { 50571 if (node.childNodes.length === 0 || node.loading) 50572 return; 50573 const { all, none, half } = getChildState(node.childNodes); 50574 if (all) { 50575 node.checked = true; 50576 node.indeterminate = false; 50577 } else if (half) { 50578 node.checked = false; 50579 node.indeterminate = true; 50580 } else if (none) { 50581 node.checked = false; 50582 node.indeterminate = false; 50583 } 50584 const parent = node.parent; 50585 if (!parent || parent.level === 0) 50586 return; 50587 if (!node.store.checkStrictly) { 50588 reInitChecked(parent); 50589 } 50590 }; 50591 const getPropertyFromData = function(node, prop) { 50592 const props = node.store.props; 50593 const data = node.data || {}; 50594 const config = props[prop]; 50595 if (typeof config === "function") { 50596 return config(data, node); 50597 } else if (typeof config === "string") { 50598 return data[config]; 50599 } else if (typeof config === "undefined") { 50600 const dataProp = data[prop]; 50601 return dataProp === void 0 ? "" : dataProp; 50602 } 50603 }; 50604 let nodeIdSeed = 0; 50605 class Node { 50606 constructor(options) { 50607 this.id = nodeIdSeed++; 50608 this.text = null; 50609 this.checked = false; 50610 this.indeterminate = false; 50611 this.data = null; 50612 this.expanded = false; 50613 this.parent = null; 50614 this.visible = true; 50615 this.isCurrent = false; 50616 this.canFocus = false; 50617 for (const name in options) { 50618 if (hasOwn(options, name)) { 50619 this[name] = options[name]; 50620 } 50621 } 50622 this.level = 0; 50623 this.loaded = false; 50624 this.childNodes = []; 50625 this.loading = false; 50626 if (this.parent) { 50627 this.level = this.parent.level + 1; 50628 } 50629 } 50630 initialize() { 50631 const store = this.store; 50632 if (!store) { 50633 throw new Error("[Node]store is required!"); 50634 } 50635 store.registerNode(this); 50636 const props = store.props; 50637 if (props && typeof props.isLeaf !== "undefined") { 50638 const isLeaf = getPropertyFromData(this, "isLeaf"); 50639 if (typeof isLeaf === "boolean") { 50640 this.isLeafByUser = isLeaf; 50641 } 50642 } 50643 if (store.lazy !== true && this.data) { 50644 this.setData(this.data); 50645 if (store.defaultExpandAll) { 50646 this.expanded = true; 50647 this.canFocus = true; 50648 } 50649 } else if (this.level > 0 && store.lazy && store.defaultExpandAll) { 50650 this.expand(); 50651 } 50652 if (!Array.isArray(this.data)) { 50653 markNodeData(this, this.data); 50654 } 50655 if (!this.data) 50656 return; 50657 const defaultExpandedKeys = store.defaultExpandedKeys;
50658 const key = store.key; 50659 if (key && defaultExpandedKeys && defaultExpandedKeys.includes(this.key)) { 50660 this.expand(null, store.autoExpandParent); 50661 } 50662 if (key && store.currentNodeKey !== void 0 && this.key === store.currentNodeKey) { 50663 store.currentNode = this; 50664 store.currentNode.isCurrent = true; 50665 } 50666 if (store.lazy) { 50667 store._initDefaultCheckedNode(this); 50668 } 50669 this.updateLeafState(); 50670 if (this.parent && (this.level === 1 || this.parent.expanded === true)) 50671 this.canFocus = true; 50672 } 50673 setData(data) { 50674 if (!Array.isArray(data)) { 50675 markNodeData(this, data); 50676 } 50677 this.data = data; 50678 this.childNodes = []; 50679 let children; 50680 if (this.level === 0 && Array.isArray(this.data)) { 50681 children = this.data; 50682 } else { 50683 children = getPropertyFromData(this, "children") || []; 50684 } 50685 for (let i = 0, j = children.length; i < j; i++) { 50686 this.insertChild({ data: children[i] }); 50687 } 50688 } 50689 get label() { 50690 return getPropertyFromData(this, "label"); 50691 } 50692 get key() { 50693 const nodeKey = this.store.key; 50694 if (this.data) 50695 return this.data[nodeKey]; 50696 return null; 50697 } 50698 get disabled() { 50699 return getPropertyFromData(this, "disabled"); 50700 } 50701 get nextSibling() { 50702 const parent = this.parent; 50703 if (parent) { 50704 const index = parent.childNodes.indexOf(this); 50705 if (index > -1) { 50706 return parent.childNodes[index + 1]; 50707 } 50708 } 50709 return null; 50710 } 50711 get previousSibling() { 50712 const parent = this.parent; 50713 if (parent) { 50714 const index = parent.childNodes.indexOf(this); 50715 if (index > -1) { 50716 return index > 0 ? parent.childNodes[index - 1] : null; 50717 } 50718 } 50719 return null; 50720 } 50721 contains(target, deep = true) { 50722 return (this.childNodes || []).some((child) => child === target || deep && child.contains(target)); 50723 } 50724 remove() { 50725 const parent = this.parent; 50726 if (parent) { 50727 parent.removeChild(this); 50728 } 50729 } 50730 insertChild(child, index, batch) { 50731 if (!child) 50732 throw new Error("InsertChild error: child is required."); 50733 if (!(child instanceof Node)) { 50734 if (!batch) { 50735 const children = this.getChildren(true); 50736 if (!children.includes(child.data)) { 50737 if (typeof index === "undefined" || index < 0) { 50738 children.push(child.data); 50739 } else { 50740 children.splice(index, 0, child.data); 50741 } 50742 } 50743 } 50744 Object.assign(child, { 50745 parent: this, 50746 store: this.store 50747 }); 50748 child = vue.reactive(new Node(child)); 50749 if (child instanceof Node) { 50750 child.initialize(); 50751 } 50752 } 50753 child.level = this.level + 1; 50754 if (typeof index === "undefined" || index < 0) { 50755 this.childNodes.push(child); 50756 } else { 50757 this.childNodes.splice(index, 0, child); 50758 } 50759 this.updateLeafState(); 50760 } 50761 insertBefore(child, ref) { 50762 let index; 50763 if (ref) { 50764 index = this.childNodes.indexOf(ref); 50765 } 50766 this.insertChild(child, index); 50767 } 50768 insertAfter(child, ref) { 50769 let index; 50770 if (ref) { 50771 index = this.childNodes.indexOf(ref); 50772 if (index !== -1) 50773 index += 1; 50774 } 50775 this.insertChild(child, index); 50776 } 50777 removeChild(child) { 50778 const children = this.getChildren() || []; 50779 const dataIndex = children.indexOf(child.data); 50780 if (dataIndex > -1) { 50781 children.splice(dataIndex, 1); 50782 } 50783 const index = this.childNodes.indexOf(child); 50784 if (index > -1) { 50785 this.store && this.store.deregisterNode(child); 50786 child.parent = null; 50787 this.childNodes.splice(index, 1); 50788 } 50789 this.updateLeafState(); 50790 } 50791 removeChildByData(data) { 50792 let targetNode = null; 50793 for (let i = 0; i < this.childNodes.length; i++) { 50794 if (this.childNodes[i].data === data) { 50795 targetNode = this.childNodes[i];
50796 break; 50797 } 50798 } 50799 if (targetNode) { 50800 this.removeChild(targetNode); 50801 } 50802 } 50803 expand(callback, expandParent) { 50804 const done = () => { 50805 if (expandParent) { 50806 let parent = this.parent; 50807 while (parent.level > 0) { 50808 parent.expanded = true; 50809 parent = parent.parent; 50810 } 50811 } 50812 this.expanded = true; 50813 if (callback) 50814 callback(); 50815 this.childNodes.forEach((item) => { 50816 item.canFocus = true; 50817 }); 50818 }; 50819 if (this.shouldLoadData()) { 50820 this.loadData((data) => { 50821 if (Array.isArray(data)) { 50822 if (this.checked) { 50823 this.setChecked(true, true); 50824 } else if (!this.store.checkStrictly) { 50825 reInitChecked(this); 50826 } 50827 done(); 50828 } 50829 }); 50830 } else { 50831 done(); 50832 } 50833 } 50834 doCreateChildren(array, defaultProps = {}) { 50835 array.forEach((item) => { 50836 this.insertChild(Object.assign({ data: item }, defaultProps), void 0, true); 50837 }); 50838 } 50839 collapse() { 50840 this.expanded = false; 50841 this.childNodes.forEach((item) => { 50842 item.canFocus = false; 50843 }); 50844 } 50845 shouldLoadData() { 50846 return this.store.lazy === true && this.store.load && !this.loaded; 50847 } 50848 updateLeafState() { 50849 if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== "undefined") { 50850 this.isLeaf = this.isLeafByUser; 50851 return; 50852 } 50853 const childNodes = this.childNodes; 50854 if (!this.store.lazy || this.store.lazy === true && this.loaded === true) { 50855 this.isLeaf = !childNodes || childNodes.length === 0; 50856 return; 50857 } 50858 this.isLeaf = false; 50859 } 50860 setChecked(value, deep, recursion, passValue) { 50861 this.indeterminate = value === "half"; 50862 this.checked = value === true; 50863 if (this.store.checkStrictly) 50864 return; 50865 if (!(this.shouldLoadData() && !this.store.checkDescendants)) { 50866 const { all, allWithoutDisable } = getChildState(this.childNodes); 50867 if (!this.isLeaf && !all && allWithoutDisable) { 50868 this.checked = false; 50869 value = false; 50870 } 50871 const handleDescendants = () => { 50872 if (deep) { 50873 const childNodes = this.childNodes; 50874 for (let i = 0, j = childNodes.length; i < j; i++) { 50875 const child = childNodes[i]; 50876 passValue = passValue || value !== false; 50877 const isCheck = child.disabled ? child.checked : passValue; 50878 child.setChecked(isCheck, deep, true, passValue); 50879 } 50880 const { half, all: all2 } = getChildState(childNodes); 50881 if (!all2) { 50882 this.checked = all2; 50883 this.indeterminate = half; 50884 } 50885 } 50886 }; 50887 if (this.shouldLoadData()) { 50888 this.loadData(() => { 50889 handleDescendants(); 50890 reInitChecked(this); 50891 }, { 50892 checked: value !== false 50893 }); 50894 return; 50895 } else { 50896 handleDescendants(); 50897 } 50898 } 50899 const parent = this.parent; 50900 if (!parent || parent.level === 0) 50901 return; 50902 if (!recursion) { 50903 reInitChecked(parent); 50904 } 50905 } 50906 getChildren(forceInit = false) { 50907 if (this.level === 0) 50908 return this.data; 50909 const data = this.data; 50910 if (!data) 50911 return null; 50912 const props = this.store.props; 50913 let children = "children"; 50914 if (props) { 50915 children = props.children || "children"; 50916 } 50917 if (data[children] === void 0) { 50918 data[children] = null; 50919 } 50920 if (forceInit && !data[children]) { 50921 data[children] = []; 50922 } 50923 return data[children]; 50924 } 50925 updateChildren() { 50926 const newData = this.getChildren() || []; 50927 const oldData = this.childNodes.map((node) => node.data); 50928 const newDataMap = {}; 50929 const newNodes = []; 50930 newData.forEach((item, index) => {
50931 const key = item[NODE_KEY]; 50932 const isNodeExists = !!key && oldData.findIndex((data) => data[NODE_KEY] === key) >= 0; 50933 if (isNodeExists) { 50934 newDataMap[key] = { index, data: item }; 50935 } else { 50936 newNodes.push({ index, data: item }); 50937 } 50938 }); 50939 if (!this.store.lazy) { 50940 oldData.forEach((item) => { 50941 if (!newDataMap[item[NODE_KEY]]) 50942 this.removeChildByData(item); 50943 }); 50944 } 50945 newNodes.forEach(({ index, data }) => { 50946 this.insertChild({ data }, index); 50947 }); 50948 this.updateLeafState(); 50949 } 50950 loadData(callback, defaultProps = {}) { 50951 if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) { 50952 this.loading = true; 50953 const resolve = (children) => { 50954 this.childNodes = []; 50955 this.doCreateChildren(children, defaultProps); 50956 this.loaded = true; 50957 this.loading = false; 50958 this.updateLeafState(); 50959 if (callback) { 50960 callback.call(this, children); 50961 } 50962 }; 50963 this.store.load(this, resolve); 50964 } else { 50965 if (callback) { 50966 callback.call(this); 50967 } 50968 } 50969 } 50970 } 50971 var Node$1 = Node; 50972 50973 class TreeStore { 50974 constructor(options) { 50975 this.currentNode = null; 50976 this.currentNodeKey = null; 50977 for (const option in options) { 50978 if (hasOwn(options, option)) { 50979 this[option] = options[option]; 50980 } 50981 } 50982 this.nodesMap = {}; 50983 } 50984 initialize() { 50985 this.root = new Node$1({ 50986 data: this.data, 50987 store: this 50988 }); 50989 this.root.initialize(); 50990 if (this.lazy && this.load) { 50991 const loadFn = this.load; 50992 loadFn(this.root, (data) => { 50993 this.root.doCreateChildren(data); 50994 this._initDefaultCheckedNodes(); 50995 }); 50996 } else { 50997 this._initDefaultCheckedNodes(); 50998 } 50999 } 51000 filter(value) { 51001 const filterNodeMethod = this.filterNodeMethod; 51002 const lazy = this.lazy; 51003 const traverse = function(node) { 51004 const childNodes = node.root ? node.root.childNodes : node.childNodes; 51005 childNodes.forEach((child) => { 51006 child.visible = filterNodeMethod.call(child, value, child.data, child); 51007 traverse(child); 51008 }); 51009 if (!node.visible && childNodes.length) { 51010 let allHidden = true; 51011 allHidden = !childNodes.some((child) => child.visible); 51012 if (node.root) { 51013 node.root.visible = allHidden === false; 51014 } else { 51015 node.visible = allHidden === false; 51016 } 51017 } 51018 if (!value) 51019 return; 51020 if (node.visible && !node.isLeaf && !lazy) 51021 node.expand(); 51022 }; 51023 traverse(this); 51024 } 51025 setData(newVal) { 51026 const instanceChanged = newVal !== this.root.data; 51027 if (instanceChanged) { 51028 this.root.setData(newVal); 51029 this._initDefaultCheckedNodes(); 51030 } else { 51031 this.root.updateChildren(); 51032 } 51033 } 51034 getNode(data) { 51035 if (data instanceof Node$1) 51036 return data; 51037 const key = isObject$1(data) ? getNodeKey(this.key, data) : data; 51038 return this.nodesMap[key] || null; 51039 } 51040 insertBefore(data, refData) { 51041 const refNode = this.getNode(refData); 51042 refNode.parent.insertBefore({ data }, refNode); 51043 } 51044 insertAfter(data, refData) { 51045 const refNode = this.getNode(refData); 51046 refNode.parent.insertAfter({ data }, refNode); 51047 } 51048 remove(data) { 51049 const node = this.getNode(data); 51050 if (node && node.parent) { 51051 if (node === this.currentNode) { 51052 this.currentNode = null; 51053 } 51054 node.parent.removeChild(node); 51055 } 51056 } 51057 append(data, parentData) { 51058 const parentNode = parentData ? this.getNode(parentData) : this.root; 51059 if (parentNode) { 51060 parentNode.insertChild({ data }); 51061 } 51062 } 51063 _initDefaultCheckedNodes() { 51064 const defaultCheckedKeys = this.defaultCheckedKeys || []; 51065 const nodesMap = this.nodesMap; 51066 defaultCheckedKeys.forEach((checkedKey) => { 51067 const node = nodesMap[checkedKey]; 51068 if (node) { 51069 node.setChecked(true, !this.checkStrictly); 51070 } 51071 }); 51072 } 51073 _initDefaultCheckedNode(node) { 51074 const defaultCheckedKeys = this.defaultCheckedKeys || []; 51075 if (defaultCheckedKeys.includes(node.key)) { 51076 node.setChecked(true, !this.checkStrictly); 51077 } 51078 } 51079 setDefaultCheckedKey(newVal) { 51080 if (newVal !== this.defaultCheckedKeys) { 51081 this.defaultCheckedKeys = newVal; 51082 this._initDefaultCheckedNodes(); 51083 } 51084 } 51085 registerNode(node) {
51086 const key = this.key; 51087 if (!node || !node.data) 51088 return; 51089 if (!key) { 51090 this.nodesMap[node.id] = node; 51091 } else { 51092 const nodeKey = node.key; 51093 if (nodeKey !== void 0) 51094 this.nodesMap[node.key] = node; 51095 } 51096 } 51097 deregisterNode(node) { 51098 const key = this.key; 51099 if (!key || !node || !node.data) 51100 return; 51101 node.childNodes.forEach((child) => { 51102 this.deregisterNode(child); 51103 }); 51104 delete this.nodesMap[node.key]; 51105 } 51106 getCheckedNodes(leafOnly = false, includeHalfChecked = false) { 51107 const checkedNodes = []; 51108 const traverse = function(node) { 51109 const childNodes = node.root ? node.root.childNodes : node.childNodes; 51110 childNodes.forEach((child) => { 51111 if ((child.checked || includeHalfChecked && child.indeterminate) && (!leafOnly || leafOnly && child.isLeaf)) { 51112 checkedNodes.push(child.data); 51113 } 51114 traverse(child); 51115 }); 51116 }; 51117 traverse(this); 51118 return checkedNodes; 51119 } 51120 getCheckedKeys(leafOnly = false) { 51121 return this.getCheckedNodes(leafOnly).map((data) => (data || {})[this.key]); 51122 } 51123 getHalfCheckedNodes() { 51124 const nodes = []; 51125 const traverse = function(node) { 51126 const childNodes = node.root ? node.root.childNodes : node.childNodes; 51127 childNodes.forEach((child) => { 51128 if (child.indeterminate) { 51129 nodes.push(child.data); 51130 } 51131 traverse(child); 51132 }); 51133 }; 51134 traverse(this); 51135 return nodes; 51136 } 51137 getHalfCheckedKeys() { 51138 return this.getHalfCheckedNodes().map((data) => (data || {})[this.key]); 51139 } 51140 _getAllNodes() { 51141 const allNodes = []; 51142 const nodesMap = this.nodesMap; 51143 for (const nodeKey in nodesMap) { 51144 if (hasOwn(nodesMap, nodeKey)) { 51145 allNodes.push(nodesMap[nodeKey]); 51146 } 51147 } 51148 return allNodes; 51149 } 51150 updateChildren(key, data) { 51151 const node = this.nodesMap[key]; 51152 if (!node) 51153 return; 51154 const childNodes = node.childNodes; 51155 for (let i = childNodes.length - 1; i >= 0; i--) { 51156 const child = childNodes[i]; 51157 this.remove(child.data); 51158 } 51159 for (let i = 0, j = data.length; i < j; i++) { 51160 const child = data[i]; 51161 this.append(child, node.data); 51162 } 51163 } 51164 _setCheckedKeys(key, leafOnly = false, checkedKeys) { 51165 const allNodes = this._getAllNodes().sort((a, b) => b.level - a.level); 51166 const cache = /* @__PURE__ */ Object.create(null); 51167 const keys = Object.keys(checkedKeys); 51168 allNodes.forEach((node) => node.setChecked(false, false)); 51169 for (let i = 0, j = allNodes.length; i < j; i++) { 51170 const node = allNodes[i]; 51171 const nodeKey = node.data[key].toString(); 51172 const checked = keys.includes(nodeKey); 51173 if (!checked) { 51174 if (node.checked && !cache[nodeKey]) { 51175 node.setChecked(false, false); 51176 } 51177 continue; 51178 } 51179 let parent = node.parent; 51180 while (parent && parent.level > 0) { 51181 cache[parent.data[key]] = true; 51182 parent = parent.parent; 51183 } 51184 if (node.isLeaf || this.checkStrictly) { 51185 node.setChecked(true, false); 51186 continue; 51187 } 51188 node.setChecked(true, true); 51189 if (leafOnly) { 51190 node.setChecked(false, false); 51191 const traverse = function(node2) { 51192 const childNodes = node2.childNodes; 51193 childNodes.forEach((child) => { 51194 if (!child.isLeaf) { 51195 child.setChecked(false, false); 51196 } 51197 traverse(child); 51198 }); 51199 }; 51200 traverse(node); 51201 } 51202 } 51203 } 51204 setCheckedNodes(array, leafOnly = false) {
51205 const key = this.key; 51206 const checkedKeys = {}; 51207 array.forEach((item) => { 51208 checkedKeys[(item || {})[key]] = true; 51209 }); 51210 this._setCheckedKeys(key, leafOnly, checkedKeys); 51211 } 51212 setCheckedKeys(keys, leafOnly = false) { 51213 this.defaultCheckedKeys = keys; 51214 const key = this.key; 51215 const checkedKeys = {}; 51216 keys.forEach((key2) => { 51217 checkedKeys[key2] = true; 51218 }); 51219 this._setCheckedKeys(key, leafOnly, checkedKeys); 51220 } 51221 setDefaultExpandedKeys(keys) { 51222 keys = keys || []; 51223 this.defaultExpandedKeys = keys; 51224 keys.forEach((key) => { 51225 const node = this.getNode(key); 51226 if (node) 51227 node.expand(null, this.autoExpandParent); 51228 }); 51229 } 51230 setChecked(data, checked, deep) { 51231 const node = this.getNode(data); 51232 if (node) { 51233 node.setChecked(!!checked, deep); 51234 } 51235 } 51236 getCurrentNode() { 51237 return this.currentNode; 51238 } 51239 setCurrentNode(currentNode) { 51240 const prevCurrentNode = this.currentNode; 51241 if (prevCurrentNode) { 51242 prevCurrentNode.isCurrent = false; 51243 } 51244 this.currentNode = currentNode; 51245 this.currentNode.isCurrent = true; 51246 } 51247 setUserCurrentNode(node, shouldAutoExpandParent = true) { 51248 const key = node[this.key]; 51249 const currNode = this.nodesMap[key]; 51250 this.setCurrentNode(currNode); 51251 if (shouldAutoExpandParent && this.currentNode.level > 1) { 51252 this.currentNode.parent.expand(null, true); 51253 } 51254 } 51255 setCurrentNodeKey(key, shouldAutoExpandParent = true) { 51256 if (key === null || key === void 0) { 51257 this.currentNode && (this.currentNode.isCurrent = false); 51258 this.currentNode = null; 51259 return; 51260 } 51261 const node = this.getNode(key); 51262 if (node) { 51263 this.setCurrentNode(node); 51264 if (shouldAutoExpandParent && this.currentNode.level > 1) { 51265 this.currentNode.parent.expand(null, true); 51266 } 51267 } 51268 } 51269 } 51270 51271 const _sfc_main$c = vue.defineComponent({ 51272 name: "ElTreeNodeContent", 51273 props: { 51274 node: { 51275 type: Object, 51276 required: true 51277 }, 51278 renderContent: Function 51279 }, 51280 setup(props) { 51281 const ns = useNamespace("tree"); 51282 const nodeInstance = vue.inject("NodeInstance"); 51283 const tree = vue.inject("RootTree"); 51284 return () => { 51285 const node = props.node; 51286 const { data, store } = node; 51287 return props.renderContent ? props.renderContent(vue.h, { _self: nodeInstance, node, data, store }) : tree.ctx.slots.default ? tree.ctx.slots.default({ node, data }) : vue.h("span", { class: ns.be("node", "label") }, [node.label]); 51288 }; 51289 } 51290 }); 51291 var NodeContent = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__file", "tree-node-content.vue"]]); 51292 51293 function useNodeExpandEventBroadcast(props) { 51294 const parentNodeMap = vue.inject("TreeNodeMap", null); 51295 const currentNodeMap = { 51296 treeNodeExpand: (node) => { 51297 if (props.node !== node) { 51298 props.node.collapse(); 51299 } 51300 }, 51301 children: [] 51302 }; 51303 if (parentNodeMap) { 51304 parentNodeMap.children.push(currentNodeMap); 51305 } 51306 vue.provide("TreeNodeMap", currentNodeMap); 51307 return { 51308 broadcastExpanded: (node) => { 51309 if (!props.accordion) 51310 return; 51311 for (const childNode of currentNodeMap.children) { 51312 childNode.treeNodeExpand(node); 51313 } 51314 } 51315 }; 51316 } 51317 51318 const dragEventsKey = Symbol("dragEvents"); 51319 function useDragNodeHandler({ props, ctx, el$, dropIndicator$, store }) { 51320 const ns = useNamespace("tree"); 51321 const dragState = vue.ref({ 51322 showDropIndicator: false, 51323 draggingNode: null, 51324 dropNode: null, 51325 allowDrop: true, 51326 dropType: null 51327 }); 51328 const treeNodeDragStart = ({ event, treeNode }) => { 51329 if (typeof props.allowDrag === "function" && !props.allowDrag(treeNode.node)) { 51330 event.preventDefault(); 51331 return false; 51332 } 51333 event.dataTransfer.effectAllowed = "move"; 51334 try { 51335 event.dataTransfer.setData("text/plain", ""); 51336 } catch (e) { 51337 } 51338 dragState.value.draggingNode = treeNode; 51339 ctx.emit("node-drag-start", treeNode.node, event); 51340 }; 51341 const treeNodeDragOver = ({ event, treeNode }) => { 51342 const dropNode = treeNode; 51343 const oldDropNode = dragState.value.dropNode; 51344 if (oldDropNode && oldDropNode.node.id !== dropNode.node.id) { 51345 removeClass(oldDropNode.$el, ns.is("drop-inner")); 51346 } 51347 const draggingNode = dragState.value.draggingNode; 51348 if (!draggingNode || !dropNode) 51349 return; 51350 let dropPrev = true; 51351 let dropInner = true; 51352 let dropNext = true; 51353 let userAllowDropInner = true; 51354 if (typeof props.allowDrop === "function") { 51355 dropPrev = props.allowDrop(draggingNode.node, dropNode.node, "prev"); 51356 userAllowDropInner = dropInner = props.allowDrop(draggingNode.node, dropNode.node, "inner"); 51357 dropNext = props.allowDrop(draggingNode.node, dropNode.node, "next"); 51358 } 51359 event.dataTransfer.dropEffect = dropInner || dropPrev || dropNext ? "move" : "none"; 51360 if ((dropPrev || dropInner || dropNext) && (oldDropNode == null ? void 0 : oldDropNode.node.id) !== dropNode.node.id) { 51361 if (oldDropNode) { 51362 ctx.emit("node-drag-leave", draggingNode.node, oldDropNode.node, event); 51363 } 51364 ctx.emit("node-drag-enter", draggingNode.node, dropNode.node, event); 51365 } 51366 if (dropPrev || dropInner || dropNext) { 51367 dragState.value.dropNode = dropNode; 51368 } 51369 if (dropNode.node.nextSibling === draggingNode.node) { 51370 dropNext = false; 51371 } 51372 if (dropNode.node.previousSibling === draggingNode.node) { 51373 dropPrev = false; 51374 } 51375 if (dropNode.node.contains(draggingNode.node, false)) { 51376 dropInner = false; 51377 } 51378 if (draggingNode.node === dropNode.node || draggingNode.node.contains(dropNode.node)) { 51379 dropPrev = false; 51380 dropInner = false; 51381 dropNext = false; 51382 } 51383 const targetPosition = dropNode.$el.getBoundingClientRect(); 51384 const treePosition = el$.value.getBoundingClientRect(); 51385 let dropType; 51386 const prevPercent = dropPrev ? dropInner ? 0.25 : dropNext ? 0.45 : 1 : -1; 51387 const nextPercent = dropNext ? dropInner ? 0.75 : dropPrev ? 0.55 : 0 : 1; 51388 let indicatorTop = -9999; 51389 const distance = event.clientY - targetPosition.top; 51390 if (distance < targetPosition.height * prevPercent) { 51391 dropType = "before"; 51392 } else if (distance > targetPosition.height * nextPercent) { 51393 dropType = "after"; 51394 } else if (dropInner) { 51395 dropType = "inner"; 51396 } else { 51397 dropType = "none"; 51398 } 51399 const iconPosition = dropNode.$el.querySelector(`.${ns.be("node", "expand-icon")}`).getBoundingClientRect(); 51400 const dropIndicator = dropIndicator$.value; 51401 if (dropType === "before") { 51402 indicatorTop = iconPosition.top - treePosition.top; 51403 } else if (dropType === "after") { 51404 indicatorTop = iconPosition.bottom - treePosition.top; 51405 } 51406 dropIndicator.style.top = `${indicatorTop}px`; 51407 dropIndicator.style.left = `${iconPosition.right - treePosition.left}px`; 51408 if (dropType === "inner") { 51409 addClass(dropNode.$el, ns.is("drop-inner")); 51410 } else { 51411 removeClass(dropNode.$el, ns.is("drop-inner")); 51412 } 51413 dragState.value.showDropIndicator = dropType === "before" || dropType === "after"; 51414 dragState.value.allowDrop = dragState.value.showDropIndicator || userAllowDropInner; 51415 dragState.value.dropType = dropType; 51416 ctx.emit("node-drag-over", draggingNode.node, dropNode.node, event); 51417 }; 51418 const treeNodeDragEnd = (event) => { 51419 const { draggingNode, dropType, dropNode } = dragState.value; 51420 event.preventDefault(); 51421 event.dataTransfer.dropEffect = "move"; 51422 if (draggingNode && dropNode) { 51423 const draggingNodeCopy = { data: draggingNode.node.data }; 51424 if (dropType !== "none") { 51425 draggingNode.node.remove(); 51426 } 51427 if (dropType === "before") { 51428 dropNode.node.parent.insertBefore(draggingNodeCopy, dropNode.node); 51429 } else if (dropType === "after") { 51430 dropNode.node.parent.insertAfter(draggingNodeCopy, dropNode.node); 51431 } else if (dropType === "inner") { 51432 dropNode.node.insertChild(draggingNodeCopy); 51433 } 51434 if (dropType !== "none") { 51435 store.value.registerNode(draggingNodeCopy); 51436 } 51437 removeClass(dropNode.$el, ns.is("drop-inner")); 51438 ctx.emit("node-drag-end", draggingNode.node, dropNode.node, dropType, event); 51439 if (dropType !== "none") { 51440 ctx.emit("node-drop", draggingNode.node, dropNode.node, dropType, event); 51441 } 51442 } 51443 if (draggingNode && !dropNode) { 51444 ctx.emit("node-drag-end", draggingNode.node, null, dropType, event); 51445 } 51446 dragState.value.showDropIndicator = false; 51447 dragState.value.draggingNode = null; 51448 dragState.value.dropNode = null; 51449 dragState.value.allowDrop = true; 51450 }; 51451 vue.provide(dragEventsKey, { 51452 treeNodeDragStart, 51453 treeNodeDragOver, 51454 treeNodeDragEnd 51455 }); 51456 return { 51457 dragState 51458 }; 51459 } 51460 51461 const _sfc_main$b = vue.defineComponent({ 51462 name: "ElTreeNode", 51463 components: { 51464 ElCollapseTransition: _CollapseTransition, 51465 ElCheckbox, 51466 NodeContent, 51467 ElIcon, 51468 Loading: loading_default 51469 }, 51470 props: { 51471 node: { 51472 type: Node$1, 51473 default: () => ({}) 51474 }, 51475 props: { 51476 type: Object, 51477 default: () => ({}) 51478 }, 51479 accordion: Boolean, 51480 renderContent: Function, 51481 renderAfterExpand: Boolean, 51482 showCheckbox: { 51483 type: Boolean, 51484 default: false 51485 } 51486 }, 51487 emits: ["node-expand"], 51488 setup(props, ctx) { 51489 const ns = useNamespace("tree"); 51490 const { broadcastExpanded } = useNodeExpandEventBroadcast(props); 51491 const tree = vue.inject("RootTree"); 51492 const expanded = vue.ref(false); 51493 const childNodeRendered = vue.ref(false); 51494 const oldChecked = vue.ref(null); 51495 const oldIndeterminate = vue.ref(null); 51496 const node$ = vue.ref(null); 51497 const dragEvents = vue.inject(dragEventsKey); 51498 const instance = vue.getCurrentInstance(); 51499 vue.provide("NodeInstance", instance); 51500 if (props.node.expanded) { 51501 expanded.value = true; 51502 childNodeRendered.value = true; 51503 } 51504 const childrenKey = tree.props["children"] || "children"; 51505 vue.watch(() => { 51506 const children = props.node.data[childrenKey]; 51507 return children && [...children]; 51508 }, () => { 51509 props.node.updateChildren();
51510 }); 51511 vue.watch(() => props.node.indeterminate, (val) => { 51512 handleSelectChange(props.node.checked, val); 51513 }); 51514 vue.watch(() => props.node.checked, (val) => { 51515 handleSelectChange(val, props.node.indeterminate); 51516 }); 51517 vue.watch(() => props.node.expanded, (val) => { 51518 vue.nextTick(() => expanded.value = val); 51519 if (val) { 51520 childNodeRendered.value = true; 51521 } 51522 }); 51523 const getNodeKey$1 = (node) => { 51524 return getNodeKey(tree.props.nodeKey, node.data); 51525 }; 51526 const getNodeClass = (node) => { 51527 const nodeClassFunc = props.props.class; 51528 if (!nodeClassFunc) { 51529 return {}; 51530 } 51531 let className; 51532 if (isFunction$1(nodeClassFunc)) { 51533 const { data } = node; 51534 className = nodeClassFunc(data, node); 51535 } else { 51536 className = nodeClassFunc; 51537 } 51538 if (isString$1(className)) { 51539 return { [className]: true }; 51540 } else { 51541 return className; 51542 } 51543 }; 51544 const handleSelectChange = (checked, indeterminate) => { 51545 if (oldChecked.value !== checked || oldIndeterminate.value !== indeterminate) { 51546 tree.ctx.emit("check-change", props.node.data, checked, indeterminate); 51547 } 51548 oldChecked.value = checked; 51549 oldIndeterminate.value = indeterminate; 51550 }; 51551 const handleClick = (e) => { 51552 handleCurrentChange(tree.store, tree.ctx.emit, () => tree.store.value.setCurrentNode(props.node)); 51553 tree.currentNode.value = props.node; 51554 if (tree.props.expandOnClickNode) { 51555 handleExpandIconClick(); 51556 } 51557 if (tree.props.checkOnClickNode && !props.node.disabled) { 51558 handleCheckChange(null, { 51559 target: { checked: !props.node.checked } 51560 }); 51561 } 51562 tree.ctx.emit("node-click", props.node.data, props.node, instance, e); 51563 }; 51564 const handleContextMenu = (event) => { 51565 if (tree.instance.vnode.props["onNodeContextmenu"]) { 51566 event.stopPropagation(); 51567 event.preventDefault(); 51568 } 51569 tree.ctx.emit("node-contextmenu", event, props.node.data, props.node, instance); 51570 }; 51571 const handleExpandIconClick = () => { 51572 if (props.node.isLeaf) 51573 return; 51574 if (expanded.value) { 51575 tree.ctx.emit("node-collapse", props.node.data, props.node, instance); 51576 props.node.collapse(); 51577 } else { 51578 props.node.expand(); 51579 ctx.emit("node-expand", props.node.data, props.node, instance); 51580 } 51581 }; 51582 const handleCheckChange = (value, ev) => { 51583 props.node.setChecked(ev.target.checked, !tree.props.checkStrictly); 51584 vue.nextTick(() => { 51585 const store = tree.store.value; 51586 tree.ctx.emit("check", props.node.data, { 51587 checkedNodes: store.getCheckedNodes(), 51588 checkedKeys: store.getCheckedKeys(), 51589 halfCheckedNodes: store.getHalfCheckedNodes(), 51590 halfCheckedKeys: store.getHalfCheckedKeys() 51591 }); 51592 }); 51593 }; 51594 const handleChildNodeExpand = (nodeData, node, instance2) => { 51595 broadcastExpanded(node); 51596 tree.ctx.emit("node-expand", nodeData, node, instance2); 51597 }; 51598 const handleDragStart = (event) => { 51599 if (!tree.props.draggable) 51600 return; 51601 dragEvents.treeNodeDragStart({ event, treeNode: props }); 51602 }; 51603 const handleDragOver = (event) => { 51604 event.preventDefault(); 51605 if (!tree.props.draggable) 51606 return; 51607 dragEvents.treeNodeDragOver({ 51608 event, 51609 treeNode: { $el: node$.value, node: props.node } 51610 }); 51611 }; 51612 const handleDrop = (event) => { 51613 event.preventDefault(); 51614 }; 51615 const handleDragEnd = (event) => { 51616 if (!tree.props.draggable) 51617 return; 51618 dragEvents.treeNodeDragEnd(event); 51619 }; 51620 return { 51621 ns, 51622 node$, 51623 tree, 51624 expanded, 51625 childNodeRendered, 51626 oldChecked, 51627 oldIndeterminate, 51628 getNodeKey: getNodeKey$1, 51629 getNodeClass, 51630 handleSelectChange, 51631 handleClick, 51632 handleContextMenu, 51633 handleExpandIconClick, 51634 handleCheckChange, 51635 handleChildNodeExpand, 51636 handleDragStart, 51637 handleDragOver, 51638 handleDrop, 51639 handleDragEnd, 51640 CaretRight: caret_right_default 51641 }; 51642 } 51643 });
51644 const _hoisted_1$7 = ["aria-expanded", "aria-disabled", "aria-checked", "draggable", "data-key"]; 51645 const _hoisted_2$5 = ["aria-expanded"]; 51646 function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) { 51647 const _component_el_icon = vue.resolveComponent("el-icon"); 51648 const _component_el_checkbox = vue.resolveComponent("el-checkbox"); 51649 const _component_loading = vue.resolveComponent("loading"); 51650 const _component_node_content = vue.resolveComponent("node-content"); 51651 const _component_el_tree_node = vue.resolveComponent("el-tree-node"); 51652 const _component_el_collapse_transition = vue.resolveComponent("el-collapse-transition"); 51653 return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", { 51654 ref: "node$", 51655 class: vue.normalizeClass([ 51656 _ctx.ns.b("node"), 51657 _ctx.ns.is("expanded", _ctx.expanded), 51658 _ctx.ns.is("current", _ctx.node.isCurrent), 51659 _ctx.ns.is("hidden", !_ctx.node.visible), 51660 _ctx.ns.is("focusable", !_ctx.node.disabled), 51661 _ctx.ns.is("checked", !_ctx.node.disabled && _ctx.node.checked), 51662 _ctx.getNodeClass(_ctx.node) 51663 ]), 51664 role: "treeitem", 51665 tabindex: "-1", 51666 "aria-expanded": _ctx.expanded, 51667 "aria-disabled": _ctx.node.disabled, 51668 "aria-checked": _ctx.node.checked, 51669 draggable: _ctx.tree.props.draggable, 51670 "data-key": _ctx.getNodeKey(_ctx.node), 51671 onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.handleClick && _ctx.handleClick(...args), ["stop"])), 51672 onContextmenu: _cache[2] || (_cache[2] = (...args) => _ctx.handleContextMenu && _ctx.handleContextMenu(...args)), 51673 onDragstart: _cache[3] || (_cache[3] = vue.withModifiers((...args) => _ctx.handleDragStart && _ctx.handleDragStart(...args), ["stop"])), 51674 onDragover: _cache[4] || (_cache[4] = vue.withModifiers((...args) => _ctx.handleDragOver && _ctx.handleDragOver(...args), ["stop"])), 51675 onDragend: _cache[5] || (_cache[5] = vue.withModifiers((...args) => _ctx.handleDragEnd && _ctx.handleDragEnd(...args), ["stop"])), 51676 onDrop: _cache[6] || (_cache[6] = vue.withModifiers((...args) => _ctx.handleDrop && _ctx.handleDrop(...args), ["stop"])) 51677 }, [ 51678 vue.createElementVNode("div", { 51679 class: vue.normalizeClass(_ctx.ns.be("node", "content")), 51680 style: vue.normalizeStyle({ paddingLeft: (_ctx.node.level - 1) * _ctx.tree.props.indent + "px" }) 51681 }, [ 51682 _ctx.tree.props.icon || _ctx.CaretRight ? (vue.openBlock(), vue.createBlock(_component_el_icon, { 51683 key: 0, 51684 class: vue.normalizeClass([ 51685 _ctx.ns.be("node", "expand-icon"), 51686 _ctx.ns.is("leaf", _ctx.node.isLeaf), 51687 { 51688 expanded: !_ctx.node.isLeaf && _ctx.expanded 51689 } 51690 ]), 51691 onClick: vue.withModifiers(_ctx.handleExpandIconClick, ["stop"]) 51692 }, { 51693 default: vue.withCtx(() => [ 51694 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tree.props.icon || _ctx.CaretRight))) 51695 ]), 51696 _: 1 51697 }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true), 51698 _ctx.showCheckbox ? (vue.openBlock(), vue.createBlock(_component_el_checkbox, { 51699 key: 1, 51700 "model-value": _ctx.node.checked, 51701 indeterminate: _ctx.node.indeterminate, 51702 disabled: !!_ctx.node.disabled, 51703 onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => { 51704 }, ["stop"])), 51705 onChange: _ctx.handleCheckChange 51706 }, null, 8, ["model-value", "indeterminate", "disabled", "onChange"])) : vue.createCommentVNode("v-if", true), 51707 _ctx.node.loading ? (vue.openBlock(), vue.createBlock(_component_el_icon, { 51708 key: 2, 51709 class: vue.normalizeClass([_ctx.ns.be("node", "loading-icon"), _ctx.ns.is("loading")]) 51710 }, { 51711 default: vue.withCtx(() => [ 51712 vue.createVNode(_component_loading) 51713 ]), 51714 _: 1 51715 }, 8, ["class"])) : vue.createCommentVNode("v-if", true), 51716 vue.createVNode(_component_node_content, { 51717 node: _ctx.node, 51718 "render-content": _ctx.renderContent 51719 }, null, 8, ["node", "render-content"])
51720 ], 6), 51721 vue.createVNode(_component_el_collapse_transition, null, { 51722 default: vue.withCtx(() => [ 51723 !_ctx.renderAfterExpand || _ctx.childNodeRendered ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", { 51724 key: 0, 51725 class: vue.normalizeClass(_ctx.ns.be("node", "children")), 51726 role: "group", 51727 "aria-expanded": _ctx.expanded 51728 }, [ 51729 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.node.childNodes, (child) => { 51730 return vue.openBlock(), vue.createBlock(_component_el_tree_node, { 51731 key: _ctx.getNodeKey(child), 51732 "render-content": _ctx.renderContent, 51733 "render-after-expand": _ctx.renderAfterExpand, 51734 "show-checkbox": _ctx.showCheckbox, 51735 node: child, 51736 accordion: _ctx.accordion, 51737 props: _ctx.props, 51738 onNodeExpand: _ctx.handleChildNodeExpand 51739 }, null, 8, ["render-content", "render-after-expand", "show-checkbox", "node", "accordion", "props", "onNodeExpand"]); 51740 }), 128)) 51741 ], 10, _hoisted_2$5)), [ 51742 [vue.vShow, _ctx.expanded] 51743 ]) : vue.createCommentVNode("v-if", true) 51744 ]), 51745 _: 1 51746 }) 51747 ], 42, _hoisted_1$7)), [ 51748 [vue.vShow, _ctx.node.visible] 51749 ]); 51750 } 51751 var ElTreeNode$1 = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$2], ["__file", "tree-node.vue"]]); 51752 51753 function useKeydown({ el$ }, store) { 51754 const ns = useNamespace("tree"); 51755 const treeItems = vue.shallowRef([]); 51756 const checkboxItems = vue.shallowRef([]); 51757 vue.onMounted(() => { 51758 initTabIndex(); 51759 }); 51760 vue.onUpdated(() => { 51761 treeItems.value = Array.from(el$.value.querySelectorAll("[role=treeitem]")); 51762 checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]")); 51763 }); 51764 vue.watch(checkboxItems, (val) => { 51765 val.forEach((checkbox) => { 51766 checkbox.setAttribute("tabindex", "-1"); 51767 }); 51768 }); 51769 const handleKeydown = (ev) => { 51770 const currentItem = ev.target; 51771 if (!currentItem.className.includes(ns.b("node"))) 51772 return; 51773 const code = ev.code; 51774 treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`)); 51775 const currentIndex = treeItems.value.indexOf(currentItem); 51776 let nextIndex; 51777 if ([EVENT_CODE.up, EVENT_CODE.down].includes(code)) { 51778 ev.preventDefault(); 51779 if (code === EVENT_CODE.up) { 51780 nextIndex = currentIndex === -1 ? 0 : currentIndex !== 0 ? currentIndex - 1 : treeItems.value.length - 1; 51781 const startIndex = nextIndex; 51782 while (true) { 51783 if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus) 51784 break; 51785 nextIndex--; 51786 if (nextIndex === startIndex) { 51787 nextIndex = -1; 51788 break; 51789 } 51790 if (nextIndex < 0) { 51791 nextIndex = treeItems.value.length - 1; 51792 } 51793 } 51794 } else { 51795 nextIndex = currentIndex === -1 ? 0 : currentIndex < treeItems.value.length - 1 ? currentIndex + 1 : 0; 51796 const startIndex = nextIndex; 51797 while (true) { 51798 if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus) 51799 break; 51800 nextIndex++; 51801 if (nextIndex === startIndex) { 51802 nextIndex = -1; 51803 break; 51804 } 51805 if (nextIndex >= treeItems.value.length) { 51806 nextIndex = 0; 51807 } 51808 } 51809 } 51810 nextIndex !== -1 && treeItems.value[nextIndex].focus(); 51811 } 51812 if ([EVENT_CODE.left, EVENT_CODE.right].includes(code)) { 51813 ev.preventDefault(); 51814 currentItem.click(); 51815 } 51816 const hasInput = currentItem.querySelector('[type="checkbox"]'); 51817 if ([EVENT_CODE.enter, EVENT_CODE.space].includes(code) && hasInput) { 51818 ev.preventDefault(); 51819 hasInput.click(); 51820 } 51821 }; 51822 useEventListener(el$, "keydown", handleKeydown); 51823 const initTabIndex = () => { 51824 var _a; 51825 treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`)); 51826 checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]")); 51827 const checkedItem = el$.value.querySelectorAll(`.${ns.is("checked")}[role=treeitem]`); 51828 if (checkedItem.length) { 51829 checkedItem[0].setAttribute("tabindex", "0"); 51830 return; 51831 } 51832 (_a = treeItems.value[0]) == null ? void 0 : _a.setAttribute("tabindex", "0"); 51833 }; 51834 } 51835 51836 const _sfc_main$a = vue.defineComponent({ 51837 name: "ElTree", 51838 components: { ElTreeNode: ElTreeNode$1 }, 51839 props: { 51840 data: { 51841 type: Array, 51842 default: () => [] 51843 }, 51844 emptyText: { 51845 type: String 51846 }, 51847 renderAfterExpand: { 51848 type: Boolean, 51849 default: true 51850 }, 51851 nodeKey: String, 51852 checkStrictly: Boolean, 51853 defaultExpandAll: Boolean, 51854 expandOnClickNode: { 51855 type: Boolean, 51856 default: true 51857 }, 51858 checkOnClickNode: Boolean, 51859 checkDescendants: { 51860 type: Boolean, 51861 default: false 51862 }, 51863 autoExpandParent: { 51864 type: Boolean, 51865 default: true 51866 }, 51867 defaultCheckedKeys: Array, 51868 defaultExpandedKeys: Array, 51869 currentNodeKey: [String, Number], 51870 renderContent: Function, 51871 showCheckbox: { 51872 type: Boolean, 51873 default: false 51874 }, 51875 draggable: { 51876 type: Boolean, 51877 default: false 51878 }, 51879 allowDrag: Function, 51880 allowDrop: Function, 51881 props: { 51882 type: Object, 51883 default: () => ({ 51884 children: "children", 51885 label: "label", 51886 disabled: "disabled" 51887 }) 51888 }, 51889 lazy: { 51890 type: Boolean, 51891 default: false 51892 }, 51893 highlightCurrent: Boolean, 51894 load: Function, 51895 filterNodeMethod: Function, 51896 accordion: Boolean, 51897 indent: { 51898 type: Number, 51899 default: 18 51900 }, 51901 icon: { 51902 type: iconPropType 51903 } 51904 }, 51905 emits: [ 51906 "check-change", 51907 "current-change", 51908 "node-click", 51909 "node-contextmenu", 51910 "node-collapse", 51911 "node-expand", 51912 "check", 51913 "node-drag-start", 51914 "node-drag-end", 51915 "node-drop", 51916 "node-drag-leave", 51917 "node-drag-enter", 51918 "node-drag-over" 51919 ], 51920 setup(props, ctx) { 51921 const { t } = useLocale(); 51922 const ns = useNamespace("tree");
vendor: 5,107 bytes, lines 51923-52043
51923 const store = vue.ref(new TreeStore({ 51924 key: props.nodeKey, 51925 data: props.data, 51926 lazy: props.lazy, 51927 props: props.props, 51928 load: props.load, 51929 currentNodeKey: props.currentNodeKey, 51930 checkStrictly: props.checkStrictly, 51931 checkDescendants: props.checkDescendants, 51932 defaultCheckedKeys: props.defaultCheckedKeys, 51933 defaultExpandedKeys: props.defaultExpandedKeys, 51934 autoExpandParent: props.autoExpandParent, 51935 defaultExpandAll: props.defaultExpandAll, 51936 filterNodeMethod: props.filterNodeMethod 51937 })); 51938 store.value.initialize(); 51939 const root = vue.ref(store.value.root); 51940 const currentNode = vue.ref(null); 51941 const el$ = vue.ref(null); 51942 const dropIndicator$ = vue.ref(null); 51943 const { broadcastExpanded } = useNodeExpandEventBroadcast(props); 51944 const { dragState } = useDragNodeHandler({ 51945 props, 51946 ctx, 51947 el$, 51948 dropIndicator$, 51949 store 51950 }); 51951 useKeydown({ el$ }, store); 51952 const isEmpty = vue.computed(() => { 51953 const { childNodes } = root.value; 51954 return !childNodes || childNodes.length === 0 || childNodes.every(({ visible }) => !visible); 51955 }); 51956 vue.watch(() => props.currentNodeKey, (newVal) => { 51957 store.value.setCurrentNodeKey(newVal); 51958 }); 51959 vue.watch(() => props.defaultCheckedKeys, (newVal) => { 51960 store.value.setDefaultCheckedKey(newVal); 51961 }); 51962 vue.watch(() => props.defaultExpandedKeys, (newVal) => { 51963 store.value.setDefaultExpandedKeys(newVal); 51964 }); 51965 vue.watch(() => props.data, (newVal) => { 51966 store.value.setData(newVal); 51967 }, { deep: true }); 51968 vue.watch(() => props.checkStrictly, (newVal) => { 51969 store.value.checkStrictly = newVal; 51970 }); 51971 const filter = (value) => { 51972 if (!props.filterNodeMethod) 51973 throw new Error("[Tree] filterNodeMethod is required when filter"); 51974 store.value.filter(value); 51975 }; 51976 const getNodeKey$1 = (node) => { 51977 return getNodeKey(props.nodeKey, node.data); 51978 }; 51979 const getNodePath = (data) => { 51980 if (!props.nodeKey) 51981 throw new Error("[Tree] nodeKey is required in getNodePath"); 51982 const node = store.value.getNode(data); 51983 if (!node) 51984 return []; 51985 const path = [node.data]; 51986 let parent = node.parent; 51987 while (parent && parent !== root.value) { 51988 path.push(parent.data); 51989 parent = parent.parent; 51990 } 51991 return path.reverse(); 51992 }; 51993 const getCheckedNodes = (leafOnly, includeHalfChecked) => { 51994 return store.value.getCheckedNodes(leafOnly, includeHalfChecked); 51995 }; 51996 const getCheckedKeys = (leafOnly) => { 51997 return store.value.getCheckedKeys(leafOnly); 51998 }; 51999 const getCurrentNode = () => { 52000 const currentNode2 = store.value.getCurrentNode(); 52001 return currentNode2 ? currentNode2.data : null; 52002 }; 52003 const getCurrentKey = () => { 52004 if (!props.nodeKey) 52005 throw new Error("[Tree] nodeKey is required in getCurrentKey"); 52006 const currentNode2 = getCurrentNode(); 52007 return currentNode2 ? currentNode2[props.nodeKey] : null; 52008 }; 52009 const setCheckedNodes = (nodes, leafOnly) => { 52010 if (!props.nodeKey) 52011 throw new Error("[Tree] nodeKey is required in setCheckedNodes"); 52012 store.value.setCheckedNodes(nodes, leafOnly); 52013 }; 52014 const setCheckedKeys = (keys, leafOnly) => { 52015 if (!props.nodeKey) 52016 throw new Error("[Tree] nodeKey is required in setCheckedKeys"); 52017 store.value.setCheckedKeys(keys, leafOnly); 52018 }; 52019 const setChecked = (data, checked, deep) => { 52020 store.value.setChecked(data, checked, deep); 52021 }; 52022 const getHalfCheckedNodes = () => { 52023 return store.value.getHalfCheckedNodes(); 52024 }; 52025 const getHalfCheckedKeys = () => { 52026 return store.value.getHalfCheckedKeys(); 52027 }; 52028 const setCurrentNode = (node, shouldAutoExpandParent = true) => { 52029 if (!props.nodeKey) 52030 throw new Error("[Tree] nodeKey is required in setCurrentNode"); 52031 handleCurrentChange(store, ctx.emit, () => store.value.setUserCurrentNode(node, shouldAutoExpandParent)); 52032 }; 52033 const setCurrentKey = (key, shouldAutoExpandParent = true) => { 52034 if (!props.nodeKey) 52035 throw new Error("[Tree] nodeKey is required in setCurrentKey"); 52036 handleCurrentChange(store, ctx.emit, () => store.value.setCurrentNodeKey(key, shouldAutoExpandParent)); 52037 }; 52038 const getNode = (data) => { 52039 return store.value.getNode(data); 52040 }; 52041 const remove = (data) => { 52042 store.value.remove(data); 52043 };
52044 const append = (data, parentNode) => { 52045 store.value.append(data, parentNode); 52046 }; 52047 const insertBefore = (data, refNode) => { 52048 store.value.insertBefore(data, refNode); 52049 }; 52050 const insertAfter = (data, refNode) => { 52051 store.value.insertAfter(data, refNode); 52052 }; 52053 const handleNodeExpand = (nodeData, node, instance) => { 52054 broadcastExpanded(node); 52055 ctx.emit("node-expand", nodeData, node, instance); 52056 }; 52057 const updateKeyChildren = (key, data) => { 52058 if (!props.nodeKey) 52059 throw new Error("[Tree] nodeKey is required in updateKeyChild"); 52060 store.value.updateChildren(key, data); 52061 }; 52062 vue.provide("RootTree", { 52063 ctx, 52064 props, 52065 store, 52066 root, 52067 currentNode, 52068 instance: vue.getCurrentInstance() 52069 }); 52070 vue.provide(formItemContextKey, void 0); 52071 return { 52072 ns, 52073 store, 52074 root, 52075 currentNode, 52076 dragState, 52077 el$, 52078 dropIndicator$, 52079 isEmpty, 52080 filter, 52081 getNodeKey: getNodeKey$1, 52082 getNodePath, 52083 getCheckedNodes, 52084 getCheckedKeys, 52085 getCurrentNode, 52086 getCurrentKey, 52087 setCheckedNodes, 52088 setCheckedKeys, 52089 setChecked, 52090 getHalfCheckedNodes, 52091 getHalfCheckedKeys, 52092 setCurrentNode, 52093 setCurrentKey, 52094 t, 52095 getNode, 52096 remove, 52097 append, 52098 insertBefore, 52099 insertAfter, 52100 handleNodeExpand, 52101 updateKeyChildren 52102 }; 52103 } 52104 }); 52105 function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) { 52106 const _component_el_tree_node = vue.resolveComponent("el-tree-node"); 52107 return vue.openBlock(), vue.createElementBlock("div", { 52108 ref: "el$", 52109 class: vue.normalizeClass([ 52110 _ctx.ns.b(), 52111 _ctx.ns.is("dragging", !!_ctx.dragState.draggingNode), 52112 _ctx.ns.is("drop-not-allow", !_ctx.dragState.allowDrop), 52113 _ctx.ns.is("drop-inner", _ctx.dragState.dropType === "inner"), 52114 { [_ctx.ns.m("highlight-current")]: _ctx.highlightCurrent } 52115 ]), 52116 role: "tree" 52117 }, [ 52118 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.root.childNodes, (child) => { 52119 return vue.openBlock(), vue.createBlock(_component_el_tree_node, { 52120 key: _ctx.getNodeKey(child), 52121 node: child, 52122 props: _ctx.props, 52123 accordion: _ctx.accordion, 52124 "render-after-expand": _ctx.renderAfterExpand, 52125 "show-checkbox": _ctx.showCheckbox, 52126 "render-content": _ctx.renderContent, 52127 onNodeExpand: _ctx.handleNodeExpand 52128 }, null, 8, ["node", "props", "accordion", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand"]); 52129 }), 128)), 52130 _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", { 52131 key: 0, 52132 class: vue.normalizeClass(_ctx.ns.e("empty-block")) 52133 }, [ 52134 vue.renderSlot(_ctx.$slots, "empty", {}, () => { 52135 var _a; 52136 return [ 52137 vue.createElementVNode("span", { 52138 class: vue.normalizeClass(_ctx.ns.e("empty-text")) 52139 }, vue.toDisplayString((_a = _ctx.emptyText) != null ? _a : _ctx.t("el.tree.emptyText")), 3) 52140 ]; 52141 }) 52142 ], 2)) : vue.createCommentVNode("v-if", true), 52143 vue.withDirectives(vue.createElementVNode("div", { 52144 ref: "dropIndicator$", 52145 class: vue.normalizeClass(_ctx.ns.e("drop-indicator")) 52146 }, null, 2), [ 52147 [vue.vShow, _ctx.dragState.showDropIndicator] 52148 ]) 52149 ], 2); 52150 } 52151 var Tree = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$1], ["__file", "tree.vue"]]); 52152 52153 Tree.install = (app) => { 52154 app.component(Tree.name, Tree); 52155 }; 52156 const _Tree = Tree; 52157 const ElTree = _Tree; 52158 52159 const useSelect = (props, { attrs }, { 52160 tree, 52161 key 52162 }) => { 52163 const ns = useNamespace("tree-select"); 52164 const result = { 52165 ...pick(vue.toRefs(props), Object.keys(ElSelect.props)), 52166 ...attrs, 52167 valueKey: key, 52168 popperClass: vue.computed(() => { 52169 const classes = [ns.e("popper")]; 52170 if (props.popperClass) 52171 classes.push(props.popperClass); 52172 return classes.join(" "); 52173 }), 52174 filterMethod: (keyword = "") => { 52175 if (props.filterMethod) 52176 props.filterMethod(keyword); 52177 vue.nextTick(() => { 52178 var _a; 52179 (_a = tree.value) == null ? void 0 : _a.filter(keyword); 52180 }); 52181 }, 52182 onVisibleChange: (visible) => { 52183 var _a; 52184 (_a = attrs.onVisibleChange) == null ? void 0 : _a.call(attrs, visible); 52185 if (props.filterable && visible) { 52186 result.filterMethod(); 52187 } 52188 } 52189 }; 52190 return result; 52191 }; 52192 52193 const component = vue.defineComponent({ 52194 extends: ElOption, 52195 setup(props, ctx) { 52196 const result = ElOption.setup(props, ctx); 52197 delete result.selectOptionClick; 52198 const vm = vue.getCurrentInstance().proxy; 52199 vue.nextTick(() => { 52200 if (!result.select.cachedOptions.get(vm.value)) { 52201 result.select.onOptionCreate(vm); 52202 } 52203 }); 52204 return result; 52205 }, 52206 methods: { 52207 selectOptionClick() { 52208 this.$el.parentElement.click(); 52209 } 52210 } 52211 });
52212 var TreeSelectOption = component; 52213 52214 function isValidValue(val) { 52215 return val || val === 0; 52216 } 52217 function isValidArray(val) { 52218 return Array.isArray(val) && val.length; 52219 } 52220 function toValidArray(val) { 52221 return Array.isArray(val) ? val : isValidValue(val) ? [val] : []; 52222 } 52223 function treeFind(treeData, findCallback, getChildren, resultCallback, parent) { 52224 for (let i = 0; i < treeData.length; i++) { 52225 const data = treeData[i]; 52226 if (findCallback(data, i, treeData, parent)) { 52227 return resultCallback ? resultCallback(data, i, treeData, parent) : data; 52228 } else { 52229 const children = getChildren(data); 52230 if (isValidArray(children)) { 52231 const find = treeFind(children, findCallback, getChildren, resultCallback, data); 52232 if (find) 52233 return find; 52234 } 52235 } 52236 } 52237 } 52238 function treeEach(treeData, callback, getChildren, parent) { 52239 for (let i = 0; i < treeData.length; i++) { 52240 const data = treeData[i]; 52241 callback(data, i, treeData, parent); 52242 const children = getChildren(data); 52243 if (isValidArray(children)) { 52244 treeEach(children, callback, getChildren, data); 52245 } 52246 } 52247 } 52248 52249 const useTree$1 = (props, { attrs, slots, emit }, { 52250 select, 52251 tree, 52252 key 52253 }) => { 52254 vue.watch(() => props.modelValue, () => { 52255 if (props.showCheckbox) { 52256 vue.nextTick(() => { 52257 const treeInstance = tree.value; 52258 if (treeInstance && !isEqual$1(treeInstance.getCheckedKeys(), toValidArray(props.modelValue))) { 52259 treeInstance.setCheckedKeys(toValidArray(props.modelValue)); 52260 } 52261 }); 52262 } 52263 }, { 52264 immediate: true, 52265 deep: true 52266 }); 52267 const propsMap = vue.computed(() => ({ 52268 value: key.value, 52269 label: "label", 52270 children: "children", 52271 disabled: "disabled", 52272 isLeaf: "isLeaf", 52273 ...props.props 52274 })); 52275 const getNodeValByProp = (prop, data) => { 52276 var _a; 52277 const propVal = propsMap.value[prop]; 52278 if (isFunction$1(propVal)) { 52279 return propVal(data, (_a = tree.value) == null ? void 0 : _a.getNode(getNodeValByProp("value", data))); 52280 } else { 52281 return data[propVal]; 52282 } 52283 }; 52284 const defaultExpandedParentKeys = toValidArray(props.modelValue).map((value) => { 52285 return treeFind(props.data || [], (data) => getNodeValByProp("value", data) === value, (data) => getNodeValByProp("children", data), (data, index, array, parent) => parent && getNodeValByProp("value", parent)); 52286 }).filter((item) => isValidValue(item)); 52287 const cacheOptions = vue.computed(() => { 52288 if (!props.renderAfterExpand && !props.lazy) 52289 return []; 52290 const options = []; 52291 treeEach(props.data.concat(props.cacheData), (node) => { 52292 const value = getNodeValByProp("value", node); 52293 options.push({ 52294 value, 52295 currentLabel: getNodeValByProp("label", node), 52296 isDisabled: getNodeValByProp("disabled", node) 52297 }); 52298 }, (data) => getNodeValByProp("children", data)); 52299 return options; 52300 }); 52301 const cacheOptionsMap = vue.computed(() => { 52302 return cacheOptions.value.reduce((prev, next) => ({ ...prev, [next.value]: next }), {}); 52303 }); 52304 return { 52305 ...pick(vue.toRefs(props), Object.keys(_Tree.props)), 52306 ...attrs, 52307 nodeKey: key, 52308 expandOnClickNode: vue.computed(() => { 52309 return !props.checkStrictly && props.expandOnClickNode; 52310 }), 52311 defaultExpandedKeys: vue.computed(() => { 52312 return props.defaultExpandedKeys ? props.defaultExpandedKeys.concat(defaultExpandedParentKeys) : defaultExpandedParentKeys; 52313 }), 52314 renderContent: (h, { node, data, store }) => { 52315 return h(TreeSelectOption, { 52316 value: getNodeValByProp("value", data), 52317 label: getNodeValByProp("label", data), 52318 disabled: getNodeValByProp("disabled", data) 52319 }, props.renderContent ? () => props.renderContent(h, { node, data, store }) : slots.default ? () => slots.default({ node, data, store }) : void 0); 52320 }, 52321 filterNodeMethod: (value, data, node) => { 52322 var _a; 52323 if (props.filterNodeMethod) 52324 return props.filterNodeMethod(value, data, node); 52325 if (!value) 52326 return true; 52327 return (_a = getNodeValByProp("label", data)) == null ? void 0 : _a.includes(value); 52328 }, 52329 onNodeClick: (data, node, e) => { 52330 var _a, _b, _c; 52331 (_a = attrs.onNodeClick) == null ? void 0 : _a.call(attrs, data, node, e); 52332 if (props.showCheckbox && props.checkOnClickNode) 52333 return; 52334 if (!props.showCheckbox && (props.checkStrictly || node.isLeaf)) { 52335 if (!getNodeValByProp("disabled", data)) { 52336 const option = (_b = select.value) == null ? void 0 : _b.options.get(getNodeValByProp("value", data)); 52337 (_c = select.value) == null ? void 0 : _c.handleOptionSelect(option, true); 52338 } 52339 } else if (props.expandOnClickNode) { 52340 e.proxy.handleExpandIconClick(); 52341 } 52342 }, 52343 onCheck: (data, params) => { 52344 if (!props.showCheckbox) 52345 return; 52346 const dataValue = getNodeValByProp("value", data); 52347 const uncachedCheckedKeys = params.checkedKeys; 52348 const cachedKeys = props.multiple ? toValidArray(props.modelValue).filter((item) => item in cacheOptionsMap.value && !tree.value.getNode(item) && !uncachedCheckedKeys.includes(item)) : []; 52349 const checkedKeys = uncachedCheckedKeys.concat(cachedKeys); 52350 if (props.checkStrictly) { 52351 emit(UPDATE_MODEL_EVENT, props.multiple ? checkedKeys : checkedKeys.includes(dataValue) ? dataValue : void 0); 52352 } else { 52353 if (props.multiple) { 52354 emit(UPDATE_MODEL_EVENT, tree.value.getCheckedKeys(true)); 52355 } else { 52356 const firstLeaf = treeFind([data], (data2) =>
52356 !isValidArray(getNodeValByProp("children", data2)) && !getNodeValByProp("disabled", data2), (data2) => getNodeValByProp("children", data2)); 52357 const firstLeafKey = firstLeaf ? getNodeValByProp("value", firstLeaf) : void 0; 52358 const hasCheckedChild = isValidValue(props.modelValue) && !!treeFind([data], (data2) => getNodeValByProp("value", data2) === props.modelValue, (data2) => getNodeValByProp("children", data2)); 52359 emit(UPDATE_MODEL_EVENT, firstLeafKey === props.modelValue || hasCheckedChild ? void 0 : firstLeafKey); 52360 } 52361 } 52362 vue.nextTick(() => { 52363 var _a; 52364 const checkedKeys2 = toValidArray(props.modelValue); 52365 tree.value.setCheckedKeys(checkedKeys2); 52366 (_a = attrs.onCheck) == null ? void 0 : _a.call(attrs, data, { 52367 checkedKeys: tree.value.getCheckedKeys(), 52368 checkedNodes: tree.value.getCheckedNodes(), 52369 halfCheckedKeys: tree.value.getHalfCheckedKeys(), 52370 halfCheckedNodes: tree.value.getHalfCheckedNodes() 52371 }); 52372 }); 52373 }, 52374 cacheOptions 52375 }; 52376 }; 52377 52378 var CacheOptions = vue.defineComponent({ 52379 props: { 52380 data: { 52381 type: Array, 52382 default: () => [] 52383 } 52384 }, 52385 setup(props) { 52386 const select = vue.inject(selectKey); 52387 vue.watch(() => props.data, () => { 52388 var _a; 52389 props.data.forEach((item) => { 52390 if (!select.cachedOptions.has(item.value)) { 52391 select.cachedOptions.set(item.value, item); 52392 } 52393 }); 52394 const inputs = ((_a = select.selectWrapper) == null ? void 0 : _a.querySelectorAll("input")) || []; 52395 if (!Array.from(inputs).includes(document.activeElement)) { 52396 select.setSelected(); 52397 } 52398 }, { flush: "post", immediate: true }); 52399 return () => void 0; 52400 } 52401 }); 52402 52403 const _sfc_main$9 = vue.defineComponent({ 52404 name: "ElTreeSelect", 52405 inheritAttrs: false, 52406 props: { 52407 ...ElSelect.props, 52408 ..._Tree.props, 52409 cacheData: { 52410 type: Array, 52411 default: () => [] 52412 } 52413 }, 52414 setup(props, context) { 52415 const { slots, expose } = context; 52416 const select = vue.ref(); 52417 const tree = vue.ref(); 52418 const key = vue.computed(() => props.nodeKey || props.valueKey || "value"); 52419 const selectProps = useSelect(props, context, { select, tree, key }); 52420 const { cacheOptions, ...treeProps } = useTree$1(props, context, { 52421 select, 52422 tree, 52423 key 52424 }); 52425 const methods = vue.reactive({}); 52426 expose(methods); 52427 vue.onMounted(() => { 52428 Object.assign(methods, { 52429 ...pick(tree.value, [ 52430 "filter", 52431 "updateKeyChildren", 52432 "getCheckedNodes", 52433 "setCheckedNodes", 52434 "getCheckedKeys", 52435 "setCheckedKeys", 52436 "setChecked", 52437 "getHalfCheckedNodes", 52438 "getHalfCheckedKeys", 52439 "getCurrentKey", 52440 "getCurrentNode", 52441 "setCurrentKey", 52442 "setCurrentNode", 52443 "getNode", 52444 "remove", 52445 "append", 52446 "insertBefore", 52447 "insertAfter" 52448 ]), 52449 ...pick(select.value, ["focus", "blur"]) 52450 }); 52451 }); 52452 return () => vue.h(ElSelect, vue.reactive({ 52453 ...selectProps, 52454 ref: (ref2) => select.value = ref2 52455 }), { 52456 ...slots, 52457 default: () => [ 52458 vue.h(CacheOptions, { data: cacheOptions.value }), 52459 vue.h(_Tree, vue.reactive({ 52460 ...treeProps, 52461 ref: (ref2) => tree.value = ref2 52462 })) 52463 ] 52464 }); 52465 } 52466 }); 52467 var TreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__file", "tree-select.vue"]]); 52468 52469 TreeSelect.install = (app) => { 52470 app.component(TreeSelect.name, TreeSelect); 52471 }; 52472 const _TreeSelect = TreeSelect; 52473 const ElTreeSelect = _TreeSelect; 52474 52475 const ROOT_TREE_INJECTION_KEY = Symbol(); 52476 const EMPTY_NODE = { 52477 key: -1, 52478 level: -1, 52479 data: {} 52480 }; 52481 var TreeOptionsEnum = /* @__PURE__ */ ((TreeOptionsEnum2) => { 52482 TreeOptionsEnum2["KEY"] = "id"; 52483 TreeOptionsEnum2["LABEL"] = "label"; 52484 TreeOptionsEnum2["CHILDREN"] = "children"; 52485 TreeOptionsEnum2["DISABLED"] = "disabled"; 52486 return TreeOptionsEnum2; 52487 })(TreeOptionsEnum || {}); 52488 var SetOperationEnum = /* @__PURE__ */ ((SetOperationEnum2) => { 52489 SetOperationEnum2["ADD"] = "add"; 52490 SetOperationEnum2["DELETE"] = "delete"; 52491 return SetOperationEnum2; 52492 })(SetOperationEnum || {}); 52493 const itemSize = { 52494 type: Number, 52495 default: 26 52496 }; 52497 const treeProps = buildProps({ 52498 data: { 52499 type: definePropType(Array), 52500 default: () => mutable([]) 52501 }, 52502 emptyText: { 52503 type: String 52504 }, 52505 height: { 52506 type: Number, 52507 default: 200 52508 }, 52509 props: { 52510 type: definePropType(Object), 52511 default: () => mutable({ 52512 children: "children" /* CHILDREN */, 52513 label: "label" /* LABEL */, 52514 disabled: "disabled" /* DISABLED */, 52515 value: "id" /* KEY */ 52516 }) 52517 }, 52518 highlightCurrent: { 52519 type: Boolean, 52520 default: false 52521 }, 52522 showCheckbox: { 52523 type: Boolean, 52524 default: false 52525 }, 52526 defaultCheckedKeys: { 52527 type: definePropType(Array), 52528 default: () => mutable([]) 52529 }, 52530 checkStrictly: { 52531 type: Boolean, 52532 default: false 52533 }, 52534 defaultExpandedKeys: { 52535 type: definePropType(Array), 52536 default: () => mutable([]) 52537 }, 52538 indent: { 52539 type: Number, 52540 default: 16 52541 }, 52542 itemSize, 52543 icon: { 52544 type: iconPropType 52545 }, 52546 expandOnClickNode: { 52547 type: Boolean, 52548 default: true 52549 }, 52550 checkOnClickNode: { 52551 type: Boolean, 52552 default: false 52553 }, 52554 currentNodeKey: { 52555 type: definePropType([String, Number]) 52556 }, 52557 accordion: { 52558 type: Boolean, 52559 default: false 52560 }, 52561 filterMethod: { 52562 type: definePropType(Function) 52563 }, 52564 perfMode: { 52565 type: Boolean, 52566 default: true 52567 } 52568 });
52569 const treeNodeProps = buildProps({ 52570 node: { 52571 type: definePropType(Object), 52572 default: () => mutable(EMPTY_NODE) 52573 }, 52574 expanded: { 52575 type: Boolean, 52576 default: false 52577 }, 52578 checked: { 52579 type: Boolean, 52580 default: false 52581 }, 52582 indeterminate: { 52583 type: Boolean, 52584 default: false 52585 }, 52586 showCheckbox: { 52587 type: Boolean, 52588 default: false 52589 }, 52590 disabled: { 52591 type: Boolean, 52592 default: false 52593 }, 52594 current: { 52595 type: Boolean, 52596 default: false 52597 }, 52598 hiddenExpandIcon: { 52599 type: Boolean, 52600 default: false 52601 }, 52602 itemSize 52603 }); 52604 const treeNodeContentProps = buildProps({ 52605 node: { 52606 type: definePropType(Object), 52607 required: true 52608 } 52609 }); 52610 const NODE_CLICK = "node-click"; 52611 const NODE_EXPAND = "node-expand"; 52612 const NODE_COLLAPSE = "node-collapse"; 52613 const CURRENT_CHANGE = "current-change"; 52614 const NODE_CHECK = "check"; 52615 const NODE_CHECK_CHANGE = "check-change"; 52616 const NODE_CONTEXTMENU = "node-contextmenu"; 52617 const treeEmits = {
52618 [NODE_CLICK]: (data, node, e) => data && node && e, 52619 [NODE_EXPAND]: (data, node) => data && node, 52620 [NODE_COLLAPSE]: (data, node) => data && node, 52621 [CURRENT_CHANGE]: (data, node) => data && node, 52622 [NODE_CHECK]: (data, checkedInfo) => data && checkedInfo, 52623 [NODE_CHECK_CHANGE]: (data, checked) => data && typeof checked === "boolean", 52624 [NODE_CONTEXTMENU]: (event, data, node) => event && data && node 52625 }; 52626 const treeNodeEmits = { 52627 click: (node, e) => !!(node && e), 52628 toggle: (node) => !!node, 52629 check: (node, checked) => node && typeof checked === "boolean" 52630 }; 52631 52632 function useCheck(props, tree) { 52633 const checkedKeys = vue.ref(/* @__PURE__ */ new Set()); 52634 const indeterminateKeys = vue.ref(/* @__PURE__ */ new Set()); 52635 const { emit } = vue.getCurrentInstance(); 52636 vue.watch([() => tree.value, () => props.defaultCheckedKeys], () => { 52637 return vue.nextTick(() => { 52638 _setCheckedKeys(props.defaultCheckedKeys); 52639 }); 52640 }, { 52641 immediate: true 52642 }); 52643 const updateCheckedKeys = () => { 52644 if (!tree.value || !props.showCheckbox || props.checkStrictly) { 52645 return; 52646 } 52647 const { levelTreeNodeMap, maxLevel } = tree.value; 52648 const checkedKeySet = checkedKeys.value; 52649 const indeterminateKeySet = /* @__PURE__ */ new Set(); 52650 for (let level = maxLevel - 1; level >= 1; --level) { 52651 const nodes = levelTreeNodeMap.get(level); 52652 if (!nodes) 52653 continue; 52654 nodes.forEach((node) => { 52655 const children = node.children; 52656 if (children) { 52657 let allChecked = true; 52658 let hasChecked = false; 52659 for (const childNode of children) { 52660 const key = childNode.key; 52661 if (checkedKeySet.has(key)) { 52662 hasChecked = true; 52663 } else if (indeterminateKeySet.has(key)) { 52664 allChecked = false; 52665 hasChecked = true; 52666 break; 52667 } else { 52668 allChecked = false; 52669 } 52670 } 52671 if (allChecked) { 52672 checkedKeySet.add(node.key); 52673 } else if (hasChecked) { 52674 indeterminateKeySet.add(node.key); 52675 checkedKeySet.delete(node.key); 52676 } else { 52677 checkedKeySet.delete(node.key); 52678 indeterminateKeySet.delete(node.key); 52679 } 52680 } 52681 }); 52682 } 52683 indeterminateKeys.value = indeterminateKeySet; 52684 }; 52685 const isChecked = (node) => checkedKeys.value.has(node.key); 52686 const isIndeterminate = (node) => indeterminateKeys.value.has(node.key); 52687 const toggleCheckbox = (node, isChecked2, nodeClick = true) => { 52688 const checkedKeySet = checkedKeys.value; 52689 const toggle = (node2, checked) => { 52690 checkedKeySet[checked ? SetOperationEnum.ADD : SetOperationEnum.DELETE](node2.key); 52691 const children = node2.children; 52692 if (!props.checkStrictly && children) { 52693 children.forEach((childNode) => { 52694 if (!childNode.disabled) { 52695 toggle(childNode, checked); 52696 } 52697 }); 52698 } 52699 }; 52700 toggle(node, isChecked2); 52701 updateCheckedKeys(); 52702 if (nodeClick) { 52703 afterNodeCheck(node, isChecked2); 52704 } 52705 }; 52706 const afterNodeCheck = (node, checked) => { 52707 const { checkedNodes, checkedKeys: checkedKeys2 } = getChecked(); 52708 const { halfCheckedNodes, halfCheckedKeys } = getHalfChecked(); 52709 emit(NODE_CHECK, node.data, { 52710 checkedKeys: checkedKeys2, 52711 checkedNodes, 52712 halfCheckedKeys, 52713 halfCheckedNodes 52714 }); 52715 emit(NODE_CHECK_CHANGE, node.data, checked); 52716 }; 52717 function getCheckedKeys(leafOnly = false) { 52718 return getChecked(leafOnly).checkedKeys; 52719 } 52720 function getCheckedNodes(leafOnly = false) { 52721 return getChecked(leafOnly).checkedNodes; 52722 } 52723 function getHalfCheckedKeys() { 52724 return getHalfChecked().halfCheckedKeys; 52725 } 52726 function getHalfCheckedNodes() { 52727 return getHalfChecked().halfCheckedNodes; 52728 } 52729 function getChecked(leafOnly = false) { 52730 const checkedNodes = [];
52731 const keys = []; 52732 if ((tree == null ? void 0 : tree.value) && props.showCheckbox) { 52733 const { treeNodeMap } = tree.value; 52734 checkedKeys.value.forEach((key) => { 52735 const node = treeNodeMap.get(key); 52736 if (node && (!leafOnly || leafOnly && node.isLeaf)) { 52737 keys.push(key); 52738 checkedNodes.push(node.data); 52739 } 52740 }); 52741 } 52742 return { 52743 checkedKeys: keys, 52744 checkedNodes 52745 }; 52746 } 52747 function getHalfChecked() { 52748 const halfCheckedNodes = []; 52749 const halfCheckedKeys = []; 52750 if ((tree == null ? void 0 : tree.value) && props.showCheckbox) { 52751 const { treeNodeMap } = tree.value; 52752 indeterminateKeys.value.forEach((key) => { 52753 const node = treeNodeMap.get(key); 52754 if (node) { 52755 halfCheckedKeys.push(key); 52756 halfCheckedNodes.push(node.data); 52757 } 52758 }); 52759 } 52760 return { 52761 halfCheckedNodes, 52762 halfCheckedKeys 52763 }; 52764 } 52765 function setCheckedKeys(keys) { 52766 checkedKeys.value.clear(); 52767 indeterminateKeys.value.clear(); 52768 _setCheckedKeys(keys); 52769 } 52770 function setChecked(key, isChecked2) { 52771 if ((tree == null ? void 0 : tree.value) && props.showCheckbox) { 52772 const node = tree.value.treeNodeMap.get(key); 52773 if (node) { 52774 toggleCheckbox(node, isChecked2, false); 52775 } 52776 } 52777 } 52778 function _setCheckedKeys(keys) { 52779 if (tree == null ? void 0 : tree.value) { 52780 const { treeNodeMap } = tree.value; 52781 if (props.showCheckbox && treeNodeMap && keys) { 52782 for (const key of keys) { 52783 const node = treeNodeMap.get(key); 52784 if (node && !isChecked(node)) { 52785 toggleCheckbox(node, true, false); 52786 } 52787 } 52788 } 52789 } 52790 } 52791 return { 52792 updateCheckedKeys, 52793 toggleCheckbox, 52794 isChecked, 52795 isIndeterminate, 52796 getCheckedKeys, 52797 getCheckedNodes, 52798 getHalfCheckedKeys, 52799 getHalfCheckedNodes, 52800 setChecked, 52801 setCheckedKeys 52802 }; 52803 } 52804 52805 function useFilter(props, tree) { 52806 const hiddenNodeKeySet = vue.ref(/* @__PURE__ */ new Set([])); 52807 const hiddenExpandIconKeySet = vue.ref(/* @__PURE__ */ new Set([])); 52808 const filterable = vue.computed(() => { 52809 return isFunction$1(props.filterMethod); 52810 }); 52811 function doFilter(query) { 52812 var _a; 52813 if (!filterable.value) { 52814 return; 52815 } 52816 const expandKeySet = /* @__PURE__ */ new Set(); 52817 const hiddenExpandIconKeys = hiddenExpandIconKeySet.value; 52818 const hiddenKeys = hiddenNodeKeySet.value; 52819 const family = []; 52820 const nodes = ((_a = tree.value) == null ? void 0 : _a.treeNodes) || []; 52821 const filter = props.filterMethod; 52822 hiddenKeys.clear(); 52823 function traverse(nodes2) { 52824 nodes2.forEach((node) => { 52825 family.push(node); 52826 if (filter == null ? void 0 : filter(query, node.data)) { 52827 family.forEach((member) => { 52828 expandKeySet.add(member.key); 52829 }); 52830 } else if (node.isLeaf) { 52831 hiddenKeys.add(node.key); 52832 } 52833 const children = node.children; 52834 if (children) { 52835 traverse(children); 52836 } 52837 if (!node.isLeaf) { 52838 if (!expandKeySet.has(node.key)) { 52839 hiddenKeys.add(node.key); 52840 } else if (children) { 52841 let allHidden = true; 52842 for (const childNode of children) { 52843 if (!hiddenKeys.has(childNode.key)) { 52844 allHidden = false; 52845 break; 52846 } 52847 } 52848 if (allHidden) { 52849 hiddenExpandIconKeys.add(node.key); 52850 } else { 52851 hiddenExpandIconKeys.delete(node.key); 52852 } 52853 } 52854 } 52855 family.pop(); 52856 }); 52857 } 52858 traverse(nodes); 52859 return expandKeySet; 52860 } 52861 function isForceHiddenExpandIcon(node) { 52862 return hiddenExpandIconKeySet.value.has(node.key); 52863 } 52864 return { 52865 hiddenExpandIconKeySet, 52866 hiddenNodeKeySet, 52867 doFilter, 52868 isForceHiddenExpandIcon 52869 }; 52870 } 52871 52872 function useTree(props, emit) {
52873 const expandedKeySet = vue.ref(new Set(props.defaultExpandedKeys)); 52874 const currentKey = vue.ref(); 52875 const tree = vue.shallowRef(); 52876 vue.watch(() => props.currentNodeKey, (key) => { 52877 currentKey.value = key; 52878 }, { 52879 immediate: true 52880 }); 52881 vue.watch(() => props.data, (data) => { 52882 setData(data); 52883 }, { 52884 immediate: true 52885 }); 52886 const { 52887 isIndeterminate, 52888 isChecked, 52889 toggleCheckbox, 52890 getCheckedKeys, 52891 getCheckedNodes, 52892 getHalfCheckedKeys, 52893 getHalfCheckedNodes, 52894 setChecked, 52895 setCheckedKeys 52896 } = useCheck(props, tree); 52897 const { doFilter, hiddenNodeKeySet, isForceHiddenExpandIcon } = useFilter(props, tree); 52898 const valueKey = vue.computed(() => { 52899 var _a; 52900 return ((_a = props.props) == null ? void 0 : _a.value) || TreeOptionsEnum.KEY; 52901 }); 52902 const childrenKey = vue.computed(() => { 52903 var _a; 52904 return ((_a = props.props) == null ? void 0 : _a.children) || TreeOptionsEnum.CHILDREN; 52905 }); 52906 const disabledKey = vue.computed(() => { 52907 var _a; 52908 return ((_a = props.props) == null ? void 0 : _a.disabled) || TreeOptionsEnum.DISABLED; 52909 }); 52910 const labelKey = vue.computed(() => { 52911 var _a; 52912 return ((_a = props.props) == null ? void 0 : _a.label) || TreeOptionsEnum.LABEL; 52913 }); 52914 const flattenTree = vue.computed(() => { 52915 const expandedKeys = expandedKeySet.value; 52916 const hiddenKeys = hiddenNodeKeySet.value; 52917 const flattenNodes = []; 52918 const nodes = tree.value && tree.value.treeNodes || []; 52919 function traverse() { 52920 const stack = []; 52921 for (let i = nodes.length - 1; i >= 0; --i) { 52922 stack.push(nodes[i]); 52923 } 52924 while (stack.length) { 52925 const node = stack.pop(); 52926 if (!node) 52927 continue; 52928 if (!hiddenKeys.has(node.key)) { 52929 flattenNodes.push(node); 52930 } 52931 if (expandedKeys.has(node.key)) { 52932 const children = node.children; 52933 if (children) { 52934 const length = children.length; 52935 for (let i = length - 1; i >= 0; --i) { 52936 stack.push(children[i]); 52937 } 52938 } 52939 } 52940 } 52941 } 52942 traverse(); 52943 return flattenNodes; 52944 }); 52945 const isNotEmpty = vue.computed(() => { 52946 return flattenTree.value.length > 0; 52947 }); 52948 function createTree(data) { 52949 const treeNodeMap = /* @__PURE__ */ new Map(); 52950 const levelTreeNodeMap = /* @__PURE__ */ new Map(); 52951 let maxLevel = 1; 52952 function traverse(nodes, level = 1, parent = void 0) { 52953 var _a; 52954 const siblings = []; 52955 for (const rawNode of nodes) { 52956 const value = getKey(rawNode); 52957 const node = { 52958 level, 52959 key: value, 52960 data: rawNode 52961 }; 52962 node.label = getLabel(rawNode); 52963 node.parent = parent; 52964 const children = getChildren(rawNode); 52965 node.disabled = getDisabled(rawNode); 52966 node.isLeaf = !children || children.length === 0; 52967 if (children && children.length) {
52968 node.children = traverse(children, level + 1, node); 52969 } 52970 siblings.push(node); 52971 treeNodeMap.set(value, node); 52972 if (!levelTreeNodeMap.has(level)) { 52973 levelTreeNodeMap.set(level, []); 52974 } 52975 (_a = levelTreeNodeMap.get(level)) == null ? void 0 : _a.push(node); 52976 } 52977 if (level > maxLevel) { 52978 maxLevel = level; 52979 } 52980 return siblings; 52981 } 52982 const treeNodes = traverse(data); 52983 return { 52984 treeNodeMap, 52985 levelTreeNodeMap, 52986 maxLevel, 52987 treeNodes 52988 }; 52989 } 52990 function filter(query) { 52991 const keys = doFilter(query); 52992 if (keys) { 52993 expandedKeySet.value = keys; 52994 } 52995 } 52996 function getChildren(node) { 52997 return node[childrenKey.value]; 52998 } 52999 function getKey(node) { 53000 if (!node) { 53001 return ""; 53002 } 53003 return node[valueKey.value]; 53004 } 53005 function getDisabled(node) { 53006 return node[disabledKey.value]; 53007 } 53008 function getLabel(node) { 53009 return node[labelKey.value]; 53010 } 53011 function toggleExpand(node) { 53012 const expandedKeys = expandedKeySet.value; 53013 if (expandedKeys.has(node.key)) { 53014 collapseNode(node); 53015 } else { 53016 expandNode(node); 53017 } 53018 } 53019 function setExpandedKeys(keys) { 53020 expandedKeySet.value = new Set(keys); 53021 } 53022 function handleNodeClick(node, e) { 53023 emit(NODE_CLICK, node.data, node, e); 53024 handleCurrentChange(node); 53025 if (props.expandOnClickNode) { 53026 toggleExpand(node); 53027 } 53028 if (props.showCheckbox && props.checkOnClickNode && !node.disabled) { 53029 toggleCheckbox(node, !isChecked(node), true); 53030 } 53031 } 53032 function handleCurrentChange(node) { 53033 if (!isCurrent(node)) { 53034 currentKey.value = node.key; 53035 emit(CURRENT_CHANGE, node.data, node); 53036 } 53037 } 53038 function handleNodeCheck(node, checked) { 53039 toggleCheckbox(node, checked); 53040 } 53041 function expandNode(node) { 53042 const keySet = expandedKeySet.value; 53043 if (tree.value && props.accordion) { 53044 const { treeNodeMap } = tree.value; 53045 keySet.forEach((key) => { 53046 const treeNode = treeNodeMap.get(key); 53047 if (node && node.level === (treeNode == null ? void 0 : treeNode.level)) { 53048 keySet.delete(key); 53049 } 53050 }); 53051 } 53052 keySet.add(node.key); 53053 emit(NODE_EXPAND, node.data, node); 53054 } 53055 function collapseNode(node) { 53056 expandedKeySet.value.delete(node.key); 53057 emit(NODE_COLLAPSE, node.data, node); 53058 } 53059 function isExpanded(node) { 53060 return expandedKeySet.value.has(node.key); 53061 } 53062 function isDisabled(node) { 53063 return !!node.disabled; 53064 } 53065 function isCurrent(node) { 53066 const current = currentKey.value; 53067 return !!current && current === node.key; 53068 } 53069 function getCurrentNode() { 53070 var _a, _b; 53071 if (!currentKey.value) 53072 return void 0; 53073 return (_b = (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(currentKey.value)) == null ? void 0 : _b.data; 53074 } 53075 function getCurrentKey() { 53076 return currentKey.value; 53077 } 53078 function setCurrentKey(key) { 53079 currentKey.value = key; 53080 } 53081 function setData(data) { 53082 vue.nextTick(() => tree.value = createTree(data)); 53083 } 53084 function getNode(data) { 53085 var _a; 53086 const key = isObject$1(data) ? getKey(data) : data; 53087 return (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(key); 53088 } 53089 return { 53090 tree, 53091 flattenTree, 53092 isNotEmpty, 53093 getKey, 53094 getChildren, 53095 toggleExpand, 53096 toggleCheckbox, 53097 isExpanded, 53098 isChecked, 53099 isIndeterminate, 53100 isDisabled, 53101 isCurrent, 53102 isForceHiddenExpandIcon, 53103 handleNodeClick, 53104 handleNodeCheck, 53105 getCurrentNode, 53106 getCurrentKey, 53107 setCurrentKey, 53108 getCheckedKeys, 53109 getCheckedNodes, 53110 getHalfCheckedKeys, 53111 getHalfCheckedNodes, 53112 setChecked, 53113 setCheckedKeys, 53114 filter, 53115 setData, 53116 getNode, 53117 expandNode, 53118 collapseNode, 53119 setExpandedKeys 53120 }; 53121 } 53122 53123 var ElNodeContent = vue.defineComponent({ 53124 name: "ElTreeNodeContent", 53125 props: treeNodeContentProps, 53126 setup(props) { 53127 const tree = vue.inject(ROOT_TREE_INJECTION_KEY); 53128 const ns = useNamespace("tree"); 53129 return () => { 53130 const node = props.node; 53131 const { data } = node; 53132 return (tree == null ? void 0 : tree.ctx.slots.default) ? tree.ctx.slots.default({ node, data }) : vue.h("span", { class: ns.be("node", "label") }, [node == null ? void 0 : node.label]); 53133 }; 53134 } 53135 });
53136 53137 const _hoisted_1$6 = ["aria-expanded", "aria-disabled", "aria-checked", "data-key", "onClick"]; 53138 const __default__$7 = vue.defineComponent({ 53139 name: "ElTreeNode" 53140 }); 53141 const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({ 53142 ...__default__$7, 53143 props: treeNodeProps, 53144 emits: treeNodeEmits, 53145 setup(__props, { emit }) { 53146 const props = __props; 53147 const tree = vue.inject(ROOT_TREE_INJECTION_KEY); 53148 const ns = useNamespace("tree"); 53149 const indent = vue.computed(() => { 53150 var _a; 53151 return (_a = tree == null ? void 0 : tree.props.indent) != null ? _a : 16; 53152 }); 53153 const icon = vue.computed(() => { 53154 var _a; 53155 return (_a = tree == null ? void 0 : tree.props.icon) != null ? _a : caret_right_default; 53156 }); 53157 const handleClick = (e) => { 53158 emit("click", props.node, e); 53159 }; 53160 const handleExpandIconClick = () => { 53161 emit("toggle", props.node); 53162 }; 53163 const handleCheckChange = (value) => { 53164 emit("check", props.node, value); 53165 }; 53166 const handleContextMenu = (event) => { 53167 var _a, _b, _c, _d; 53168 if ((_c = (_b = (_a = tree == null ? void 0 : tree.instance) == null ? void 0 : _a.vnode) == null ? void 0 : _b.props) == null ? void 0 : _c["onNodeContextmenu"]) { 53169 event.stopPropagation(); 53170 event.preventDefault(); 53171 } 53172 tree == null ? void 0 : tree.ctx.emit(NODE_CONTEXTMENU, event, (_d = props.node) == null ? void 0 : _d.data, props.node); 53173 }; 53174 return (_ctx, _cache) => { 53175 var _a, _b, _c; 53176 return vue.openBlock(), vue.createElementBlock("div", { 53177 ref: "node$", 53178 class: vue.normalizeClass([ 53179 vue.unref(ns).b("node"), 53180 vue.unref(ns).is("expanded", _ctx.expanded), 53181 vue.unref(ns).is("current", _ctx.current), 53182 vue.unref(ns).is("focusable", !_ctx.disabled), 53183 vue.unref(ns).is("checked", !_ctx.disabled && _ctx.checked) 53184 ]), 53185 role: "treeitem", 53186 tabindex: "-1", 53187 "aria-expanded": _ctx.expanded, 53188 "aria-disabled": _ctx.disabled, 53189 "aria-checked": _ctx.checked, 53190 "data-key": (_a = _ctx.node) == null ? void 0 : _a.key, 53191 onClick: vue.withModifiers(handleClick, ["stop"]), 53192 onContextmenu: handleContextMenu 53193 }, [ 53194 vue.createElementVNode("div", { 53195 class: vue.normalizeClass(vue.unref(ns).be("node", "content")), 53196 style: vue.normalizeStyle({ 53197 paddingLeft: `${(_ctx.node.level - 1) * vue.unref(indent)}px`, 53198 height: _ctx.itemSize + "px" 53199 }) 53200 }, [ 53201 vue.unref(icon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 53202 key: 0, 53203 class: vue.normalizeClass([ 53204 vue.unref(ns).is("leaf", !!((_b = _ctx.node) == null ? void 0 : _b.isLeaf)), 53205 vue.unref(ns).is("hidden", _ctx.hiddenExpandIcon), 53206 { 53207 expanded: !((_c = _ctx.node) == null ? void 0 : _c.isLeaf) && _ctx.expanded 53208 }, 53209 vue.unref(ns).be("node", "expand-icon") 53210 ]), 53211 onClick: vue.withModifiers(handleExpandIconClick, ["stop"]) 53212 }, { 53213 default: vue.withCtx(() => [ 53214 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(icon)))) 53215 ]), 53216 _: 1 53217 }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true), 53218 _ctx.showCheckbox ? (vue.openBlock(), vue.createBlock(vue.unref(ElCheckbox), { 53219 key: 1, 53220 "model-value": _ctx.checked, 53221 indeterminate: _ctx.indeterminate, 53222 disabled: _ctx.disabled, 53223 onChange: handleCheckChange, 53224 onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => { 53225 }, ["stop"])) 53226 }, null, 8, ["model-value", "indeterminate", "disabled"])) : vue.createCommentVNode("v-if", true), 53227 vue.createVNode(vue.unref(ElNodeContent), { node: _ctx.node }, null, 8, ["node"])
53228 ], 6) 53229 ], 42, _hoisted_1$6); 53230 }; 53231 } 53232 }); 53233 var ElTreeNode = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__file", "tree-node.vue"]]); 53234 53235 const __default__$6 = vue.defineComponent({ 53236 name: "ElTreeV2" 53237 }); 53238 const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({ 53239 ...__default__$6, 53240 props: treeProps, 53241 emits: treeEmits, 53242 setup(__props, { expose, emit }) { 53243 const props = __props; 53244 const slots = vue.useSlots(); 53245 const treeNodeSize = vue.computed(() => props.itemSize); 53246 vue.provide(ROOT_TREE_INJECTION_KEY, { 53247 ctx: { 53248 emit, 53249 slots 53250 }, 53251 props, 53252 instance: vue.getCurrentInstance() 53253 }); 53254 vue.provide(formItemContextKey, void 0); 53255 const { t } = useLocale(); 53256 const ns = useNamespace("tree"); 53257 const { 53258 flattenTree, 53259 isNotEmpty, 53260 toggleExpand, 53261 isExpanded, 53262 isIndeterminate, 53263 isChecked, 53264 isDisabled, 53265 isCurrent, 53266 isForceHiddenExpandIcon, 53267 handleNodeClick, 53268 handleNodeCheck, 53269 toggleCheckbox, 53270 getCurrentNode, 53271 getCurrentKey, 53272 setCurrentKey, 53273 getCheckedKeys, 53274 getCheckedNodes, 53275 getHalfCheckedKeys, 53276 getHalfCheckedNodes, 53277 setChecked, 53278 setCheckedKeys, 53279 filter, 53280 setData, 53281 getNode, 53282 expandNode, 53283 collapseNode, 53284 setExpandedKeys 53285 } = useTree(props, emit); 53286 expose({ 53287 toggleCheckbox, 53288 getCurrentNode, 53289 getCurrentKey, 53290 setCurrentKey, 53291 getCheckedKeys, 53292 getCheckedNodes, 53293 getHalfCheckedKeys, 53294 getHalfCheckedNodes, 53295 setChecked, 53296 setCheckedKeys, 53297 filter, 53298 setData, 53299 getNode, 53300 expandNode, 53301 collapseNode, 53302 setExpandedKeys 53303 }); 53304 return (_ctx, _cache) => { 53305 var _a; 53306 return vue.openBlock(), vue.createElementBlock("div", { 53307 class: vue.normalizeClass([vue.unref(ns).b(), { [vue.unref(ns).m("highlight-current")]: _ctx.highlightCurrent }]), 53308 role: "tree" 53309 }, [ 53310 vue.unref(isNotEmpty) ? (vue.openBlock(), vue.createBlock(vue.unref(FixedSizeList$1), { 53311 key: 0, 53312 "class-name": vue.unref(ns).b("virtual-list"), 53313 data: vue.unref(flattenTree), 53314 total: vue.unref(flattenTree).length, 53315 height: _ctx.height, 53316 "item-size": vue.unref(treeNodeSize), 53317 "perf-mode": _ctx.perfMode 53318 }, { 53319 default: vue.withCtx(({ data, index, style }) => [ 53320 (vue.openBlock(), vue.createBlock(ElTreeNode, { 53321 key: data[index].key, 53322 style: vue.normalizeStyle(style), 53323 node: data[index], 53324 expanded: vue.unref(isExpanded)(data[index]), 53325 "show-checkbox": _ctx.showCheckbox, 53326 checked: vue.unref(isChecked)(data[index]), 53327 indeterminate: vue.unref(isIndeterminate)(data[index]), 53328 "item-size": vue.unref(treeNodeSize), 53329 disabled: vue.unref(isDisabled)(data[index]), 53330 current: vue.unref(isCurrent)(data[index]), 53331 "hidden-expand-icon": vue.unref(isForceHiddenExpandIcon)(data[index]), 53332 onClick: vue.unref(handleNodeClick), 53333 onToggle: vue.unref(toggleExpand), 53334 onCheck: vue.unref(handleNodeCheck) 53335 }, null, 8, ["style", "node", "expanded", "show-checkbox", "checked", "indeterminate", "item-size", "disabled", "current", "hidden-expand-icon", "onClick", "onToggle", "onCheck"])) 53336 ]), 53337 _: 1 53338 }, 8, ["class-name", "data", "total", "height", "item-size", "perf-mode"])) : (vue.openBlock(), vue.createElementBlock("div", { 53339 key: 1, 53340 class: vue.normalizeClass(vue.unref(ns).e("empty-block")) 53341 }, [ 53342 vue.createElementVNode("span", { 53343 class: vue.normalizeClass(vue.unref(ns).e("empty-text")) 53344 }, vue.toDisplayString((_a = _ctx.emptyText) != null ? _a : vue.unref(t)("el.tree.emptyText")), 3) 53345 ], 2)) 53346 ], 2); 53347 }; 53348 } 53349 });
53350 var TreeV2 = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__file", "tree.vue"]]); 53351 53352 const ElTreeV2 = withInstall(TreeV2); 53353 53354 const uploadContextKey = Symbol("uploadContextKey"); 53355 53356 const SCOPE$2 = "ElUpload"; 53357 class UploadAjaxError extends Error { 53358 constructor(message, status, method, url) { 53359 super(message); 53360 this.name = "UploadAjaxError"; 53361 this.status = status; 53362 this.method = method; 53363 this.url = url; 53364 } 53365 } 53366 function getError(action, option, xhr) { 53367 let msg; 53368 if (xhr.response) { 53369 msg = `${xhr.response.error || xhr.response}`; 53370 } else if (xhr.responseText) { 53371 msg = `${xhr.responseText}`; 53372 } else { 53373 msg = `fail to ${option.method} ${action} ${xhr.status}`; 53374 } 53375 return new UploadAjaxError(msg, xhr.status, option.method, action); 53376 } 53377 function getBody(xhr) { 53378 const text = xhr.responseText || xhr.response; 53379 if (!text) { 53380 return text; 53381 } 53382 try { 53383 return JSON.parse(text); 53384 } catch (e) { 53385 return text; 53386 } 53387 } 53388 const ajaxUpload = (option) => { 53389 if (typeof XMLHttpRequest === "undefined") 53390 throwError(SCOPE$2, "XMLHttpRequest is undefined"); 53391 const xhr = new XMLHttpRequest(); 53392 const action = option.action; 53393 if (xhr.upload) { 53394 xhr.upload.addEventListener("progress", (evt) => { 53395 const progressEvt = evt; 53396 progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0; 53397 option.onProgress(progressEvt); 53398 }); 53399 } 53400 const formData = new FormData(); 53401 if (option.data) { 53402 for (const [key, value] of Object.entries(option.data)) { 53403 if (Array.isArray(value)) 53404 formData.append(key, ...value); 53405 else 53406 formData.append(key, value); 53407 } 53408 } 53409 formData.append(option.filename, option.file, option.file.name); 53410 xhr.addEventListener("error", () => { 53411 option.onError(getError(action, option, xhr)); 53412 }); 53413 xhr.addEventListener("load", () => { 53414 if (xhr.status < 200 || xhr.status >= 300) { 53415 return option.onError(getError(action, option, xhr)); 53416 } 53417 option.onSuccess(getBody(xhr)); 53418 }); 53419 xhr.open(option.method, action, true); 53420 if (option.withCredentials && "withCredentials" in xhr) { 53421 xhr.withCredentials = true; 53422 } 53423 const headers = option.headers || {}; 53424 if (headers instanceof Headers) { 53425 headers.forEach((value, key) => xhr.setRequestHeader(key, value)); 53426 } else { 53427 for (const [key, value] of Object.entries(headers)) { 53428 if (isNil(value)) 53429 continue; 53430 xhr.setRequestHeader(key, String(value)); 53431 } 53432 } 53433 xhr.send(formData); 53434 return xhr; 53435 }; 53436 53437 const uploadListTypes = ["text", "picture", "picture-card"]; 53438 let fileId = 1; 53439 const genFileId = () => Date.now() + fileId++; 53440 const uploadBaseProps = buildProps({ 53441 action: { 53442 type: String, 53443 default: "#" 53444 }, 53445 headers: { 53446 type: definePropType(Object) 53447 }, 53448 method: { 53449 type: String, 53450 default: "post" 53451 }, 53452 data: { 53453 type: Object, 53454 default: () => mutable({}) 53455 }, 53456 multiple: { 53457 type: Boolean, 53458 default: false 53459 }, 53460 name: { 53461 type: String, 53462 default: "file" 53463 }, 53464 drag: { 53465 type: Boolean, 53466 default: false 53467 }, 53468 withCredentials: Boolean, 53469 showFileList: { 53470 type: Boolean, 53471 default: true 53472 }, 53473 accept: { 53474 type: String, 53475 default: "" 53476 }, 53477 type: { 53478 type: String, 53479 default: "select" 53480 }, 53481 fileList: { 53482 type: definePropType(Array), 53483 default: () => mutable([]) 53484 }, 53485 autoUpload: { 53486 type: Boolean, 53487 default: true 53488 }, 53489 listType: { 53490 type: String, 53491 values: uploadListTypes, 53492 default: "text" 53493 }, 53494 httpRequest: { 53495 type: definePropType(Function), 53496 default: ajaxUpload 53497 }, 53498 disabled: Boolean, 53499 limit: Number 53500 });
53501 const uploadProps = buildProps({ 53502 ...uploadBaseProps, 53503 beforeUpload: { 53504 type: definePropType(Function), 53505 default: NOOP 53506 }, 53507 beforeRemove: { 53508 type: definePropType(Function) 53509 }, 53510 onRemove: { 53511 type: definePropType(Function), 53512 default: NOOP 53513 }, 53514 onChange: { 53515 type: definePropType(Function), 53516 default: NOOP 53517 }, 53518 onPreview: { 53519 type: definePropType(Function), 53520 default: NOOP 53521 }, 53522 onSuccess: { 53523 type: definePropType(Function), 53524 default: NOOP 53525 }, 53526 onProgress: { 53527 type: definePropType(Function), 53528 default: NOOP 53529 }, 53530 onError: { 53531 type: definePropType(Function), 53532 default: NOOP 53533 }, 53534 onExceed: { 53535 type: definePropType(Function), 53536 default: NOOP 53537 } 53538 }); 53539 53540 const uploadListProps = buildProps({ 53541 files: { 53542 type: definePropType(Array), 53543 default: () => mutable([]) 53544 }, 53545 disabled: { 53546 type: Boolean, 53547 default: false 53548 }, 53549 handlePreview: { 53550 type: definePropType(Function), 53551 default: NOOP 53552 }, 53553 listType: { 53554 type: String, 53555 values: uploadListTypes, 53556 default: "text" 53557 } 53558 }); 53559 const uploadListEmits = { 53560 remove: (file) => !!file 53561 }; 53562 53563 const _hoisted_1$5 = ["onKeydown"]; 53564 const _hoisted_2$4 = ["src"]; 53565 const _hoisted_3$2 = ["onClick"]; 53566 const _hoisted_4$1 = ["onClick"]; 53567 const _hoisted_5 = ["onClick"]; 53568 const __default__$5 = vue.defineComponent({ 53569 name: "ElUploadList" 53570 }); 53571 const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({ 53572 ...__default__$5, 53573 props: uploadListProps, 53574 emits: uploadListEmits, 53575 setup(__props, { emit }) { 53576 const { t } = useLocale(); 53577 const nsUpload = useNamespace("upload"); 53578 const nsIcon = useNamespace("icon"); 53579 const nsList = useNamespace("list"); 53580 const disabled = useFormDisabled(); 53581 const focusing = vue.ref(false); 53582 const handleRemove = (file) => { 53583 emit("remove", file); 53584 }; 53585 return (_ctx, _cache) => { 53586 return vue.openBlock(), vue.createBlock(vue.TransitionGroup, { 53587 tag: "ul", 53588 class: vue.normalizeClass([ 53589 vue.unref(nsUpload).b("list"), 53590 vue.unref(nsUpload).bm("list", _ctx.listType), 53591 vue.unref(nsUpload).is("disabled", vue.unref(disabled)) 53592 ]), 53593 name: vue.unref(nsList).b() 53594 }, { 53595 default: vue.withCtx(() => [ 53596 (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.files, (file) => { 53597 return vue.openBlock(), vue.createElementBlock("li", { 53598 key: file.uid || file.name, 53599 class: vue.normalizeClass([ 53600 vue.unref(nsUpload).be("list", "item"), 53601 vue.unref(nsUpload).is(file.status), 53602 { focusing: focusing.value } 53603 ]), 53604 tabindex: "0", 53605 onKeydown: vue.withKeys(($event) => !vue.unref(disabled) && handleRemove(file), ["delete"]), 53606 onFocus: _cache[0] || (_cache[0] = ($event) => focusing.value = true), 53607 onBlur: _cache[1] || (_cache[1] = ($event) => focusing.value = false), 53608 onClick: _cache[2] || (_cache[2] = ($event) => focusing.value = false) 53609 }, [ 53610 vue.renderSlot(_ctx.$slots, "default", { file }, () => [ 53611 _ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock("img", { 53612 key: 0, 53613 class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-thumbnail")), 53614 src: file.url, 53615 alt: "" 53616 }, null, 10, _hoisted_2$4)) : vue.createCommentVNode("v-if", true), 53617 file.status === "uploading" || _ctx.listType !== "picture-card" ? (vue.openBlock(), vue.createElementBlock("div", { 53618 key: 1, 53619 class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-info")) 53620 }, [ 53621 vue.createElementVNode("a", { 53622 class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-name")), 53623 onClick: vue.withModifiers(($event) => _ctx.handlePreview(file), ["prevent"]) 53624 }, [ 53625 vue.createVNode(vue.unref(ElIcon), { 53626 class: vue.normalizeClass(vue.unref(nsIcon).m("document")) 53627 }, { 53628 default: vue.withCtx(() => [ 53629 vue.createVNode(vue.unref(document_default)) 53630 ]), 53631 _: 1 53632 }, 8, ["class"]), 53633 vue.createElementVNode("span", { 53634 class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-file-name")) 53635 }, vue.toDisplayString(file.name), 3) 53636 ], 10, _hoisted_3$2), 53637 file.status === "uploading" ? (vue.openBlock(), vue.createBlock(vue.unref(ElProgress), { 53638 key: 0, 53639 type: _ctx.listType === "picture-card" ? "circle" : "line", 53640 "stroke-width": _ctx.listType === "picture-card" ? 6 : 2, 53641 percentage: Number(file.percentage), 53642 style: vue.normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem") 53643 }, null, 8, ["type", "stroke-width", "percentage", "style"])) : vue.createCommentVNode("v-if", true) 53644 ], 2)) : vue.createCommentVNode("v-if", true), 53645 vue.createElementVNode("label", { 53646 class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-status-label")) 53647 }, [ 53648 _ctx.listType === "text" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 53649 key: 0, 53650 class: vue.normalizeClass([vue.unref(nsIcon).m("upload-success"), vue.unref(nsIcon).m("circle-check")]) 53651 }, { 53652 default: vue.withCtx(() => [ 53653 vue.createVNode(vue.unref(circle_check_default)) 53654 ]), 53655 _: 1 53656 }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 53657 key: 1, 53658 class: vue.normalizeClass([vue.unref(nsIcon).m("upload-success"), vue.unref(nsIcon).m("check")]) 53659 }, { 53660 default: vue.withCtx(() => [ 53661 vue.createVNode(vue.unref(check_default)) 53662 ]), 53663 _: 1 53664 }, 8, ["class"])) : vue.createCommentVNode("v-if", true) 53665 ], 2), 53666 !vue.unref(disabled) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 53667 key: 2, 53668 class: vue.normalizeClass(vue.unref(nsIcon).m("close")), 53669 onClick: ($event) => handleRemove(file) 53670 }, { 53671 default: vue.withCtx(() => [ 53672 vue.createVNode(vue.unref(close_default)) 53673 ]), 53674 _: 2 53675 }, 1032, ["class", "onClick"])) : vue.createCommentVNode("v-if", true), 53676 vue.createCommentVNode(" Due to close btn only appears when li gets focu
53676sed disappears after li gets blurred, thus keyboard navigation can never reach close btn"), 53677 vue.createCommentVNode(" This is a bug which needs to be fixed "), 53678 vue.createCommentVNode(" TODO: Fix the incorrect navigation interaction "), 53679 !vue.unref(disabled) ? (vue.openBlock(), vue.createElementBlock("i", { 53680 key: 3, 53681 class: vue.normalizeClass(vue.unref(nsIcon).m("close-tip")) 53682 }, vue.toDisplayString(vue.unref(t)("el.upload.deleteTip")), 3)) : vue.createCommentVNode("v-if", true), 53683 _ctx.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock("span", { 53684 key: 4, 53685 class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-actions")) 53686 }, [ 53687 vue.createElementVNode("span", { 53688 class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-preview")), 53689 onClick: ($event) => _ctx.handlePreview(file) 53690 }, [ 53691 vue.createVNode(vue.unref(ElIcon), { 53692 class: vue.normalizeClass(vue.unref(nsIcon).m("zoom-in")) 53693 }, { 53694 default: vue.withCtx(() => [ 53695 vue.createVNode(vue.unref(zoom_in_default)) 53696 ]), 53697 _: 1 53698 }, 8, ["class"]) 53699 ], 10, _hoisted_4$1), 53700 !vue.unref(disabled) ? (vue.openBlock(), vue.createElementBlock("span", { 53701 key: 0, 53702 class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-delete")), 53703 onClick: ($event) => handleRemove(file) 53704 }, [ 53705 vue.createVNode(vue.unref(ElIcon), { 53706 class: vue.normalizeClass(vue.unref(nsIcon).m("delete")) 53707 }, { 53708 default: vue.withCtx(() => [ 53709 vue.createVNode(vue.unref(delete_default)) 53710 ]), 53711 _: 1 53712 }, 8, ["class"]) 53713 ], 10, _hoisted_5)) : vue.createCommentVNode("v-if", true) 53714 ], 2)) : vue.createCommentVNode("v-if", true) 53715 ]) 53716 ], 42, _hoisted_1$5); 53717 }), 128)), 53718 vue.renderSlot(_ctx.$slots, "append") 53719 ]), 53720 _: 3 53721 }, 8, ["class", "name"]); 53722 }; 53723 } 53724 }); 53725 var UploadList = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "upload-list.vue"]]); 53726 53727 const uploadDraggerProps = buildProps({ 53728 disabled: { 53729 type: Boolean, 53730 default: false 53731 } 53732 }); 53733 const uploadDraggerEmits = { 53734 file: (file) => isArray$1(file) 53735 }; 53736 53737 const _hoisted_1$4 = ["onDrop", "onDragover"]; 53738 const COMPONENT_NAME = "ElUploadDrag"; 53739 const __default__$4 = vue.defineComponent({ 53740 name: COMPONENT_NAME 53741 }); 53742 const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({ 53743 ...__default__$4, 53744 props: uploadDraggerProps, 53745 emits: uploadDraggerEmits, 53746 setup(__props, { emit }) { 53747 const uploaderContext = vue.inject(uploadContextKey); 53748 if (!uploaderContext) { 53749 throwError(COMPONENT_NAME, "usage: <el-upload><el-upload-dragger /></el-upload>"); 53750 } 53751 const ns = useNamespace("upload"); 53752 const dragover = vue.ref(false); 53753 const disabled = useFormDisabled(); 53754 const onDrop = (e) => { 53755 if (disabled.value) 53756 return; 53757 dragover.value = false; 53758 e.stopPropagation(); 53759 const files = Array.from(e.dataTransfer.files); 53760 const accept = uploaderContext.accept.value; 53761 if (!accept) { 53762 emit("file", files); 53763 return; 53764 } 53765 const filesFiltered = files.filter((file) => { 53766 const { type, name } = file; 53767 const extension = name.includes(".") ? `.${name.split(".").pop()}` : ""; 53768 const baseType = type.replace(/\/.*$/, ""); 53769 return accept.split(",").map((type2) => type2.trim()).filter((type2) => type2).some((acceptedType) => { 53770 if (acceptedType.startsWith(".")) { 53771 return extension === acceptedType; 53772 } 53773 if (/\/\*$/.test(acceptedType)) { 53774 return baseType === acceptedType.replace(/\/\*$/, ""); 53775 } 53776 if (/^[^/]+\/[^/]+$/.test(acceptedType)) { 53777 return type === acceptedType; 53778 } 53779 return false; 53780 }); 53781 }); 53782 emit("file", filesFiltered); 53783 }; 53784 const onDragover = () => { 53785 if (!disabled.value) 53786 dragover.value = true; 53787 }; 53788 return (_ctx, _cache) => {
53789 return vue.openBlock(), vue.createElementBlock("div", { 53790 class: vue.normalizeClass([vue.unref(ns).b("dragger"), vue.unref(ns).is("dragover", dragover.value)]), 53791 onDrop: vue.withModifiers(onDrop, ["prevent"]), 53792 onDragover: vue.withModifiers(onDragover, ["prevent"]), 53793 onDragleave: _cache[0] || (_cache[0] = vue.withModifiers(($event) => dragover.value = false, ["prevent"])) 53794 }, [ 53795 vue.renderSlot(_ctx.$slots, "default") 53796 ], 42, _hoisted_1$4); 53797 }; 53798 } 53799 }); 53800 var UploadDragger = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "upload-dragger.vue"]]); 53801 53802 const uploadContentProps = buildProps({ 53803 ...uploadBaseProps, 53804 beforeUpload: { 53805 type: definePropType(Function), 53806 default: NOOP 53807 }, 53808 onRemove: { 53809 type: definePropType(Function), 53810 default: NOOP 53811 }, 53812 onStart: { 53813 type: definePropType(Function), 53814 default: NOOP 53815 }, 53816 onSuccess: { 53817 type: definePropType(Function), 53818 default: NOOP 53819 }, 53820 onProgress: { 53821 type: definePropType(Function), 53822 default: NOOP 53823 }, 53824 onError: { 53825 type: definePropType(Function), 53826 default: NOOP 53827 }, 53828 onExceed: { 53829 type: definePropType(Function), 53830 default: NOOP 53831 } 53832 }); 53833 53834 const _hoisted_1$3 = ["onKeydown"]; 53835 const _hoisted_2$3 = ["name", "multiple", "accept"]; 53836 const __default__$3 = vue.defineComponent({ 53837 name: "ElUploadContent", 53838 inheritAttrs: false 53839 }); 53840 const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({ 53841 ...__default__$3, 53842 props: uploadContentProps, 53843 setup(__props, { expose }) { 53844 const props = __props; 53845 const ns = useNamespace("upload"); 53846 const disabled = useFormDisabled(); 53847 const requests = vue.shallowRef({}); 53848 const inputRef = vue.shallowRef(); 53849 const uploadFiles = (files) => { 53850 if (files.length === 0) 53851 return; 53852 const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props; 53853 if (limit && fileList.length + files.length > limit) { 53854 onExceed(files, fileList); 53855 return; 53856 } 53857 if (!multiple) { 53858 files = files.slice(0, 1); 53859 } 53860 for (const file of files) { 53861 const rawFile = file; 53862 rawFile.uid = genFileId(); 53863 onStart(rawFile); 53864 if (autoUpload) 53865 upload(rawFile); 53866 } 53867 }; 53868 const upload = async (rawFile) => { 53869 inputRef.value.value = ""; 53870 if (!props.beforeUpload) { 53871 return doUpload(rawFile); 53872 } 53873 let hookResult; 53874 let beforeData = {}; 53875 try { 53876 const originData = props.data; 53877 const beforeUploadPromise = props.beforeUpload(rawFile); 53878 beforeData = isObject$1(props.data) ? cloneDeep(props.data) : props.data; 53879 hookResult = await beforeUploadPromise; 53880 if (isObject$1(props.data) && isEqual$1(originData, beforeData)) { 53881 beforeData = cloneDeep(props.data); 53882 } 53883 } catch (e) { 53884 hookResult = false; 53885 } 53886 if (hookResult === false) { 53887 props.onRemove(rawFile); 53888 return; 53889 } 53890 let file = rawFile; 53891 if (hookResult instanceof Blob) { 53892 if (hookResult instanceof File) { 53893 file = hookResult; 53894 } else { 53895 file = new File([hookResult], rawFile.name, { 53896 type: rawFile.type 53897 }); 53898 } 53899 } 53900 doUpload(Object.assign(file, { 53901 uid: rawFile.uid 53902 }), beforeData); 53903 }; 53904 const doUpload = (rawFile, beforeData) => { 53905 const { 53906 headers, 53907 data, 53908 method, 53909 withCredentials, 53910 name: filename, 53911 action, 53912 onProgress, 53913 onSuccess, 53914 onError, 53915 httpRequest 53916 } = props; 53917 const { uid } = rawFile; 53918 const options = { 53919 headers: headers || {}, 53920 withCredentials, 53921 file: rawFile, 53922 data: beforeData != null ? beforeData : data, 53923 method, 53924 filename, 53925 action, 53926 onProgress: (evt) => { 53927 onProgress(evt, rawFile); 53928 }, 53929 onSuccess: (res) => { 53930 onSuccess(res, rawFile); 53931 delete requests.value[uid]; 53932 }, 53933 onError: (err) => { 53934 onError(err, rawFile); 53935 delete requests.value[uid]; 53936 } 53937 }; 53938 const request = httpRequest(options); 53939 requests.value[uid] = request; 53940 if (request instanceof Promise) { 53941 request.then(options.onSuccess, options.onError); 53942 } 53943 }; 53944 const handleChange = (e) => { 53945 const files = e.target.files; 53946 if (!files) 53947 return; 53948 uploadFiles(Array.from(files)); 53949 }; 53950 const handleClick = () => { 53951 if (!disabled.value) { 53952 inputRef.value.value = ""; 53953 inputRef.value.click(); 53954 } 53955 }; 53956 const handleKeydown = () => { 53957 handleClick(); 53958 }; 53959 const abort = (file) => { 53960 const _reqs = entriesOf(requests.value).filter(file ? ([uid]) => String(file.uid) === uid : () => true);
53961 _reqs.forEach(([uid, req]) => { 53962 if (req instanceof XMLHttpRequest) 53963 req.abort(); 53964 delete requests.value[uid]; 53965 }); 53966 }; 53967 expose({ 53968 abort, 53969 upload 53970 }); 53971 return (_ctx, _cache) => { 53972 return vue.openBlock(), vue.createElementBlock("div", { 53973 class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.listType), vue.unref(ns).is("drag", _ctx.drag)]), 53974 tabindex: "0", 53975 onClick: handleClick, 53976 onKeydown: vue.withKeys(vue.withModifiers(handleKeydown, ["self"]), ["enter", "space"]) 53977 }, [ 53978 _ctx.drag ? (vue.openBlock(), vue.createBlock(UploadDragger, { 53979 key: 0, 53980 disabled: vue.unref(disabled), 53981 onFile: uploadFiles 53982 }, { 53983 default: vue.withCtx(() => [ 53984 vue.renderSlot(_ctx.$slots, "default") 53985 ]), 53986 _: 3 53987 }, 8, ["disabled"])) : vue.renderSlot(_ctx.$slots, "default", { key: 1 }), 53988 vue.createElementVNode("input", { 53989 ref_key: "inputRef", 53990 ref: inputRef, 53991 class: vue.normalizeClass(vue.unref(ns).e("input")), 53992 name: _ctx.name, 53993 multiple: _ctx.multiple, 53994 accept: _ctx.accept, 53995 type: "file", 53996 onChange: handleChange, 53997 onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => { 53998 }, ["stop"])) 53999 }, null, 42, _hoisted_2$3) 54000 ], 42, _hoisted_1$3); 54001 }; 54002 } 54003 }); 54004 var UploadContent = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "upload-content.vue"]]); 54005 54006 const SCOPE$1 = "ElUpload"; 54007 const revokeObjectURL = (file) => { 54008 var _a; 54009 if ((_a = file.url) == null ? void 0 : _a.startsWith("blob:")) { 54010 URL.revokeObjectURL(file.url); 54011 } 54012 }; 54013 const useHandlers = (props, uploadRef) => { 54014 const uploadFiles = useVModel(props, "fileList", void 0, { passive: true }); 54015 const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid); 54016 function abort(file) { 54017 var _a; 54018 (_a = uploadRef.value) == null ? void 0 : _a.abort(file); 54019 } 54020 function clearFiles(states = ["ready", "uploading", "success", "fail"]) { 54021 uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status)); 54022 } 54023 const handleError = (err, rawFile) => { 54024 const file = getFile(rawFile); 54025 if (!file) 54026 return; 54027 console.error(err); 54028 file.status = "fail"; 54029 uploadFiles.value.splice(uploadFiles.value.indexOf(file), 1); 54030 props.onError(err, file, uploadFiles.value); 54031 props.onChange(file, uploadFiles.value); 54032 }; 54033 const handleProgress = (evt, rawFile) => { 54034 const file = getFile(rawFile); 54035 if (!file) 54036 return; 54037 props.onProgress(evt, file, uploadFiles.value); 54038 file.status = "uploading"; 54039 file.percentage = Math.round(evt.percent); 54040 }; 54041 const handleSuccess = (response, rawFile) => { 54042 const file = getFile(rawFile); 54043 if (!file) 54044 return; 54045 file.status = "success"; 54046 file.response = response; 54047 props.onSuccess(response, file, uploadFiles.value); 54048 props.onChange(file, uploadFiles.value); 54049 }; 54050 const handleStart = (file) => { 54051 if (isNil(file.uid)) 54052 file.uid = genFileId(); 54053 const uploadFile = { 54054 name: file.name, 54055 percentage: 0, 54056 status: "ready", 54057 size: file.size, 54058 raw: file, 54059 uid: file.uid 54060 }; 54061 if (props.listType === "picture-card" || props.listType === "picture") { 54062 try { 54063 uploadFile.url = URL.createObjectURL(file); 54064 } catch (err) { 54065 debugWarn(SCOPE$1, err.message); 54066 props.onError(err, uploadFile, uploadFiles.value); 54067 } 54068 } 54069 uploadFiles.value = [...uploadFiles.value, uploadFile]; 54070 props.onChange(uploadFile, uploadFiles.value); 54071 }; 54072 const handleRemove = async (file) => { 54073 const uploadFile = file instanceof File ? getFile(file) : file; 54074 if (!uploadFile) 54075 throwError(SCOPE$1, "file to be removed not found"); 54076 const doRemove = (file2) => { 54077 abort(file2); 54078 const fileList = uploadFiles.value; 54079 fileList.splice(fileList.indexOf(file2), 1); 54080 props.onRemove(file2, fileList); 54081 revokeObjectURL(file2); 54082 }; 54083 if (props.beforeRemove) { 54084 const before = await props.beforeRemove(uploadFile, uploadFiles.value); 54085 if (before !== false) 54086 doRemove(uploadFile); 54087 } else { 54088 doRemove(uploadFile); 54089 } 54090 }; 54091 function submit() { 54092 uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => { 54093 var _a; 54094 return raw && ((_a = uploadRef.value) == null ? void 0 : _a.upload(raw)); 54095 }); 54096 } 54097 vue.watch(() => props.listType, (val) => { 54098 if (val !== "picture-card" && val !== "picture") { 54099 return; 54100 } 54101 uploadFiles.value = uploadFiles.value.map((file) => { 54102 const { raw, url } = file; 54103 if (!url && raw) { 54104 try { 54105 file.url = URL.createObjectURL(raw);
54106 } catch (err) { 54107 props.onError(err, file, uploadFiles.value); 54108 } 54109 } 54110 return file; 54111 }); 54112 }); 54113 vue.watch(uploadFiles, (files) => { 54114 for (const file of files) { 54115 file.uid || (file.uid = genFileId()); 54116 file.status || (file.status = "success"); 54117 } 54118 }, { immediate: true, deep: true }); 54119 return { 54120 uploadFiles, 54121 abort, 54122 clearFiles, 54123 handleError, 54124 handleProgress, 54125 handleStart, 54126 handleSuccess, 54127 handleRemove, 54128 submit 54129 }; 54130 }; 54131 54132 const __default__$2 = vue.defineComponent({ 54133 name: "ElUpload" 54134 }); 54135 const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({ 54136 ...__default__$2, 54137 props: uploadProps, 54138 setup(__props, { expose }) { 54139 const props = __props; 54140 const slots = vue.useSlots(); 54141 const disabled = useFormDisabled(); 54142 const uploadRef = vue.shallowRef(); 54143 const { 54144 abort, 54145 submit, 54146 clearFiles, 54147 uploadFiles, 54148 handleStart, 54149 handleError, 54150 handleRemove, 54151 handleSuccess, 54152 handleProgress 54153 } = useHandlers(props, uploadRef); 54154 const isPictureCard = vue.computed(() => props.listType === "picture-card"); 54155 const uploadContentProps = vue.computed(() => ({ 54156 ...props, 54157 fileList: uploadFiles.value, 54158 onStart: handleStart, 54159 onProgress: handleProgress, 54160 onSuccess: handleSuccess, 54161 onError: handleError, 54162 onRemove: handleRemove 54163 })); 54164 vue.onBeforeUnmount(() => { 54165 uploadFiles.value.forEach(({ url }) => { 54166 if (url == null ? void 0 : url.startsWith("blob:")) 54167 URL.revokeObjectURL(url); 54168 }); 54169 }); 54170 vue.provide(uploadContextKey, { 54171 accept: vue.toRef(props, "accept") 54172 }); 54173 expose({ 54174 abort, 54175 submit, 54176 clearFiles, 54177 handleStart, 54178 handleRemove 54179 }); 54180 return (_ctx, _cache) => { 54181 return vue.openBlock(), vue.createElementBlock("div", null, [ 54182 vue.unref(isPictureCard) && _ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadList, { 54183 key: 0, 54184 disabled: vue.unref(disabled), 54185 "list-type": _ctx.listType, 54186 files: vue.unref(uploadFiles), 54187 "handle-preview": _ctx.onPreview, 54188 onRemove: vue.unref(handleRemove) 54189 }, vue.createSlots({ 54190 append: vue.withCtx(() => [ 54191 vue.createVNode(UploadContent, vue.mergeProps({ 54192 ref_key: "uploadRef", 54193 ref: uploadRef 54194 }, vue.unref(uploadContentProps)), { 54195 default: vue.withCtx(() => [ 54196 vue.unref(slots).trigger ? vue.renderSlot(_ctx.$slots, "trigger", { key: 0 }) : vue.createCommentVNode("v-if", true), 54197 !vue.unref(slots).trigger && vue.unref(slots).default ? vue.renderSlot(_ctx.$slots, "default", { key: 1 }) : vue.createCommentVNode("v-if", true) 54198 ]), 54199 _: 3 54200 }, 16) 54201 ]), 54202 _: 2 54203 }, [ 54204 _ctx.$slots.file ? { 54205 name: "default", 54206 fn: vue.withCtx(({ file }) => [ 54207 vue.renderSlot(_ctx.$slots, "file", { file }) 54208 ]) 54209 } : void 0 54210 ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : vue.createCommentVNode("v-if", true), 54211 !vue.unref(isPictureCard) || vue.unref(isPictureCard) && !_ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadContent, vue.mergeProps({ 54212 key: 1, 54213 ref_key: "uploadRef", 54214 ref: uploadRef 54215 }, vue.unref(uploadContentProps)), { 54216 default: vue.withCtx(() => [
54217 vue.unref(slots).trigger ? vue.renderSlot(_ctx.$slots, "trigger", { key: 0 }) : vue.createCommentVNode("v-if", true), 54218 !vue.unref(slots).trigger && vue.unref(slots).default ? vue.renderSlot(_ctx.$slots, "default", { key: 1 }) : vue.createCommentVNode("v-if", true) 54219 ]), 54220 _: 3 54221 }, 16)) : vue.createCommentVNode("v-if", true), 54222 _ctx.$slots.trigger ? vue.renderSlot(_ctx.$slots, "default", { key: 2 }) : vue.createCommentVNode("v-if", true), 54223 vue.renderSlot(_ctx.$slots, "tip"), 54224 !vue.unref(isPictureCard) && _ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadList, { 54225 key: 3, 54226 disabled: vue.unref(disabled), 54227 "list-type": _ctx.listType, 54228 files: vue.unref(uploadFiles), 54229 "handle-preview": _ctx.onPreview, 54230 onRemove: vue.unref(handleRemove) 54231 }, vue.createSlots({ _: 2 }, [ 54232 _ctx.$slots.file ? { 54233 name: "default", 54234 fn: vue.withCtx(({ file }) => [ 54235 vue.renderSlot(_ctx.$slots, "file", { file }) 54236 ]) 54237 } : void 0 54238 ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : vue.createCommentVNode("v-if", true) 54239 ]); 54240 }; 54241 } 54242 }); 54243 var Upload = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "upload.vue"]]); 54244 54245 const ElUpload = withInstall(Upload); 54246 54247 var Components = [ 54248 ElAffix, 54249 ElAlert, 54250 ElAutocomplete, 54251 ElAutoResizer, 54252 ElAvatar, 54253 ElBacktop, 54254 ElBadge, 54255 ElBreadcrumb, 54256 ElBreadcrumbItem, 54257 ElButton, 54258 ElButtonGroup$1, 54259 ElCalendar, 54260 ElCard, 54261 ElCarousel, 54262 ElCarouselItem, 54263 ElCascader, 54264 ElCascaderPanel, 54265 ElCheckTag, 54266 ElCheckbox, 54267 ElCheckboxButton, 54268 ElCheckboxGroup$1, 54269 ElCol, 54270 ElCollapse, 54271 ElCollapseItem, 54272 ElCollapseTransition, 54273 ElColorPicker, 54274 ElConfigProvider, 54275 ElContainer, 54276 ElAside, 54277 ElFooter, 54278 ElHeader, 54279 ElMain, 54280 ElDatePicker, 54281 ElDescriptions, 54282 ElDescriptionsItem, 54283 ElDialog, 54284 ElDivider, 54285 ElDrawer, 54286 ElDropdown, 54287 ElDropdownItem, 54288 ElDropdownMenu, 54289 ElEmpty, 54290 ElForm, 54291 ElFormItem, 54292 ElIcon, 54293 ElImage, 54294 ElImageViewer, 54295 ElInput, 54296 ElInputNumber, 54297 ElLink, 54298 ElMenu, 54299 ElMenuItem, 54300 ElMenuItemGroup, 54301 ElSubMenu, 54302 ElPageHeader, 54303 ElPagination, 54304 ElPopconfirm, 54305 ElPopover, 54306 ElPopper, 54307 ElProgress, 54308 ElRadio, 54309 ElRadioButton, 54310 ElRadioGroup, 54311 ElRate, 54312 ElResult, 54313 ElRow, 54314 ElScrollbar, 54315 ElSelect, 54316 ElOption, 54317 ElOptionGroup, 54318 ElSelectV2, 54319 ElSkeleton, 54320 ElSkeletonItem, 54321 ElSlider, 54322 ElSpace, 54323 ElStatistic, 54324 ElCountdown, 54325 ElSteps, 54326 ElStep, 54327 ElSwitch, 54328 ElTable, 54329 ElTableColumn, 54330 ElTableV2, 54331 ElTabs, 54332 ElTabPane, 54333 ElTag, 54334 ElText, 54335 ElTimePicker, 54336 ElTimeSelect, 54337 ElTimeline, 54338 ElTimelineItem, 54339 ElTooltip, 54340 ElTooltipV2, 54341 ElTransfer, 54342 ElTree, 54343 ElTreeSelect, 54344 ElTreeV2, 54345 ElUpload 54346 ]; 54347 54348 const SCOPE = "ElInfiniteScroll"; 54349 const CHECK_INTERVAL = 50; 54350 const DEFAULT_DELAY = 200; 54351 const DEFAULT_DISTANCE = 0; 54352 const attributes = { 54353 delay: { 54354 type: Number, 54355 default: DEFAULT_DELAY 54356 }, 54357 distance: { 54358 type: Number, 54359 default: DEFAULT_DISTANCE 54360 }, 54361 disabled: { 54362 type: Boolean, 54363 default: false 54364 }, 54365 immediate: { 54366 type: Boolean, 54367 default: true 54368 } 54369 }; 54370 const getScrollOptions = (el, instance) => { 54371 return Object.entries(attributes).reduce((acm, [name, option]) => { 54372 var _a, _b; 54373 const { type, default: defaultValue } = option; 54374 const attrVal = el.getAttribute(`infinite-scroll-${name}`); 54375 let value = (_b = (_a = instance[attrVal]) != null ? _a : attrVal) != null ? _b : defaultValue;
54376 value = value === "false" ? false : value; 54377 value = type(value); 54378 acm[name] = Number.isNaN(value) ? defaultValue : value; 54379 return acm; 54380 }, {}); 54381 }; 54382 const destroyObserver = (el) => { 54383 const { observer } = el[SCOPE]; 54384 if (observer) { 54385 observer.disconnect(); 54386 delete el[SCOPE].observer; 54387 } 54388 }; 54389 const handleScroll = (el, cb) => { 54390 const { container, containerEl, instance, observer, lastScrollTop } = el[SCOPE]; 54391 const { disabled, distance } = getScrollOptions(el, instance); 54392 const { clientHeight, scrollHeight, scrollTop } = containerEl; 54393 const delta = scrollTop - lastScrollTop; 54394 el[SCOPE].lastScrollTop = scrollTop; 54395 if (observer || disabled || delta < 0) 54396 return; 54397 let shouldTrigger = false; 54398 if (container === el) { 54399 shouldTrigger = scrollHeight - (clientHeight + scrollTop) <= distance; 54400 } else { 54401 const { clientTop, scrollHeight: height } = el; 54402 const offsetTop = getOffsetTopDistance(el, containerEl); 54403 shouldTrigger = scrollTop + clientHeight >= offsetTop + clientTop + height - distance; 54404 } 54405 if (shouldTrigger) { 54406 cb.call(instance); 54407 } 54408 }; 54409 function checkFull(el, cb) { 54410 const { containerEl, instance } = el[SCOPE]; 54411 const { disabled } = getScrollOptions(el, instance); 54412 if (disabled || containerEl.clientHeight === 0) 54413 return; 54414 if (containerEl.scrollHeight <= containerEl.clientHeight) { 54415 cb.call(instance); 54416 } else { 54417 destroyObserver(el); 54418 } 54419 } 54420 const InfiniteScroll = { 54421 async mounted(el, binding) { 54422 const { instance, value: cb } = binding; 54423 if (!isFunction$1(cb)) { 54424 throwError(SCOPE, "'v-infinite-scroll' binding value must be a function"); 54425 } 54426 await vue.nextTick(); 54427 const { delay, immediate } = getScrollOptions(el, instance); 54428 const container = getScrollContainer(el, true); 54429 const containerEl = container === window ? document.documentElement : container; 54430 const onScroll = throttle(handleScroll.bind(null, el, cb), delay); 54431 if (!container) 54432 return; 54433 el[SCOPE] = { 54434 instance, 54435 container, 54436 containerEl, 54437 delay, 54438 cb, 54439 onScroll, 54440 lastScrollTop: containerEl.scrollTop 54441 }; 54442 if (immediate) { 54443 const observer = new MutationObserver(throttle(checkFull.bind(null, el, cb), CHECK_INTERVAL)); 54444 el[SCOPE].observer = observer; 54445 observer.observe(el, { childList: true, subtree: true }); 54446 checkFull(el, cb); 54447 } 54448 container.addEventListener("scroll", onScroll); 54449 }, 54450 unmounted(el) { 54451 const { container, onScroll } = el[SCOPE]; 54452 container == null ? void 0 : container.removeEventListener("scroll", onScroll); 54453 destroyObserver(el); 54454 }, 54455 async updated(el) { 54456 if (!el[SCOPE]) { 54457 await vue.nextTick(); 54458 } else { 54459 const { containerEl, cb, observer } = el[SCOPE]; 54460 if (containerEl.clientHeight && observer) { 54461 checkFull(el, cb); 54462 } 54463 } 54464 } 54465 }; 54466 var InfiniteScroll$1 = InfiniteScroll; 54467 54468 const _InfiniteScroll = InfiniteScroll$1; 54469 _InfiniteScroll.install = (app) => { 54470 app.directive("InfiniteScroll", _InfiniteScroll); 54471 }; 54472 const ElInfiniteScroll = _InfiniteScroll; 54473 54474 function createLoadingComponent(options) { 54475 let afterLeaveTimer; 54476 const afterLeaveFlag = vue.ref(false); 54477 const data = vue.reactive({ 54478 ...options, 54479 originalPosition: "", 54480 originalOverflow: "", 54481 visible: false 54482 }); 54483 function setText(text) { 54484 data.text = text; 54485 } 54486 function destroySelf() { 54487 const target = data.parent; 54488 const ns = vm.ns; 54489 if (!target.vLoadingAddClassList) { 54490 let loadingNumber = target.getAttribute("loading-number"); 54491 loadingNumber = Number.parseInt(loadingNumber) - 1; 54492 if (!loadingNumber) { 54493 removeClass(target, ns.bm("parent", "relative"));
54494 target.removeAttribute("loading-number"); 54495 } else { 54496 target.setAttribute("loading-number", loadingNumber.toString()); 54497 } 54498 removeClass(target, ns.bm("parent", "hidden")); 54499 } 54500 removeElLoadingChild(); 54501 loadingInstance.unmount(); 54502 } 54503 function removeElLoadingChild() { 54504 var _a, _b; 54505 (_b = (_a = vm.$el) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.removeChild(vm.$el); 54506 } 54507 function close() { 54508 var _a; 54509 if (options.beforeClose && !options.beforeClose()) 54510 return; 54511 afterLeaveFlag.value = true; 54512 clearTimeout(afterLeaveTimer); 54513 afterLeaveTimer = window.setTimeout(handleAfterLeave, 400); 54514 data.visible = false; 54515 (_a = options.closed) == null ? void 0 : _a.call(options); 54516 } 54517 function handleAfterLeave() { 54518 if (!afterLeaveFlag.value) 54519 return; 54520 const target = data.parent; 54521 afterLeaveFlag.value = false; 54522 target.vLoadingAddClassList = void 0; 54523 destroySelf(); 54524 } 54525 const elLoadingComponent = vue.defineComponent({ 54526 name: "ElLoading", 54527 setup(_, { expose }) { 54528 const { ns, zIndex } = useGlobalComponentSettings("loading"); 54529 expose({ 54530 ns, 54531 zIndex 54532 }); 54533 return () => { 54534 const svg = data.spinner || data.svg; 54535 const spinner = vue.h("svg", { 54536 class: "circular",
54537 viewBox: data.svgViewBox ? data.svgViewBox : "0 0 50 50", 54538 ...svg ? { innerHTML: svg } : {} 54539 }, [ 54540 vue.h("circle", { 54541 class: "path", 54542 cx: "25", 54543 cy: "25", 54544 r: "20", 54545 fill: "none" 54546 }) 54547 ]); 54548 const spinnerText = data.text ? vue.h("p", { class: ns.b("text") }, [data.text]) : void 0; 54549 return vue.h(vue.Transition, { 54550 name: ns.b("fade"), 54551 onAfterLeave: handleAfterLeave 54552 }, { 54553 default: vue.withCtx(() => [ 54554 vue.withDirectives(vue.createVNode("div", { 54555 style: { 54556 backgroundColor: data.background || "" 54557 }, 54558 class: [ 54559 ns.b("mask"), 54560 data.customClass, 54561 data.fullscreen ? "is-fullscreen" : "" 54562 ] 54563 }, [ 54564 vue.h("div", { 54565 class: ns.b("spinner") 54566 }, [spinner, spinnerText]) 54567 ]), [[vue.vShow, data.visible]]) 54568 ]) 54569 }); 54570 }; 54571 } 54572 }); 54573 const loadingInstance = vue.createApp(elLoadingComponent); 54574 const vm = loadingInstance.mount(document.createElement("div")); 54575 return { 54576 ...vue.toRefs(data), 54577 setText, 54578 removeElLoadingChild, 54579 close, 54580 handleAfterLeave, 54581 vm, 54582 get $el() { 54583 return vm.$el; 54584 } 54585 }; 54586 } 54587 54588 let fullscreenInstance = void 0; 54589 const Loading = function(options = {}) { 54590 if (!isClient) 54591 return void 0; 54592 const resolved = resolveOptions(options); 54593 if (resolved.fullscreen && fullscreenInstance) { 54594 return fullscreenInstance; 54595 } 54596 const instance = createLoadingComponent({ 54597 ...resolved, 54598 closed: () => { 54599 var _a; 54600 (_a = resolved.closed) == null ? void 0 : _a.call(resolved); 54601 if (resolved.fullscreen) 54602 fullscreenInstance = void 0; 54603 } 54604 }); 54605 addStyle(resolved, resolved.parent, instance); 54606 addClassList(resolved, resolved.parent, instance); 54607 resolved.parent.vLoadingAddClassList = () => addClassList(resolved, resolved.parent, instance); 54608 let loadingNumber = resolved.parent.getAttribute("loading-number"); 54609 if (!loadingNumber) { 54610 loadingNumber = "1"; 54611 } else { 54612 loadingNumber = `${Number.parseInt(loadingNumber) + 1}`; 54613 } 54614 resolved.parent.setAttribute("loading-number", loadingNumber); 54615 resolved.parent.appendChild(instance.$el); 54616 vue.nextTick(() => instance.visible.value = resolved.visible); 54617 if (resolved.fullscreen) { 54618 fullscreenInstance = instance; 54619 } 54620 return instance; 54621 }; 54622 const resolveOptions = (options) => { 54623 var _a, _b, _c, _d; 54624 let target; 54625 if (isString$1(options.target)) { 54626 target = (_a = document.querySelector(options.target)) != null ? _a : document.body; 54627 } else { 54628 target = options.target || document.body; 54629 } 54630 return { 54631 parent: target === document.body || options.body ? document.body : target, 54632 background: options.background || "", 54633 svg: options.svg || "", 54634 svgViewBox: options.svgViewBox || "", 54635 spinner: options.spinner || false, 54636 text: options.text || "", 54637 fullscreen: target === document.body && ((_b = options.fullscreen) != null ? _b : true), 54638 lock: (_c = options.lock) != null ? _c : false, 54639 customClass: options.customClass || "", 54640 visible: (_d = options.visible) != null ? _d : true, 54641 target 54642 }; 54643 }; 54644 const addStyle = async (options, parent, instance) => { 54645 const { nextZIndex } = instance.vm.zIndex || instance.vm._.exposed.zIndex; 54646 const maskStyle = {}; 54647 if (options.fullscreen) { 54648 instance.originalPosition.value = getStyle(document.body, "position"); 54649 instance.originalOverflow.value = getStyle(document.body, "overflow"); 54650 maskStyle.zIndex = nextZIndex(); 54651 } else if (options.parent === document.body) { 54652 instance.originalPosition.value = getStyle(document.body, "position"); 54653 await vue.nextTick(); 54654 for (const property of ["top", "left"]) { 54655 const scroll = property === "top" ? "scrollTop" : "scrollLeft"; 54656 maskStyle[property] = `${options.target.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] - Number.parseInt(getStyle(document.body, `margin-${property}`), 10)}px`; 54657 } 54658 for (const property of ["height", "width"]) { 54659 maskStyle[property] = `${options.target.getBoundingClientRect()[property]}px`; 54660 } 54661 } else { 54662 instance.originalPosition.value = getStyle(parent, "position"); 54663 } 54664 for (const [key, value] of Object.entries(maskStyle)) { 54665 instance.$el.style[key] = value; 54666 } 54667 }; 54668 const addClassList = (options, parent, instance) => { 54669 const ns = instance.vm.ns || instance.vm._.exposed.ns; 54670 if (!["absolute", "fixed", "sticky"].includes(instance.originalPosition.value)) { 54671 addClass(parent, ns.bm("parent", "relative"));
54672 } else { 54673 removeClass(parent, ns.bm("parent", "relative")); 54674 } 54675 if (options.fullscreen && options.lock) { 54676 addClass(parent, ns.bm("parent", "hidden")); 54677 } else { 54678 removeClass(parent, ns.bm("parent", "hidden")); 54679 } 54680 }; 54681 54682 const INSTANCE_KEY = Symbol("ElLoading"); 54683 const createInstance = (el, binding) => { 54684 var _a, _b, _c, _d; 54685 const vm = binding.instance; 54686 const getBindingProp = (key) => isObject$1(binding.value) ? binding.value[key] : void 0; 54687 const resolveExpression = (key) => { 54688 const data = isString$1(key) && (vm == null ? void 0 : vm[key]) || key; 54689 if (data) 54690 return vue.ref(data); 54691 else 54692 return data; 54693 }; 54694 const getProp = (name) => resolveExpression(getBindingProp(name) || el.getAttribute(`element-loading-${hyphenate(name)}`)); 54695 const fullscreen = (_a = getBindingProp("fullscreen")) != null ? _a : binding.modifiers.fullscreen; 54696 const options = { 54697 text: getProp("text"), 54698 svg: getProp("svg"), 54699 svgViewBox: getProp("svgViewBox"), 54700 spinner: getProp("spinner"), 54701 background: getProp("background"), 54702 customClass: getProp("customClass"), 54703 fullscreen, 54704 target: (_b = getBindingProp("target")) != null ? _b : fullscreen ? void 0 : el, 54705 body: (_c = getBindingProp("body")) != null ? _c : binding.modifiers.body, 54706 lock: (_d = getBindingProp("lock")) != null ? _d : binding.modifiers.lock 54707 }; 54708 el[INSTANCE_KEY] = { 54709 options, 54710 instance: Loading(options) 54711 }; 54712 }; 54713 const updateOptions = (newOptions, originalOptions) => { 54714 for (const key of Object.keys(originalOptions)) { 54715 if (vue.isRef(originalOptions[key])) 54716 originalOptions[key].value = newOptions[key]; 54717 } 54718 }; 54719 const vLoading = { 54720 mounted(el, binding) { 54721 if (binding.value) { 54722 createInstance(el, binding); 54723 } 54724 }, 54725 updated(el, binding) { 54726 const instance = el[INSTANCE_KEY]; 54727 if (binding.oldValue !== binding.value) { 54728 if (binding.value && !binding.oldValue) { 54729 createInstance(el, binding); 54730 } else if (binding.value && binding.oldValue) { 54731 if (isObject$1(binding.value)) 54732 updateOptions(binding.value, instance.options); 54733 } else { 54734 instance == null ? void 0 : instance.instance.close(); 54735 } 54736 } 54737 }, 54738 unmounted(el) { 54739 var _a; 54740 (_a = el[INSTANCE_KEY]) == null ? void 0 : _a.instance.close(); 54741 } 54742 }; 54743 54744 const ElLoading = { 54745 install(app) { 54746 app.directive("loading", vLoading); 54747 app.config.globalProperties.$loading = Loading; 54748 }, 54749 directive: vLoading, 54750 service: Loading 54751 }; 54752 54753 const messageTypes = ["success", "info", "warning", "error"]; 54754 const messageDefaults = mutable({ 54755 customClass: "", 54756 center: false, 54757 dangerouslyUseHTMLString: false, 54758 duration: 3e3, 54759 icon: void 0, 54760 id: "", 54761 message: "", 54762 onClose: void 0, 54763 showClose: false, 54764 type: "info", 54765 offset: 16, 54766 zIndex: 0, 54767 grouping: false, 54768 repeatNum: 1, 54769 appendTo: isClient ? document.body : void 0 54770 }); 54771 const messageProps = buildProps({ 54772 customClass: { 54773 type: String, 54774 default: messageDefaults.customClass 54775 }, 54776 center: { 54777 type: Boolean, 54778 default: messageDefaults.center 54779 }, 54780 dangerouslyUseHTMLString: { 54781 type: Boolean, 54782 default: messageDefaults.dangerouslyUseHTMLString 54783 }, 54784 duration: { 54785 type: Number, 54786 default: messageDefaults.duration 54787 }, 54788 icon: { 54789 type: iconPropType, 54790 default: messageDefaults.icon 54791 }, 54792 id: { 54793 type: String, 54794 default: messageDefaults.id 54795 }, 54796 message: { 54797 type: definePropType([ 54798 String, 54799 Object, 54800 Function 54801 ]), 54802 default: messageDefaults.message 54803 }, 54804 onClose: { 54805 type: definePropType(Function), 54806 required: false 54807 }, 54808 showClose: { 54809 type: Boolean, 54810 default: messageDefaults.showClose 54811 }, 54812 type: { 54813 type: String, 54814 values: messageTypes, 54815 default: messageDefaults.type 54816 }, 54817 offset: { 54818 type: Number, 54819 default: messageDefaults.offset 54820 }, 54821 zIndex: { 54822 type: Number, 54823 default: messageDefaults.zIndex 54824 }, 54825 grouping: { 54826 type: Boolean, 54827 default: messageDefaults.grouping 54828 }, 54829 repeatNum: { 54830 type: Number, 54831 default: messageDefaults.repeatNum 54832 } 54833 });
54834 const messageEmits = { 54835 destroy: () => true 54836 }; 54837 54838 const instances = vue.shallowReactive([]); 54839 const getInstance = (id) => { 54840 const idx = instances.findIndex((instance) => instance.id === id); 54841 const current = instances[idx]; 54842 let prev; 54843 if (idx > 0) { 54844 prev = instances[idx - 1]; 54845 } 54846 return { current, prev }; 54847 }; 54848 const getLastOffset = (id) => { 54849 const { prev } = getInstance(id); 54850 if (!prev) 54851 return 0; 54852 return prev.vm.exposed.bottom.value; 54853 }; 54854 const getOffsetOrSpace = (id, offset) => { 54855 const idx = instances.findIndex((instance) => instance.id === id); 54856 return idx > 0 ? 20 : offset; 54857 }; 54858 54859 const _hoisted_1$2 = ["id"]; 54860 const _hoisted_2$2 = ["innerHTML"]; 54861 const __default__$1 = vue.defineComponent({ 54862 name: "ElMessage" 54863 }); 54864 const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({ 54865 ...__default__$1, 54866 props: messageProps, 54867 emits: messageEmits, 54868 setup(__props, { expose }) { 54869 const props = __props; 54870 const { Close } = TypeComponents; 54871 const { ns, zIndex } = useGlobalComponentSettings("message"); 54872 const { currentZIndex, nextZIndex } = zIndex; 54873 const messageRef = vue.ref(); 54874 const visible = vue.ref(false); 54875 const height = vue.ref(0);
54876 let stopTimer = void 0; 54877 const badgeType = vue.computed(() => props.type ? props.type === "error" ? "danger" : props.type : "info"); 54878 const typeClass = vue.computed(() => { 54879 const type = props.type; 54880 return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] }; 54881 }); 54882 const iconComponent = vue.computed(() => props.icon || TypeComponentsMap[props.type] || ""); 54883 const lastOffset = vue.computed(() => getLastOffset(props.id)); 54884 const offset = vue.computed(() => getOffsetOrSpace(props.id, props.offset) + lastOffset.value); 54885 const bottom = vue.computed(() => height.value + offset.value); 54886 const customStyle = vue.computed(() => ({ 54887 top: `${offset.value}px`, 54888 zIndex: currentZIndex.value 54889 })); 54890 function startTimer() { 54891 if (props.duration === 0) 54892 return; 54893 ({ stop: stopTimer } = useTimeoutFn(() => { 54894 close(); 54895 }, props.duration)); 54896 } 54897 function clearTimer() { 54898 stopTimer == null ? void 0 : stopTimer(); 54899 } 54900 function close() { 54901 visible.value = false; 54902 } 54903 function keydown({ code }) { 54904 if (code === EVENT_CODE.esc) { 54905 close(); 54906 } 54907 } 54908 vue.onMounted(() => { 54909 startTimer(); 54910 nextZIndex(); 54911 visible.value = true; 54912 }); 54913 vue.watch(() => props.repeatNum, () => { 54914 clearTimer(); 54915 startTimer(); 54916 }); 54917 useEventListener(document, "keydown", keydown); 54918 useResizeObserver(messageRef, () => { 54919 height.value = messageRef.value.getBoundingClientRect().height; 54920 }); 54921 expose({ 54922 visible, 54923 bottom, 54924 close 54925 }); 54926 return (_ctx, _cache) => { 54927 return vue.openBlock(), vue.createBlock(vue.Transition, { 54928 name: vue.unref(ns).b("fade"), 54929 onBeforeLeave: _ctx.onClose, 54930 onAfterLeave: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("destroy")), 54931 persisted: "" 54932 }, { 54933 default: vue.withCtx(() => [ 54934 vue.withDirectives(vue.createElementVNode("div", { 54935 id: _ctx.id, 54936 ref_key: "messageRef", 54937 ref: messageRef, 54938 class: vue.normalizeClass([ 54939 vue.unref(ns).b(), 54940 { [vue.unref(ns).m(_ctx.type)]: _ctx.type && !_ctx.icon }, 54941 vue.unref(ns).is("center", _ctx.center), 54942 vue.unref(ns).is("closable", _ctx.showClose), 54943 _ctx.customClass 54944 ]), 54945 style: vue.normalizeStyle(vue.unref(customStyle)), 54946 role: "alert", 54947 onMouseenter: clearTimer, 54948 onMouseleave: startTimer 54949 }, [ 54950 _ctx.repeatNum > 1 ? (vue.openBlock(), vue.createBlock(vue.unref(ElBadge), { 54951 key: 0, 54952 value: _ctx.repeatNum, 54953 type: vue.unref(badgeType), 54954 class: vue.normalizeClass(vue.unref(ns).e("badge")) 54955 }, null, 8, ["value", "type", "class"])) : vue.createCommentVNode("v-if", true), 54956 vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 54957 key: 1, 54958 class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(typeClass)]) 54959 }, { 54960 default: vue.withCtx(() => [ 54961 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent)))) 54962 ]), 54963 _: 1 54964 }, 8, ["class"])) : vue.createCommentVNode("v-if", true), 54965 vue.renderSlot(_ctx.$slots, "default", {}, () => [ 54966 !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", { 54967 key: 0, 54968 class: vue.normalizeClass(vue.unref(ns).e("content")) 54969 }, vue.toDisplayString(_ctx.message), 3)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [ 54970 vue.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "), 54971 vue.createElementVNode("p", { 54972 class: vue.normalizeClass(vue.unref(ns).e("content")), 54973 innerHTML: _ctx.message 54974 }, null, 10, _hoisted_2$2) 54975 ], 2112)) 54976 ]), 54977 _ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 54978 key: 2, 54979 class: vue.normalizeClass(vue.unref(ns).e("closeBtn")), 54980 onClick: vue.withModifiers(close, ["stop"]) 54981 }, { 54982 default: vue.withCtx(() => [ 54983 vue.createVNode(vue.unref(Close)) 54984 ]), 54985 _: 1 54986 }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true) 54987 ], 46, _hoisted_1$2), [ 54988 [vue.vShow, visible.value] 54989 ]) 54990 ]), 54991 _: 3 54992 }, 8, ["name", "onBeforeLeave"]); 54993 }; 54994 } 54995 });
54996 var MessageConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "message.vue"]]); 54997 54998 let seed$1 = 1; 54999 const normalizeOptions = (params) => { 55000 const options = !params || isString$1(params) || vue.isVNode(params) || isFunction$1(params) ? { message: params } : params; 55001 const normalized = { 55002 ...messageDefaults, 55003 ...options 55004 }; 55005 if (!normalized.appendTo) { 55006 normalized.appendTo = document.body; 55007 } else if (isString$1(normalized.appendTo)) { 55008 let appendTo = document.querySelector(normalized.appendTo); 55009 if (!isElement$1(appendTo)) { 55010 appendTo = document.body; 55011 } 55012 normalized.appendTo = appendTo; 55013 } 55014 return normalized; 55015 }; 55016 const closeMessage = (instance) => { 55017 const idx = instances.indexOf(instance); 55018 if (idx === -1) 55019 return; 55020 instances.splice(idx, 1); 55021 const { handler } = instance; 55022 handler.close(); 55023 }; 55024 const createMessage = ({ appendTo, ...options }, context) => { 55025 const id = `message_${seed$1++}`; 55026 const userOnClose = options.onClose; 55027 const container = document.createElement("div"); 55028 const props = { 55029 ...options, 55030 id, 55031 onClose: () => { 55032 userOnClose == null ? void 0 : userOnClose(); 55033 closeMessage(instance); 55034 }, 55035 onDestroy: () => { 55036 vue.render(null, container); 55037 } 55038 }; 55039 const vnode = vue.createVNode(MessageConstructor, props, isFunction$1(props.message) || vue.isVNode(props.message) ? { 55040 default: isFunction$1(props.message) ? props.message : () => props.message 55041 } : null); 55042 vnode.appContext = context || message._context; 55043 vue.render(vnode, container); 55044 appendTo.appendChild(container.firstElementChild); 55045 const vm = vnode.component; 55046 const handler = { 55047 close: () => { 55048 vm.exposed.visible.value = false; 55049 } 55050 }; 55051 const instance = { 55052 id, 55053 vnode, 55054 vm, 55055 handler, 55056 props: vnode.component.props 55057 }; 55058 return instance; 55059 }; 55060 const message = (options = {}, context) => { 55061 if (!isClient) 55062 return { close: () => void 0 }; 55063 if (isNumber(messageConfig.max) && instances.length >= messageConfig.max) { 55064 return { close: () => void 0 }; 55065 } 55066 const normalized = normalizeOptions(options); 55067 if (normalized.grouping && instances.length) { 55068 const instance2 = instances.find(({ vnode: vm }) => { 55069 var _a; 55070 return ((_a = vm.props) == null ? void 0 : _a.message) === normalized.message; 55071 }); 55072 if (instance2) { 55073 instance2.props.repeatNum += 1; 55074 instance2.props.type = normalized.type; 55075 return instance2.handler; 55076 } 55077 } 55078 const instance = createMessage(normalized, context); 55079 instances.push(instance); 55080 return instance.handler; 55081 }; 55082 messageTypes.forEach((type) => { 55083 message[type] = (options = {}, appContext) => { 55084 const normalized = normalizeOptions(options); 55085 return message({ ...normalized, type }, appContext); 55086 }; 55087 }); 55088 function closeAll$1(type) { 55089 for (const instance of instances) { 55090 if (!type || type === instance.props.type) { 55091 instance.handler.close(); 55092 } 55093 } 55094 } 55095 message.closeAll = closeAll$1; 55096 message._context = null; 55097 var Message = message; 55098 55099 const ElMessage = withInstallFunction(Message, "$message"); 55100 55101 const _sfc_main$1 = vue.defineComponent({ 55102 name: "ElMessageBox", 55103 directives: { 55104 TrapFocus 55105 }, 55106 components: { 55107 ElButton, 55108 ElFocusTrap, 55109 ElInput, 55110 ElOverlay, 55111 ElIcon, 55112 ...TypeComponents 55113 }, 55114 inheritAttrs: false, 55115 props: { 55116 buttonSize: { 55117 type: String, 55118 validator: isValidComponentSize 55119 }, 55120 modal: { 55121 type: Boolean, 55122 default: true 55123 }, 55124 lockScroll: { 55125 type: Boolean, 55126 default: true 55127 }, 55128 showClose: { 55129 type: Boolean, 55130 default: true 55131 }, 55132 closeOnClickModal: { 55133 type: Boolean, 55134 default: true 55135 }, 55136 closeOnPressEscape: { 55137 type: Boolean, 55138 default: true 55139 }, 55140 closeOnHashChange: { 55141 type: Boolean, 55142 default: true 55143 }, 55144 center: Boolean, 55145 draggable: Boolean, 55146 roundButton: { 55147 default: false, 55148 type: Boolean 55149 }, 55150 container: { 55151 type: String, 55152 default: "body" 55153 }, 55154 boxType: { 55155 type: String, 55156 default: "" 55157 } 55158 }, 55159 emits: ["vanish", "action"], 55160 setup(props, { emit }) { 55161 const { 55162 locale, 55163 zIndex, 55164 ns, 55165 size: btnSize 55166 } = useGlobalComponentSettings("message-box", vue.computed(() => props.buttonSize)); 55167 const { t } = locale; 55168 const { nextZIndex } = zIndex; 55169 const visible = vue.ref(false); 55170 const state = vue.reactive({ 55171 autofocus: true, 55172 beforeClose: null, 55173 callback: null, 55174 cancelButtonText: "", 55175 cancelButtonClass: "", 55176 confirmButtonText: "", 55177 confirmButtonClass: "", 55178 customClass: "", 55179 customStyle: {}, 55180 dangerouslyUseHTMLString: false, 55181 distinguishCancelAndClose: false, 55182 icon: "", 55183 inputPattern: null, 55184 inputPlaceholder: "", 55185 inputType: "text", 55186 inputValue: null, 55187 inputValidator: null, 55188 inputErrorMessage: "", 55189 message: null, 55190 modalFade: true, 55191 modalClass: "",
55192 showCancelButton: false, 55193 showConfirmButton: true, 55194 type: "", 55195 title: void 0, 55196 showInput: false, 55197 action: "", 55198 confirmButtonLoading: false, 55199 cancelButtonLoading: false, 55200 confirmButtonDisabled: false, 55201 editorErrorMessage: "", 55202 validateError: false, 55203 zIndex: nextZIndex() 55204 }); 55205 const typeClass = vue.computed(() => { 55206 const type = state.type; 55207 return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] }; 55208 }); 55209 const contentId = useId(); 55210 const inputId = useId(); 55211 const iconComponent = vue.computed(() => state.icon || TypeComponentsMap[state.type] || ""); 55212 const hasMessage = vue.computed(() => !!state.message); 55213 const rootRef = vue.ref(); 55214 const headerRef = vue.ref(); 55215 const focusStartRef = vue.ref(); 55216 const inputRef = vue.ref(); 55217 const confirmRef = vue.ref(); 55218 const confirmButtonClasses = vue.computed(() => state.confirmButtonClass); 55219 vue.watch(() => state.inputValue, async (val) => { 55220 await vue.nextTick(); 55221 if (props.boxType === "prompt" && val !== null) { 55222 validate(); 55223 } 55224 }, { immediate: true }); 55225 vue.watch(() => visible.value, (val) => { 55226 var _a, _b; 55227 if (val) { 55228 if (props.boxType !== "prompt") { 55229 if (state.autofocus) { 55230 focusStartRef.value = (_b = (_a = confirmRef.value) == null ? void 0 : _a.$el) != null ? _b : rootRef.value; 55231 } else { 55232 focusStartRef.value = rootRef.value; 55233 } 55234 } 55235 state.zIndex = nextZIndex(); 55236 } 55237 if (props.boxType !== "prompt") 55238 return; 55239 if (val) { 55240 vue.nextTick().then(() => { 55241 var _a2; 55242 if (inputRef.value && inputRef.value.$el) { 55243 if (state.autofocus) { 55244 focusStartRef.value = (_a2 = getInputElement()) != null ? _a2 : rootRef.value; 55245 } else { 55246 focusStartRef.value = rootRef.value; 55247 } 55248 } 55249 }); 55250 } else { 55251 state.editorErrorMessage = ""; 55252 state.validateError = false; 55253 } 55254 }); 55255 const draggable = vue.computed(() => props.draggable); 55256 useDraggable(rootRef, headerRef, draggable); 55257 vue.onMounted(async () => { 55258 await vue.nextTick(); 55259 if (props.closeOnHashChange) { 55260 window.addEventListener("hashchange", doClose); 55261 } 55262 }); 55263 vue.onBeforeUnmount(() => { 55264 if (props.closeOnHashChange) { 55265 window.removeEventListener("hashchange", doClose); 55266 } 55267 }); 55268 function doClose() { 55269 if (!visible.value) 55270 return; 55271 visible.value = false; 55272 vue.nextTick(() => { 55273 if (state.action) 55274 emit("action", state.action); 55275 }); 55276 } 55277 const handleWrapperClick = () => { 55278 if (props.closeOnClickModal) { 55279 handleAction(state.distinguishCancelAndClose ? "close" : "cancel"); 55280 } 55281 }; 55282 const overlayEvent = useSameTarget(handleWrapperClick); 55283 const handleInputEnter = (e) => { 55284 if (state.inputType !== "textarea") { 55285 e.preventDefault(); 55286 return handleAction("confirm"); 55287 } 55288 }; 55289 const handleAction = (action) => { 55290 var _a; 55291 if (props.boxType === "prompt" && action === "confirm" && !validate()) { 55292 return; 55293 } 55294 state.action = action; 55295 if (state.beforeClose) { 55296 (_a = state.beforeClose) == null ? void 0 : _a.call(state, action, state, doClose); 55297 } else { 55298 doClose(); 55299 } 55300 }; 55301 const validate = () => { 55302 if (props.boxType === "prompt") { 55303 const inputPattern = state.inputPattern; 55304 if (inputPattern && !inputPattern.test(state.inputValue || "")) { 55305 state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error"); 55306 state.validateError = true; 55307 return false; 55308 } 55309 const inputValidator = state.inputValidator; 55310 if (typeof inputValidator === "function") { 55311 const validateResult = inputValidator(state.inputValue); 55312 if (validateResult === false) { 55313 state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error"); 55314 state.validateError = true; 55315 return false; 55316 } 55317 if (typeof validateResult === "string") { 55318 state.editorErrorMessage = validateResult; 55319 state.validateError = true; 55320 return false; 55321 } 55322 } 55323 } 55324 state.editorErrorMessage = ""; 55325 state.validateError = false; 55326 return true; 55327 }; 55328 const getInputElement = () => { 55329 const inputRefs = inputRef.value.$refs; 55330 return inputRefs.input || inputRefs.textarea; 55331 }; 55332 const handleClose = () => { 55333 handleAction("close"); 55334 }; 55335 const onCloseRequested = () => { 55336 if (props.closeOnPressEscape) { 55337 handleClose(); 55338 } 55339 }; 55340 if (props.lockScroll) { 55341 useLockscreen(visible); 55342 } 55343 useRestoreActive(visible); 55344 return { 55345 ...vue.toRefs(state), 55346 ns, 55347 overlayEvent, 55348 visible, 55349 hasMessage, 55350 typeClass, 55351 contentId, 55352 inputId, 55353 btnSize, 55354 iconComponent,
55355 confirmButtonClasses, 55356 rootRef, 55357 focusStartRef, 55358 headerRef, 55359 inputRef, 55360 confirmRef, 55361 doClose, 55362 handleClose, 55363 onCloseRequested, 55364 handleWrapperClick, 55365 handleInputEnter, 55366 handleAction, 55367 t 55368 }; 55369 } 55370 }); 55371 const _hoisted_1$1 = ["aria-label", "aria-describedby"]; 55372 const _hoisted_2$1 = ["aria-label"]; 55373 const _hoisted_3$1 = ["id"]; 55374 function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { 55375 const _component_el_icon = vue.resolveComponent("el-icon"); 55376 const _component_close = vue.resolveComponent("close"); 55377 const _component_el_input = vue.resolveComponent("el-input"); 55378 const _component_el_button = vue.resolveComponent("el-button"); 55379 const _component_el_focus_trap = vue.resolveComponent("el-focus-trap"); 55380 const _component_el_overlay = vue.resolveComponent("el-overlay"); 55381 return vue.openBlock(), vue.createBlock(vue.Transition, { 55382 name: "fade-in-linear", 55383 onAfterLeave: _cache[11] || (_cache[11] = ($event) => _ctx.$emit("vanish")), 55384 persisted: "" 55385 }, { 55386 default: vue.withCtx(() => [ 55387 vue.withDirectives(vue.createVNode(_component_el_overlay, { 55388 "z-index": _ctx.zIndex, 55389 "overlay-class": [_ctx.ns.is("message-box"), _ctx.modalClass], 55390 mask: _ctx.modal 55391 }, { 55392 default: vue.withCtx(() => [ 55393 vue.createElementVNode("div", { 55394 role: "dialog", 55395 "aria-label": _ctx.title, 55396 "aria-modal": "true", 55397 "aria-describedby": !_ctx.showInput ? _ctx.contentId : void 0, 55398 class: vue.normalizeClass(`${_ctx.ns.namespace.value}-overlay-message-box`), 55399 onClick: _cache[8] || (_cache[8] = (...args) => _ctx.overlayEvent.onClick && _ctx.overlayEvent.onClick(...args)), 55400 onMousedown: _cache[9] || (_cache[9] = (...args) => _ctx.overlayEvent.onMousedown && _ctx.overlayEvent.onMousedown(...args)), 55401 onMouseup: _cache[10] || (_cache[10] = (...args) => _ctx.overlayEvent.onMouseup && _ctx.overlayEvent.onMouseup(...args)) 55402 }, [ 55403 vue.createVNode(_component_el_focus_trap, { 55404 loop: "", 55405 trapped: _ctx.visible, 55406 "focus-trap-el": _ctx.rootRef, 55407 "focus-start-el": _ctx.focusStartRef, 55408 onReleaseRequested: _ctx.onCloseRequested 55409 }, { 55410 default: vue.withCtx(() => [ 55411 vue.createElementVNode("div", { 55412 ref: "rootRef", 55413 class: vue.normalizeClass([ 55414 _ctx.ns.b(), 55415 _ctx.customClass, 55416 _ctx.ns.is("draggable", _ctx.draggable), 55417 { [_ctx.ns.m("center")]: _ctx.center } 55418 ]), 55419 style: vue.normalizeStyle(_ctx.customStyle), 55420 tabindex: "-1", 55421 onClick: _cache[7] || (_cache[7] = vue.withModifiers(() => { 55422 }, ["stop"])) 55423 }, [ 55424 _ctx.title !== null && _ctx.title !== void 0 ? (vue.openBlock(), vue.createElementBlock("div", { 55425 key: 0, 55426 ref: "headerRef", 55427 class: vue.normalizeClass(_ctx.ns.e("header")) 55428 }, [ 55429 vue.createElementVNode("div", { 55430 class: vue.normalizeClass(_ctx.ns.e("title")) 55431 }, [ 55432 _ctx.iconComponent && _ctx.center ? (vue.openBlock(), vue.createBlock(_component_el_icon, { 55433 key: 0, 55434 class: vue.normalizeClass([_ctx.ns.e("status"), _ctx.typeClass]) 55435 }, { 55436 default: vue.withCtx(() => [ 55437 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent))) 55438 ]), 55439 _: 1 55440 }, 8, ["class"])) : vue.createCommentVNode("v-if", true), 55441 vue.createElementVNode("span", null, vue.toDisplayString(_ctx.title), 1) 55442 ], 2), 55443 _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", { 55444 key: 0, 55445 type: "button", 55446 class: vue.normalizeClass(_ctx.ns.e("headerbtn")), 55447 "aria-label": _ctx.t("el.messagebox.close"), 55448 onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel")), 55449 onKeydown: _cache[1] || (_cache[1] = vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"), ["prevent"]), ["enter"])) 55450 }, [ 55451 vue.createVNode(_component_el_icon, { 55452 class: vue.normalizeClass(_ctx.ns.e("close")) 55453 }, { 55454 default: vue.withCtx(() => [ 55455 vue.createVNode(_component_close) 55456 ]), 55457 _: 1 55458 }, 8, ["class"]) 55459 ], 42, _hoisted_2$1)) : vue.createCommentVNode("v-if", true) 55460 ], 2)) : vue.createCommentVNode("v-if", true), 55461 vue.createElementVNode("div", { 55462 id: _ctx.contentId, 55463 class: vue.normalizeClass(_ctx.ns.e("content")) 55464 }, [ 55465 vue.createElementVNode("div", { 55466 class: vue.normalizeClass(_ctx.ns.e("container")) 55467 }, [ 55468 _ctx.iconComponent && !_ctx.center && _ctx.hasMessage ? (vue.openBlock(), vue.createBlock(_component_el_icon, { 55469 key: 0, 55470 class: vue.normalizeClass([_ctx.ns.e("status"), _ctx.typeClass]) 55471 }, { 55472 default: vue.withCtx(() => [ 55473 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent))) 55474 ]), 55475 _: 1 55476 }, 8, ["class"])) : vue.createCommentVNode("v-if", true), 55477 _ctx.hasMessage ? (vue.openBlock(), vue.createElementBlock("div", { 55478 key: 1, 55479 class: vue.normalizeClass(_ctx.ns.e("message")) 55480 }, [
55481 vue.renderSlot(_ctx.$slots, "default", {}, () => [ 55482 !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.showInput ? "label" : "p"), { 55483 key: 0, 55484 for: _ctx.showInput ? _ctx.inputId : void 0 55485 }, { 55486 default: vue.withCtx(() => [ 55487 vue.createTextVNode(vue.toDisplayString(!_ctx.dangerouslyUseHTMLString ? _ctx.message : ""), 1) 55488 ]), 55489 _: 1 55490 }, 8, ["for"])) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.showInput ? "label" : "p"), { 55491 key: 1, 55492 for: _ctx.showInput ? _ctx.inputId : void 0, 55493 innerHTML: _ctx.message 55494 }, null, 8, ["for", "innerHTML"])) 55495 ]) 55496 ], 2)) : vue.createCommentVNode("v-if", true) 55497 ], 2), 55498 vue.withDirectives(vue.createElementVNode("div", { 55499 class: vue.normalizeClass(_ctx.ns.e("input")) 55500 }, [ 55501 vue.createVNode(_component_el_input, { 55502 id: _ctx.inputId, 55503 ref: "inputRef", 55504 modelValue: _ctx.inputValue, 55505 "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.inputValue = $event), 55506 type: _ctx.inputType, 55507 placeholder: _ctx.inputPlaceholder, 55508 "aria-invalid": _ctx.validateError, 55509 class: vue.normalizeClass({ invalid: _ctx.validateError }), 55510 onKeydown: vue.withKeys(_ctx.handleInputEnter, ["enter"]) 55511 }, null, 8, ["id", "modelValue", "type", "placeholder", "aria-invalid", "class", "onKeydown"]), 55512 vue.createElementVNode("div", { 55513 class: vue.normalizeClass(_ctx.ns.e("errormsg")), 55514 style: vue.normalizeStyle({ 55515 visibility: !!_ctx.editorErrorMessage ? "visible" : "hidden" 55516 }) 55517 }, vue.toDisplayString(_ctx.editorErrorMessage), 7) 55518 ], 2), [ 55519 [vue.vShow, _ctx.showInput] 55520 ]) 55521 ], 10, _hoisted_3$1), 55522 vue.createElementVNode("div", { 55523 class: vue.normalizeClass(_ctx.ns.e("btns")) 55524 }, [ 55525 _ctx.showCancelButton ? (vue.openBlock(), vue.createBlock(_component_el_button, { 55526 key: 0, 55527 loading: _ctx.cancelButtonLoading, 55528 class: vue.normalizeClass([_ctx.cancelButtonClass]), 55529 round: _ctx.roundButton, 55530 size: _ctx.btnSize, 55531 onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleAction("cancel")), 55532 onKeydown: _cache[4] || (_cache[4] = vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction("cancel"), ["prevent"]), ["enter"])) 55533 }, { 55534 default: vue.withCtx(() => [ 55535 vue.createTextVNode(vue.toDisplayString(_ctx.cancelButtonText || _ctx.t("el.messagebox.cancel")), 1) 55536 ]), 55537 _: 1 55538 }, 8, ["loading", "class", "round", "size"])) : vue.createCommentVNode("v-if", true), 55539 vue.withDirectives(vue.createVNode(_component_el_button, { 55540 ref: "confirmRef", 55541 type: "primary", 55542 loading: _ctx.confirmButtonLoading, 55543 class: vue.normalizeClass([_ctx.confirmButtonClasse
55543s]), 55544 round: _ctx.roundButton, 55545 disabled: _ctx.confirmButtonDisabled, 55546 size: _ctx.btnSize, 55547 onClick: _cache[5] || (_cache[5] = ($event) => _ctx.handleAction("confirm")), 55548 onKeydown: _cache[6] || (_cache[6] = vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction("confirm"), ["prevent"]), ["enter"])) 55549 }, { 55550 default: vue.withCtx(() => [ 55551 vue.createTextVNode(vue.toDisplayString(_ctx.confirmButtonText || _ctx.t("el.messagebox.confirm")), 1) 55552 ]), 55553 _: 1 55554 }, 8, ["loading", "class", "round", "disabled", "size"]), [ 55555 [vue.vShow, _ctx.showConfirmButton] 55556 ]) 55557 ], 2) 55558 ], 6) 55559 ]), 55560 _: 3 55561 }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onReleaseRequested"]) 55562 ], 42, _hoisted_1$1) 55563 ]), 55564 _: 3 55565 }, 8, ["z-index", "overlay-class", "mask"]), [ 55566 [vue.vShow, _ctx.visible] 55567 ]) 55568 ]), 55569 _: 3 55570 }); 55571 } 55572 var MessageBoxConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "index.vue"]]); 55573 55574 const messageInstance = /* @__PURE__ */ new Map(); 55575 const getAppendToElement = (props) => { 55576 let appendTo = document.body; 55577 if (props.appendTo) { 55578 if (isString$1(props.appendTo)) { 55579 appendTo = document.querySelector(props.appendTo); 55580 } 55581 if (isElement$1(props.appendTo)) { 55582 appendTo = props.appendTo; 55583 } 55584 if (!isElement$1(appendTo)) { 55585 appendTo = document.body; 55586 } 55587 } 55588 return appendTo; 55589 }; 55590 const initInstance = (props, container, appContext = null) => { 55591 const vnode = vue.createVNode(MessageBoxConstructor, props, isFunction$1(props.message) || vue.isVNode(props.message) ? { 55592 default: isFunction$1(props.message) ? props.message : () => props.message 55593 } : null); 55594 vnode.appContext = appContext; 55595 vue.render(vnode, container); 55596 getAppendToElement(props).appendChild(container.firstElementChild); 55597 return vnode.component; 55598 }; 55599 const genContainer = () => { 55600 return document.createElement("div"); 55601 }; 55602 const showMessage = (options, appContext) => { 55603 const container = genContainer(); 55604 options.onVanish = () => { 55605 vue.render(null, container); 55606 messageInstance.delete(vm); 55607 }; 55608 options.onAction = (action) => { 55609 const currentMsg = messageInstance.get(vm); 55610 let resolve; 55611 if (options.showInput) { 55612 resolve = { value: vm.inputValue, action }; 55613 } else { 55614 resolve = action; 55615 } 55616 if (options.callback) { 55617 options.callback(resolve, instance.proxy); 55618 } else { 55619 if (action === "cancel" || action === "close") { 55620 if (options.distinguishCancelAndClose && action !== "cancel") { 55621 currentMsg.reject("close"); 55622 } else { 55623 currentMsg.reject("cancel"); 55624 } 55625 } else { 55626 currentMsg.resolve(resolve); 55627 } 55628 } 55629 }; 55630 const instance = initInstance(options, container, appContext); 55631 const vm = instance.proxy; 55632 for (const prop in options) { 55633 if (hasOwn(options, prop) && !hasOwn(vm.$props, prop)) { 55634 vm[prop] = options[prop]; 55635 } 55636 } 55637 vm.visible = true; 55638 return vm; 55639 }; 55640 function MessageBox(options, appContext = null) { 55641 if (!isClient) 55642 return Promise.reject(); 55643 let callback; 55644 if (isString$1(options) || vue.isVNode(options)) { 55645 options = { 55646 message: options 55647 }; 55648 } else { 55649 callback = options.callback; 55650 } 55651 return new Promise((resolve, reject) => { 55652 const vm = showMessage(options, appContext != null ? appContext : MessageBox._context); 55653 messageInstance.set(vm, { 55654 options, 55655 callback, 55656 resolve, 55657 reject 55658 }); 55659 }); 55660 }
55661 const MESSAGE_BOX_VARIANTS = ["alert", "confirm", "prompt"]; 55662 const MESSAGE_BOX_DEFAULT_OPTS = { 55663 alert: { closeOnPressEscape: false, closeOnClickModal: false }, 55664 confirm: { showCancelButton: true }, 55665 prompt: { showCancelButton: true, showInput: true } 55666 }; 55667 MESSAGE_BOX_VARIANTS.forEach((boxType) => { 55668 MessageBox[boxType] = messageBoxFactory(boxType); 55669 }); 55670 function messageBoxFactory(boxType) { 55671 return (message, title, options, appContext) => { 55672 let titleOrOpts = ""; 55673 if (isObject$1(title)) { 55674 options = title; 55675 titleOrOpts = ""; 55676 } else if (isUndefined(title)) { 55677 titleOrOpts = ""; 55678 } else { 55679 titleOrOpts = title; 55680 } 55681 return MessageBox(Object.assign({ 55682 title: titleOrOpts, 55683 message, 55684 type: "", 55685 ...MESSAGE_BOX_DEFAULT_OPTS[boxType] 55686 }, options, { 55687 boxType 55688 }), appContext); 55689 }; 55690 } 55691 MessageBox.close = () => { 55692 messageInstance.forEach((_, vm) => { 55693 vm.doClose(); 55694 }); 55695 messageInstance.clear(); 55696 }; 55697 MessageBox._context = null; 55698 55699 const _MessageBox = MessageBox; 55700 _MessageBox.install = (app) => { 55701 _MessageBox._context = app._context; 55702 app.config.globalProperties.$msgbox = _MessageBox; 55703 app.config.globalProperties.$messageBox = _MessageBox; 55704 app.config.globalProperties.$alert = _MessageBox.alert; 55705 app.config.globalProperties.$confirm = _MessageBox.confirm; 55706 app.config.globalProperties.$prompt = _MessageBox.prompt; 55707 }; 55708 const ElMessageBox = _MessageBox; 55709 55710 const notificationTypes = [ 55711 "success", 55712 "info", 55713 "warning", 55714 "error" 55715 ]; 55716 const notificationProps = buildProps({ 55717 customClass: { 55718 type: String, 55719 default: "" 55720 }, 55721 dangerouslyUseHTMLString: { 55722 type: Boolean, 55723 default: false 55724 }, 55725 duration: { 55726 type: Number, 55727 default: 4500 55728 }, 55729 icon: { 55730 type: iconPropType 55731 }, 55732 id: { 55733 type: String, 55734 default: "" 55735 }, 55736 message: { 55737 type: definePropType([String, Object]), 55738 default: "" 55739 }, 55740 offset: { 55741 type: Number, 55742 default: 0 55743 }, 55744 onClick: { 55745 type: definePropType(Function), 55746 default: () => void 0 55747 }, 55748 onClose: { 55749 type: definePropType(Function), 55750 required: true 55751 }, 55752 position: { 55753 type: String, 55754 values: ["top-right", "top-left", "bottom-right", "bottom-left"], 55755 default: "top-right" 55756 }, 55757 showClose: { 55758 type: Boolean, 55759 default: true 55760 }, 55761 title: { 55762 type: String, 55763 default: "" 55764 }, 55765 type: { 55766 type: String, 55767 values: [...notificationTypes, ""], 55768 default: "" 55769 }, 55770 zIndex: { 55771 type: Number, 55772 default: 0 55773 } 55774 }); 55775 const notificationEmits = { 55776 destroy: () => true 55777 }; 55778 55779 const _hoisted_1 = ["id"]; 55780 const _hoisted_2 = ["textContent"]; 55781 const _hoisted_3 = { key: 0 }; 55782 const _hoisted_4 = ["innerHTML"]; 55783 const __default__ = vue.defineComponent({ 55784 name: "ElNotification" 55785 }); 55786 const _sfc_main = /* @__PURE__ */ vue.defineComponent({ 55787 ...__default__, 55788 props: notificationProps, 55789 emits: notificationEmits, 55790 setup(__props, { expose }) { 55791 const props = __props; 55792 const { ns, zIndex } = useGlobalComponentSettings("notification"); 55793 const { nextZIndex, currentZIndex } = zIndex; 55794 const { Close } = CloseComponents; 55795 const visible = vue.ref(false); 55796 let timer = void 0; 55797 const typeClass = vue.computed(() => { 55798 const type = props.type; 55799 return type && TypeComponentsMap[props.type] ? ns.m(type) : ""; 55800 }); 55801 const iconComponent = vue.computed(() => { 55802 if (!props.type) 55803 return props.icon; 55804 return TypeComponentsMap[props.type] || props.icon; 55805 }); 55806 const horizontalClass = vue.computed(() => props.position.endsWith("right") ? "right" : "left"); 55807 const verticalProperty = vue.computed(() => props.position.startsWith("top") ? "top" : "bottom"); 55808 const positionStyle = vue.computed(() => { 55809 return { 55810 [verticalProperty.value]: `${props.offset}px`, 55811 zIndex: currentZIndex.value 55812 }; 55813 }); 55814 function startTimer() { 55815 if (props.duration > 0) { 55816 ({ stop: timer } = useTimeoutFn(() => { 55817 if (visible.value) 55818 close(); 55819 }, props.duration)); 55820 } 55821 } 55822 function clearTimer() { 55823 timer == null ? void 0 : timer(); 55824 } 55825 function close() { 55826 visible.value = false; 55827 } 55828 function onKeydown({ code }) { 55829 if (code === EVENT_CODE.delete || code === EVENT_CODE.backspace) { 55830 clearTimer(); 55831 } else if (code === EVENT_CODE.esc) { 55832 if (visible.value) { 55833 close(); 55834 } 55835 } else { 55836 startTimer(); 55837 } 55838 } 55839 vue.onMounted(() => { 55840 startTimer(); 55841 nextZIndex(); 55842 visible.value = true; 55843 }); 55844 useEventListener(document, "keydown", onKeydown); 55845 expose({ 55846 visible, 55847 close 55848 }); 55849 return (_ctx, _cache) => {
55850 return vue.openBlock(), vue.createBlock(vue.Transition, { 55851 name: vue.unref(ns).b("fade"), 55852 onBeforeLeave: _ctx.onClose, 55853 onAfterLeave: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("destroy")), 55854 persisted: "" 55855 }, { 55856 default: vue.withCtx(() => [ 55857 vue.withDirectives(vue.createElementVNode("div", { 55858 id: _ctx.id, 55859 class: vue.normalizeClass([vue.unref(ns).b(), _ctx.customClass, vue.unref(horizontalClass)]), 55860 style: vue.normalizeStyle(vue.unref(positionStyle)), 55861 role: "alert", 55862 onMouseenter: clearTimer, 55863 onMouseleave: startTimer, 55864 onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args)) 55865 }, [ 55866 vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 55867 key: 0, 55868 class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(typeClass)]) 55869 }, { 55870 default: vue.withCtx(() => [ 55871 (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent)))) 55872 ]), 55873 _: 1 55874 }, 8, ["class"])) : vue.createCommentVNode("v-if", true), 55875 vue.createElementVNode("div", { 55876 class: vue.normalizeClass(vue.unref(ns).e("group")) 55877 }, [ 55878 vue.createElementVNode("h2", { 55879 class: vue.normalizeClass(vue.unref(ns).e("title")), 55880 textContent: vue.toDisplayString(_ctx.title) 55881 }, null, 10, _hoisted_2), 55882 vue.withDirectives(vue.createElementVNode("div", { 55883 class: vue.normalizeClass(vue.unref(ns).e("content")), 55884 style: vue.normalizeStyle(!!_ctx.title ? void 0 : { margin: 0 }) 55885 }, [ 55886 vue.renderSlot(_ctx.$slots, "default", {}, () => [ 55887 !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_3, vue.toDisplayString(_ctx.message), 1)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [ 55888 vue.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "), 55889 vue.createElementVNode("p", { innerHTML: _ctx.message }, null, 8, _hoisted_4) 55890 ], 2112)) 55891 ]) 55892 ], 6), [ 55893 [vue.vShow, _ctx.message] 55894 ]), 55895 _ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { 55896 key: 0, 55897 class: vue.normalizeClass(vue.unref(ns).e("closeBtn")), 55898 onClick: vue.withModifiers(close, ["stop"]) 55899 }, { 55900 default: vue.withCtx(() => [ 55901 vue.createVNode(vue.unref(Close)) 55902 ]), 55903 _: 1 55904 }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true) 55905 ], 2) 55906 ], 46, _hoisted_1), [ 55907 [vue.vShow, visible.value] 55908 ]) 55909 ]), 55910 _: 3 55911 }, 8, ["name", "onBeforeLeave"]); 55912 }; 55913 } 55914 }); 55915 var NotificationConstructor = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "notification.vue"]]); 55916 55917 const notifications = { 55918 "top-left": [], 55919 "top-right": [], 55920 "bottom-left": [], 55921 "bottom-right": [] 55922 }; 55923 const GAP_SIZE = 16; 55924 let seed = 1; 55925 const notify = function(options = {}, context = null) { 55926 if (!isClient) 55927 return { close: () => void 0 }; 55928 if (typeof options === "string" || vue.isVNode(options)) { 55929 options = { message: options }; 55930 } 55931 const position = options.position || "top-right"; 55932 let verticalOffset = options.offset || 0;
55933 notifications[position].forEach(({ vm: vm2 }) => { 55934 var _a; 55935 verticalOffset += (((_a = vm2.el) == null ? void 0 : _a.offsetHeight) || 0) + GAP_SIZE; 55936 }); 55937 verticalOffset += GAP_SIZE; 55938 const id = `notification_${seed++}`; 55939 const userOnClose = options.onClose; 55940 const props = { 55941 ...options, 55942 offset: verticalOffset, 55943 id, 55944 onClose: () => { 55945 close(id, position, userOnClose); 55946 } 55947 }; 55948 let appendTo = document.body; 55949 if (isElement$1(options.appendTo)) { 55950 appendTo = options.appendTo; 55951 } else if (isString$1(options.appendTo)) { 55952 appendTo = document.querySelector(options.appendTo); 55953 } 55954 if (!isElement$1(appendTo)) { 55955 appendTo = document.body; 55956 } 55957 const container = document.createElement("div"); 55958 const vm = vue.createVNode(NotificationConstructor, props, vue.isVNode(props.message) ? { 55959 default: () => props.message 55960 } : null); 55961 vm.appContext = context != null ? context : notify._context; 55962 vm.props.onDestroy = () => { 55963 vue.render(null, container); 55964 }; 55965 vue.render(vm, container); 55966 notifications[position].push({ vm });
55967 appendTo.appendChild(container.firstElementChild); 55968 return { 55969 close: () => { 55970 vm.component.exposed.visible.value = false; 55971 } 55972 }; 55973 }; 55974 notificationTypes.forEach((type) => { 55975 notify[type] = (options = {}) => { 55976 if (typeof options === "string" || vue.isVNode(options)) { 55977 options = { 55978 message: options 55979 }; 55980 } 55981 return notify({ 55982 ...options, 55983 type 55984 }); 55985 }; 55986 }); 55987 function close(id, position, userOnClose) { 55988 const orientedNotifications = notifications[position]; 55989 const idx = orientedNotifications.findIndex(({ vm: vm2 }) => { 55990 var _a; 55991 return ((_a = vm2.component) == null ? void 0 : _a.props.id) === id; 55992 }); 55993 if (idx === -1) 55994 return; 55995 const { vm } = orientedNotifications[idx]; 55996 if (!vm) 55997 return; 55998 userOnClose == null ? void 0 : userOnClose(vm); 55999 const removedHeight = vm.el.offsetHeight; 56000 const verticalPos = position.split("-")[0]; 56001 orientedNotifications.splice(idx, 1); 56002 const len = orientedNotifications.length; 56003 if (len < 1) 56004 return; 56005 for (let i = idx; i < len; i++) { 56006 const { el, component } = orientedNotifications[i].vm; 56007 const pos = Number.parseInt(el.style[verticalPos], 10) - removedHeight - GAP_SIZE; 56008 component.props.offset = pos; 56009 } 56010 } 56011 function closeAll() { 56012 for (const orientedNotifications of Object.values(notifications)) { 56013 orientedNotifications.forEach(({ vm }) => { 56014 vm.component.exposed.visible.value = false; 56015 }); 56016 } 56017 } 56018 notify.closeAll = closeAll; 56019 notify._context = null; 56020 var Notify = notify; 56021 56022 const ElNotification = withInstallFunction(Notify, "$notify"); 56023 56024 var Plugins = [ 56025 ElInfiniteScroll, 56026 ElLoading, 56027 ElMessage, 56028 ElMessageBox, 56029 ElNotification, 56030 ElPopoverDirective 56031 ]; 56032 56033 var installer = makeInstaller([...Components, ...Plugins]); 56034 56035 const install = installer.install; 56036 const version = installer.version; 56037 56038 exports.BAR_MAP = BAR_MAP; 56039 exports.CASCADER_PANEL_INJECTION_KEY = CASCADER_PANEL_INJECTION_KEY; 56040 exports.CHANGE_EVENT = CHANGE_EVENT; 56041 exports.ClickOutside = ClickOutside; 56042 exports.CommonPicker = CommonPicker; 56043 exports.CommonProps = CommonProps; 56044 exports.DEFAULT_FORMATS_DATE = DEFAULT_FORMATS_DATE; 56045 exports.DEFAULT_FORMATS_DATEPICKER = DEFAULT_FORMATS_DATEPICKER; 56046 exports.DEFAULT_FORMATS_TIME = DEFAULT_FORMATS_TIME; 56047 exports.DROPDOWN_COLLECTION_INJECTION_KEY = COLLECTION_INJECTION_KEY; 56048 exports.DROPDOWN_COLLECTION_ITEM_INJECTION_KEY = COLLECTION_ITEM_INJECTION_KEY; 56049 exports.DROPDOWN_INJECTION_KEY = DROPDOWN_INJECTION_KEY; 56050 exports.DefaultProps = DefaultProps; 56051 exports.DynamicSizeGrid = DynamicSizeGrid$1; 56052 exports.DynamicSizeList = DynamicSizeList$1; 56053 exports.EVENT_CODE = EVENT_CODE; 56054 exports.Effect = Effect; 56055 exports.ElAffix = ElAffix; 56056 exports.ElAlert = ElAlert; 56057 exports.ElAside = ElAside; 56058 exports.ElAutoResizer = ElAutoResizer; 56059 exports.ElAutocomplete = ElAutocomplete; 56060 exports.ElAvatar = ElAvatar; 56061 exports.ElBacktop = ElBacktop; 56062 exports.ElBadge = ElBadge; 56063 exports.ElBreadcrumb = ElBreadcrumb; 56064 exports.ElBreadcrumbItem = ElBreadcrumbItem; 56065 exports.ElButton = ElButton; 56066 exports.ElButtonGroup = ElButtonGroup$1; 56067 exports.ElCalendar = ElCalendar; 56068 exports.ElCard = ElCard; 56069 exports.ElCarousel = ElCarousel; 56070 exports.ElCarouselItem = ElCarouselItem; 56071 exports.ElCascader = ElCascader; 56072 exports.ElCascaderPanel = ElCascaderPanel; 56073 exports.ElCheckTag = ElCheckTag; 56074 exports.ElCheckbox = ElCheckbox; 56075 exports.ElCheckboxButton = ElCheckboxButton; 56076 exports.ElCheckboxGroup = ElCheckboxGroup$1; 56077 exports.ElCol = ElCol; 56078 exports.ElCollapse = ElCollapse; 56079 exports.ElCollapseItem = ElCollapseItem; 56080 exports.ElCollapseTransition = ElCollapseTransition; 56081 exports.ElCollection = ElCollection; 56082 exports.ElCollectionItem = ElCollectionItem; 56083 exports.ElColorPicker = ElColorPicker; 56084 exports.ElConfigProvider = ElConfigProvider; 56085 exports.ElContainer = ElContainer; 56086 exports.ElCountdown = ElCountdown; 56087 exports.ElDatePicker = ElDatePicker; 56088 exports.ElDescriptions = ElDescriptions; 56089 exports.ElDescriptionsItem = ElDescriptionsItem; 56090 exports.ElDialog = ElDialog; 56091 exports.ElDivider = ElDivider; 56092 exports.ElDrawer = ElDrawer; 56093 exports.ElDropdown = ElDropdown; 56094 exports.ElDropdownItem = ElDropdownItem; 56095 exports.ElDropdownMenu = ElDropdownMenu; 56096 exports.ElEmpty = ElEmpty; 56097 exports.ElFooter = ElFooter; 56098 exports.ElForm = ElForm; 56099 exports.ElFormItem = ElFormItem; 56100 exports.ElHeader = ElHeader; 56101 exports.ElIcon = ElIcon; 56102 exports.ElImage = ElImage; 56103 exports.ElImageViewer = ElImageViewer; 56104 exports.ElInfiniteScroll = ElInfiniteScroll; 56105 exports.ElInput = ElInput; 56106 exports.ElInputNumber = ElInputNumber; 56107 exports.ElLink = ElLink; 56108 exports.ElLoading = ElLoading; 56109 exports.ElLoadingDirective = vLoading; 56110 exports.ElLoadingService = Loading; 56111 exports.ElMain = ElMain; 56112 exports.ElMenu = ElMenu; 56113 exports.ElMenuItem = ElMenuItem; 56114 exports.ElMenuItemGroup = ElMenuItemGroup; 56115 exports.ElMessage = ElMessage; 56116 exports.ElMessageBox = ElMessageBox; 56117 exports.ElNotification = ElNotification; 56118 exports.ElOption = ElOption; 56119 exports.ElOptionGroup = ElOptionGroup; 56120 exports.ElOverlay = ElOverlay; 56121 exports.ElPageHeader = ElPageHeader; 56122 exports.ElPagination = ElPagination; 56123 exports.ElPopconfirm = ElPopconfirm; 56124 exports.ElPopover = ElPopover; 56125 exports.ElPopoverDirective = ElPopoverDirective; 56126 exports.ElPopper = ElPopper; 56127 exports.ElPopperArrow = ElPopperArrow; 56128 exports.ElPopperContent = ElPopperContent; 56129 exports.ElPopperTrigger = ElPopperTrigger; 56130 exports.ElProgress = ElProgress; 56131 exports.ElRadio = ElRadio; 56132 exports.ElRadioButton = ElRadioButton; 56133 exports.ElRadioGroup = ElRadioGroup; 56134 exports.ElRate = ElRate; 56135 exports.ElResult = ElResult; 56136 exports.ElRow = ElRow; 56137 exports.ElScrollbar = ElScrollbar; 56138 exports.ElSelect = ElSelect; 56139 exports.ElSelectV2 = ElSelectV2; 56140 exports.ElSkeleton = ElSkeleton; 56141 exports.ElSkeletonItem = ElSkeletonItem; 56142 exports.ElSlider = ElSlider; 56143 exports.ElSpace = ElSpace; 56144 exports.ElStatistic = ElStatistic; 56145 exports.ElStep = ElStep; 56146 exports.ElSteps = ElSteps; 56147 exports.ElSubMenu = ElSubMenu; 56148 exports.ElSwitch = ElSwitch; 56149 exports.ElTabPane = ElTabPane; 56150 exports.ElTable = ElTable; 56151 exports.ElTableColumn = ElTableColumn; 56152 exports.ElTableV2 = ElTableV2; 56153 exports.ElTabs = ElTabs; 56154 exports.ElTag = ElTag; 56155 exports.ElText = ElText; 56156 exports.ElTimePicker = ElTimePicker; 56157 exports.ElTimeSelect = ElTimeSelect; 56158 exports.ElTimeline = ElTimeline; 56159 exports.ElTimelineItem = ElTimelineItem; 56160 exports.ElTooltip = ElTooltip; 56161 exports.ElTransfer = ElTransfer; 56162 exports.ElTree = ElTree; 56163 exports.ElTreeSelect = ElTreeSelect; 56164 exports.ElTreeV2 = ElTreeV2; 56165 exports.ElUpload = ElUpload; 56166 exports.FIRST_KEYS = FIRST_KEYS; 56167 exports.FIRST_LAST_KEYS = FIRST_LAST_KEYS;
56168 exports.FORWARD_REF_INJECTION_KEY = FORWARD_REF_INJECTION_KEY; 56169 exports.FixedSizeGrid = FixedSizeGrid$1; 56170 exports.FixedSizeList = FixedSizeList$1; 56171 exports.GAP = GAP; 56172 exports.ID_INJECTION_KEY = ID_INJECTION_KEY; 56173 exports.INPUT_EVENT = INPUT_EVENT; 56174 exports.INSTALLED_KEY = INSTALLED_KEY; 56175 exports.IconComponentMap = IconComponentMap; 56176 exports.IconMap = IconMap; 56177 exports.LAST_KEYS = LAST_KEYS; 56178 exports.LEFT_CHECK_CHANGE_EVENT = LEFT_CHECK_CHANGE_EVENT; 56179 exports.Mousewheel = Mousewheel; 56180 exports.POPPER_CONTENT_INJECTION_KEY = POPPER_CONTENT_INJECTION_KEY; 56181 exports.POPPER_INJECTION_KEY = POPPER_INJECTION_KEY; 56182 exports.RIGHT_CHECK_CHANGE_EVENT = RIGHT_CHECK_CHANGE_EVENT; 56183 exports.ROOT_PICKER_INJECTION_KEY = ROOT_PICKER_INJECTION_KEY; 56184 exports.RowAlign = RowAlign; 56185 exports.RowJustify = RowJustify; 56186 exports.SIZE_INJECTION_KEY = SIZE_INJECTION_KEY; 56187 exports.TOOLTIP_INJECTION_KEY = TOOLTIP_INJECTION_KEY; 56188 exports.TableV2 = TableV2$1; 56189 exports.TableV2Alignment = Alignment; 56190 exports.TableV2FixedDir = FixedDir; 56191 exports.TableV2Placeholder = placeholderSign; 56192 exports.TableV2SortOrder = SortOrder; 56193 exports.TimePickPanel = TimePickPanel; 56194 exports.TrapFocus = TrapFocus; 56195 exports.UPDATE_MODEL_EVENT = UPDATE_MODEL_EVENT; 56196 exports.WEEK_DAYS = WEEK_DAYS; 56197 exports.affixEmits = affixEmits; 56198 exports.affixProps = affixProps; 56199 exports.alertEffects = alertEffects; 56200 exports.alertEmits = alertEmits; 56201 exports.alertProps = alertProps; 56202 exports.arrowMiddleware = arrowMiddleware; 56203 exports.autoResizerProps = autoResizerProps; 56204 exports.autocompleteEmits = autocompleteEmits; 56205 exports.autocompleteProps = autocompleteProps; 56206 exports.avatarEmits = avatarEmits; 56207 exports.avatarProps = avatarProps; 56208 exports.backtopEmits = backtopEmits; 56209 exports.backtopProps = backtopProps; 56210 exports.badgeProps = badgeProps; 56211 exports.breadcrumbItemProps = breadcrumbItemProps; 56212 exports.breadcrumbKey = breadcrumbKey; 56213 exports.breadcrumbProps = breadcrumbProps; 56214 exports.buildLocaleContext = buildLocaleContext; 56215 exports.buildTimeList = buildTimeList; 56216 exports.buildTranslator = buildTranslator; 56217 exports.buttonEmits = buttonEmits; 56218 exports.buttonGroupContextKey = buttonGroupContextKey; 56219 exports.buttonNativeTypes = buttonNativeTypes; 56220 exports.buttonProps = buttonProps; 56221 exports.buttonTypes = buttonTypes; 56222 exports.calendarEmits = calendarEmits; 56223 exports.calendarProps = calendarProps; 56224 exports.cardProps = cardProps; 56225 exports.carouselContextKey = carouselContextKey; 56226 exports.carouselEmits = carouselEmits; 56227 exports.carouselItemProps = carouselItemProps; 56228 exports.carouselProps = carouselProps; 56229 exports.cascaderEmits = cascaderEmits; 56230 exports.cascaderProps = cascaderProps; 56231 exports.checkTagEmits = checkTagEmits; 56232 exports.checkTagProps = checkTagProps; 56233 exports.checkboxEmits = checkboxEmits; 56234 exports.checkboxGroupContextKey = checkboxGroupContextKey; 56235 exports.checkboxGroupEmits = checkboxGroupEmits; 56236 exports.checkboxGroupProps = checkboxGroupProps; 56237 exports.checkboxProps = checkboxProps; 56238 exports.colProps = colProps; 56239 exports.collapseContextKey = collapseContextKey; 56240 exports.collapseEmits = collapseEmits; 56241 exports.collapseItemProps = collapseItemProps; 56242 exports.collapseProps = collapseProps; 56243 exports.colorPickerContextKey = colorPickerContextKey; 56244 exports.colorPickerEmits = colorPickerEmits; 56245 exports.colorPickerProps = colorPickerProps; 56246 exports.componentSizeMap = componentSizeMap; 56247 exports.componentSizes = componentSizes; 56248 exports.configProviderContextKey = configProviderContextKey; 56249 exports.configProviderProps = configProviderProps; 56250 exports.countdownEmits = countdownEmits; 56251 exports.countdownProps = countdownProps; 56252 exports.createModelToggleComposable = createModelToggleComposable; 56253 exports.dateEquals = dateEquals; 56254 exports.datePickTypes = datePickTypes; 56255 exports.datePickerProps = datePickerProps; 56256 exports.dayjs = dayjs; 56257 exports["default"] = installer; 56258 exports.defaultInitialZIndex = defaultInitialZIndex; 56259 exports.defaultNamespace = defaultNamespace; 56260 exports.descriptionProps = descriptionProps; 56261 exports.dialogEmits = dialogEmits; 56262 exports.dialogInjectionKey = dialogInjectionKey; 56263 exports.dialogProps = dialogProps; 56264 exports.dividerProps = dividerProps; 56265 exports.drawerEmits = drawerEmits; 56266 exports.drawerProps = drawerProps; 56267 exports.dropdownItemProps = dropdownItemProps; 56268 exports.dropdownMenuProps = dropdownMenuProps; 56269 exports.dropdownProps = dropdownProps; 56270 exports.elPaginationKey = elPaginationKey; 56271 exports.emitChangeFn = emitChangeFn; 56272 exports.emptyProps = emptyProps; 56273 exports.extractDateFormat = extractDateFormat; 56274 exports.extractTimeFormat = extractTimeFormat; 56275 exports.formContextKey = formContextKey; 56276 exports.formEmits = formEmits; 56277 exports.formItemContextKey = formItemContextKey; 56278 exports.formItemProps = formItemProps; 56279 exports.formItemValidateStates = formItemValidateStates; 56280 exports.formProps = formProps; 56281 exports.formatter = formatter; 56282 exports.genFileId = genFileId; 56283 exports.getPositionDataWithUnit = getPositionDataWithUnit; 56284 exports.iconProps = iconProps; 56285 exports.imageEmits = imageEmits; 56286 exports.imageProps = imageProps; 56287 exports.imageViewerEmits = imageViewerEmits; 56288 exports.imageViewerProps = imageViewerProps; 56289 exports.inputEmits = inputEmits; 56290 exports.inputNumberEmits = inputNumberEmits; 56291 exports.inputNumberProps = inputNumberProps; 56292 exports.inputProps = inputProps; 56293 exports.install = install; 56294 exports.linkEmits = linkEmits; 56295 exports.linkProps = linkProps; 56296 exports.localeContextKey = localeContextKey; 56297 exports.makeInstaller = makeInstaller; 56298 exports.makeList = makeList; 56299 exports.menuEmits = menuEmits; 56300 exports.menuItemEmits = menuItemEmits; 56301 exports.menuItemGroupProps = menuItemGroupProps; 56302 exports.menuItemProps = menuItemProps; 56303 exports.menuProps = menuProps; 56304 exports.messageConfig = messageConfig; 56305 exports.messageDefaults = messageDefaults; 56306 exports.messageEmits = messageEmits; 56307 exports.messageProps = messageProps; 56308 exports.messageTypes = messageTypes; 56309 exports.namespaceContextKey = namespaceContextKey; 56310 exports.notificationEmits = notificationEmits; 56311 exports.notificationProps = notificationProps; 56312 exports.notificationTypes = notificationTypes; 56313 exports.overlayEmits = overlayEmits; 56314 exports.overlayProps = overlayProps; 56315 exports.pageHeaderEmits = pageHeaderEmits; 56316 exports.pageHeaderProps = pageHeaderProps; 56317 exports.paginationEmits = paginationEmits; 56318 exports.paginationProps = paginationProps; 56319 exports.parseDate = parseDate; 56320 exports.popconfirmEmits = popconfirmEmits; 56321 exports.popconfirmProps = popconfirmProps; 56322 exports.popoverEmits = popoverEmits; 56323 exports.popoverProps = popoverProps; 56324 exports.popperArrowProps = popperArrowProps; 56325 exports.popperContentEmits = popperContentEmits; 56326 exports.popperContentProps = popperContentProps; 56327 exports.popperCoreConfigProps = popperCoreConfigProps; 56328 exports.popperProps = popperProps; 56329 exports.popperTriggerProps = popperTriggerProps; 56330 exports.progressProps = progressProps; 56331 exports.provideGlobalConfig = provideGlobalConfig; 56332 exports.radioButtonProps = radioButtonProps; 56333 exports.radioEmits = radioEmits; 56334 exports.radioGroupEmits = radioGroupEmits; 56335 exports.radioGroupKey = radioGroupKey; 56336 exports.radioGroupProps = radioGroupProps; 56337 exports.radioProps = radioProps; 56338 exports.radioPropsBase = radioPropsBase; 56339 exports.rangeArr = rangeArr; 56340 exports.rateEmits = rateEmits; 56341 exports.rateProps = rateProps; 56342 exports.renderThumbStyle = renderThumbStyle$1; 56343 exports.resultProps = resultProps; 56344 exports.roleTypes = roleTypes; 56345 exports.rowContextKey = rowContextKey; 56346 exports.rowProps = rowProps; 56347 exports.scrollbarContextKey = scrollbarContextKey; 56348 exports.scrollbarEmits = scrollbarEmits; 56349 exports.scrollbarProps = scrollbarProps; 56350 exports.selectGroupKey = selectGroupKey; 56351 exports.selectKey = selectKey; 56352 exports.selectV2InjectionKey = selectV2InjectionKey; 56353 exports.skeletonItemProps = skeletonItemProps; 56354 exports.skeletonProps = skeletonProps; 56355 exports.sliderContextKey = sliderContextKey; 56356 exports.sliderEmits = sliderEmits; 56357 exports.sliderProps = sliderProps; 56358 exports.spaceProps = spaceProps; 56359 exports.statisticProps = statisticProps; 56360 exports.stepProps = stepProps; 56361 exports.stepsEmits = stepsEmits; 56362 exports.stepsProps = stepsProps; 56363 exports.subMenuProps = subMenuProps; 56364 exports.switchEmits = switchEmits; 56365 exports.switchProps = switchProps; 56366 exports.tabBarProps = tabBarProps; 56367 exports.tabNavEmits = tabNavEmits; 56368 exports.tabNavProps = tabNavProps; 56369 exports.tabPaneProps = tabPaneProps; 56370 exports.tableV2Props = tableV2Props; 56371 exports.tableV2RowProps = tableV2RowProps; 56372 exports.tabsEmits = tabsEmits; 56373 exports.tabsProps = tabsProps; 56374 exports.tabsRootContextKey = tabsRootContextKey; 56375 exports.tagEmits = tagEmits; 56376 exports.tagProps = tagProps; 56377 exports.textProps = textProps; 56378 exports.thumbProps = thumbProps; 56379 exports.timePickerDefaultProps = timePickerDefaultProps; 56380 exports.timeUnits = timeUnits$1; 56381 exports.timelineItemProps = timelineItemProps; 56382 exports.tooltipEmits = tooltipEmits; 56383 exports.transferCheckedChangeFn = transferCheckedChangeFn; 56384 exports.transferEmits = transferEmits; 56385 exports.transferProps = transferProps; 56386 exports.translate = translate; 56387 exports.uploadBaseProps = uploadBaseProps; 56388 exports.uploadContentProps = uploadContentProps; 56389 exports.uploadContextKey = uploadContextKey; 56390 exports.uploadDraggerEmits = uploadDraggerEmits; 56391 exports.uploadDraggerProps = uploadDraggerProps; 56392 exports.uploadListEmits = uploadListEmits; 56393 exports.uploadListProps = uploadListProps; 56394 exports.uploadListTypes = uploadListTypes; 56395 exports.uploadProps = uploadProps; 56396 exports.useAttrs = useAttrs; 56397 exports.useCascaderConfig = useCascaderConfig; 56398 exports.useCursor = useCursor; 56399 exports.useDelayedRender = useDelayedRender; 56400 exports.useDelayedToggle = useDelayedToggle; 56401 exports.useDelayedToggleProps = useDelayedToggleProps; 56402 exports.useDeprecated = useDeprecated; 56403 exports.useDialog = useDialog; 56404 exports.useDisabled = useDisabled; 56405 exports.useDraggable = useDraggable;
56406 exports.useEscapeKeydown = useEscapeKeydown; 56407 exports.useFloating = useFloating; 56408 exports.useFloatingProps = useFloatingProps; 56409 exports.useFocus = useFocus; 56410 exports.useFormDisabled = useFormDisabled; 56411 exports.useFormItem = useFormItem; 56412 exports.useFormItemInputId = useFormItemInputId; 56413 exports.useFormSize = useFormSize; 56414 exports.useForwardRef = useForwardRef; 56415 exports.useForwardRefDirective = useForwardRefDirective; 56416 exports.useGetDerivedNamespace = useGetDerivedNamespace; 56417 exports.useGlobalComponentSettings = useGlobalComponentSettings; 56418 exports.useGlobalConfig = useGlobalConfig; 56419 exports.useGlobalSize = useGlobalSize; 56420 exports.useId = useId; 56421 exports.useIdInjection = useIdInjection; 56422 exports.useLocale = useLocale; 56423 exports.useLockscreen = useLockscreen; 56424 exports.useModal = useModal; 56425 exports.useModelToggle = useModelToggle; 56426 exports.useModelToggleEmits = useModelToggleEmits; 56427 exports.useModelToggleProps = useModelToggleProps; 56428 exports.useNamespace = useNamespace; 56429 exports.useOrderedChildren = useOrderedChildren; 56430 exports.usePopper = usePopper; 56431 exports.usePopperArrowProps = usePopperArrowProps; 56432 exports.usePopperContainer = usePopperContainer; 56433 exports.usePopperContainerId = usePopperContainerId; 56434 exports.usePopperContentEmits = usePopperContentEmits; 56435 exports.usePopperContentProps = usePopperContentProps; 56436 exports.usePopperCoreConfigProps = usePopperCoreConfigProps; 56437 exports.usePopperProps = usePopperProps; 56438 exports.usePopperTriggerProps = usePopperTriggerProps; 56439 exports.usePreventGlobal = usePreventGlobal; 56440 exports.useProp = useProp; 56441 exports.useRestoreActive = useRestoreActive; 56442 exports.useSameTarget = useSameTarget; 56443 exports.useSize = useSize; 56444 exports.useSizeProp = useSizeProp; 56445 exports.useSizeProps = useSizeProps; 56446 exports.useSpace = useSpace; 56447 exports.useTeleport = useTeleport; 56448 exports.useThrottleRender = useThrottleRender; 56449 exports.useTimeout = useTimeout; 56450 exports.useTooltipContentProps = useTooltipContentProps; 56451 exports.useTooltipModelToggle = useTooltipModelToggle; 56452 exports.useTooltipModelToggleEmits = useTooltipModelToggleEmits; 56453 exports.useTooltipModelToggleProps = useTooltipModelToggleProps; 56454 exports.useTooltipProps = useTooltipProps; 56455 exports.useTooltipTriggerProps = useTooltipTriggerProps; 56456 exports.useTransitionFallthrough = useTransitionFallthrough; 56457 exports.useTransitionFallthroughEmits = useTransitionFallthroughEmits; 56458 exports.useZIndex = useZIndex; 56459 exports.vLoading = vLoading; 56460 exports.vRepeatClick = vRepeatClick; 56461 exports.valueEquals = valueEquals; 56462 exports.version = version; 56463 exports.virtualizedGridProps = virtualizedGridProps; 56464 exports.virtualizedListProps = virtualizedListProps; 56465 exports.virtualizedProps = virtualizedProps; 56466 exports.virtualizedScrollbarProps = virtualizedScrollbarProps; 56467 exports.zIndexContextKey = zIndexContextKey; 56468 56469 Object.defineProperty(exports, '__esModule', { value: true }); 56470 56471 })); 56472
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.