UNPKG

@ctsy/layui-vue

Version:

a component library for Vue 3 base on layui-vue

1,582 lines 1.54 MB
var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; var __getOwnPropDescs = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) { if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); import { defineComponent, computed, openBlock, createElementBlock, normalizeStyle, unref, createCommentVNode, toDisplayString as toDisplayString$1, useSlots, ref, watch, createVNode, Transition, withCtx, normalizeClass, createBlock, createElementVNode, Fragment, renderSlot, createTextVNode, renderList, h, render as render$1, nextTick, isVNode, getCurrentInstance, inject, onMounted, onUnmounted, shallowRef, onBeforeMount, isRef, Text, onBeforeUnmount, withDirectives, withModifiers, vShow, resolveComponent as resolveComponent$1, provide, getCurrentScope, onScopeDispose, customRef, onUpdated, reactive, toRefs, vModelText, vModelSelect, withKeys, toRef, Teleport, normalizeProps, mergeProps, toHandlers } from "vue"; var index$T = ""; var index$S = ""; var index$R = ""; function ownKeys$2(object4, enumerableOnly) { var keys2 = Object.keys(object4); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object4); enumerableOnly && (symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object4, sym).enumerable; })), keys2.push.apply(keys2, symbols); } return keys2; } function _objectSpread2$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), true).forEach(function(key) { _defineProperty$2(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function(key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } function _defineProperty$2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toConsumableArray$1(arr) { return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$1(); } function _arrayWithoutHoles$1(arr) { if (Array.isArray(arr)) return _arrayLikeToArray$1(arr); } function _iterableToArray$1(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); } function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _nonIterableSpread$1() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var __default__$4$2 = { name: "Shade" }; var _sfc_main$5$1 = /* @__PURE__ */ defineComponent(_objectSpread2$2(_objectSpread2$2({}, __default__$4$2), {}, { props: { index: null, opacity: null, visible: { type: Boolean } }, emits: ["shadeClick"], setup: function setup(__props, _ref) { var emit = _ref.emit; var props = __props; var styles = computed(function() { return { opacity: props.opacity, zIndex: props.index }; }); var shadeClick = function shadeClick2() { emit("shadeClick"); }; return function(_ctx, _cache) { return __props.visible ? (openBlock(), createElementBlock("div", { key: 0, class: "layui-layer-shade", style: normalizeStyle(unref(styles)), onClick: shadeClick }, null, 4)) : createCommentVNode("", true); }; } })); var _hoisted_1$3$1 = ["src"]; var __default__$3$2 = { name: "Iframe" }; var _sfc_main$4$1 = /* @__PURE__ */ defineComponent(_objectSpread2$2(_objectSpread2$2({}, __default__$3$2), {}, { props: { src: null }, setup: function setup2(__props) { return function(_ctx, _cache) { return openBlock(), createElementBlock("iframe", { scrolling: "auto", class: "layui-layer-iframe", allowtransparency: "true", frameborder: "0", src: __props.src }, null, 8, _hoisted_1$3$1); }; } })); var _hoisted_1$2$1 = { class: "layui-layer-title", style: { "cursor": "move" } }; var __default__$2$2 = { name: "Title" }; var _sfc_main$3$1 = /* @__PURE__ */ defineComponent(_objectSpread2$2(_objectSpread2$2({}, __default__$2$2), {}, { props: { title: null }, setup: function setup3(__props) { var renderContent = function renderContent2(content) { if (typeof content === "function") { return content(); } return content; }; return function(_ctx, _cache) { return openBlock(), createElementBlock("div", _hoisted_1$2$1, toDisplayString$1(renderContent(__props.title)), 1); }; } })); var __default__$1$2 = { name: "CloseBtn" }; var _sfc_main$2$1 = /* @__PURE__ */ defineComponent(_objectSpread2$2(_objectSpread2$2({}, __default__$1$2), {}, { emits: ["closeHandle"], setup: function setup4(__props, _ref) { var emit = _ref.emit; var closeHandle = function closeHandle2() { emit("closeHandle"); }; return function(_ctx, _cache) { return openBlock(), createElementBlock("a", { class: "layui-layer-ico layui-layer-close layui-layer-close1", href: "javascript:;", onClick: closeHandle }); }; } })); var _export_sfc$1 = (sfc, props) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props) { target[key] = val; } return target; }; var _sfc_main$1$1 = { name: "Resize" }; var _hoisted_1$1$1 = { class: "layui-layer-resize" }; function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("span", _hoisted_1$1$1); } var Resize = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$1, [["render", _sfc_render$7]]); function nextId() { var s = []; var hexDigits = "0123456789abcdef"; for (var i = 0; i < 36; i++) { s[i] = hexDigits.substr(Math.floor(Math.random() * 16), 1); } s[14] = "4"; s[19] = hexDigits.substr(s[19] & 3 | 8, 1); s[8] = s[13] = s[18] = s[23] = "-"; var uuid = s.join(""); return uuid; } function calculateArea(type4, area, offset2) { return type4 != "drawer" ? calculateBaseArea(area) : calculateDrawerArea(offset2, area); } function calculateBaseArea(area) { if (area === "auto") { return []; } if (typeof area == "string") { return [area]; } return _toConsumableArray$1(area); } function calculateDrawerArea(offset2) { var drawerArea = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "30%"; if (drawerArea instanceof Array) { return drawerArea; } if (drawerArea === "auto") { drawerArea = "30%"; } if (offset2 === "l" || offset2 === "r") { return [drawerArea, "100%"]; } else if (offset2 === "t" || offset2 === "b") { return ["100%", drawerArea]; } return [drawerArea, "100%"]; } function calculateOffset$1(offset2, area, type4) { var arr = ["t", "r", "b", "l", "lt", "lb", "rt", "rb"]; var t = offset2[0]; var l = offset2[1]; if (offset2 instanceof Array && type4 === "drawer") { offset2 = "r"; } if (arr.indexOf(offset2) > -1) { t = "50%"; l = "50%"; } if (arr.indexOf(offset2) != -1 || t.indexOf("%") > -1) t = "calc(" + t + " - (" + (area === "auto" ? "100px" : area[1]) + "/2 ))"; if (arr.indexOf(offset2) != -1 || l.indexOf("%") > -1) l = "calc(" + l + " - (" + (area === "auto" ? "100px" : area[0]) + "/2 ))"; if (offset2 === "t") t = "0px"; else if (offset2 === "r") l = "calc(100% - " + area[0] + ")"; else if (offset2 === "b") t = "calc(100% - " + area[1] + ")"; else if (offset2 === "l") l = "0px"; else if (offset2 === "lt") { t = "0px"; l = "0px"; } else if (offset2 === "lb") { t = "calc(100% - " + area[1] + ")"; l = "0px"; } else if (offset2 === "rt") { t = "0px"; l = "calc(100% - " + area[0] + ")"; } else if (offset2 === "rb") { t = "calc(100% - " + area[1] + ")"; l = "calc(100% - " + area[0] + ")"; } return [t, l]; } function calculateType(modalType) { if (modalType === "dialog" || modalType === 0 || modalType === "0") { return 0; } else if (modalType === "page" || modalType === "drawer" || modalType === 1 || modalType === "1") { return 1; } else if (modalType === "iframe" || modalType === 2 || modalType === "2") { return 2; } else if (modalType === "loading" || modalType === 3 || modalType === "3") { return 3; } return 0; } function calculateContent(height, btn, type4, isMessage) { if (height && height.indexOf("%") != -1) { height = "100%"; } if (btn && btn.length > 0) { if (type4 === 0) { return "calc(" + height + " - 137px)"; } if (type4 === 1) { return "calc(" + height + " - 102px)"; } if (type4 === 2) { return "calc(" + height + " - 102px)"; } } else { if (type4 === 0) { return isMessage ? height : "calc(" + height + " - 137px)"; } if (type4 === 1) { return "calc(" + height + " - 51px)"; } if (type4 === 2) { return "calc(" + height + " - 51px)"; } } } function maxArea() { return { w: "100%", h: "100%" }; } function maxOffset() { return { t: "0px", l: "0px" }; } function minArea() { return { w: "180px", h: "51px" }; } function minOffset(left) { return { t: "calc(100% - 51px)", l: left + "px" }; } function getArea(dom) { var width = getComputedStyle(dom, null).width; var height = getComputedStyle(dom, null).height; return [width, height]; } var minArrays = []; function updateMinArrays(id, state) { var i = 0; if (state) { var index2 = minArrays.findIndex(function(v) { return v === void 0; }); if (index2 === -1) { minArrays.push(id); i = minArrays.length - 1; } else { minArrays[index2] = id; i = index2; } } else { delete minArrays[minArrays.findIndex(function(v) { return v == id; })]; i = -1; } return i; } function getDrawerAnimationClass(offset2) { var isClose = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; var prefix = "layer-drawer-anim layer-anim"; var suffix = "rl"; if (offset2 === "l") { suffix = "lr"; } else if (offset2 === "r") { suffix = "rl"; } else if (offset2 === "t") { suffix = "tb"; } else if (offset2 === "b") { suffix = "bt"; } return isClose ? "".concat(prefix, "-").concat(suffix, "-close") : "".concat(prefix, "-").concat(suffix); } var useMove$1 = function useMove(el, callback) { el.style.position = "fixed"; var offsetX; var offsetY; if (el != null) { el.addEventListener("mousedown", function(event) { if (event.path[0].className === "layui-layer-title") { if (event.button == 0 && el != null) { var lexObj = getComputedStyle(el); offsetX = event.pageX - el.offsetLeft + parseInt(lexObj["margin-left"]); offsetY = event.pageY - el.offsetTop + parseInt(lexObj["margin-right"]); var move2 = function move22(event2) { if (el != null) { var x = event2.pageX - offsetX; var y = event2.pageY - offsetY; if (x < 0) { x = 0; } else if (x > document.documentElement.clientWidth - el.offsetWidth) { x = document.documentElement.clientWidth - el.offsetWidth; } if (y < 0) { y = 0; } else if (y > document.documentElement.clientHeight - el.offsetHeight) { y = document.documentElement.clientHeight - el.offsetHeight; } el.style.left = "".concat(x, "px"); el.style.top = "".concat(y, "px"); callback(el.style.left, el.style.top); } return false; }; document.addEventListener("mousemove", move2); var stop = function stop2() { document.removeEventListener("mousemove", move2); document.removeEventListener("mouseup", stop2); }; document.addEventListener("mouseup", stop); } } return false; }); } }; var useMove2 = function useMove3(el, callback) { if (el != null) { el.addEventListener("mousedown", function(event) { if (event.path[0].className === "layui-layer-resize") { if (event.button == 0 && el != null) { var x = el.offsetLeft; var y = el.offsetTop; var move2 = function move22(moveEvent) { if (el != null) { var offsetX = moveEvent.clientX; var offsetY = moveEvent.clientY; var w = offsetX - x; var h2 = offsetY - y; w < 260 && (w = 260); h2 < 115 && (h2 = 115); el.style.width = "".concat(w, "px"); el.style.height = "".concat(h2, "px"); callback(el.style.width, el.style.height); } return false; }; document.addEventListener("mousemove", move2); var stop = function stop2() { document.removeEventListener("mousemove", move2); document.removeEventListener("mouseup", stop2); }; document.addEventListener("mouseup", stop); } } return false; }); } }; var _hoisted_1$V = ["innerHTML"]; var _hoisted_2$y = { key: 1, class: "layui-layer-setwin" }; var _hoisted_3$q = { key: 0 }; var _hoisted_4$m = ["onClick"]; var __default__$2G = { name: "LayLayer" }; var _sfc_main$1j = /* @__PURE__ */ defineComponent(_objectSpread2$2(_objectSpread2$2({}, __default__$2G), {}, { props: { title: { type: [String, Boolean, Function], default: "\u4FE1\u606F" }, icon: null, skin: null, zIndex: { type: [Number, Function], default: 99999 }, setTop: { type: Boolean, default: false }, offset: { default: function _default() { return ["50%", "50%"]; } }, area: { default: "auto" }, modelValue: { type: Boolean, default: false }, maxmin: { type: [Boolean, String], default: false }, btn: { type: [Array, Boolean] }, move: { type: [Boolean, String], default: true }, resize: { type: [Boolean, String], default: false }, type: { default: 1 }, content: null, isHtmlFragment: { type: Boolean, default: false }, shade: { type: [Boolean, String], default: true }, shadeClose: { type: [Boolean, String], default: true }, shadeOpacity: { default: "0.1" }, closeBtn: { type: [Boolean, String], default: true }, btnAlign: { default: "r" }, time: { default: 0 }, load: { default: 0 }, anim: { default: 0 }, isOutAnim: { type: Boolean, default: true }, destroy: { type: Function, default: function _default2() { } }, success: { type: Function, default: function _default3() { } }, end: { type: Function, default: function _default4() { } }, yes: null, yesText: { default: "\u786E\u5B9A" }, isFunction: { type: Boolean, default: false }, isMessage: { type: Boolean, default: false }, appContext: null }, emits: ["close", "update:modelValue"], setup: function setup5(__props, _ref) { var expose = _ref.expose, emit = _ref.emit; var props = __props; var slots = useSlots(); var layero = ref(null); var id = ref(nextId()); var max2 = ref(false); var min2 = ref(false); var type4 = calculateType(props.type); var area = ref(calculateArea(props.type, props.area, props.offset)); var offset2 = ref(calculateOffset$1(props.offset, area.value, props.type)); var contentHeight = ref(calculateContent(area.value[1], props.btn, type4, props.isMessage)); var index2 = ref(props.zIndex); var visible = ref(false); var first = ref(true); var w = ref(area.value[0]); var h2 = ref(area.value[1]); var t = ref(offset2.value[0]); var l = ref(offset2.value[1]); var _w = ref(area.value[0]); var _h = ref(area.value[0]); var _t = ref(offset2.value[0]); var _l = ref(offset2.value[1]); var firstOpenDelayCalculation = function firstOpenDelayCalculation2() { nextTick(function() { area.value = getArea(layero.value); if (props.type === "drawer") { area.value = calculateDrawerArea(props.offset, props.area); } offset2.value = calculateOffset$1(props.offset, area.value, props.type); w.value = area.value[0]; h2.value = area.value[1]; t.value = offset2.value[0]; l.value = offset2.value[1]; _w.value = area.value[0]; _l.value = area.value[1]; _t.value = offset2.value[0]; _l.value = offset2.value[1]; supportMove(); }); }; var notFirstOpenLayerInit = function notFirstOpenLayerInit2() { w.value = _w.value; h2.value = _h.value; t.value = _t.value; l.value = _l.value; supportMove(); }; var beforeCloseSaveData = function beforeCloseSaveData2() { if (min2.value) minHandle(); if (max2.value) maxHandle(); _w.value = w.value; _h.value = h2.value; _t.value = t.value; _l.value = l.value; }; var maxHandle = function maxHandle2() { if (max2.value) { w.value = _w.value; h2.value = _h.value; t.value = _t.value; l.value = _l.value; } else { _t.value = t.value; _l.value = l.value; _w.value = w.value; _h.value = h2.value; w.value = maxArea().w; h2.value = maxArea().h; t.value = maxOffset().t; l.value = maxOffset().l; } max2.value = !max2.value; }; var minHandle = function minHandle2() { var left = 180 * updateMinArrays(id.value, !min2.value); if (left > document.documentElement.clientWidth - 180) { left = document.documentElement.clientWidth - 180; } if (min2.value) { w.value = _w.value; h2.value = _h.value; t.value = _t.value; l.value = _l.value; } else { _w.value = w.value; _h.value = h2.value; _t.value = t.value; _l.value = l.value; h2.value = minArea().h; w.value = minArea().w; t.value = minOffset(left).t; l.value = minOffset(left).l; } min2.value = !min2.value; }; var reset22 = function reset3() { if (!first.value) { min2.value = false; max2.value = false; w.value = area.value[0]; h2.value = area.value[1]; t.value = offset2.value[0]; l.value = offset2.value[1]; _w.value = area.value[0]; _h.value = area.value[1]; _t.value = offset2.value[0]; _l.value = offset2.value[1]; } if (!props.modelValue) { emit("update:modelValue", true); } }; watch(function() { return props.modelValue; }, function() { visible.value = props.modelValue; if (visible.value) { if (first.value) { first.value = false; firstOpenDelayCalculation(); } else { notFirstOpenLayerInit(); } } else { beforeCloseSaveData(); } }, { deep: true }); watch(function() { return visible.value; }, function() { if (visible.value) { if (props.isFunction) { firstOpenDelayCalculation(); } props.success(); } else { props.end(); } }); watch(function() { return h2.value; }, function() { contentHeight.value = calculateContent(h2.value, props.btn, type4, props.isMessage); }); var boxClasses = computed(function() { return [type4 === 0 ? "layui-layer-dialog" : "", type4 === 1 ? "layui-layer-page" : "", type4 === 2 ? "layui-layer-iframe" : "", type4 === 3 ? "layui-layer-loading" : "", props.isMessage ? "layui-layer-msg" : "", props.isMessage && !props.icon ? "layui-layer-hui" : "", props.skin]; }); var supportMove = function supportMove2() { if (props.move && props.type != "drawer") { nextTick(function() { useMove$1(layero.value, function(left, top) { l.value = left; t.value = top; }); useMove2(layero.value, function(width, height) { h2.value = height; w.value = width; }); }); } }; var styles = computed(function() { return { top: t.value, left: l.value, width: w.value, height: h2.value, zIndex: index2.value }; }); var contentClasses = computed(function() { return [type4 === 3 ? "layui-layer-loading".concat(props.load) : "", props.icon ? "layui-layer-padding" : ""]; }); var closeHandle = function closeHandle2() { emit("close"); emit("update:modelValue", false); props.destroy(); }; var yesHandle = function yesHandle2() { if (props.yes != void 0) props.yes(); else closeHandle(); }; var shadeHandle = function shadeHandle2() { if (props.shadeClose) closeHandle(); }; var renderContent = function renderContent2(content) { if (content instanceof Function) { return content(); } return content; }; var iconClass = computed(function() { return ["layui-layer-ico", "layui-layer-ico".concat(props.icon)]; }); var enterActiveClass = computed(function() { if (props.type === "drawer") { return getDrawerAnimationClass(props.offset); } return "layer-anim layer-anim-0".concat(props.anim); }); var leaveActiveClass = computed(function() { if (props.type === "drawer") { return getDrawerAnimationClass(props.offset, true); } return props.isOutAnim ? "layer-anim-close" : ""; }); var open2 = function open3() { visible.value = true; }; var close2 = function close3() { visible.value = false; }; var shadeVisible = computed(function() { return visible.value && props.shade && !min2.value; }); var showResize = computed(function() { return props.resize && !max2.value && !min2.value; }); var showTitle = computed(function() { return props.title && props.type != 3; }); expose({ reset: reset22, open: open2, close: close2 }); return function(_ctx, _cache) { return openBlock(), createElementBlock("div", null, [createVNode(_sfc_main$5$1, { index: index2.value, visible: unref(shadeVisible), opacity: __props.shadeOpacity, onShadeClick: shadeHandle }, null, 8, ["index", "visible", "opacity"]), createVNode(Transition, { "enter-active-class": unref(enterActiveClass), "leave-active-class": unref(leaveActiveClass) }, { default: withCtx(function() { return [visible.value ? (openBlock(), createElementBlock("div", { key: 0, ref_key: "layero", ref: layero, class: normalizeClass(["layui-layer layui-layer-border", unref(boxClasses)]), style: normalizeStyle(unref(styles)) }, [unref(showTitle) ? (openBlock(), createBlock(_sfc_main$3$1, { key: 0, title: __props.title }, null, 8, ["title"])) : createCommentVNode("", true), createElementVNode("div", { class: normalizeClass(["layui-layer-content", unref(contentClasses)]), style: normalizeStyle({ height: contentHeight.value }) }, [unref(type4) === 0 || unref(type4) === 1 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [__props.icon ? (openBlock(), createElementBlock("i", { key: 0, class: normalizeClass(unref(iconClass)) }, null, 2)) : createCommentVNode("", true), unref(slots).default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [__props.isHtmlFragment ? (openBlock(), createElementBlock("span", { key: 0, innerHTML: renderContent(props.content) }, null, 8, _hoisted_1$V)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString$1(renderContent(props.content)), 1)], 64))], 64))], 64)) : createCommentVNode("", true), unref(type4) === 2 ? (openBlock(), createBlock(_sfc_main$4$1, { key: 1, src: props.content }, null, 8, ["src"])) : createCommentVNode("", true)], 6), unref(type4) != 3 ? (openBlock(), createElementBlock("span", _hoisted_2$y, [__props.maxmin && !max2.value ? (openBlock(), createElementBlock("a", { key: 0, class: normalizeClass(["layui-layer-min", [min2.value ? "layui-layer-ico layui-layer-maxmin" : ""]]), href: "javascript:;", onClick: minHandle }, [!min2.value ? (openBlock(), createElementBlock("cite", _hoisted_3$q)) : createCommentVNode("", true)], 2)) : createCommentVNode("", true), __props.maxmin && !min2.value ? (openBlock(), createElementBlock("a", { key: 1, class: normalizeClass(["layui-layer-ico layui-layer-max", [max2.value ? "layui-layer-maxmin" : ""]]), href: "javascript:;", onClick: maxHandle }, null, 2)) : createCommentVNode("", true), __props.closeBtn ? (openBlock(), createBlock(_sfc_main$2$1, { key: 2, onCloseHandle: closeHandle })) : createCommentVNode("", true)])) : createCommentVNode("", true), (__props.btn && __props.btn.length > 0 || unref(type4) === 0) && !__props.isMessage ? (openBlock(), createElementBlock("div", { key: 2, class: normalizeClass(["layui-layer-btn", ["layui-layer-btn-".concat(__props.btnAlign)]]) }, [__props.btn && __props.btn.length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.btn, function(b, index22) { return openBlock(), createElementBlock("a", { key: index22, class: normalizeClass(["layui-layer-btn".concat(index22)]), onClick: function onClick($event) { return b.callback(props.domId); } }, toDisplayString$1(b.text), 11, _hoisted_4$m); }), 128)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [unref(type4) === 0 ? (openBlock(), createElementBlock("a", { key: 0, class: "layui-layer-btn0", onClick: _cache[0] || (_cache[0] = function($event) { return yesHandle(); }) }, toDisplayString$1(__props.yesText), 1)) : createCommentVNode("", true)], 64))], 2)) : createCommentVNode("", true), unref(showResize) ? (openBlock(), createBlock(Resize, { key: 3 })) : createCommentVNode("", true)], 6)) : createCommentVNode("", true)]; }), _: 3 }, 8, ["enter-active-class", "leave-active-class"])]); }; } })); var layerInstance = []; var addInstance = function addInstance2(instance) { layerInstance.push(instance); }; var delInstance = function delInstance2(id) { layerInstance.forEach(function(item, index2) { if (item.modalContainer.id === id) { layerInstance.splice(index2, 1); } }); }; var cleanInstance = function cleanInstance2() { layerInstance.splice(0, layerInstance.length); }; var isExist = function isExist2(id) { var b = false; layerInstance.forEach(function(item, index2) { if (item.modalContainer.id === id) { b = true; } }); return b; }; var mergeOption = function mergeOption2(option, defaultOption) { if (option) defaultOption = Object.assign(defaultOption, option); return defaultOption; }; var createContainer = function createContainer2() { var modalContainer = document.createElement("div"); modalContainer.id = nextId(); document.body.appendChild(modalContainer); return modalContainer; }; var modalChildrenVNode = function modalChildrenVNode2(content) { if (typeof content === "function") { return isVNode(content()) ? { default: function _default5() { return content(); } } : void 0; } return isVNode(content) ? { default: function _default5() { return content; } } : void 0; }; var layer = { _context: null, open: function open(option, callback) { var defaultOption = {}; return layer.create(option, defaultOption, callback); }, drawer: function drawer(option, callback) { var defaultOption = { type: "drawer" }; return layer.create(option, defaultOption, callback); }, msg: function msg(message, option, callback) { var defaultOption = { type: 0, title: false, content: message, closeBtn: false, shadeClose: false, isMessage: true, shade: false, time: 1e3, btn: false }; return layer.create(option, defaultOption, callback); }, load: function load(_load, option, callback) { var defaultOption = { type: 3, load: _load, anim: 5, isOutAnim: false, shadeClose: false }; return layer.create(option, defaultOption, callback); }, confirm: function confirm(msg2, option, callback) { var defaultOption = { type: 0, content: msg2, shadeClose: false }; return layer.create(option, defaultOption, callback); }, create: function create(option, defaultOption, callback) { var _modalInstance$compon3, _modalInstance$compon4; var timer; var options = mergeOption(option, defaultOption); var modalContainer = createContainer(); options.id = modalContainer; var modalInstance = h(_sfc_main$1j, _objectSpread2$2(_objectSpread2$2({}, options), {}, { isFunction: true, destroy: function destroy2() { var _modalInstance$compon, _modalInstance$compon2; clearTimeout(timer); (_modalInstance$compon = modalInstance.component) === null || _modalInstance$compon === void 0 ? void 0 : (_modalInstance$compon2 = _modalInstance$compon.exposed) === null || _modalInstance$compon2 === void 0 ? void 0 : _modalInstance$compon2.close(); setTimeout(function() { render$1(null, modalContainer); if (document.body.contains(modalContainer)) { document.body.removeChild(modalContainer); } }, 2e3); delInstance(modalContainer.id); } }), modalChildrenVNode(options.content)); modalInstance.appContext = options.appContext || layer._context; render$1(modalInstance, modalContainer); (_modalInstance$compon3 = modalInstance.component) === null || _modalInstance$compon3 === void 0 ? void 0 : (_modalInstance$compon4 = _modalInstance$compon3.exposed) === null || _modalInstance$compon4 === void 0 ? void 0 : _modalInstance$compon4.open(); if (defaultOption && defaultOption.time != void 0) { timer = setTimeout(function() { var _modalInstance$compon5, _modalInstance$compon6; (_modalInstance$compon5 = modalInstance.component) === null || _modalInstance$compon5 === void 0 ? void 0 : (_modalInstance$compon6 = _modalInstance$compon5.exposed) === null || _modalInstance$compon6 === void 0 ? void 0 : _modalInstance$compon6.close(); if (callback) callback(modalContainer.id); setTimeout(function() { render$1(null, modalContainer); if (document.body.contains(modalContainer)) { document.body.removeChild(modalContainer); } }, 2e3); delInstance(modalContainer.id); }, defaultOption.time); } addInstance({ modalContainer, modalInstance }); return { modalContainer, modalInstance }; }, close: function close(instance) { if (instance != null && isExist(instance.modalContainer.id)) { var _instance$modalInstan, _instance$modalInstan2; (_instance$modalInstan = instance.modalInstance.component) === null || _instance$modalInstan === void 0 ? void 0 : (_instance$modalInstan2 = _instance$modalInstan.exposed) === null || _instance$modalInstan2 === void 0 ? void 0 : _instance$modalInstan2.close(); setTimeout(function() { render$1(null, instance.modalContainer); if (document.body.contains(instance.modalContainer)) document.body.removeChild(instance.modalContainer); }, 2e3); } delInstance(instance.modalContainer.id); }, closeAll: function closeAll() { layerInstance.forEach(function(item) { var _item$modalInstance$c, _item$modalInstance$c2; (_item$modalInstance$c = item.modalInstance.component) === null || _item$modalInstance$c === void 0 ? void 0 : (_item$modalInstance$c2 = _item$modalInstance$c.exposed) === null || _item$modalInstance$c2 === void 0 ? void 0 : _item$modalInstance$c2.close(); setTimeout(function() { render$1(null, item.modalContainer); if (document.body.contains(item.modalContainer)) document.body.removeChild(item.modalContainer); }, 2e3); }); cleanInstance(); }, reset: function reset(instance) { var _instance$modalInstan3, _instance$modalInstan4; (_instance$modalInstan3 = instance.modalInstance.component) === null || _instance$modalInstan3 === void 0 ? void 0 : (_instance$modalInstan4 = _instance$modalInstan3.exposed) === null || _instance$modalInstan4 === void 0 ? void 0 : _instance$modalInstan4.reset(); } }; var install$1 = function install2(app, options) { layer._context = app._context; app.component(_sfc_main$1j.name, _sfc_main$1j); app.config.globalProperties.$layer = layer; }; var index$Q = { install: install$1 }; /*! * shared v9.2.0-beta.33 * (c) 2022 kazuya kawaguchi * Released under the MIT License. */ const inBrowser = typeof window !== "undefined"; const hasSymbol = typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol"; const makeSymbol = (name) => hasSymbol ? Symbol(name) : name; const generateFormatCacheKey = (locale2, key, source) => friendlyJSONstringify({ l: locale2, k: key, s: source }); const friendlyJSONstringify = (json) => JSON.stringify(json).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/\u0027/g, "\\u0027"); const isNumber$3 = (val) => typeof val === "number" && isFinite(val); const isDate$1 = (val) => toTypeString(val) === "[object Date]"; const isRegExp = (val) => toTypeString(val) === "[object RegExp]"; const isEmptyObject = (val) => isPlainObject$1(val) && Object.keys(val).length === 0; function warn$1(msg2, err) { if (typeof console !== "undefined") { console.warn(`[intlify] ` + msg2); if (err) { console.warn(err.stack); } } } const assign$1 = Object.assign; let _globalThis; const getGlobalThis = () => { return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); }; function escapeHtml(rawText) { return rawText.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;"); } const hasOwnProperty$1 = Object.prototype.hasOwnProperty; function hasOwn(obj, key) { return hasOwnProperty$1.call(obj, key); } const isArray$1 = Array.isArray; const isFunction$3 = (val) => typeof val === "function"; const isString$2 = (val) => typeof val === "string"; const isBoolean = (val) => typeof val === "boolean"; const isObject$2 = (val) => val !== null && typeof val === "object"; const objectToString = Object.prototype.toString; const toTypeString = (value) => objectToString.call(value); const isPlainObject$1 = (val) => toTypeString(val) === "[object Object]"; const toDisplayString = (val) => { return val == null ? "" : isArray$1(val) || isPlainObject$1(val) && val.toString === objectToString ? JSON.stringify(val, null, 2) : String(val); }; /*! * message-compiler v9.2.0-beta.33 * (c) 2022 kazuya kawaguchi * Released under the MIT License. */ const CompileErrorCodes = { EXPECTED_TOKEN: 1, INVALID_TOKEN_IN_PLACEHOLDER: 2, UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER: 3, UNKNOWN_ESCAPE_SEQUENCE: 4, INVALID_UNICODE_ESCAPE_SEQUENCE: 5, UNBALANCED_CLOSING_BRACE: 6, UNTERMINATED_CLOSING_BRACE: 7, EMPTY_PLACEHOLDER: 8, NOT_ALLOW_NEST_PLACEHOLDER: 9, INVALID_LINKED_FORMAT: 10, MUST_HAVE_MESSAGES_IN_PLURAL: 11, UNEXPECTED_EMPTY_LINKED_MODIFIER: 12, UNEXPECTED_EMPTY_LINKED_KEY: 13, UNEXPECTED_LEXICAL_ANALYSIS: 14, __EXTEND_POINT__: 15 }; function createCompileError(code2, loc, options = {}) { const { domain, messages: messages2, args } = options; const msg2 = code2; const error = new SyntaxError(String(msg2)); error.code = code2; if (loc) { error.location = loc; } error.domain = domain; return error; } function defaultOnError(error) { throw error; } function createPosition(line, column, offset2) { return { line, column, offset: offset2 }; } function createLocation(start, end, source) { const loc = { start, end }; if (source != null) { loc.source = source; } return loc; } const CHAR_SP = " "; const CHAR_CR = "\r"; const CHAR_LF = "\n"; const CHAR_LS = String.fromCharCode(8232); const CHAR_PS = String.fromCharCode(8233); function createScanner(str) { const _buf = str; let _index = 0; let _line = 1; let _column = 1; let _peekOffset = 0; const isCRLF = (index3) => _buf[index3] === CHAR_CR && _buf[index3 + 1] === CHAR_LF; const isLF = (index3) => _buf[index3] === CHAR_LF; const isPS = (index3) => _buf[index3] === CHAR_PS; const isLS = (index3) => _buf[index3] === CHAR_LS; const isLineEnd = (index3) => isCRLF(index3) || isLF(index3) || isPS(index3) || isLS(index3); const index2 = () => _index; const line = () => _line; const column = () => _column; const peekOffset = () => _peekOffset; const charAt = (offset2) => isCRLF(offset2) || isPS(offset2) || isLS(offset2) ? CHAR_LF : _buf[offset2]; const currentChar = () => charAt(_index); const currentPeek = () => charAt(_index + _peekOffset); function next() { _peekOffset = 0; if (isLineEnd(_index)) { _line++; _column = 0; } if (isCRLF(_index)) { _index++; } _index++; _column++; return _buf[_index]; } function peek() { if (isCRLF(_index + _peekOffset)) { _peekOffset++; } _peekOffset++; return _buf[_index + _peekOffset]; } function reset3() { _index = 0; _line = 1; _column = 1; _peekOffset = 0; } function resetPeek(offset2 = 0) { _peekOffset = offset2; } function skipToPeek() { const target = _index + _peekOffset; while (target !== _index) { next(); } _peekOffset = 0; } return { index: index2, line, column, peekOffset, charAt, currentChar, currentPeek, next, peek, reset: reset3, resetPeek, skipToPeek }; } const EOF = void 0; const LITERAL_DELIMITER = "'"; const ERROR_DOMAIN$1 = "tokenizer"; function createTokenizer(source, options = {}) { const location2 = options.location !== false; const _scnr = createScanner(source); const currentOffset = () => _scnr.index(); const currentPosition = () => createPosition(_scnr.line(), _scnr.column(), _scnr.index()); const _initLoc = currentPosition(); const _initOffset = currentOffset(); const _context = { currentType: 14, offset: _initOffset, startLoc: _initLoc, endLoc: _initLoc, lastType: 14, lastOffset: _initOffset, lastStartLoc: _initLoc, lastEndLoc: _initLoc, braceNest: 0, inLinked: false, text: "" }; const context = () => _context; const { onError } = options; function emitError(code2, pos, offset2, ...args) { const ctx = context(); pos.column += offset2; pos.offset += offset2; if (onError) { const loc = createLocation(ctx.startLoc, pos); const err = createCompileError(code2, loc, { domain: ERROR_DOMAIN$1, args }); onError(err); } } function getToken(context2, type4, value) { context2.endLoc = currentPosition(); context2.currentType = type4; const token2 = { type: type4 }; if (location2) { token2.loc = createLocation(context2.startLoc, context2.endLoc); } if (value != null) { token2.value = value; } return token2; } const getEndToken = (context2) => getToken(context2, 14); function eat(scnr, ch) { if (scnr.currentChar() === ch) { scnr.next(); return ch; } else { emitError(CompileErrorCodes.EXPECTED_TOKEN, currentPosition(), 0, ch); return ""; } } function peekSpaces(scnr) { let buf = ""; while (scnr.currentPeek() === CHAR_SP || scnr.currentPeek() === CHAR_LF) { buf += scnr.currentPeek(); scnr.peek(); } return buf; } function skipSpaces(scnr) { const buf = peekSpaces(scnr); scnr.skipToPeek(); return buf; } function isIdentifierStart(ch) { if (ch === EOF) { return false; } const cc = ch.charCodeAt(0); return cc >= 97 && cc <= 122 || cc >= 65 && cc <= 90 || cc === 95; } function isNumberStart(ch) { if (ch === EOF) { return false; } const cc = ch.charCodeAt(0); return cc >= 48 && cc <= 57; } function isNamedIdentifierStart(scnr, context2) { const { currentType } = context2; if (currentType !== 2) { return false; } peekSpaces(scnr); const ret = isIdentifierStart(scnr.currentPeek()); scnr.resetPeek(); return ret; } function isListIdentifierStart(scnr, context2) { const { currentType } = context2; if (currentType !== 2) { return false; } peekSpaces(scnr); const ch = scnr.currentPeek() === "-" ? scnr.peek() : scnr.currentPeek(); const ret = isNumberStart(ch); scnr.resetPeek(); return ret; } function isLiteralStart(scnr, context2) { const { currentType } = context2; if (currentType !== 2) { return false; } peekSpaces(scnr); const ret = scnr.currentPeek() === LITERAL_DELIMITER; scnr.resetPeek(); return ret; } function isLinkedDotStart(scnr, context2) { const { currentType } = context2; if (currentType !== 8) { return false; } peekSpaces(scnr); const ret = scnr.currentPeek() === "."; scnr.resetPeek(); return ret; } function isLinkedModifierStart(scnr, context2) { const { currentType } = context2; if (currentType !== 9) { return false; } peekSpaces(scnr); const ret = isIdentifierStart(scnr.currentPeek()); scnr.resetPeek(); return ret; } function isLinkedDelimiterStart(scnr, context2) { const { currentType } = context2; if (!(currentType === 8 || currentType === 12)) { return false; } peekSpaces(scnr); const ret = scnr.currentPeek() === ":"; scnr.resetPeek(); return ret; } function isLinkedReferStart(scnr, context2) { const { currentType } = context2; if (currentType !== 10) { return false; } const fn = () => { const ch = scnr.currentPeek(); if (ch === "{") { return isIdentifierStart(scnr.peek()); } else if (ch === "@" || ch === "%" || ch === "|" || ch === ":" || ch === "." || ch === CHAR_SP || !ch) { return false; } else if (ch === CHAR_LF) { scnr.peek(); return fn(); } else { return isIdentifierStart(ch); } }; const ret = fn(); scnr.resetPeek(); return ret; } function isPluralStart(scnr) { peekSpaces(scnr); const ret = scnr.currentPeek() === "|"; scnr.resetPeek(); return ret; } function isTextStart(scnr, reset3 = true) { const fn = (hasSpace = false, prev = "", detectModulo = false) => { const ch = scnr.currentPeek(); if (ch === "{") { return prev === "%" ? false : hasSpace; } else if (ch === "@" || !ch) { return prev === "%" ? true : hasSpace; } else if (ch === "%") { scnr.peek(); return fn(hasSpace, "%", true); } else if (ch === "|") { return prev === "%" || detectModulo ? true : !(prev === CHAR_SP || prev === CHAR_LF); } else if (ch === CHAR_SP) { scnr.peek(); return fn(true, CHAR_SP, detectModulo); } else if (ch === CHAR_LF) { scnr.peek(); return fn(true, CHAR_LF, detectModulo); } else { return true; } }; const ret = fn(); reset3 && scnr.resetPeek(); return ret; } function takeChar(scnr, fn) { const ch = scnr.currentChar(); if (ch === EOF) { return EOF; } if (fn(ch)) { scnr.next(); return ch; } return null; } function takeIdentifierChar(scnr) { const closure = (ch) => { const cc = ch.charCodeAt(0); return cc >= 97 && cc <= 122 || cc >= 65 && cc <= 90 || cc >= 48 && cc <= 57 || cc === 95 || cc === 36; }; return takeChar(scnr, closure); } function takeDigit(scnr) { const closure = (ch) => { const cc = ch.charCodeAt(0); return cc >= 48 && cc <= 57; }; return takeChar(scnr, closure); } function takeHexDigit(scnr) { const closure = (ch) => { const cc = ch.charCodeAt(0); return cc >= 48 && cc <= 57 || cc >= 65 && cc <= 70 || cc >= 97 && cc <= 102; }; return takeChar(scnr, closure); } function getDigits(scnr) { let ch = ""; let num = ""; while (ch = takeDigit(scnr)) { num += ch; } return num; } function readText(scnr) { let buf = ""; while (true) { const ch = scnr.currentChar(); if (ch === "{" || ch === "}" || ch === "@" || ch === "|" || !ch) { break; } else if (ch === "%") { if (isTextStart(scnr)) { buf += ch; scnr.next(); } else { break; } } else if (ch === CHAR_SP || ch === CHAR_LF) { if (isTextStart(scnr)) { buf += ch; scnr.next(); } else if (isPluralStart(scnr)) { break; } else { buf += ch; scnr.next(); } } else { buf += ch; scnr.next(); } } return buf; } function readNamedIdentifier(scnr) { skipSpaces(scnr); let ch = ""; let name = ""; while (ch = takeIdentifierChar(scnr)) { name += ch; } if (scnr.currentChar() === EOF) { emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0); } return name; } function readListIdentifier(scnr) { skipSpaces(scnr); let value = ""; if (scnr.currentChar() === "-") { scnr.next(); value += `-${getDigits(scnr)}`; } else { value += getDigits(scnr); } if (scnr.currentChar() === EOF) { emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0); } return value; } function readLiteral(scnr) { skipSpaces(scnr); eat(scnr, `'`); let ch = ""; let literal = ""; const fn = (x) => x !== LITERAL_DELIMITER && x !== CHAR_LF; while (ch = takeChar(scnr, fn)) { if (ch === "\\") { literal += readEscapeSequence(scnr); } else { literal += ch; } } const current = scnr.currentChar(); if (current === CHAR_LF || current === EOF) { emitError(CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER, currentPosition(), 0); if (current === CHAR_LF) { scnr.next(); eat(scnr, `'`); } return literal; } eat(scnr, `'`); return literal; } function readEscapeSequence(scnr) { const ch = scnr.currentChar(); switch (ch) { case "\\": case `'`: scnr.next(); return `\\${ch}`; case "u": return readUnicodeEscapeSequence(scnr, ch, 4); case "U": return readUnicodeEscapeSeque