layui/package/layer/lib/layer-vue.es.js

2263 lines
128 KiB
JavaScript
Raw Normal View History

2022-11-15 09:16:55 +08:00
import { defineComponent, computed, openBlock, createElementBlock, normalizeStyle, unref, createCommentVNode, toDisplayString, normalizeClass, ref, watch, onMounted, nextTick, createElementVNode, Fragment, renderList, shallowRef, createTextVNode, createVNode, useSlots, inject, Transition, withCtx, createBlock, renderSlot, h, render, isVNode } from "vue";
function _defineProperty(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 asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function() {
var self = this, args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(void 0);
});
};
}
function _typeof(obj) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
return typeof obj2;
} : function(obj2) {
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
}, _typeof(obj);
}
var runtime = { exports: {} };
(function(module) {
var runtime2 = function(exports) {
var Op = Object.prototype;
var hasOwn = Op.hasOwnProperty;
var undefined$1;
var $Symbol = typeof Symbol === "function" ? Symbol : {};
var iteratorSymbol = $Symbol.iterator || "@@iterator";
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key, value) {
Object.defineProperty(obj, key, {
value,
enumerable: true,
configurable: true,
writable: true
});
return obj[key];
}
try {
define({}, "");
} catch (err) {
define = function define2(obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
var generator = Object.create(protoGenerator.prototype);
var context = new Context(tryLocsList || []);
generator._invoke = makeInvokeMethod(innerFn, self, context);
return generator;
}
exports.wrap = wrap;
function tryCatch(fn, obj, arg) {
try {
return {
type: "normal",
arg: fn.call(obj, arg)
};
} catch (err) {
return {
type: "throw",
arg: err
};
}
}
var GenStateSuspendedStart = "suspendedStart";
var GenStateSuspendedYield = "suspendedYield";
var GenStateExecuting = "executing";
var GenStateCompleted = "completed";
var ContinueSentinel = {};
function Generator() {
}
function GeneratorFunction() {
}
function GeneratorFunctionPrototype() {
}
var IteratorPrototype = {};
define(IteratorPrototype, iteratorSymbol, function() {
return this;
});
var getProto = Object.getPrototypeOf;
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
IteratorPrototype = NativeIteratorPrototype;
}
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
GeneratorFunction.prototype = GeneratorFunctionPrototype;
define(Gp, "constructor", GeneratorFunctionPrototype);
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
define(prototype, method, function(arg) {
return this._invoke(method, arg);
});
});
}
exports.isGeneratorFunction = function(genFun) {
var ctor = typeof genFun === "function" && genFun.constructor;
return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
};
exports.mark = function(genFun) {
if (Object.setPrototypeOf) {
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
} else {
genFun.__proto__ = GeneratorFunctionPrototype;
define(genFun, toStringTagSymbol, "GeneratorFunction");
}
genFun.prototype = Object.create(Gp);
return genFun;
};
exports.awrap = function(arg) {
return {
__await: arg
};
};
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if (record.type === "throw") {
reject(record.arg);
} else {
var result = record.arg;
var value = result.value;
if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) {
return PromiseImpl.resolve(value.__await).then(function(value2) {
invoke("next", value2, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
});
}
return PromiseImpl.resolve(value).then(function(unwrapped) {
result.value = unwrapped;
resolve(result);
}, function(error) {
return invoke("throw", error, resolve, reject);
});
}
}
var previousPromise;
function enqueue(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
}
this._invoke = enqueue;
}
defineIteratorMethods(AsyncIterator.prototype);
define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
return this;
});
exports.AsyncIterator = AsyncIterator;
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
if (PromiseImpl === void 0)
PromiseImpl = Promise;
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
};
function makeInvokeMethod(innerFn, self, context) {
var state = GenStateSuspendedStart;
return function invoke(method, arg) {
if (state === GenStateExecuting) {
throw new Error("Generator is already running");
}
if (state === GenStateCompleted) {
if (method === "throw") {
throw arg;
}
return doneResult();
}
context.method = method;
context.arg = arg;
while (true) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel)
continue;
return delegateResult;
}
}
if (context.method === "next") {
context.sent = context._sent = context.arg;
} else if (context.method === "throw") {
if (state === GenStateSuspendedStart) {
state = GenStateCompleted;
throw context.arg;
}
context.dispatchException(context.arg);
} else if (context.method === "return") {
context.abrupt("return", context.arg);
}
state = GenStateExecuting;
var record = tryCatch(innerFn, self, context);
if (record.type === "normal") {
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
if (record.arg === ContinueSentinel) {
continue;
}
return {
value: record.arg,
done: context.done
};
} else if (record.type === "throw") {
state = GenStateCompleted;
context.method = "throw";
context.arg = record.arg;
}
}
};
}
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (method === undefined$1) {
context.delegate = null;
if (context.method === "throw") {
if (delegate.iterator["return"]) {
context.method = "return";
context.arg = undefined$1;
maybeInvokeDelegate(delegate, context);
if (context.method === "throw") {
return ContinueSentinel;
}
}
context.method = "throw";
context.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if (record.type === "throw") {
context.method = "throw";
context.arg = record.arg;
context.delegate = null;
return ContinueSentinel;
}
var info = record.arg;
if (!info) {
context.method = "throw";
context.arg = new TypeError("iterator result is not an object");
context.delegate = null;
return ContinueSentinel;
}
if (info.done) {
context[delegate.resultName] = info.value;
context.next = delegate.nextLoc;
if (context.method !== "return") {
context.method = "next";
context.arg = undefined$1;
}
} else {
return info;
}
context.delegate = null;
return ContinueSentinel;
}
defineIteratorMethods(Gp);
define(Gp, toStringTagSymbol, "Generator");
define(Gp, iteratorSymbol, function() {
return this;
});
define(Gp, "toString", function() {
return "[object Generator]";
});
function pushTryEntry(locs) {
var entry = {
tryLoc: locs[0]
};
if (1 in locs) {
entry.catchLoc = locs[1];
}
if (2 in locs) {
entry.finallyLoc = locs[2];
entry.afterLoc = locs[3];
}
this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal";
delete record.arg;
entry.completion = record;
}
function Context(tryLocsList) {
this.tryEntries = [{
tryLoc: "root"
}];
tryLocsList.forEach(pushTryEntry, this);
this.reset(true);
}
exports.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
keys.reverse();
return function next() {
while (keys.length) {
var key2 = keys.pop();
if (key2 in object) {
next.value = key2;
next.done = false;
return next;
}
}
next.done = true;
return next;
};
};
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) {
return iteratorMethod.call(iterable);
}
if (typeof iterable.next === "function") {
return iterable;
}
if (!isNaN(iterable.length)) {
var i = -1, next = function next2() {
while (++i < iterable.length) {
if (hasOwn.call(iterable, i)) {
next2.value = iterable[i];
next2.done = false;
return next2;
}
}
next2.value = undefined$1;
next2.done = true;
return next2;
};
return next.next = next;
}
}
return {
next: doneResult
};
}
exports.values = values;
function doneResult() {
return {
value: undefined$1,
done: true
};
}
Context.prototype = {
constructor: Context,
reset: function reset2(skipTempReset) {
this.prev = 0;
this.next = 0;
this.sent = this._sent = undefined$1;
this.done = false;
this.delegate = null;
this.method = "next";
this.arg = undefined$1;
this.tryEntries.forEach(resetTryEntry);
if (!skipTempReset) {
for (var name in this) {
if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
this[name] = undefined$1;
}
}
}
},
stop: function stop() {
this.done = true;
var rootEntry = this.tryEntries[0];
var rootRecord = rootEntry.completion;
if (rootRecord.type === "throw") {
throw rootRecord.arg;
}
return this.rval;
},
dispatchException: function dispatchException(exception) {
if (this.done) {
throw exception;
}
var context = this;
function handle(loc, caught) {
record.type = "throw";
record.arg = exception;
context.next = loc;
if (caught) {
context.method = "next";
context.arg = undefined$1;
}
return !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
var record = entry.completion;
if (entry.tryLoc === "root") {
return handle("end");
}
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc");
var hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
} else if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else if (hasCatch) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
}
} else if (hasFinally) {
if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else {
throw new Error("try statement without catch or finally");
}
}
}
},
abrupt: function abrupt(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
finallyEntry = null;
}
var record = finallyEntry ? finallyEntry.completion : {};
record.type = type;
record.arg = arg;
if (finallyEntry) {
this.method = "next";
this.next = finallyEntry.finallyLoc;
return ContinueSentinel;
}
return this.complete(record);
},
complete: function complete(record, afterLoc) {
if (record.type === "throw") {
throw record.arg;
}
if (record.type === "break" || record.type === "continue") {
this.next = record.arg;
} else if (record.type === "return") {
this.rval = this.arg = record.arg;
this.method = "return";
this.next = "end";
} else if (record.type === "normal" && afterLoc) {
this.next = afterLoc;
}
return ContinueSentinel;
},
finish: function finish(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) {
this.complete(entry.completion, entry.afterLoc);
resetTryEntry(entry);
return ContinueSentinel;
}
}
},
"catch": function _catch(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if (record.type === "throw") {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
throw new Error("illegal catch attempt");
},
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
this.delegate = {
iterator: values(iterable),
resultName,
nextLoc
};
if (this.method === "next") {
this.arg = undefined$1;
}
return ContinueSentinel;
}
};
return exports;
}(module.exports);
try {
regeneratorRuntime = runtime2;
} catch (accidentalStrictMode) {
if ((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === "object") {
globalThis.regeneratorRuntime = runtime2;
} else {
Function("r", "regeneratorRuntime = r")(runtime2);
}
}
})(runtime);
var regenerator = runtime.exports;
function ownKeys$7(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$7(target) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys$7(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$7(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
var __default__$6 = {
name: "Shade"
};
var _sfc_main$7 = defineComponent(_objectSpread$7(_objectSpread$7({}, __default__$6), {}, {
props: {
opacity: null,
index: null,
visible: {
type: [Boolean, String]
}
},
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);
};
}
}));
function ownKeys$6(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$6(target) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys$6(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
var _hoisted_1$5 = ["src"];
var __default__$5 = {
name: "Iframe"
};
var _sfc_main$6 = defineComponent(_objectSpread$6(_objectSpread$6({}, __default__$5), {}, {
props: {
src: null
},
setup: function setup2(__props) {
var props = __props;
var src = computed(function() {
return props.src;
});
return function(_ctx, _cache) {
return openBlock(), createElementBlock("iframe", {
scrolling: "auto",
class: "layui-layer-iframe",
allowtransparency: "true",
frameborder: "0",
src: unref(src)
}, null, 8, _hoisted_1$5);
};
}
}));
function ownKeys$5(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$5(target) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys$5(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
var _hoisted_1$4 = {
class: "layui-layer-title",
style: {
"cursor": "move"
}
};
var __default__$4 = {
name: "Title"
};
var _sfc_main$5 = defineComponent(_objectSpread$5(_objectSpread$5({}, __default__$4), {}, {
props: {
title: {
type: [String, Boolean, Function]
}
},
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$4, toDisplayString(renderContent(__props.title)), 1);
};
}
}));
function ownKeys$4(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$4(target) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys$4(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
var __default__$3 = {
name: "CloseBtn"
};
var _sfc_main$4 = defineComponent(_objectSpread$4(_objectSpread$4({}, __default__$3), {}, {
props: {
closeBtn: {
type: [Number, String, Boolean]
}
},
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: normalizeClass(["layui-layer-ico layui-layer-close layui-layer-close" + __props.closeBtn]),
href: "javascript:;",
onClick: closeHandle
}, null, 2);
};
}
}));
var _export_sfc = (sfc, props) => {
const target = sfc.__vccOpts || sfc;
for (const [key, val] of props) {
target[key] = val;
}
return target;
};
var _sfc_main$3 = {
name: "Resize"
};
var _hoisted_1$3 = {
class: "layui-layer-resize"
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("span", _hoisted_1$3);
}
var Resize = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render]]);
function ownKeys$3(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$3(target) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys$3(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
var _hoisted_1$2 = {
class: "layui-layer-phimg"
};
var _hoisted_2$2 = ["src"];
var _hoisted_3$2 = {
key: 0,
class: "layui-layer-imgsee"
};
var _hoisted_4$1 = {
key: 0,
class: "layui-layer-imguide"
};
var _hoisted_5 = {
key: 0,
class: "thumb-row"
};
var _hoisted_6 = ["onClick"];
var _hoisted_7 = ["src"];
var _hoisted_8 = {
key: 1,
class: "layui-layer-imgtit"
};
var _hoisted_9 = {
key: 0
};
var _hoisted_10 = {
key: 1
};
var __default__$2 = {
name: "Photos"
};
var _sfc_main$2 = defineComponent(_objectSpread$3(_objectSpread$3({}, __default__$2), {}, {
props: {
imgList: null,
startIndex: {
default: 0
}
},
emits: ["resetCalculationPohtosArea"],
setup: function setup5(__props, _ref) {
var emit = _ref.emit;
var props = __props;
var index2 = ref(props.startIndex);
watch(index2, function() {
emit("resetCalculationPohtosArea", index2.value);
});
var changeIndex = function changeIndex2(step) {
var nowIndex = index2.value;
var next = nowIndex + step;
if (next < 0) {
next = props.imgList.length - 1;
}
if (next >= props.imgList.length) {
next = 0;
}
index2.value = next;
};
var showLayerImgBar = ref(false);
onMounted(function() {
nextTick(function() {
showLayerImgBar.value = true;
});
});
var ifSetThumb = computed(function() {
var res = false;
props.imgList.forEach(function(e) {
if (e.thumb) {
res = true;
}
});
return res;
});
return function(_ctx, _cache) {
return openBlock(), createElementBlock("div", _hoisted_1$2, [createElementVNode("img", {
src: __props.imgList[index2.value].src
}, null, 8, _hoisted_2$2), __props.imgList.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_3$2, [__props.imgList.length > 1 ? (openBlock(), createElementBlock("span", _hoisted_4$1, [createElementVNode("a", {
href: "javascript:;",
class: "layui-layer-iconext layui-layer-imgprev",
onClick: _cache[0] || (_cache[0] = function($event) {
return changeIndex(-1);
})
}), createElementVNode("a", {
href: "javascript:;",
class: "layui-layer-iconext layui-layer-imgnext",
onClick: _cache[1] || (_cache[1] = function($event) {
return changeIndex(1);
})
})])) : createCommentVNode("", true), __props.imgList.length > 1 || __props.imgList[index2.value].alt ? (openBlock(), createElementBlock("div", {
key: 1,
class: "layui-layer-imgbar",
style: normalizeStyle({
opacity: showLayerImgBar.value ? 1 : 0
})
}, [unref(ifSetThumb) ? (openBlock(), createElementBlock("div", _hoisted_5, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.imgList, function(item, i) {
return openBlock(), createElementBlock("div", {
class: "thumb-box",
key: "thumb-box" + i,
onClick: function onClick($event) {
return index2.value = i;
}
}, [createElementVNode("img", {
src: item.thumb
}, null, 8, _hoisted_7)], 8, _hoisted_6);
}), 128)), createElementVNode("div", {
class: "thumb-box-border",
style: normalizeStyle({
left: "calc(calc( calc(100% - ".concat(100 * __props.imgList.length, "px) / 2) + ").concat(index2.value * 100, "px)")
})
}, null, 4)])) : (openBlock(), createElementBlock("span", _hoisted_8, [__props.imgList[index2.value].alt ? (openBlock(), createElementBlock("span", _hoisted_9, toDisplayString(__props.imgList[index2.value].alt), 1)) : createCommentVNode("", true), __props.imgList.length > 1 ? (openBlock(), createElementBlock("em", _hoisted_10, toDisplayString(index2.value + 1) + " / " + toDisplayString(__props.imgList.length), 1)) : createCommentVNode("", true)]))], 4)) : createCommentVNode("", true)])) : createCommentVNode("", true)]);
};
}
}));
function ownKeys$2(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys$2(Object(source), true).forEach(function(key) {
_defineProperty(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;
}
var _hoisted_1$1 = {
class: "title"
};
var _hoisted_2$1 = {
key: 0,
class: "content"
};
var _hoisted_3$1 = ["innerHTML"];
var __default__$1 = {
name: "Notifiy"
};
var _sfc_main$1 = defineComponent(_objectSpread$2(_objectSpread$2({}, __default__$1), {}, {
props: {
title: null,
content: null,
isHtmlFragment: {
type: Boolean,
default: false
},
icon: null,
iconClass: null
},
emits: ["close"],
setup: function setup6(__props, _ref) {
var emit = _ref.emit;
var notifyRef = shallowRef(null);
var close2 = function close3() {
emit("close");
};
function addClass(obj, cls) {
var obj_class = obj.className, blank = obj_class != "" ? " " : "";
var added = obj_class + blank + cls;
obj.className = added;
}
onMounted(function() {
nextTick(function() {
setTimeout(function() {
var _notifyRef$value, _notifyRef$value$pare, _notifyRef$value2, _notifyRef$value2$par;
if (!((_notifyRef$value = notifyRef.value) !== null && _notifyRef$value !== void 0 && (_notifyRef$value$pare = _notifyRef$value.parentElement) !== null && _notifyRef$value$pare !== void 0 && _notifyRef$value$pare.parentElement))
return;
addClass((_notifyRef$value2 = notifyRef.value) === null || _notifyRef$value2 === void 0 ? void 0 : (_notifyRef$value2$par = _notifyRef$value2.parentElement) === null || _notifyRef$value2$par === void 0 ? void 0 : _notifyRef$value2$par.parentElement, "layui-layer-notifiy-transition");
}, 300);
});
});
return function(_ctx, _cache) {
return openBlock(), createElementBlock("div", {
class: "layui-layer-notifiy-wrapper",
ref_key: "notifyRef",
ref: notifyRef
}, [createElementVNode("h2", _hoisted_1$1, [__props.icon ? (openBlock(), createElementBlock("i", {
key: 0,
class: normalizeClass(__props.iconClass)
}, null, 2)) : createCommentVNode("", true), createTextVNode(" " + toDisplayString(__props.title), 1)]), !__props.isHtmlFragment ? (openBlock(), createElementBlock("div", _hoisted_2$1, [createElementVNode("p", null, toDisplayString(__props.content), 1)])) : (openBlock(), createElementBlock("div", {
key: 1,
class: "content",
innerHTML: __props.content
}, null, 8, _hoisted_3$1)), createVNode(_sfc_main$4, {
onClick: close2
})], 512);
};
}
}));
function _arrayLikeToArray(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 _arrayWithoutHoles(arr) {
if (Array.isArray(arr))
return _arrayLikeToArray(arr);
}
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
return Array.from(iter);
}
function _unsupportedIterableToArray(o, minLen) {
if (!o)
return;
if (typeof o === "string")
return _arrayLikeToArray(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(o, minLen);
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
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(type, area, offset) {
return type != "drawer" ? calculateBaseArea(area) : calculateDrawerArea(offset, area);
}
function calculateBaseArea(area) {
if (area === "auto") {
return [];
}
if (typeof area == "string") {
return [area];
}
return _toConsumableArray(area);
}
function calculateDrawerArea(offset) {
var drawerArea = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "30%";
if (drawerArea instanceof Array) {
return drawerArea;
}
if (drawerArea === "auto") {
drawerArea = "30%";
}
if (offset === "l" || offset === "r") {
return [drawerArea, "100%"];
} else if (offset === "t" || offset === "b") {
return ["100%", drawerArea];
}
return [drawerArea, "100%"];
}
function calculateOffset(offset, area, type) {
var arr = ["t", "r", "b", "l", "lt", "lb", "rt", "rb"];
var t = offset[0];
var l = offset[1];
if (offset instanceof Array && type === "drawer") {
offset = "r";
}
if (arr.indexOf(offset) > -1) {
t = "50%";
l = "50%";
}
if (arr.indexOf(offset) != -1 || t.indexOf("%") > -1)
t = "calc(" + t + " - (" + (area === "auto" ? "100px" : area[1]) + "/2 ))";
if (arr.indexOf(offset) != -1 || l.indexOf("%") > -1)
l = "calc(" + l + " - (" + (area === "auto" ? "100px" : area[0]) + "/2 ))";
if (offset === "t")
t = "0px";
else if (offset === "r")
l = "calc(100% - " + area[0] + ")";
else if (offset === "b")
t = "calc(100% - " + area[1] + ")";
else if (offset === "l")
l = "0px";
else if (offset === "lt") {
t = "0px";
l = "0px";
} else if (offset === "lb") {
t = "calc(100% - " + area[1] + ")";
l = "0px";
} else if (offset === "rt") {
t = "0px";
l = "calc(100% - " + area[0] + ")";
} else if (offset === "rb") {
t = "calc(100% - " + area[1] + ")";
l = "calc(100% - " + area[0] + ")";
}
return [t, l];
}
function calculateType(modalType) {
if (modalType === "dialog" || modalType == 0) {
return 0;
} else if (modalType === "page" || modalType == 1) {
return 1;
} else if (modalType === "iframe" || modalType == 2) {
return 2;
} else if (modalType === "loading" || modalType == 3) {
return 3;
} else if (modalType === "drawer" || modalType == 4) {
return 4;
} else if (modalType === "photos" || modalType == 5) {
return 5;
} else if (modalType === "notifiy" || modalType == 6) {
return 6;
}
return 0;
}
function calculateContent(title2, height, btn, type, isMessage) {
if (height && height.indexOf("%") != -1) {
height = "100%";
}
if (btn && btn.length > 0) {
if (type == 0) {
if (title2) {
return "calc(" + height + " - 137px)";
} else {
return "calc(" + height + " - 86px)";
}
}
if (type == 1 || type == 4) {
if (title2) {
return "calc(" + height + " - 102px)";
} else {
return "calc(" + height + " - 51px)";
}
}
if (type == 2) {
if (title2) {
return "calc(" + height + " - 102px)";
} else {
return "calc(" + height + " - 51px)";
}
}
} else {
if (type == 0) {
if (title2) {
return isMessage ? "" : "calc(" + height + " - 137px)";
} else {
return isMessage ? "" : "calc(" + height + " - 86px)";
}
}
if (type == 1 || type == 4) {
if (title2) {
return "calc(" + height + " - 51px)";
} else {
return "calc(" + height + " - 0px)";
}
}
if (type == 2) {
if (title2) {
return "calc(" + height + " - 51px)";
} else {
return "calc(" + height + " - 0px)";
}
}
}
}
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(offset) {
var isClose = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
var prefix = "layer-drawer-anim layer-anim";
var suffix = "rl";
if (offset === "l") {
suffix = "lr";
} else if (offset === "r") {
suffix = "rl";
} else if (offset === "t") {
suffix = "tb";
} else if (offset === "b") {
suffix = "bt";
}
return isClose ? "".concat(prefix, "-").concat(suffix, "-close") : "".concat(prefix, "-").concat(suffix);
}
function calculatePhotosArea(_x, _x2) {
return _calculatePhotosArea.apply(this, arguments);
}
function _calculatePhotosArea() {
_calculatePhotosArea = _asyncToGenerator(/* @__PURE__ */ regenerator.mark(function _callee(url, options) {
var img, area;
return regenerator.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
area = function _area(img2) {
var imgarea = [img2.width, img2.height];
var winarea = [window.innerWidth - 250, window.innerHeight - 250];
if (imgarea[0] > winarea[0] || imgarea[1] > winarea[1]) {
var wh = [imgarea[0] / winarea[0], imgarea[1] / winarea[1]];
if (wh[0] > wh[1]) {
imgarea[0] = imgarea[0] / wh[0];
imgarea[1] = imgarea[1] / wh[0];
} else if (wh[0] < wh[1]) {
imgarea[0] = imgarea[0] / wh[1];
imgarea[1] = imgarea[1] / wh[1];
}
}
return [imgarea[0] + "px", imgarea[1] + "px"];
};
img = new Image();
img.src = url;
return _context.abrupt("return", new Promise(function(resolve, reject) {
if (img.complete) {
resolve(area(img));
return;
}
var layerId = layer.load(2);
img.onload = function() {
layer.close(layerId);
resolve(area(img));
};
img.onerror = function() {
layer.close(layerId);
layer.msg("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25");
reject(false);
};
}));
case 4:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return _calculatePhotosArea.apply(this, arguments);
}
function calculateNotifOffset(offset, area, layerId) {
var arr = ["lt", "lb", "rt", "rb"];
var t = "0", l = "0";
var transOffsetLeft = 15;
var transOffsetTop = 15;
window.NotifiyQueen = window.NotifiyQueen || [];
var notifiyQueen = window.NotifiyQueen;
if (typeof offset != "string" || arr.indexOf(offset) === -1) {
offset = "rt";
}
var nodeList = notifiyQueen.filter(function(e) {
if (e.offset === offset) {
return e;
}
});
var prevNode = nodeList.length > 0 ? nodeList[nodeList.length - 1] : null;
if (prevNode) {
var _document$getElementB, _document$getElementB2;
prevNode = (_document$getElementB = document.getElementById(prevNode["id"])) === null || _document$getElementB === void 0 ? void 0 : (_document$getElementB2 = _document$getElementB.firstElementChild) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.firstElementChild;
if (offset === "rt" || offset === "lt") {
transOffsetTop += prevNode.offsetHeight + parseFloat(prevNode.style["top"]);
} else {
var bottom = parseFloat(prevNode.style["top"].split(" - ")[1]);
transOffsetTop += prevNode.offsetHeight + bottom;
}
} else {
if (offset === "rb" || offset === "lb") {
transOffsetTop += parseFloat(area[1]);
}
}
if (offset === "rt") {
t = transOffsetTop + "px";
l = "calc(100% - " + (parseFloat(area[0]) + transOffsetLeft) + "px)";
} else if (offset === "rb") {
t = "calc(100vh - " + transOffsetTop + "px)";
l = "calc(100% - " + (parseFloat(area[0]) + transOffsetLeft) + "px)";
} else if (offset === "lt") {
t = transOffsetTop + "px";
l = transOffsetLeft + "px";
} else if (offset === "lb") {
t = "calc(100vh - " + transOffsetTop + "px)";
l = transOffsetLeft + "px";
}
notifiyQueen.push({
id: layerId,
offset
});
return [t, l];
}
function removeNotifiyFromQueen(layerId) {
var _document$getElementB3, _document$getElementB4;
var transOffsetTop = 15;
var notifiyDom = (_document$getElementB3 = document.getElementById(layerId)) === null || _document$getElementB3 === void 0 ? void 0 : (_document$getElementB4 = _document$getElementB3.firstElementChild) === null || _document$getElementB4 === void 0 ? void 0 : _document$getElementB4.firstElementChild;
var offsetHeight = notifiyDom.offsetHeight;
window.NotifiyQueen = window.NotifiyQueen || [];
var notifiyQueen = window.NotifiyQueen;
var index2 = notifiyQueen.findIndex(function(e) {
return e.id === layerId;
});
var offsetType = notifiyQueen[index2].offset;
var list = notifiyQueen.filter(function(e) {
if (e.offset === offsetType) {
return e;
}
});
var findIndex = list.findIndex(function(e) {
return e.id === layerId;
});
var needCalculatelist = list.slice(findIndex + 1);
needCalculatelist.forEach(function(e) {
var _document$getElementB5, _document$getElementB6;
var dom = (_document$getElementB5 = document.getElementById(e.id)) === null || _document$getElementB5 === void 0 ? void 0 : (_document$getElementB6 = _document$getElementB5.firstElementChild) === null || _document$getElementB6 === void 0 ? void 0 : _document$getElementB6.firstElementChild;
if (offsetType === "rt" || offsetType === "lt") {
dom.style["top"] = parseFloat(dom.style["top"]) - transOffsetTop - offsetHeight + "px";
} else {
var bottom = parseFloat(dom.style["top"].split(" - ")[1]) - transOffsetTop - offsetHeight;
dom.style["top"] = "calc(100vh - " + bottom + "px)";
}
});
notifiyQueen.splice(index2, 1);
}
function getNotifyAnimationClass(offset) {
var prefix = "layer-drawer-anim layer-anim";
var suffix = "";
if (offset === "lt" || offset === "lb") {
suffix = "lr";
} else {
suffix = "rl";
}
return "".concat(prefix, "-").concat(suffix);
}
var useMove$1 = function useMove(el, callback) {
if (el != null) {
el.addEventListener("mousedown", function(event) {
var path = event.composedPath && event.composedPath() || event.path;
if (path[0].className === "layui-layer-resize") {
if (event.button == 0 && el != null) {
var x = el.offsetLeft;
var y = el.offsetTop;
var move = function move2(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", move);
var stop = function stop2() {
document.removeEventListener("mousemove", move);
document.removeEventListener("mouseup", stop2);
};
document.addEventListener("mouseup", stop);
}
}
return false;
});
}
};
var useMove2 = function useMove3(el, callback) {
el.style.position = "fixed";
var offsetX;
var offsetY;
if (el != null) {
el.addEventListener("mousedown", function(event) {
var path = event.composedPath && event.composedPath() || event.path;
if (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 move = function move2(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", move);
var stop = function stop2() {
document.removeEventListener("mousemove", move);
document.removeEventListener("mouseup", stop2);
};
document.addEventListener("mouseup", stop);
}
}
return false;
});
}
};
var zIndexKey = Symbol("zIndex");
function ownKeys$1(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$1(target) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys$1(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
var _hoisted_1 = ["innerHTML"];
var _hoisted_2 = {
key: 1,
class: "layui-layer-setwin"
};
var _hoisted_3 = {
key: 0
};
var _hoisted_4 = ["onClick"];
var __default__ = {
name: "LayLayer"
};
var _sfc_main = defineComponent(_objectSpread$1(_objectSpread$1({}, __default__), {}, {
props: {
id: null,
title: {
type: [String, Boolean, Function],
default: "\u6807\u9898"
},
icon: null,
skin: null,
zIndex: null,
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: "1"
},
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,
startIndex: {
default: 0
},
imgList: {
default: function _default5() {
return [];
}
},
min: {
type: Function,
default: function _default6() {
}
},
full: {
type: Function,
default: function _default7() {
}
},
restore: {
type: Function,
default: function _default8() {
}
}
},
emits: ["close", "update:modelValue"],
setup: function setup7(__props, _ref) {
var _props$zIndex;
var expose = _ref.expose, emit = _ref.emit;
var props = __props;
var slots = useSlots();
var max = ref(false);
var min = ref(false);
var id = ref(props.id || nextId());
var layero = ref(null);
var type = calculateType(props.type);
var area = ref(calculateArea(props.type, props.area, props.offset));
var offset = ref(calculateOffset(props.offset, area.value, props.type));
var contentHeight = ref(calculateContent(props.title, area.value[1], props.btn, type, props.isMessage));
var index2 = ref((_props$zIndex = props.zIndex) !== null && _props$zIndex !== void 0 ? _props$zIndex : inject(zIndexKey, 99999));
var visible = ref(false);
var first = ref(true);
var w = ref(area.value[0]);
var h2 = ref(area.value[1]);
var t = ref(offset.value[0]);
var l = ref(offset.value[1]);
var _w = ref(area.value[0]);
var _h = ref(area.value[0]);
var _t = ref(offset.value[0]);
var _l = ref(offset.value[1]);
var firstOpenDelayCalculation = function firstOpenDelayCalculation2() {
nextTick(/* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ regenerator.mark(function _callee() {
return regenerator.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
area.value = getArea(layero.value);
if (type == 4) {
area.value = calculateDrawerArea(props.offset, props.area);
}
if (!(type == 5)) {
_context.next = 6;
break;
}
_context.next = 5;
return calculatePhotosArea(props.imgList[props.startIndex].src, props);
case 5:
area.value = _context.sent;
case 6:
offset.value = calculateOffset(props.offset, area.value, props.type);
if (type == 6) {
offset.value = calculateNotifOffset(props.offset, area.value, id.value);
}
w.value = area.value[0];
h2.value = area.value[1];
_w.value = area.value[0];
_l.value = area.value[1];
t.value = offset.value[0];
l.value = offset.value[1];
_t.value = offset.value[0];
_l.value = offset.value[1];
supportMove();
case 17:
case "end":
return _context.stop();
}
}
}, _callee);
})));
};
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 (min.value)
minHandle();
if (max.value)
maxHandle();
_w.value = w.value;
_h.value = h2.value;
_t.value = t.value;
_l.value = l.value;
};
var maxHandle = function maxHandle2() {
if (max.value) {
w.value = _w.value;
h2.value = _h.value;
t.value = _t.value;
l.value = _l.value;
props.restore(props.id);
} 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;
props.full(props.id);
}
max.value = !max.value;
};
var minHandle = function minHandle2() {
var left = 180 * updateMinArrays(id.value, !min.value);
if (left > document.documentElement.clientWidth - 180) {
left = document.documentElement.clientWidth - 180;
}
if (min.value) {
w.value = _w.value;
h2.value = _h.value;
t.value = _t.value;
l.value = _l.value;
props.restore(props.id);
} 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;
props.min(props.id);
}
min.value = !min.value;
};
var reset2 = function reset3() {
if (!first.value) {
min.value = false;
max.value = false;
w.value = area.value[0];
h2.value = area.value[1];
t.value = offset.value[0];
l.value = offset.value[1];
_w.value = area.value[0];
_h.value = area.value[1];
_t.value = offset.value[0];
_l.value = offset.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,
immediate: true
});
watch(function() {
return visible.value;
}, function() {
if (visible.value) {
if (props.isFunction) {
firstOpenDelayCalculation();
}
props.success();
}
}, {
immediate: true
});
watch(function() {
return visible.value;
}, function() {
if (!visible.value) {
props.end();
}
});
watch(function() {
return h2.value;
}, function() {
contentHeight.value = calculateContent(props.title, h2.value, props.btn, type, props.isMessage);
});
var boxClasses = computed(function() {
return [{
"layui-layer-dialog": type === 0,
"layui-layer-page": type === 1,
"layui-layer-iframe": type === 2,
"layui-layer-loading": type === 3,
"layui-layer-drawer": type === 4,
"layui-layer-photos": type === 5,
"layui-layer-notifiy": type === 6,
"layui-layer-msg": props.isMessage,
"layui-layer-hui": props.isMessage && !props.icon
}, props.skin];
});
var supportMove = function supportMove2() {
if (props.move && type != 4) {
nextTick(function() {
if (!layero.value)
return;
useMove2(layero.value, function(left, top) {
l.value = left;
t.value = top;
});
useMove$1(layero.value, function(width, height) {
h2.value = height;
w.value = width;
});
});
}
};
var styles = computed(function() {
var style = {
top: t.value,
left: l.value,
width: w.value,
height: h2.value,
zIndex: index2.value
};
return style;
});
var contentClasses = computed(function() {
return [type === 3 ? "layui-layer-loading".concat(props.load) : "", props.icon ? "layui-layer-padding" : ""];
});
var closeHandle = function closeHandle2() {
emit("close");
emit("update:modelValue", false);
props.destroy();
if (type === 6) {
removeNotifiyFromQueen(props.id);
}
};
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 (type === 4) {
return getDrawerAnimationClass(props.offset);
}
if (type === 6) {
return getNotifyAnimationClass(props.offset);
}
return "layer-anim layer-anim-0".concat(props.anim);
});
var leaveActiveClass = computed(function() {
if (type === 4) {
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 && !min.value;
});
var showResize = computed(function() {
return props.resize && !max.value && !min.value;
});
var showTitle = computed(function() {
return props.title && props.type != 3 && props.type != 5 && props.type != 6;
});
var resetCalculationPohtosArea = function resetCalculationPohtosArea2(index22) {
nextTick(/* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ regenerator.mark(function _callee2() {
return regenerator.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return calculatePhotosArea(props.imgList[index22].src, props);
case 2:
area.value = _context2.sent;
offset.value = calculateOffset(props.offset, area.value, props.type);
w.value = area.value[0];
h2.value = area.value[1];
t.value = offset.value[0];
l.value = offset.value[1];
_w.value = area.value[0];
_l.value = area.value[1];
_t.value = offset.value[0];
_l.value = offset.value[1];
case 12:
case "end":
return _context2.stop();
}
}
}, _callee2);
})));
};
expose({
reset: reset2,
open: open2,
close: close2
});
return function(_ctx, _cache) {
return openBlock(), createElementBlock("div", null, [createVNode(_sfc_main$7, {
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$5, {
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(type) === 0 || unref(type) === 1 || unref(type) === 4 ? (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)) : (openBlock(), createElementBlock(Fragment, {
key: 1
}, [createTextVNode(toDisplayString(renderContent(props.content)), 1)], 64))], 64))], 64)) : createCommentVNode("", true), unref(type) === 2 ? (openBlock(), createBlock(_sfc_main$6, {
key: 1,
src: props.content
}, null, 8, ["src"])) : createCommentVNode("", true), unref(type) === 5 ? (openBlock(), createBlock(_sfc_main$2, {
key: 2,
imgList: props.imgList,
startIndex: props.startIndex,
onResetCalculationPohtosArea: resetCalculationPohtosArea
}, null, 8, ["imgList", "startIndex"])) : createCommentVNode("", true), unref(type) === 6 ? (openBlock(), createBlock(_sfc_main$1, {
key: 3,
onClose: closeHandle,
title: props.title,
content: props.content,
isHtmlFragment: props.isHtmlFragment,
icon: props.icon,
iconClass: unref(iconClass)
}, null, 8, ["title", "content", "isHtmlFragment", "icon", "iconClass"])) : createCommentVNode("", true)], 6), unref(type) != 3 && unref(type) != 5 && unref(type) != 6 ? (openBlock(), createElementBlock("span", _hoisted_2, [__props.maxmin && !max.value ? (openBlock(), createElementBlock("a", {
key: 0,
class: normalizeClass(["layui-layer-min", [min.value ? "layui-layer-ico layui-layer-maxmin" : ""]]),
href: "javascript:;",
onClick: minHandle
}, [!min.value ? (openBlock(), createElementBlock("cite", _hoisted_3)) : createCommentVNode("", true)], 2)) : createCommentVNode("", true), __props.maxmin && !min.value ? (openBlock(), createElementBlock("a", {
key: 1,
class: normalizeClass(["layui-layer-ico layui-layer-max", [max.value ? "layui-layer-maxmin" : ""]]),
href: "javascript:;",
onClick: maxHandle
}, null, 2)) : createCommentVNode("", true), __props.closeBtn != false ? (openBlock(), createBlock(_sfc_main$4, {
key: 2,
"close-btn": __props.closeBtn,
onCloseHandle: closeHandle
}, null, 8, ["close-btn"])) : createCommentVNode("", true)])) : createCommentVNode("", true), (__props.btn && __props.btn.length > 0 || unref(type) === 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(id.value);
}
}, toDisplayString(b.text), 11, _hoisted_4);
}), 128)) : (openBlock(), createElementBlock(Fragment, {
key: 1
}, [unref(type) === 0 ? (openBlock(), createElementBlock("a", {
key: 0,
class: "layui-layer-btn0",
onClick: _cache[0] || (_cache[0] = function($event) {
return yesHandle();
})
}, toDisplayString(__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 index$1 = /* @__PURE__ */ (() => ".layui-layer-imgbar,.layui-layer-imgtit a,.layui-layer-tab .layui-layer-title span,.layui-layer-title{text-overflow:ellipsis;white-space:nowrap;user-select:none}.layui-layer,.layui-layer-shade{position:fixed;pointer-events:auto}.layui-layer-shade{top:0;left:0;width:100%;height:100%;background-color:#000}.layui-layer{top:0;left:0;box-shadow:1px 1px 50px #0000004d;background-color:#fff;border-radius:2px;padding:0;margin:0}.layui-layer-close{position:absolute}.layui-layer-content{position:relative}.layui-layer-border{border:1px solid #eeeeee;box-shadow:1px 1px 5px #0003}.layui-layer-load{background:url(data:image/gif;base64,R0lGODlhJQAlAJECAL3L2AYrTv///wAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFCgACACwAAAAAJQAlAAACi5SPqcvtDyGYIFpF690i8xUw3qJBwUlSadmcLqYmGQu6KDIeM13beGzYWWy3DlB4IYaMk+Dso2RWkFCfLPcRvFbZxFLUDTt21BW56TyjRep1e20+i+eYMR145W2eefj+6VFmgTQi+ECVY8iGxcg35phGo/iDFwlTyXWphwlm1imGRdcnuqhHeop6UAAAIfkEBQoAAgAsEAACAAQACwAAAgWMj6nLXAAh+QQFCgACACwVAAUACgALAAACFZQvgRi92dyJcVJlLobUdi8x4bIhBQAh+QQFCgACACwXABEADAADAAACBYyPqcsFACH5BAUKAAIALBUAFQAKAAsAAAITlGKZwWoMHYxqtmplxlNT7ixGAQAh+QQFCgACACwQABgABAALAAACBYyPqctcACH5BAUKAAIALAUAFQAKAAsAAAIVlC+BGL3Z3IlxUmUuhtR2LzHhsiEFACH5BAUKAAIALAEAEQAMAAMAAAIFjI+pywUAIfkEBQoAAgAsBQAFAAoACwAAAhOUYJnAagwdjGq2amXGU1PuLEYBACH5BAUKAAIALBAAAgAEAAsAAAIFhI+py1wAIfkEBQoAAgAsFQAFAAoACwAAAhWUL4AIvdnciXFSZS6G1HYvMeGyIQUAIfkEBQoAAgAsFwARAAwAAwAAAgWEj6nLBQAh+QQFCgACACwVABUACgALAAACE5RgmcBqDB2MarZqZcZTU+4sRgEAIfkEBQoAAgAsEAAYAAQACwAAAgWEj6nLXAAh+QQFCgACACwFABUACgALAAACFZQvgAi92dyJcVJlLobUdi8x4bIhBQAh+QQFCgACACwBABEADAADAAACBYSPqcsFADs=) center center no-repeat #eee}.layui-layer-ico{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANIAAAA9CAYAAADYizcVAAAACXBIWXMAAAsTAAALEwEAmpwYAAAGfGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDUgNzkuMTYzNDk5LCAyMDE4LzA4LzEzLTE2OjQwOjIyICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiIHhtcDpDcmVhdGVEYXRlPSIyMDIyLTEwLTE5VDEzOjExOjM2KzA4OjAwIiB4bXA6TW9kaWZ5RGF0ZT0iMjAyMi0xMC0yMFQxNDoyMDoxNiswODowMCIgeG1wOk1ldGFkYXRhRGF0ZT0iMjAyMi0xMC0yMFQxNDoyMDoxNiswODowMCIgZGM6Zm9ybWF0PSJpbWFnZS9wbmciIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiIHBob3Rvc2hvcDpJQ0NQcm9maWxlPSJzUkdCIElFQzYxOTY2LTIuMSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDphMGIwMjVmMy02YjkyLWQzNGUtOWM1Ni0wMTVmMjA4MjM3OGIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6YTQwNTYxOWItODQ1ZC01ODRjLWFlNTEtYzE2ODZjMmU2Yzc1IiB4bXBNTTpPcmlnaW5hbERvY3VtZW50SUQ9InhtcC5kaWQ6YTQwNTYxOWItODQ1ZC01ODRjLWFlNTEtYzE2ODZjMmU2Yzc1Ij4gPHBob3Rvc2hvcDpEb2N1bWVudEFuY2VzdG9ycz4gPHJkZjpCYWc+IDxyZGY6bGk+eG1wLmRpZDphNDA1NjE5Yi04NDVkLTU4NGMtYWU1MS1jMTY4NmMyZTZjNzU8L3JkZjpsaT4gPC9yZGY6QmFnPiA8L3Bob3Rvc2hvcDpEb2N1bWVudEFuY2VzdG9ycz4gPHhtcE1NOkhpc3Rvcnk+IDxyZGY6U2VxPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0iY3JlYXRlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDphNDA1NjE5Yi04NDVkLTU4NGMtYWU1MS1jMTY4NmMyZTZjNzUiIHN0RXZ0OndoZW49IjIwMjItMTAtMTlUMTM6MTE6MzYrMDg6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE5IChXaW5kb3dzKSIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6YTBiMDI1ZjMtNmI5Mi1kMzRlLTljNTYtMDE1ZjIwODIzNzhiIiBzdEV2dDp3aGVuPSIyMDIyLTEwLTIwVDE0OjIwOjE2KzA4OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+BiYglAAAKw5JREFUeJztnXl4W9W57n97a7Iky2M8JDaOnTlO4gxAICQhDAkNUCgEMtDSAdJQoLSnp7Tc3tseSu899HDa0pEDTQNhaKGQACEFCjm
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
_defineProperty(target, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
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 findById = function findById2(id) {
var instance = null;
layerInstance.forEach(function(item, index2) {
if (item.modalContainer.id === id) {
instance = item;
}
});
return instance;
};
var mergeOption = function mergeOption2(option, defaultOption) {
if (option)
defaultOption = Object.assign(defaultOption, option);
return defaultOption;
};
var createContainer = function createContainer2(options) {
var modalContainer = document.createElement("div");
modalContainer.id = options.id;
document.body.appendChild(modalContainer);
return modalContainer;
};
var modalChildrenVNode = function modalChildrenVNode2(content) {
if (typeof content === "function") {
return isVNode(content()) ? {
default: function _default9() {
return content();
}
} : void 0;
}
return isVNode(content) ? {
default: function _default9() {
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);
},
photos: function photos(option, callback) {
if (typeof option === "string") {
option = {
imgList: [{
src: option
}]
};
}
var defaultOption = {
type: 5,
anim: 2,
startIndex: 0,
isOutAnim: true,
shadeClose: true,
shadeOpacity: "0.7"
};
return layer.create(option, defaultOption, callback);
},
notifiy: function notifiy() {
var option = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
var callback = arguments.length > 1 ? arguments[1] : void 0;
option.type = 6;
var defaultOption = {
offset: "rt",
time: 2e3,
area: "auto",
shade: 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);
if (options.hasOwnProperty("id")) {
layer.close(options.id);
} else {
options.id = nextId();
}
var modalContainer = createContainer(options);
var modalInstance = h(_sfc_main, _objectSpread(_objectSpread({}, options), {}, {
isFunction: true,
destroy: function destroy() {
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(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(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 && defaultOption.time != 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(null, modalContainer);
if (document.body.contains(modalContainer)) {
document.body.removeChild(modalContainer);
}
}, 2e3);
delInstance(modalContainer.id);
if (options.type === 6) {
removeNotifiyFromQueen(options.id);
}
}, defaultOption.time);
}
addInstance({
modalContainer,
modalInstance
});
return modalContainer.id;
},
close: function close(id) {
if (id != null && isExist(id)) {
var _instance$modalInstan, _instance$modalInstan2;
var instance = findById(id);
(_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(null, instance.modalContainer);
if (document.body.contains(instance.modalContainer))
document.body.removeChild(instance.modalContainer);
}, 2e3);
}
delInstance(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(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 = function install2(app, options) {
layer._context = app._context;
app.component(_sfc_main.name, _sfc_main);
app.config.globalProperties.$layer = layer;
if (options) {
app.provide(zIndexKey, options.zIndex);
}
};
var index = {
install
};
export { _sfc_main as LayLayer, index as default, layer };