lew-ui 2.4.4 → 2.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/radio/src/LewRadio.vue.d.ts +5 -5
- package/dist/components/radio/src/LewRadioGroup.vue.d.ts +10 -10
- package/dist/components/radio/src/props.d.ts +7 -6
- package/dist/components/steps/src/LewSteps.vue.d.ts +10 -10
- package/dist/components/tag/src/LewTag.vue.d.ts +5 -5
- package/dist/directives/index.d.ts +0 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +943 -952
- package/dist/index.umd.js +1 -1
- package/dist/methods/index.d.ts +3 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- /package/dist/{directives → methods}/dialog/index.d.ts +0 -0
- /package/dist/{directives → methods}/dialog/src/LewDialog.vue.d.ts +0 -0
- /package/dist/{directives → methods}/dialog/src/index.d.ts +0 -0
- /package/dist/{directives → methods}/dialog/src/props.d.ts +0 -0
- /package/dist/{directives → methods}/message/index.d.ts +0 -0
- /package/dist/{directives → methods}/message/src/index.d.ts +0 -0
- /package/dist/{directives → methods}/notification/index.d.ts +0 -0
- /package/dist/{directives → methods}/notification/src/index.d.ts +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as h$1, defineComponent, openBlock, createBlock, resolveDynamicComponent, normalizeClass, normalizeStyle, unref, createApp, computed, createElementBlock, renderSlot, getCurrentScope, onScopeDispose, toRef as toRef$1, readonly, customRef, ref, onMounted, nextTick, getCurrentInstance, shallowRef, watch, toRefs, mergeModels, useModel, reactive, withCtx, createElementVNode, createVNode, Transition, createCommentVNode, withModifiers, withDirectives, toDisplayString, vShow, Fragment, renderList, createTextVNode,
|
|
1
|
+
import { h as h$1, defineComponent, openBlock, createBlock, resolveDynamicComponent, normalizeClass, normalizeStyle, unref, createApp, computed, createElementBlock, renderSlot, getCurrentScope, onScopeDispose, toRef as toRef$1, readonly, customRef, ref, onMounted, nextTick, getCurrentInstance, shallowRef, watch, toRefs, mergeModels, useModel, reactive, withCtx, createElementVNode, createVNode, Transition, createCommentVNode, withModifiers, withDirectives, toDisplayString, vShow, Fragment, renderList, createTextVNode, resolveDirective, isRef, vModelText, mergeProps, createSlots, onUnmounted, vModelDynamic, watchEffect, TransitionGroup, toRaw, vModelCheckbox, resolveComponent, onActivated, normalizeProps, guardReactiveProps, Teleport, provide, inject } from "vue";
|
|
2
2
|
const flexProps = {
|
|
3
3
|
direction: {
|
|
4
4
|
type: String,
|
|
@@ -4330,7 +4330,6 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
4330
4330
|
};
|
|
4331
4331
|
__expose({ init, getTreeList });
|
|
4332
4332
|
return (_ctx, _cache) => {
|
|
4333
|
-
const _component_lew_checkbox = resolveComponent("lew-checkbox");
|
|
4334
4333
|
const _directive_loading = resolveDirective("loading");
|
|
4335
4334
|
return withDirectives((openBlock(), createElementBlock("div", {
|
|
4336
4335
|
style: normalizeStyle({
|
|
@@ -4382,7 +4381,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
4382
4381
|
onClick: ($event) => select(item)
|
|
4383
4382
|
}, [
|
|
4384
4383
|
item.level > 0 && _ctx.showLine ? (openBlock(), createElementBlock("div", _hoisted_3$o)) : createCommentVNode("", true),
|
|
4385
|
-
_ctx.showCheckbox ? (openBlock(), createBlock(
|
|
4384
|
+
_ctx.showCheckbox ? (openBlock(), createBlock(unref(LewCheckbox), {
|
|
4386
4385
|
key: 1,
|
|
4387
4386
|
certain: _ctx.multiple && unref(certainKeys).includes(item.key) && !(modelValue.value || []).includes(item.key),
|
|
4388
4387
|
checked: _ctx.multiple ? (modelValue.value || []).includes(item.key) : modelValue.value === item.key,
|
|
@@ -4412,7 +4411,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
|
|
|
4412
4411
|
};
|
|
4413
4412
|
}
|
|
4414
4413
|
});
|
|
4415
|
-
const LewTree = /* @__PURE__ */ _export_sfc(_sfc_main$V, [["__scopeId", "data-v-
|
|
4414
|
+
const LewTree = /* @__PURE__ */ _export_sfc(_sfc_main$V, [["__scopeId", "data-v-39cc6823"]]);
|
|
4416
4415
|
function tryOnScopeDispose(fn2) {
|
|
4417
4416
|
if (getCurrentScope()) {
|
|
4418
4417
|
onScopeDispose(fn2);
|
|
@@ -5563,7 +5562,7 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
|
|
|
5563
5562
|
};
|
|
5564
5563
|
}
|
|
5565
5564
|
});
|
|
5566
|
-
const LewTreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["__scopeId", "data-v-
|
|
5565
|
+
const LewTreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["__scopeId", "data-v-e7e4d91d"]]);
|
|
5567
5566
|
const tabsModel = {
|
|
5568
5567
|
modelValue: {
|
|
5569
5568
|
type: [String, Number],
|
|
@@ -6117,7 +6116,6 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
6117
6116
|
setup(__props) {
|
|
6118
6117
|
const stepsValue = useModel(__props, "modelValue");
|
|
6119
6118
|
return (_ctx, _cache) => {
|
|
6120
|
-
const _component_lew_text_trim = resolveComponent("lew-text-trim");
|
|
6121
6119
|
return openBlock(), createElementBlock("div", _hoisted_1$B, [
|
|
6122
6120
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (item, index2) => {
|
|
6123
6121
|
return openBlock(), createElementBlock("div", {
|
|
@@ -6157,13 +6155,13 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
6157
6155
|
]),
|
|
6158
6156
|
createElementVNode("div", _hoisted_4$d, [
|
|
6159
6157
|
createElementVNode("div", _hoisted_5$9, [
|
|
6160
|
-
createVNode(
|
|
6158
|
+
createVNode(unref(LewTextTrim), {
|
|
6161
6159
|
placement: "bottom",
|
|
6162
6160
|
text: item.title
|
|
6163
6161
|
}, null, 8, ["text"])
|
|
6164
6162
|
]),
|
|
6165
6163
|
createElementVNode("div", _hoisted_6$7, [
|
|
6166
|
-
createVNode(
|
|
6164
|
+
createVNode(unref(LewTextTrim), {
|
|
6167
6165
|
allowHTML: "",
|
|
6168
6166
|
lineClamp: 2,
|
|
6169
6167
|
placement: "bottom",
|
|
@@ -7779,14 +7777,13 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
7779
7777
|
getWidth
|
|
7780
7778
|
});
|
|
7781
7779
|
return (_ctx, _cache) => {
|
|
7782
|
-
const _component_lew_flex = resolveComponent("lew-flex");
|
|
7783
7780
|
return openBlock(), createElementBlock("div", {
|
|
7784
7781
|
ref_key: "formLabelRef",
|
|
7785
7782
|
ref: formLabelRef,
|
|
7786
7783
|
class: "lew-get-label-width-box"
|
|
7787
7784
|
}, [
|
|
7788
7785
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (item, index2) => {
|
|
7789
|
-
return openBlock(), createBlock(
|
|
7786
|
+
return openBlock(), createBlock(unref(LewFlex), {
|
|
7790
7787
|
gap: "5",
|
|
7791
7788
|
style: normalizeStyle({
|
|
7792
7789
|
fontSize: `var(--lew-form-font-size-${__props.size})`
|
|
@@ -7807,7 +7804,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
7807
7804
|
};
|
|
7808
7805
|
}
|
|
7809
7806
|
});
|
|
7810
|
-
const LewGetLabelWidth = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__scopeId", "data-v-
|
|
7807
|
+
const LewGetLabelWidth = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__scopeId", "data-v-792e52a4"]]);
|
|
7811
7808
|
const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
7812
7809
|
__name: "LewFormItem",
|
|
7813
7810
|
props: /* @__PURE__ */ mergeModels(formItemProps, {
|
|
@@ -7818,6 +7815,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
7818
7815
|
}),
|
|
7819
7816
|
emits: /* @__PURE__ */ mergeModels(["change"], ["update:modelValue"]),
|
|
7820
7817
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
7818
|
+
var _a;
|
|
7821
7819
|
const asMap = {
|
|
7822
7820
|
input: LewInput,
|
|
7823
7821
|
textarea: LewTextarea,
|
|
@@ -7836,6 +7834,10 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
7836
7834
|
upload: LewUpload,
|
|
7837
7835
|
"input-number": LewInputNumber
|
|
7838
7836
|
};
|
|
7837
|
+
const app = (_a = getCurrentInstance()) == null ? void 0 : _a.appContext.app;
|
|
7838
|
+
if (app && !app.directive("tooltip")) {
|
|
7839
|
+
app.use(LewTooltip);
|
|
7840
|
+
}
|
|
7839
7841
|
const getFormItemClassNames = computed(() => {
|
|
7840
7842
|
const { direction, size } = cloneDeep(props);
|
|
7841
7843
|
return object2class("lew-form-item", { direction, size });
|
|
@@ -7879,7 +7881,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
7879
7881
|
};
|
|
7880
7882
|
__expose({ validate, setError });
|
|
7881
7883
|
return (_ctx, _cache) => {
|
|
7882
|
-
var
|
|
7884
|
+
var _a2;
|
|
7883
7885
|
const _directive_tooltip = resolveDirective("tooltip");
|
|
7884
7886
|
return openBlock(), createElementBlock("div", {
|
|
7885
7887
|
class: normalizeClass(["lew-form-item", unref(getFormItemClassNames)]),
|
|
@@ -7911,7 +7913,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
7911
7913
|
createElementVNode("div", {
|
|
7912
7914
|
class: normalizeClass(["lew-form-item-main", { "lew-form-item-error": unref(errMsg) }]),
|
|
7913
7915
|
style: normalizeStyle({
|
|
7914
|
-
width: _ctx.direction === "x" ? `calc(${(
|
|
7916
|
+
width: _ctx.direction === "x" ? `calc(${(_a2 = unref(formItemRef)) == null ? void 0 : _a2.offsetWidth}px - ${unref(any2px)(_ctx.labelWidth)} - 10px)` : "100%",
|
|
7915
7917
|
justifyContent: _ctx.direction === "x" && _ctx.between ? "flex-end" : "flex-start"
|
|
7916
7918
|
})
|
|
7917
7919
|
}, [
|
|
@@ -7935,7 +7937,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
7935
7937
|
};
|
|
7936
7938
|
}
|
|
7937
7939
|
});
|
|
7938
|
-
const LewFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__scopeId", "data-v-
|
|
7940
|
+
const LewFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__scopeId", "data-v-ddaaa50f"]]);
|
|
7939
7941
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
7940
7942
|
function getDefaultExportFromCjs(x2) {
|
|
7941
7943
|
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
@@ -9776,7 +9778,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
9776
9778
|
};
|
|
9777
9779
|
}
|
|
9778
9780
|
});
|
|
9779
|
-
const LewForm = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__scopeId", "data-v-
|
|
9781
|
+
const LewForm = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__scopeId", "data-v-d8f3f2f7"]]);
|
|
9780
9782
|
const checkboxModel = {
|
|
9781
9783
|
modelValue: {
|
|
9782
9784
|
type: Boolean,
|
|
@@ -10125,11 +10127,11 @@ const radioProps = {
|
|
|
10125
10127
|
size: {
|
|
10126
10128
|
type: String,
|
|
10127
10129
|
default: "medium",
|
|
10128
|
-
description: "
|
|
10129
|
-
validator(value) {
|
|
10130
|
+
description: "复选框组中复选框的尺寸",
|
|
10131
|
+
validator: (value) => {
|
|
10130
10132
|
if (!validSizes.includes(value)) {
|
|
10131
10133
|
console.warn(
|
|
10132
|
-
|
|
10134
|
+
'[LewRadio] 无效的 size 值,请使用 "small"、"medium" 或 "large"'
|
|
10133
10135
|
);
|
|
10134
10136
|
return false;
|
|
10135
10137
|
}
|
|
@@ -10158,13 +10160,10 @@ const radioGroupProps = {
|
|
|
10158
10160
|
direction: {
|
|
10159
10161
|
type: String,
|
|
10160
10162
|
default: "x",
|
|
10161
|
-
description: "
|
|
10162
|
-
validator(value) {
|
|
10163
|
-
|
|
10164
|
-
|
|
10165
|
-
console.warn(
|
|
10166
|
-
`[LewRadioGroup] 无效的排列方向: ${value}。请使用 ${validDirections.join(", ")} 中的一个。`
|
|
10167
|
-
);
|
|
10163
|
+
description: "复选框组的排列方向",
|
|
10164
|
+
validator: (value) => {
|
|
10165
|
+
if (!validDirection.includes(value)) {
|
|
10166
|
+
console.warn('[LewRadioGroup] 无效的 direction 值,请使用 "x" 或 "y"');
|
|
10168
10167
|
return false;
|
|
10169
10168
|
}
|
|
10170
10169
|
return true;
|
|
@@ -10198,11 +10197,11 @@ const radioGroupProps = {
|
|
|
10198
10197
|
size: {
|
|
10199
10198
|
type: String,
|
|
10200
10199
|
default: "medium",
|
|
10201
|
-
description: "
|
|
10202
|
-
validator(value) {
|
|
10200
|
+
description: "复选框组中复选框的尺寸",
|
|
10201
|
+
validator: (value) => {
|
|
10203
10202
|
if (!validSizes.includes(value)) {
|
|
10204
10203
|
console.warn(
|
|
10205
|
-
|
|
10204
|
+
'[LewRadioGroup] 无效的 size 值,请使用 "small"、"medium" 或 "large"'
|
|
10206
10205
|
);
|
|
10207
10206
|
return false;
|
|
10208
10207
|
}
|
|
@@ -10307,8 +10306,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
10307
10306
|
});
|
|
10308
10307
|
});
|
|
10309
10308
|
return (_ctx, _cache) => {
|
|
10310
|
-
|
|
10311
|
-
return openBlock(), createBlock(_component_lew_flex, {
|
|
10309
|
+
return openBlock(), createBlock(unref(LewFlex), {
|
|
10312
10310
|
x: "start",
|
|
10313
10311
|
gap: "10",
|
|
10314
10312
|
class: normalizeClass(["lew-radio-group", unref(getRadioGroupClassName)]),
|
|
@@ -10334,7 +10332,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
|
|
|
10334
10332
|
};
|
|
10335
10333
|
}
|
|
10336
10334
|
});
|
|
10337
|
-
const LewRadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-
|
|
10335
|
+
const LewRadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-edc6d013"]]);
|
|
10338
10336
|
const selectModel = {
|
|
10339
10337
|
modelValue: {
|
|
10340
10338
|
type: [String, Number, void 0],
|
|
@@ -10595,8 +10593,6 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
10595
10593
|
);
|
|
10596
10594
|
__expose({ show, hide: hide2 });
|
|
10597
10595
|
return (_ctx, _cache) => {
|
|
10598
|
-
const _component_lew_empty = resolveComponent("lew-empty");
|
|
10599
|
-
const _component_lew_text_trim = resolveComponent("lew-text-trim");
|
|
10600
10596
|
return openBlock(), createBlock(unref(_sfc_main$k), {
|
|
10601
10597
|
ref_key: "lewPopoverRef",
|
|
10602
10598
|
ref: lewPopoverRef,
|
|
@@ -10665,7 +10661,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
10665
10661
|
class: "lew-not-found"
|
|
10666
10662
|
}, {
|
|
10667
10663
|
default: withCtx(() => [
|
|
10668
|
-
createVNode(
|
|
10664
|
+
createVNode(unref(_sfc_main$d), { title: "暂无结果" })
|
|
10669
10665
|
]),
|
|
10670
10666
|
_: 1
|
|
10671
10667
|
}))
|
|
@@ -10695,7 +10691,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
10695
10691
|
key: 1,
|
|
10696
10692
|
class: normalizeClass(["lew-select-item", getSelectItemClassName(templateProps)])
|
|
10697
10693
|
}, [
|
|
10698
|
-
createVNode(
|
|
10694
|
+
createVNode(unref(LewTextTrim), {
|
|
10699
10695
|
text: templateProps.label,
|
|
10700
10696
|
delay: [500, 0],
|
|
10701
10697
|
class: "lew-select-label"
|
|
@@ -10720,7 +10716,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
10720
10716
|
};
|
|
10721
10717
|
}
|
|
10722
10718
|
});
|
|
10723
|
-
const LewSelect = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-
|
|
10719
|
+
const LewSelect = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-aba2a338"]]);
|
|
10724
10720
|
const selectMultipleModel = {
|
|
10725
10721
|
modelValue: {
|
|
10726
10722
|
type: Array,
|
|
@@ -10998,11 +10994,6 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
10998
10994
|
});
|
|
10999
10995
|
__expose({ show, hide: hide2 });
|
|
11000
10996
|
return (_ctx, _cache) => {
|
|
11001
|
-
const _component_lew_tag = resolveComponent("lew-tag");
|
|
11002
|
-
const _component_lew_flex = resolveComponent("lew-flex");
|
|
11003
|
-
const _component_lew_empty = resolveComponent("lew-empty");
|
|
11004
|
-
const _component_lew_checkbox = resolveComponent("lew-checkbox");
|
|
11005
|
-
const _component_lew_text_trim = resolveComponent("lew-text-trim");
|
|
11006
10997
|
return openBlock(), createBlock(unref(_sfc_main$k), {
|
|
11007
10998
|
ref_key: "lewPopoverRef",
|
|
11008
10999
|
ref: lewPopoverRef,
|
|
@@ -11045,7 +11036,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
11045
11036
|
_: 1
|
|
11046
11037
|
}),
|
|
11047
11038
|
unref(getLabels) && unref(getLabels).length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
11048
|
-
_ctx.valueLayout === "tag" ? (openBlock(), createBlock(
|
|
11039
|
+
_ctx.valueLayout === "tag" ? (openBlock(), createBlock(unref(LewFlex), {
|
|
11049
11040
|
key: 0,
|
|
11050
11041
|
style: { "padding": "5px" },
|
|
11051
11042
|
x: "start",
|
|
@@ -11058,7 +11049,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
11058
11049
|
createVNode(TransitionGroup, { name: "list" }, {
|
|
11059
11050
|
default: withCtx(() => [
|
|
11060
11051
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(getLabels), (item, index2) => {
|
|
11061
|
-
return openBlock(), createBlock(
|
|
11052
|
+
return openBlock(), createBlock(unref(_sfc_main$o), {
|
|
11062
11053
|
key: index2,
|
|
11063
11054
|
type: "light",
|
|
11064
11055
|
size: _ctx.size,
|
|
@@ -11090,7 +11081,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
11090
11081
|
createElementVNode("div", _hoisted_1$t, toDisplayString(unref(getLabels).join(_ctx.valueTextSplit)), 1)
|
|
11091
11082
|
]),
|
|
11092
11083
|
"popover-body": withCtx(() => [
|
|
11093
|
-
createVNode(
|
|
11084
|
+
createVNode(unref(LewFlex), {
|
|
11094
11085
|
x: "start",
|
|
11095
11086
|
y: "center",
|
|
11096
11087
|
gap: 5,
|
|
@@ -11100,7 +11091,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
11100
11091
|
}, {
|
|
11101
11092
|
default: withCtx(() => [
|
|
11102
11093
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(getLabels), (item, index2) => {
|
|
11103
|
-
return openBlock(), createBlock(
|
|
11094
|
+
return openBlock(), createBlock(unref(_sfc_main$o), {
|
|
11104
11095
|
key: index2,
|
|
11105
11096
|
type: "light",
|
|
11106
11097
|
size: _ctx.size,
|
|
@@ -11145,13 +11136,13 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
11145
11136
|
])) : createCommentVNode("", true),
|
|
11146
11137
|
createElementVNode("div", _hoisted_3$g, [
|
|
11147
11138
|
unref(state).options && unref(state).options.length === 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
11148
|
-
_ctx.$slots.empty ? renderSlot(_ctx.$slots, "empty", { key: 0 }, void 0, true) : (openBlock(), createBlock(
|
|
11139
|
+
_ctx.$slots.empty ? renderSlot(_ctx.$slots, "empty", { key: 0 }, void 0, true) : (openBlock(), createBlock(unref(LewFlex), {
|
|
11149
11140
|
key: 1,
|
|
11150
11141
|
direction: "y",
|
|
11151
11142
|
class: "lew-not-found"
|
|
11152
11143
|
}, {
|
|
11153
11144
|
default: withCtx(() => [
|
|
11154
|
-
createVNode(
|
|
11145
|
+
createVNode(unref(_sfc_main$d), { title: "暂无结果" })
|
|
11155
11146
|
]),
|
|
11156
11147
|
_: 1
|
|
11157
11148
|
}))
|
|
@@ -11182,12 +11173,12 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
11182
11173
|
key: 1,
|
|
11183
11174
|
class: normalizeClass(["lew-select-item lew-select-item-mul", getSelectItemClassName(templateProps)])
|
|
11184
11175
|
}, [
|
|
11185
|
-
(openBlock(), createBlock(
|
|
11176
|
+
(openBlock(), createBlock(unref(LewCheckbox), {
|
|
11186
11177
|
key: templateProps.value,
|
|
11187
11178
|
class: "lew-select-checkbox",
|
|
11188
11179
|
checked: unref(getChecked)(templateProps.value)
|
|
11189
11180
|
}, null, 8, ["checked"])),
|
|
11190
|
-
createVNode(
|
|
11181
|
+
createVNode(unref(LewTextTrim), {
|
|
11191
11182
|
text: templateProps.label,
|
|
11192
11183
|
delay: [500, 0],
|
|
11193
11184
|
class: "lew-select-label"
|
|
@@ -11206,7 +11197,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
11206
11197
|
};
|
|
11207
11198
|
}
|
|
11208
11199
|
});
|
|
11209
|
-
const LewSelectMultiple = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-
|
|
11200
|
+
const LewSelectMultiple = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-77cedcac"]]);
|
|
11210
11201
|
const switchModel = {
|
|
11211
11202
|
modelValue: {
|
|
11212
11203
|
type: Boolean,
|
|
@@ -14655,7 +14646,6 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
14655
14646
|
return styleObj;
|
|
14656
14647
|
});
|
|
14657
14648
|
return (_ctx, _cache) => {
|
|
14658
|
-
const _component_lew_text_trim = resolveComponent("lew-text-trim");
|
|
14659
14649
|
return openBlock(), createElementBlock("div", {
|
|
14660
14650
|
class: normalizeClass(["lew-tag", unref(tagClassName)]),
|
|
14661
14651
|
style: normalizeStyle(unref(getStyle))
|
|
@@ -14664,10 +14654,10 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
14664
14654
|
renderSlot(_ctx.$slots, "left")
|
|
14665
14655
|
]),
|
|
14666
14656
|
createElementVNode("div", _hoisted_2$b, [
|
|
14667
|
-
_ctx.text ? (openBlock(), createBlock(
|
|
14657
|
+
_ctx.text ? (openBlock(), createBlock(unref(LewTextTrim), {
|
|
14668
14658
|
key: 0,
|
|
14669
14659
|
text: _ctx.text
|
|
14670
|
-
}, null, 8, ["text"])) : (openBlock(), createBlock(
|
|
14660
|
+
}, null, 8, ["text"])) : (openBlock(), createBlock(unref(LewTextTrim), { key: 1 }, {
|
|
14671
14661
|
default: withCtx(() => [
|
|
14672
14662
|
renderSlot(_ctx.$slots, "default")
|
|
14673
14663
|
]),
|
|
@@ -19115,6 +19105,11 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19115
19105
|
}),
|
|
19116
19106
|
emits: /* @__PURE__ */ mergeModels(["change"], ["update:modelValue"]),
|
|
19117
19107
|
setup(__props, { emit: __emit }) {
|
|
19108
|
+
var _a;
|
|
19109
|
+
const app = (_a = getCurrentInstance()) == null ? void 0 : _a.appContext.app;
|
|
19110
|
+
if (app && !app.directive("tooltip")) {
|
|
19111
|
+
app.use(LewTooltip);
|
|
19112
|
+
}
|
|
19118
19113
|
const { isSupported } = useClipboardItems({ read: true });
|
|
19119
19114
|
const tipFontSizeMap = {
|
|
19120
19115
|
small: 14,
|
|
@@ -19377,13 +19372,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19377
19372
|
}
|
|
19378
19373
|
});
|
|
19379
19374
|
return (_ctx, _cache) => {
|
|
19380
|
-
const _component_lew_flex = resolveComponent("lew-flex");
|
|
19381
|
-
const _component_lew_alert = resolveComponent("lew-alert");
|
|
19382
|
-
const _component_lew_image = resolveComponent("lew-image");
|
|
19383
|
-
const _component_lew_text_trim = resolveComponent("lew-text-trim");
|
|
19384
|
-
const _component_lew_tag = resolveComponent("lew-tag");
|
|
19385
19375
|
const _directive_tooltip = resolveDirective("tooltip");
|
|
19386
|
-
return openBlock(), createBlock(
|
|
19376
|
+
return openBlock(), createBlock(unref(LewFlex), {
|
|
19387
19377
|
class: "lew-upload-wrapper",
|
|
19388
19378
|
direction: "y",
|
|
19389
19379
|
gap: "10"
|
|
@@ -19391,17 +19381,17 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19391
19381
|
default: withCtx(() => [
|
|
19392
19382
|
withDirectives(createElementVNode("label", {
|
|
19393
19383
|
onMouseenter: _cache[2] || (_cache[2] = ($event) => {
|
|
19394
|
-
var
|
|
19395
|
-
return (
|
|
19384
|
+
var _a2;
|
|
19385
|
+
return (_a2 = unref(inputPasteRef)) == null ? void 0 : _a2.focus();
|
|
19396
19386
|
}),
|
|
19397
19387
|
onMouseleave: _cache[3] || (_cache[3] = ($event) => {
|
|
19398
|
-
var
|
|
19399
|
-
return (
|
|
19388
|
+
var _a2;
|
|
19389
|
+
return (_a2 = unref(inputPasteRef)) == null ? void 0 : _a2.blur();
|
|
19400
19390
|
}),
|
|
19401
19391
|
class: normalizeClass(["lew-upload-label", unref(getUploadLabelClass)]),
|
|
19402
19392
|
style: { "width": "100%" }
|
|
19403
19393
|
}, [
|
|
19404
|
-
createVNode(
|
|
19394
|
+
createVNode(unref(LewFlex), {
|
|
19405
19395
|
ref_key: "dropRef",
|
|
19406
19396
|
ref: dropRef,
|
|
19407
19397
|
direction: "y",
|
|
@@ -19456,12 +19446,12 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19456
19446
|
], 34), [
|
|
19457
19447
|
[vShow, (modelValue.value || []).length < _ctx.limit]
|
|
19458
19448
|
]),
|
|
19459
|
-
!unref(isFunction)(_ctx.uploadHelper) ? (openBlock(), createBlock(
|
|
19449
|
+
!unref(isFunction)(_ctx.uploadHelper) ? (openBlock(), createBlock(unref(LewAlert), {
|
|
19460
19450
|
key: 0,
|
|
19461
19451
|
type: "error",
|
|
19462
19452
|
title: "uploadHelper Error: 未配置上传方法"
|
|
19463
19453
|
})) : createCommentVNode("", true),
|
|
19464
|
-
withDirectives(createVNode(
|
|
19454
|
+
withDirectives(createVNode(unref(LewFlex), {
|
|
19465
19455
|
direction: "y",
|
|
19466
19456
|
class: "lew-upload-file-list",
|
|
19467
19457
|
gap: "10"
|
|
@@ -19470,7 +19460,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19470
19460
|
createVNode(TransitionGroup, { name: "upload-list" }, {
|
|
19471
19461
|
default: withCtx(() => [
|
|
19472
19462
|
(openBlock(true), createElementBlock(Fragment, null, renderList(modelValue.value, (item) => {
|
|
19473
|
-
return openBlock(), createBlock(
|
|
19463
|
+
return openBlock(), createBlock(unref(LewFlex), {
|
|
19474
19464
|
key: item.id,
|
|
19475
19465
|
class: "lew-upload-file-item",
|
|
19476
19466
|
mode: "between",
|
|
@@ -19480,7 +19470,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19480
19470
|
})
|
|
19481
19471
|
}, {
|
|
19482
19472
|
default: withCtx(() => [
|
|
19483
|
-
createVNode(
|
|
19473
|
+
createVNode(unref(LewFlex), {
|
|
19484
19474
|
style: normalizeStyle({
|
|
19485
19475
|
width: `${fileIconSizeMap[_ctx.size]}px`,
|
|
19486
19476
|
height: `${fileIconSizeMap[_ctx.size]}px`
|
|
@@ -19488,7 +19478,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19488
19478
|
class: "lew-upload-icon-wrapper"
|
|
19489
19479
|
}, {
|
|
19490
19480
|
default: withCtx(() => [
|
|
19491
|
-
checkUrlIsImg(item.url) ? (openBlock(), createBlock(
|
|
19481
|
+
checkUrlIsImg(item.url) ? (openBlock(), createBlock(unref(LewImage), {
|
|
19492
19482
|
key: 0,
|
|
19493
19483
|
class: "lew-upload-file-image",
|
|
19494
19484
|
src: item.url
|
|
@@ -19500,14 +19490,14 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19500
19490
|
]),
|
|
19501
19491
|
_: 2
|
|
19502
19492
|
}, 1032, ["style"]),
|
|
19503
|
-
createVNode(
|
|
19493
|
+
createVNode(unref(LewFlex), {
|
|
19504
19494
|
class: "lew-upload-file-info",
|
|
19505
19495
|
style: normalizeStyle({ width: `calc(100% - ${fileIconSizeMap[_ctx.size]}px - 8px)` }),
|
|
19506
19496
|
direction: "y",
|
|
19507
19497
|
gap: "0"
|
|
19508
19498
|
}, {
|
|
19509
19499
|
default: withCtx(() => [
|
|
19510
|
-
item.status === "fail" ? withDirectives((openBlock(), createBlock(
|
|
19500
|
+
item.status === "fail" ? withDirectives((openBlock(), createBlock(unref(LewFlex), {
|
|
19511
19501
|
key: 0,
|
|
19512
19502
|
onClick: withModifiers(($event) => reUpload(item.id), ["stop"]),
|
|
19513
19503
|
x: "center",
|
|
@@ -19532,7 +19522,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19532
19522
|
trigger: "mouseenter"
|
|
19533
19523
|
}]
|
|
19534
19524
|
]) : createCommentVNode("", true),
|
|
19535
|
-
withDirectives((openBlock(), createBlock(
|
|
19525
|
+
withDirectives((openBlock(), createBlock(unref(LewFlex), {
|
|
19536
19526
|
onClick: withModifiers(($event) => deleteFile(item.id), ["stop"]),
|
|
19537
19527
|
x: "center",
|
|
19538
19528
|
y: "center",
|
|
@@ -19556,19 +19546,19 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19556
19546
|
trigger: "mouseenter"
|
|
19557
19547
|
}]
|
|
19558
19548
|
]),
|
|
19559
|
-
createVNode(
|
|
19549
|
+
createVNode(unref(LewFlex), {
|
|
19560
19550
|
mode: "between",
|
|
19561
19551
|
gap: "5",
|
|
19562
19552
|
y: "center"
|
|
19563
19553
|
}, {
|
|
19564
19554
|
default: withCtx(() => [
|
|
19565
|
-
createVNode(
|
|
19555
|
+
createVNode(unref(LewFlex), {
|
|
19566
19556
|
y: "center",
|
|
19567
19557
|
x: "start",
|
|
19568
19558
|
gap: "5"
|
|
19569
19559
|
}, {
|
|
19570
19560
|
default: withCtx(() => [
|
|
19571
|
-
createVNode(
|
|
19561
|
+
createVNode(unref(LewTextTrim), {
|
|
19572
19562
|
text: unref(getFileName)(item),
|
|
19573
19563
|
style: normalizeStyle({
|
|
19574
19564
|
width: `calc(100% - 60px)`,
|
|
@@ -19582,12 +19572,12 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19582
19572
|
]),
|
|
19583
19573
|
_: 2
|
|
19584
19574
|
}, 1024),
|
|
19585
|
-
item.percent ? (openBlock(), createBlock(
|
|
19575
|
+
item.percent ? (openBlock(), createBlock(unref(LewFlex), {
|
|
19586
19576
|
key: 1,
|
|
19587
19577
|
class: normalizeClass(["lew-upload-progress", [`lew-upload-progress-${item.status}`]])
|
|
19588
19578
|
}, {
|
|
19589
19579
|
default: withCtx(() => [
|
|
19590
|
-
createVNode(
|
|
19580
|
+
createVNode(unref(LewFlex), {
|
|
19591
19581
|
y: "center",
|
|
19592
19582
|
class: "lew-upload-progress-box"
|
|
19593
19583
|
}, {
|
|
@@ -19605,7 +19595,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19605
19595
|
]),
|
|
19606
19596
|
_: 2
|
|
19607
19597
|
}, 1032, ["class"])) : createCommentVNode("", true),
|
|
19608
|
-
createVNode(
|
|
19598
|
+
createVNode(unref(LewFlex), {
|
|
19609
19599
|
mode: "between",
|
|
19610
19600
|
y: "center",
|
|
19611
19601
|
class: "lew-upload-footer"
|
|
@@ -19621,13 +19611,13 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19621
19611
|
], 64)) : createCommentVNode("", true),
|
|
19622
19612
|
item.size ? (openBlock(), createElementBlock("span", _hoisted_3$3, toDisplayString(unref(formatBytes)(item.size)), 1)) : createCommentVNode("", true)
|
|
19623
19613
|
], 4),
|
|
19624
|
-
createVNode(
|
|
19614
|
+
createVNode(unref(LewFlex), {
|
|
19625
19615
|
style: { "max-width": "200px" },
|
|
19626
19616
|
y: "center",
|
|
19627
19617
|
x: "end"
|
|
19628
19618
|
}, {
|
|
19629
19619
|
default: withCtx(() => [
|
|
19630
|
-
createVNode(
|
|
19620
|
+
createVNode(unref(_sfc_main$o), {
|
|
19631
19621
|
type: "light",
|
|
19632
19622
|
size: "small",
|
|
19633
19623
|
color: statusColorMap[item.status || "complete"]
|
|
@@ -19672,7 +19662,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19672
19662
|
};
|
|
19673
19663
|
}
|
|
19674
19664
|
});
|
|
19675
|
-
const LewUpload = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-
|
|
19665
|
+
const LewUpload = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-6c2e3992"]]);
|
|
19676
19666
|
const collapseModel = {
|
|
19677
19667
|
modelValue: {
|
|
19678
19668
|
type: [Array, String],
|
|
@@ -24063,937 +24053,938 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
24063
24053
|
treeSelectProps,
|
|
24064
24054
|
uploadProps
|
|
24065
24055
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
24066
|
-
const
|
|
24067
|
-
|
|
24068
|
-
|
|
24069
|
-
|
|
24056
|
+
const LewTooltip = {
|
|
24057
|
+
install(app) {
|
|
24058
|
+
app.directive("tooltip", {
|
|
24059
|
+
mounted(el, binding) {
|
|
24060
|
+
var _a, _b, _c;
|
|
24061
|
+
const { trigger, content, placement, allowHTML, delay } = binding.value;
|
|
24062
|
+
let _trigger = trigger;
|
|
24063
|
+
if (trigger === "hover") {
|
|
24064
|
+
_trigger = "mouseenter";
|
|
24065
|
+
}
|
|
24066
|
+
if (!trigger) {
|
|
24067
|
+
_trigger = "mouseenter";
|
|
24068
|
+
}
|
|
24069
|
+
el.instance = tippy(el, {
|
|
24070
|
+
theme: "light",
|
|
24071
|
+
trigger: _trigger,
|
|
24072
|
+
content,
|
|
24073
|
+
animation: "scale",
|
|
24074
|
+
interactive: true,
|
|
24075
|
+
appendTo: () => document.body,
|
|
24076
|
+
placement,
|
|
24077
|
+
allowHTML,
|
|
24078
|
+
arrow: ROUND_ARROW,
|
|
24079
|
+
maxWidth: 250,
|
|
24080
|
+
duration: [250, 250],
|
|
24081
|
+
delay: trigger === "mouseenter" ? delay || [80, 80] : void 0
|
|
24082
|
+
});
|
|
24083
|
+
(_a = el.instance) == null ? void 0 : _a.popper.children[0].setAttribute("data-lew", "tooltip");
|
|
24084
|
+
if (!((_b = binding == null ? void 0 : binding.value) == null ? void 0 : _b.content)) {
|
|
24085
|
+
(_c = el.instance) == null ? void 0 : _c.disable();
|
|
24086
|
+
}
|
|
24087
|
+
},
|
|
24088
|
+
updated(el, binding) {
|
|
24089
|
+
var _a, _b, _c, _d, _e;
|
|
24090
|
+
const { triggerFrom, content } = binding.value;
|
|
24091
|
+
if (!content) {
|
|
24092
|
+
(_a = el.instance) == null ? void 0 : _a.disable();
|
|
24093
|
+
} else {
|
|
24094
|
+
(_b = el.instance) == null ? void 0 : _b.enable();
|
|
24095
|
+
(_c = el.instance) == null ? void 0 : _c.setContent(content);
|
|
24096
|
+
}
|
|
24097
|
+
if (triggerFrom === "input-number") {
|
|
24098
|
+
if (content) {
|
|
24099
|
+
(_d = el.instance) == null ? void 0 : _d.show();
|
|
24100
|
+
} else {
|
|
24101
|
+
(_e = el.instance) == null ? void 0 : _e.hide();
|
|
24102
|
+
}
|
|
24103
|
+
}
|
|
24104
|
+
},
|
|
24105
|
+
unmounted(el) {
|
|
24106
|
+
var _a;
|
|
24107
|
+
(_a = el.instance) == null ? void 0 : _a.hide();
|
|
24108
|
+
el.instance = null;
|
|
24109
|
+
}
|
|
24110
|
+
});
|
|
24111
|
+
}
|
|
24070
24112
|
};
|
|
24071
|
-
const
|
|
24072
|
-
const
|
|
24073
|
-
|
|
24074
|
-
|
|
24075
|
-
|
|
24076
|
-
|
|
24077
|
-
if (!hasMessageById) {
|
|
24078
|
-
if (id) {
|
|
24079
|
-
messageElement.setAttribute("id", `lew-message-id-${id}`);
|
|
24113
|
+
const createBackTopHandler = (target) => {
|
|
24114
|
+
const dom = shallowRef(document.documentElement);
|
|
24115
|
+
if (target) {
|
|
24116
|
+
const targetElement = document.querySelector(`.${target}`);
|
|
24117
|
+
if (!targetElement) {
|
|
24118
|
+
throw new Error(`目标元素不存在: ${target}`);
|
|
24080
24119
|
}
|
|
24081
|
-
|
|
24082
|
-
messageElement,
|
|
24083
|
-
messageContainer == null ? void 0 : messageContainer.childNodes[0]
|
|
24084
|
-
);
|
|
24085
|
-
} else {
|
|
24086
|
-
clearTimeout(LewMessage$1.timer[id]);
|
|
24120
|
+
dom.value = targetElement;
|
|
24087
24121
|
}
|
|
24088
|
-
|
|
24089
|
-
|
|
24090
|
-
|
|
24091
|
-
|
|
24092
|
-
|
|
24093
|
-
nextTick(() => {
|
|
24094
|
-
messageElement.setAttribute(
|
|
24095
|
-
"class",
|
|
24096
|
-
`lew-message lew-message-${type} lew-message-show`
|
|
24097
|
-
);
|
|
24098
|
-
LewMessage$1.timer[id] = setTimeout(
|
|
24099
|
-
() => {
|
|
24100
|
-
messageElement.setAttribute(
|
|
24101
|
-
"class",
|
|
24102
|
-
`lew-message lew-message-${type} lew-message-hidden`
|
|
24103
|
-
);
|
|
24104
|
-
setTimeout(() => {
|
|
24105
|
-
if (messageElement) messageContainer == null ? void 0 : messageContainer.removeChild(messageElement);
|
|
24106
|
-
}, 250);
|
|
24107
|
-
},
|
|
24108
|
-
duration === 0 ? 31536e6 : duration || 3e3
|
|
24109
|
-
);
|
|
24110
|
-
});
|
|
24111
|
-
}, 10);
|
|
24112
|
-
};
|
|
24113
|
-
const removeClass = (element, className) => {
|
|
24114
|
-
element.classList.remove(className);
|
|
24122
|
+
return () => {
|
|
24123
|
+
if (dom.value) {
|
|
24124
|
+
dom.value.scrollTo({ top: 0, behavior: "smooth" });
|
|
24125
|
+
}
|
|
24126
|
+
};
|
|
24115
24127
|
};
|
|
24116
|
-
const
|
|
24117
|
-
|
|
24128
|
+
const index$1 = {
|
|
24129
|
+
install(app) {
|
|
24130
|
+
app.directive("backtop", {
|
|
24131
|
+
mounted(el, binding) {
|
|
24132
|
+
const backTopHandler = createBackTopHandler(binding.value);
|
|
24133
|
+
el.addEventListener("click", backTopHandler);
|
|
24134
|
+
el._backTopHandler = backTopHandler;
|
|
24135
|
+
},
|
|
24136
|
+
unmounted(el) {
|
|
24137
|
+
if (el._backTopHandler) {
|
|
24138
|
+
el.removeEventListener("click", el._backTopHandler);
|
|
24139
|
+
delete el._backTopHandler;
|
|
24140
|
+
}
|
|
24141
|
+
}
|
|
24142
|
+
});
|
|
24143
|
+
}
|
|
24118
24144
|
};
|
|
24119
|
-
const
|
|
24120
|
-
|
|
24121
|
-
|
|
24122
|
-
|
|
24123
|
-
|
|
24124
|
-
|
|
24125
|
-
|
|
24126
|
-
|
|
24127
|
-
|
|
24128
|
-
|
|
24129
|
-
|
|
24130
|
-
|
|
24131
|
-
|
|
24132
|
-
|
|
24133
|
-
|
|
24134
|
-
|
|
24135
|
-
|
|
24136
|
-
|
|
24137
|
-
|
|
24138
|
-
|
|
24139
|
-
|
|
24140
|
-
request: async ({ loadingMessage }, asyncFn) => {
|
|
24141
|
-
try {
|
|
24142
|
-
LewMessage$1.loading({
|
|
24143
|
-
id: "lew-request-loading",
|
|
24144
|
-
content: loadingMessage,
|
|
24145
|
-
duration: 0
|
|
24146
|
-
});
|
|
24147
|
-
const startTime = (/* @__PURE__ */ new Date()).getTime();
|
|
24148
|
-
asyncFn().then(
|
|
24149
|
-
async ({
|
|
24150
|
-
content = "请求成功!",
|
|
24151
|
-
duration = 3e3,
|
|
24152
|
-
type = "success"
|
|
24153
|
-
}) => {
|
|
24154
|
-
const endTime = (/* @__PURE__ */ new Date()).getTime();
|
|
24155
|
-
const delay = 250;
|
|
24156
|
-
if (endTime - startTime < delay) {
|
|
24157
|
-
await new Promise(
|
|
24158
|
-
(resolve) => setTimeout(resolve, delay - (endTime - startTime))
|
|
24159
|
-
);
|
|
24160
|
-
}
|
|
24161
|
-
LewMessage$1.close({ id: "lew-request-loading" });
|
|
24162
|
-
LewMessage$1[type]({
|
|
24163
|
-
content,
|
|
24164
|
-
duration
|
|
24165
|
-
});
|
|
24145
|
+
const LewLoading = {
|
|
24146
|
+
install(app) {
|
|
24147
|
+
app.directive("loading", {
|
|
24148
|
+
mounted(el, binding) {
|
|
24149
|
+
const { tip, iconSize, visible } = binding.value;
|
|
24150
|
+
const loadingWrapper = document.createElement("div");
|
|
24151
|
+
const loadingBox = document.createElement("div");
|
|
24152
|
+
loadingWrapper.classList.add("lew-loading-wrapper");
|
|
24153
|
+
loadingBox.classList.add("lew-loading-box");
|
|
24154
|
+
el.classList.add("lew-loading");
|
|
24155
|
+
const loader = createApp(Icon, {
|
|
24156
|
+
type: "loader",
|
|
24157
|
+
spinning: true,
|
|
24158
|
+
size: iconSize || 24
|
|
24159
|
+
});
|
|
24160
|
+
loader.mount(loadingBox);
|
|
24161
|
+
loadingBox.setAttribute("data-after", tip || "");
|
|
24162
|
+
loadingWrapper.appendChild(loadingBox);
|
|
24163
|
+
el.appendChild(loadingWrapper);
|
|
24164
|
+
if (visible) {
|
|
24165
|
+
el.classList.add("lew-loading-show");
|
|
24166
24166
|
}
|
|
24167
|
-
|
|
24168
|
-
|
|
24169
|
-
|
|
24170
|
-
|
|
24171
|
-
|
|
24172
|
-
|
|
24173
|
-
|
|
24174
|
-
|
|
24175
|
-
|
|
24176
|
-
duration
|
|
24177
|
-
});
|
|
24167
|
+
},
|
|
24168
|
+
updated(el, binding) {
|
|
24169
|
+
const { tip, visible } = binding.value;
|
|
24170
|
+
const loadingBox = el.querySelector(".lew-loading-box");
|
|
24171
|
+
loadingBox && loadingBox.setAttribute("data-after", tip || "");
|
|
24172
|
+
if (visible) {
|
|
24173
|
+
el.classList.add("lew-loading-show");
|
|
24174
|
+
} else {
|
|
24175
|
+
el.classList.remove("lew-loading-show");
|
|
24178
24176
|
}
|
|
24179
|
-
);
|
|
24180
|
-
} catch (error2) {
|
|
24181
|
-
LewMessage$1.error({
|
|
24182
|
-
id: "lew-request-loading",
|
|
24183
|
-
content: "An error occurred",
|
|
24184
|
-
duration: 3e3,
|
|
24185
|
-
onClose: () => {
|
|
24186
|
-
}
|
|
24187
|
-
});
|
|
24188
|
-
}
|
|
24189
|
-
},
|
|
24190
|
-
timer: {}
|
|
24191
|
-
};
|
|
24192
|
-
LewMessage$1.warning = (e2) => LewMessage$1.message({ type: "warning", e: e2 });
|
|
24193
|
-
LewMessage$1.error = (e2) => LewMessage$1.message({ type: "error", e: e2 });
|
|
24194
|
-
LewMessage$1.info = (e2) => LewMessage$1.message({ type: "info", e: e2 });
|
|
24195
|
-
LewMessage$1.normal = (e2) => LewMessage$1.message({ type: "normal", e: e2 });
|
|
24196
|
-
LewMessage$1.success = (e2) => LewMessage$1.message({ type: "success", e: e2 });
|
|
24197
|
-
LewMessage$1.loading = (e2) => LewMessage$1.message({ type: "loading", e: e2 });
|
|
24198
|
-
const dialogProps = {
|
|
24199
|
-
type: {
|
|
24200
|
-
type: String,
|
|
24201
|
-
default: "error",
|
|
24202
|
-
description: "对话框类型",
|
|
24203
|
-
validator: (value) => {
|
|
24204
|
-
const validTypes = [
|
|
24205
|
-
"primary",
|
|
24206
|
-
"success",
|
|
24207
|
-
"warning",
|
|
24208
|
-
"error",
|
|
24209
|
-
"info"
|
|
24210
|
-
];
|
|
24211
|
-
if (!validTypes.includes(value)) {
|
|
24212
|
-
console.warn(
|
|
24213
|
-
`[LewDialog] 无效的类型: ${value}。请使用 ${validTypes.join(", ")} 中的一个。`
|
|
24214
|
-
);
|
|
24215
|
-
return false;
|
|
24216
24177
|
}
|
|
24217
|
-
|
|
24218
|
-
|
|
24219
|
-
|
|
24220
|
-
|
|
24221
|
-
|
|
24222
|
-
|
|
24223
|
-
|
|
24224
|
-
|
|
24225
|
-
|
|
24226
|
-
|
|
24227
|
-
|
|
24228
|
-
|
|
24229
|
-
|
|
24230
|
-
|
|
24231
|
-
|
|
24232
|
-
|
|
24233
|
-
|
|
24234
|
-
|
|
24235
|
-
|
|
24236
|
-
|
|
24237
|
-
|
|
24238
|
-
|
|
24239
|
-
|
|
24240
|
-
|
|
24241
|
-
|
|
24242
|
-
|
|
24243
|
-
|
|
24244
|
-
|
|
24245
|
-
|
|
24246
|
-
|
|
24247
|
-
|
|
24248
|
-
|
|
24249
|
-
|
|
24250
|
-
|
|
24178
|
+
});
|
|
24179
|
+
}
|
|
24180
|
+
};
|
|
24181
|
+
const initLewContextMenu = () => {
|
|
24182
|
+
window.LewContextMenu = {
|
|
24183
|
+
menu: {},
|
|
24184
|
+
contextMenu: null,
|
|
24185
|
+
instance: tippy(document.body, {
|
|
24186
|
+
theme: "light",
|
|
24187
|
+
animation: "shift-away-subtle",
|
|
24188
|
+
trigger: "manual",
|
|
24189
|
+
interactive: true,
|
|
24190
|
+
placement: "right-start",
|
|
24191
|
+
duration: [250, 250],
|
|
24192
|
+
delay: [250, 250],
|
|
24193
|
+
arrow: false,
|
|
24194
|
+
appendTo: () => document.body,
|
|
24195
|
+
allowHTML: true
|
|
24196
|
+
}),
|
|
24197
|
+
menuInstance: {}
|
|
24198
|
+
};
|
|
24199
|
+
window.LewContextMenu.instance.popper.children[0].setAttribute(
|
|
24200
|
+
"data-lew",
|
|
24201
|
+
"popover"
|
|
24202
|
+
);
|
|
24203
|
+
};
|
|
24204
|
+
const findContextMenuId = (el) => {
|
|
24205
|
+
try {
|
|
24206
|
+
const id = el.getAttribute("lew-context-menu-id");
|
|
24207
|
+
if (id) return id;
|
|
24208
|
+
return el.parentNode ? findContextMenuId(el.parentNode) : "";
|
|
24209
|
+
} catch {
|
|
24210
|
+
return "";
|
|
24211
|
+
}
|
|
24212
|
+
};
|
|
24213
|
+
const LewVContextMenu = {
|
|
24214
|
+
install(app) {
|
|
24215
|
+
app.directive("context-menu", {
|
|
24216
|
+
mounted(el, binding) {
|
|
24217
|
+
if (!window.LewContextMenu) {
|
|
24218
|
+
initLewContextMenu();
|
|
24219
|
+
}
|
|
24220
|
+
if (!el.id) {
|
|
24221
|
+
const id = getUniqueId();
|
|
24222
|
+
el.setAttribute("lew-context-menu-id", id);
|
|
24223
|
+
const { options } = binding.value;
|
|
24224
|
+
window.LewContextMenu.menu[id] = options || [];
|
|
24225
|
+
}
|
|
24226
|
+
if (!window.LewContextMenu.contextMenu) {
|
|
24227
|
+
window.LewContextMenu.contextMenu = (e2) => {
|
|
24228
|
+
const id = findContextMenuId(e2.target);
|
|
24229
|
+
if (!id) return;
|
|
24230
|
+
e2.preventDefault();
|
|
24231
|
+
const options = window.LewContextMenu.menu[id];
|
|
24232
|
+
const { instance } = window.LewContextMenu;
|
|
24233
|
+
instance.hide();
|
|
24234
|
+
const menuDom = document.createElement("div");
|
|
24235
|
+
Object.keys(window.LewContextMenu.menuInstance).forEach(
|
|
24236
|
+
(key) => {
|
|
24237
|
+
window.LewContextMenu.menuInstance[key].destroy();
|
|
24238
|
+
delete window.LewContextMenu.menuInstance[key];
|
|
24239
|
+
}
|
|
24240
|
+
);
|
|
24241
|
+
createApp({
|
|
24242
|
+
render() {
|
|
24243
|
+
return h$1(LewContextMenu, {
|
|
24244
|
+
options,
|
|
24245
|
+
onSelect: (item) => {
|
|
24246
|
+
const { selectHandler } = binding.value;
|
|
24247
|
+
if (isFunction(selectHandler)) {
|
|
24248
|
+
selectHandler(item);
|
|
24249
|
+
}
|
|
24250
|
+
if (!(item.children || []).length) {
|
|
24251
|
+
instance.hide();
|
|
24252
|
+
}
|
|
24253
|
+
}
|
|
24254
|
+
});
|
|
24255
|
+
}
|
|
24256
|
+
}).mount(menuDom);
|
|
24257
|
+
setTimeout(() => {
|
|
24258
|
+
instance.setProps({
|
|
24259
|
+
content: menuDom,
|
|
24260
|
+
getReferenceClientRect: () => ({
|
|
24261
|
+
width: 0,
|
|
24262
|
+
height: 0,
|
|
24263
|
+
top: e2.clientY,
|
|
24264
|
+
bottom: e2.clientY,
|
|
24265
|
+
left: e2.clientX,
|
|
24266
|
+
right: e2.clientX
|
|
24267
|
+
})
|
|
24268
|
+
});
|
|
24269
|
+
instance.show();
|
|
24270
|
+
}, 120);
|
|
24271
|
+
};
|
|
24272
|
+
window.addEventListener(
|
|
24273
|
+
"contextmenu",
|
|
24274
|
+
window.LewContextMenu.contextMenu
|
|
24275
|
+
);
|
|
24276
|
+
}
|
|
24277
|
+
},
|
|
24278
|
+
updated(el, binding) {
|
|
24279
|
+
const id = findContextMenuId(el);
|
|
24280
|
+
if (id) {
|
|
24281
|
+
const { options } = binding.value;
|
|
24282
|
+
window.LewContextMenu.menu[id] = options || [];
|
|
24283
|
+
} else {
|
|
24284
|
+
console.error("发生未知错误!找不到 lew-context-menu-id。");
|
|
24285
|
+
}
|
|
24251
24286
|
}
|
|
24252
|
-
|
|
24253
|
-
}
|
|
24254
|
-
},
|
|
24255
|
-
closeOnClickOverlay: {
|
|
24256
|
-
type: Boolean,
|
|
24257
|
-
default: false,
|
|
24258
|
-
description: "是否在点击遮罩层时关闭对话框"
|
|
24259
|
-
},
|
|
24260
|
-
closeByEsc: {
|
|
24261
|
-
type: Boolean,
|
|
24262
|
-
default: false,
|
|
24263
|
-
description: "是否允许通过按下 ESC 键关闭对话框"
|
|
24264
|
-
},
|
|
24265
|
-
transformOrigin: {
|
|
24266
|
-
type: String,
|
|
24267
|
-
default: "0 0",
|
|
24268
|
-
description: "对话框变换原点(内部使用,无需手动设置)"
|
|
24287
|
+
});
|
|
24269
24288
|
}
|
|
24270
24289
|
};
|
|
24271
|
-
const
|
|
24272
|
-
|
|
24273
|
-
|
|
24290
|
+
const contextMenuProps = {
|
|
24291
|
+
options: {
|
|
24292
|
+
type: Array,
|
|
24293
|
+
default: () => [],
|
|
24294
|
+
description: "右键菜单配置"
|
|
24295
|
+
}
|
|
24274
24296
|
};
|
|
24275
|
-
const
|
|
24276
|
-
const
|
|
24277
|
-
const
|
|
24297
|
+
const _hoisted_1$1 = ["onClick"];
|
|
24298
|
+
const _hoisted_2$1 = { class: "lew-context-menu-label" };
|
|
24299
|
+
const _hoisted_3$1 = ["title"];
|
|
24278
24300
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
24279
|
-
__name: "
|
|
24280
|
-
props:
|
|
24281
|
-
emits: ["
|
|
24301
|
+
__name: "LewContextMenu",
|
|
24302
|
+
props: contextMenuProps,
|
|
24303
|
+
emits: ["select"],
|
|
24282
24304
|
setup(__props, { emit: __emit }) {
|
|
24283
|
-
const { Escape } = useMagicKeys();
|
|
24284
|
-
useDOMCreate("lew-dialog");
|
|
24285
24305
|
const props = __props;
|
|
24286
24306
|
const emit = __emit;
|
|
24287
|
-
const
|
|
24288
|
-
|
|
24289
|
-
const cancelLoading = ref(false);
|
|
24290
|
-
const okRef1 = ref();
|
|
24291
|
-
const okRef2 = ref();
|
|
24292
|
-
const maskClick = () => {
|
|
24293
|
-
if (props.closeOnClickOverlay) {
|
|
24294
|
-
visible.value = false;
|
|
24295
|
-
}
|
|
24307
|
+
const clickItem = (item) => {
|
|
24308
|
+
emit("select", item);
|
|
24296
24309
|
};
|
|
24297
|
-
|
|
24298
|
-
|
|
24299
|
-
|
|
24300
|
-
|
|
24301
|
-
if (
|
|
24302
|
-
|
|
24303
|
-
});
|
|
24304
|
-
watch(visible, (newVal) => {
|
|
24305
|
-
if (!newVal) {
|
|
24306
|
-
setTimeout(() => emit("close"), 500);
|
|
24307
|
-
}
|
|
24308
|
-
});
|
|
24309
|
-
const handleAction = async (action) => {
|
|
24310
|
-
const actionFunction = props[action];
|
|
24311
|
-
const loadingRef = action === "ok" ? okLoading : cancelLoading;
|
|
24312
|
-
if (typeof actionFunction === "function") {
|
|
24313
|
-
loadingRef.value = true;
|
|
24314
|
-
const result = await actionFunction();
|
|
24315
|
-
if (result !== false) {
|
|
24316
|
-
visible.value = false;
|
|
24310
|
+
let itemRefs = ref([]);
|
|
24311
|
+
const initTippy = () => {
|
|
24312
|
+
itemRefs.value.forEach((el, index2) => {
|
|
24313
|
+
const item = props.options[index2];
|
|
24314
|
+
if (!el || item.disabled || (item.children || []).length === 0) {
|
|
24315
|
+
return;
|
|
24317
24316
|
}
|
|
24318
|
-
|
|
24319
|
-
|
|
24320
|
-
|
|
24321
|
-
|
|
24322
|
-
|
|
24323
|
-
|
|
24324
|
-
|
|
24325
|
-
|
|
24326
|
-
|
|
24317
|
+
const menuDom = document.createElement("div");
|
|
24318
|
+
createApp({
|
|
24319
|
+
render() {
|
|
24320
|
+
return h$1(LewContextMenu, {
|
|
24321
|
+
options: item.children,
|
|
24322
|
+
onSelect: (item2) => {
|
|
24323
|
+
emit("select", item2);
|
|
24324
|
+
}
|
|
24325
|
+
});
|
|
24326
|
+
}
|
|
24327
|
+
}).mount(menuDom);
|
|
24328
|
+
const uniqueId2 = getUniqueId();
|
|
24329
|
+
if (!window.LewContextMenu) {
|
|
24330
|
+
initLewContextMenu();
|
|
24327
24331
|
}
|
|
24332
|
+
window.LewContextMenu.menuInstance[uniqueId2] = tippy(el, {
|
|
24333
|
+
theme: "light",
|
|
24334
|
+
animation: "shift-away-subtle",
|
|
24335
|
+
trigger: "mouseenter",
|
|
24336
|
+
interactive: true,
|
|
24337
|
+
placement: "right-start",
|
|
24338
|
+
duration: [250, 250],
|
|
24339
|
+
delay: [250, 250],
|
|
24340
|
+
arrow: false,
|
|
24341
|
+
offset: [0, 0],
|
|
24342
|
+
allowHTML: true,
|
|
24343
|
+
hideOnClick: false,
|
|
24344
|
+
zIndex: 9999,
|
|
24345
|
+
content: menuDom
|
|
24346
|
+
});
|
|
24347
|
+
window.LewContextMenu.menuInstance[uniqueId2].popper.children[0].setAttribute("data-lew", "popover");
|
|
24328
24348
|
});
|
|
24329
|
-
}
|
|
24349
|
+
};
|
|
24350
|
+
const renderIcon = ({ renderIcon: renderIcon2 }) => {
|
|
24351
|
+
if (renderIcon2) return renderIcon2();
|
|
24352
|
+
return "";
|
|
24353
|
+
};
|
|
24354
|
+
onMounted(() => {
|
|
24355
|
+
initTippy();
|
|
24356
|
+
});
|
|
24330
24357
|
return (_ctx, _cache) => {
|
|
24331
|
-
return openBlock(), createBlock(
|
|
24332
|
-
|
|
24333
|
-
|
|
24334
|
-
|
|
24335
|
-
|
|
24336
|
-
|
|
24337
|
-
|
|
24338
|
-
|
|
24339
|
-
|
|
24340
|
-
|
|
24341
|
-
|
|
24342
|
-
|
|
24343
|
-
|
|
24344
|
-
|
|
24345
|
-
|
|
24346
|
-
|
|
24347
|
-
|
|
24348
|
-
|
|
24349
|
-
|
|
24358
|
+
return openBlock(), createBlock(unref(LewFlex), {
|
|
24359
|
+
direction: "y",
|
|
24360
|
+
gap: "0",
|
|
24361
|
+
class: "lew-context-menu"
|
|
24362
|
+
}, {
|
|
24363
|
+
default: withCtx(() => [
|
|
24364
|
+
(_ctx.options || []).length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.options, (item, index2) => {
|
|
24365
|
+
return openBlock(), createElementBlock("div", {
|
|
24366
|
+
key: index2,
|
|
24367
|
+
class: normalizeClass(["lew-context-menu-box", {
|
|
24368
|
+
"lew-context-menu-box-disabled": item.disabled,
|
|
24369
|
+
"lew-context-menu-box-divider-line": item.isDividerLine
|
|
24370
|
+
}])
|
|
24371
|
+
}, [
|
|
24372
|
+
createElementVNode("div", {
|
|
24373
|
+
ref_for: true,
|
|
24374
|
+
ref: (el) => unref(itemRefs).push(el),
|
|
24375
|
+
onClick: ($event) => clickItem(item),
|
|
24376
|
+
class: "lew-context-menu-item",
|
|
24377
|
+
style: normalizeStyle({ "animation-delay": index2 * 15 + "ms" })
|
|
24350
24378
|
}, [
|
|
24351
|
-
|
|
24379
|
+
createElementVNode("div", _hoisted_2$1, [
|
|
24380
|
+
item.renderIcon ? (openBlock(), createBlock(renderIcon, {
|
|
24381
|
+
key: 0,
|
|
24382
|
+
renderIcon: item.renderIcon
|
|
24383
|
+
}, null, 8, ["renderIcon"])) : createCommentVNode("", true),
|
|
24384
|
+
createElementVNode("div", {
|
|
24385
|
+
title: item.label,
|
|
24386
|
+
class: "lew-context-menu-label-text"
|
|
24387
|
+
}, toDisplayString(item.label), 9, _hoisted_3$1)
|
|
24388
|
+
]),
|
|
24389
|
+
(item.children || []).length > 0 ? (openBlock(), createBlock(Icon, {
|
|
24352
24390
|
key: 0,
|
|
24353
|
-
|
|
24354
|
-
|
|
24355
|
-
|
|
24356
|
-
|
|
24357
|
-
|
|
24358
|
-
|
|
24359
|
-
|
|
24360
|
-
|
|
24361
|
-
|
|
24362
|
-
|
|
24363
|
-
|
|
24364
|
-
|
|
24365
|
-
|
|
24366
|
-
|
|
24367
|
-
|
|
24368
|
-
|
|
24369
|
-
createElementVNode("header", null, [
|
|
24370
|
-
renderSlot(_ctx.$slots, "title", {}, void 0, true)
|
|
24371
|
-
]),
|
|
24372
|
-
createElementVNode("main", null, [
|
|
24373
|
-
renderSlot(_ctx.$slots, "content", {}, void 0, true)
|
|
24374
|
-
])
|
|
24375
|
-
])
|
|
24376
|
-
]),
|
|
24377
|
-
_: 3
|
|
24378
|
-
}),
|
|
24379
|
-
createElementVNode("footer", null, [
|
|
24380
|
-
_ctx.cancelText ? (openBlock(), createBlock(unref(LewButton), {
|
|
24381
|
-
key: 0,
|
|
24382
|
-
text: _ctx.cancelText,
|
|
24383
|
-
color: "gray",
|
|
24384
|
-
type: "text",
|
|
24385
|
-
loading: cancelLoading.value,
|
|
24386
|
-
onClick: withModifiers(cancel, ["stop"])
|
|
24387
|
-
}, null, 8, ["text", "loading"])) : createCommentVNode("", true),
|
|
24388
|
-
_ctx.okText ? (openBlock(), createBlock(unref(LewButton), {
|
|
24389
|
-
key: 1,
|
|
24390
|
-
ref_key: "okRef1",
|
|
24391
|
-
ref: okRef1,
|
|
24392
|
-
text: _ctx.okText,
|
|
24393
|
-
type: "fill",
|
|
24394
|
-
color: _ctx.type,
|
|
24395
|
-
loading: okLoading.value,
|
|
24396
|
-
onClick: withModifiers(ok, ["stop"])
|
|
24397
|
-
}, null, 8, ["text", "color", "loading"])) : createCommentVNode("", true)
|
|
24398
|
-
])
|
|
24399
|
-
]),
|
|
24400
|
-
_: 3
|
|
24401
|
-
})) : createCommentVNode("", true),
|
|
24402
|
-
_ctx.layout === "mini" ? (openBlock(), createElementBlock("div", {
|
|
24403
|
-
key: 1,
|
|
24404
|
-
class: "lew-dialog-box lew-dialog-box-mini",
|
|
24405
|
-
onClick: _cache[1] || (_cache[1] = withModifiers(() => {
|
|
24406
|
-
}, ["stop"]))
|
|
24407
|
-
}, [
|
|
24408
|
-
createElementVNode("div", _hoisted_4, [
|
|
24409
|
-
createVNode(Icon, {
|
|
24410
|
-
size: 24,
|
|
24411
|
-
type: _ctx.type
|
|
24412
|
-
}, null, 8, ["type"])
|
|
24413
|
-
]),
|
|
24414
|
-
createVNode(unref(LewFlex), { class: "right" }, {
|
|
24415
|
-
default: withCtx(() => [
|
|
24416
|
-
createElementVNode("main", null, [
|
|
24417
|
-
renderSlot(_ctx.$slots, "content", {}, void 0, true)
|
|
24418
|
-
]),
|
|
24419
|
-
createVNode(unref(LewFlex), { x: "end" }, {
|
|
24420
|
-
default: withCtx(() => [
|
|
24421
|
-
_ctx.cancelText ? (openBlock(), createBlock(unref(LewButton), {
|
|
24422
|
-
key: 0,
|
|
24423
|
-
text: _ctx.cancelText,
|
|
24424
|
-
type: "text",
|
|
24425
|
-
size: "small",
|
|
24426
|
-
color: "gray",
|
|
24427
|
-
round: "",
|
|
24428
|
-
loading: cancelLoading.value,
|
|
24429
|
-
onClick: withModifiers(cancel, ["stop"])
|
|
24430
|
-
}, null, 8, ["text", "loading"])) : createCommentVNode("", true),
|
|
24431
|
-
_ctx.okText ? (openBlock(), createBlock(unref(LewButton), {
|
|
24432
|
-
key: 1,
|
|
24433
|
-
ref_key: "okRef2",
|
|
24434
|
-
ref: okRef2,
|
|
24435
|
-
text: _ctx.okText,
|
|
24436
|
-
type: "fill",
|
|
24437
|
-
size: "small",
|
|
24438
|
-
round: "",
|
|
24439
|
-
color: _ctx.type,
|
|
24440
|
-
loading: okLoading.value,
|
|
24441
|
-
onClick: withModifiers(ok, ["stop"])
|
|
24442
|
-
}, null, 8, ["text", "color", "loading"])) : createCommentVNode("", true)
|
|
24443
|
-
]),
|
|
24444
|
-
_: 1
|
|
24445
|
-
})
|
|
24446
|
-
]),
|
|
24447
|
-
_: 3
|
|
24448
|
-
})
|
|
24449
|
-
])) : createCommentVNode("", true)
|
|
24450
|
-
])) : createCommentVNode("", true)
|
|
24451
|
-
]),
|
|
24452
|
-
_: 3
|
|
24453
|
-
})
|
|
24454
|
-
], 4)
|
|
24455
|
-
]);
|
|
24391
|
+
size: 14,
|
|
24392
|
+
type: "chevron-right"
|
|
24393
|
+
})) : createCommentVNode("", true)
|
|
24394
|
+
], 12, _hoisted_1$1)
|
|
24395
|
+
], 2);
|
|
24396
|
+
}), 128)) : (openBlock(), createBlock(unref(_sfc_main$d), {
|
|
24397
|
+
key: 1,
|
|
24398
|
+
width: "120px",
|
|
24399
|
+
padding: "5px",
|
|
24400
|
+
"font-size": "12px",
|
|
24401
|
+
type: "search",
|
|
24402
|
+
title: "暂无操作"
|
|
24403
|
+
}))
|
|
24404
|
+
]),
|
|
24405
|
+
_: 1
|
|
24406
|
+
});
|
|
24456
24407
|
};
|
|
24457
24408
|
}
|
|
24458
24409
|
});
|
|
24459
|
-
const
|
|
24460
|
-
const
|
|
24461
|
-
|
|
24462
|
-
|
|
24463
|
-
|
|
24464
|
-
|
|
24465
|
-
|
|
24466
|
-
|
|
24467
|
-
|
|
24410
|
+
const LewContextMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-e1377a5c"]]);
|
|
24411
|
+
const directives = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
24412
|
+
__proto__: null,
|
|
24413
|
+
LewBacktop: index$1,
|
|
24414
|
+
LewContextMenu,
|
|
24415
|
+
LewLoading,
|
|
24416
|
+
LewTooltip,
|
|
24417
|
+
LewVContextMenu,
|
|
24418
|
+
contextMenuProps,
|
|
24419
|
+
initLewContextMenu
|
|
24420
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
24421
|
+
const createMessageList$1 = () => {
|
|
24422
|
+
const messageContainer = document.createElement("div");
|
|
24423
|
+
messageContainer.setAttribute("id", "lew-message");
|
|
24424
|
+
document.body.appendChild(messageContainer);
|
|
24468
24425
|
};
|
|
24469
|
-
const
|
|
24470
|
-
const {
|
|
24471
|
-
|
|
24472
|
-
|
|
24473
|
-
|
|
24474
|
-
|
|
24475
|
-
|
|
24476
|
-
|
|
24477
|
-
|
|
24478
|
-
|
|
24479
|
-
|
|
24480
|
-
|
|
24481
|
-
|
|
24482
|
-
|
|
24483
|
-
|
|
24484
|
-
|
|
24485
|
-
|
|
24486
|
-
|
|
24487
|
-
|
|
24488
|
-
|
|
24489
|
-
|
|
24490
|
-
|
|
24491
|
-
|
|
24492
|
-
|
|
24493
|
-
|
|
24494
|
-
|
|
24495
|
-
|
|
24496
|
-
|
|
24497
|
-
|
|
24498
|
-
|
|
24499
|
-
|
|
24500
|
-
|
|
24501
|
-
|
|
24426
|
+
const showMessage = ({ type, e: e2 }) => {
|
|
24427
|
+
const { id, content, duration } = e2;
|
|
24428
|
+
const messageContainer = document.getElementById("lew-message");
|
|
24429
|
+
const hasMessageById = id ? document.getElementById(`lew-message-id-${id}`) : false;
|
|
24430
|
+
const messageElement = hasMessageById || document.createElement("div");
|
|
24431
|
+
messageElement.innerHTML = `${getIconInnerHTML({ type, strokeWidth: type === "loading" ? 2.5 : void 0, spinning: type === "loading" })}<div class="lew-message-content">${content || e2}</div>`;
|
|
24432
|
+
if (!hasMessageById) {
|
|
24433
|
+
if (id) {
|
|
24434
|
+
messageElement.setAttribute("id", `lew-message-id-${id}`);
|
|
24435
|
+
}
|
|
24436
|
+
messageContainer == null ? void 0 : messageContainer.appendChild(
|
|
24437
|
+
messageElement,
|
|
24438
|
+
messageContainer == null ? void 0 : messageContainer.childNodes[0]
|
|
24439
|
+
);
|
|
24440
|
+
} else {
|
|
24441
|
+
clearTimeout(LewMessage$1.timer[id]);
|
|
24442
|
+
}
|
|
24443
|
+
messageElement.setAttribute(
|
|
24444
|
+
"class",
|
|
24445
|
+
`lew-message lew-message-${type} lew-message-id-${id}`
|
|
24446
|
+
);
|
|
24447
|
+
setTimeout(() => {
|
|
24448
|
+
nextTick(() => {
|
|
24449
|
+
messageElement.setAttribute(
|
|
24450
|
+
"class",
|
|
24451
|
+
`lew-message lew-message-${type} lew-message-show`
|
|
24452
|
+
);
|
|
24453
|
+
LewMessage$1.timer[id] = setTimeout(
|
|
24454
|
+
() => {
|
|
24455
|
+
messageElement.setAttribute(
|
|
24456
|
+
"class",
|
|
24457
|
+
`lew-message lew-message-${type} lew-message-hidden`
|
|
24458
|
+
);
|
|
24459
|
+
setTimeout(() => {
|
|
24460
|
+
if (messageElement) messageContainer == null ? void 0 : messageContainer.removeChild(messageElement);
|
|
24461
|
+
}, 250);
|
|
24502
24462
|
},
|
|
24503
|
-
|
|
24504
|
-
title: () => title,
|
|
24505
|
-
content: () => content
|
|
24506
|
-
}
|
|
24463
|
+
duration === 0 ? 31536e6 : duration || 3e3
|
|
24507
24464
|
);
|
|
24508
|
-
}
|
|
24509
|
-
});
|
|
24510
|
-
app.mount(div2);
|
|
24465
|
+
});
|
|
24466
|
+
}, 10);
|
|
24511
24467
|
};
|
|
24512
|
-
const
|
|
24513
|
-
|
|
24514
|
-
...dialogTypes
|
|
24468
|
+
const removeClass = (element, className) => {
|
|
24469
|
+
element.classList.remove(className);
|
|
24515
24470
|
};
|
|
24516
|
-
const
|
|
24517
|
-
|
|
24518
|
-
|
|
24519
|
-
|
|
24520
|
-
|
|
24521
|
-
|
|
24522
|
-
|
|
24523
|
-
|
|
24524
|
-
|
|
24525
|
-
|
|
24526
|
-
|
|
24527
|
-
|
|
24528
|
-
|
|
24529
|
-
|
|
24530
|
-
|
|
24531
|
-
|
|
24532
|
-
|
|
24533
|
-
|
|
24534
|
-
|
|
24535
|
-
|
|
24536
|
-
|
|
24537
|
-
|
|
24538
|
-
|
|
24539
|
-
|
|
24540
|
-
|
|
24541
|
-
|
|
24542
|
-
|
|
24543
|
-
|
|
24544
|
-
|
|
24545
|
-
|
|
24471
|
+
const addClass = (element, className) => {
|
|
24472
|
+
element.classList.add(className);
|
|
24473
|
+
};
|
|
24474
|
+
const LewMessage$1 = {
|
|
24475
|
+
name: "LewMessage",
|
|
24476
|
+
message: ({ type, e: e2 }) => {
|
|
24477
|
+
if (!document.getElementById("lew-message")) {
|
|
24478
|
+
createMessageList$1();
|
|
24479
|
+
LewMessage$1.message({ type, e: e2 });
|
|
24480
|
+
} else {
|
|
24481
|
+
showMessage({ type, e: e2 });
|
|
24482
|
+
}
|
|
24483
|
+
},
|
|
24484
|
+
close: ({ id }) => {
|
|
24485
|
+
const messageElement = document.getElementById(`lew-message-id-${id}`);
|
|
24486
|
+
if (messageElement) {
|
|
24487
|
+
removeClass(messageElement, "lew-message-show");
|
|
24488
|
+
addClass(messageElement, "lew-message-hidden");
|
|
24489
|
+
setTimeout(() => {
|
|
24490
|
+
clearTimeout(LewMessage$1.timer[id]);
|
|
24491
|
+
messageElement.remove();
|
|
24492
|
+
}, 350);
|
|
24493
|
+
}
|
|
24494
|
+
},
|
|
24495
|
+
request: async ({ loadingMessage }, asyncFn) => {
|
|
24496
|
+
try {
|
|
24497
|
+
LewMessage$1.loading({
|
|
24498
|
+
id: "lew-request-loading",
|
|
24499
|
+
content: loadingMessage,
|
|
24500
|
+
duration: 0
|
|
24501
|
+
});
|
|
24502
|
+
const startTime = (/* @__PURE__ */ new Date()).getTime();
|
|
24503
|
+
asyncFn().then(
|
|
24504
|
+
async ({
|
|
24505
|
+
content = "请求成功!",
|
|
24506
|
+
duration = 3e3,
|
|
24507
|
+
type = "success"
|
|
24508
|
+
}) => {
|
|
24509
|
+
const endTime = (/* @__PURE__ */ new Date()).getTime();
|
|
24510
|
+
const delay = 250;
|
|
24511
|
+
if (endTime - startTime < delay) {
|
|
24512
|
+
await new Promise(
|
|
24513
|
+
(resolve) => setTimeout(resolve, delay - (endTime - startTime))
|
|
24514
|
+
);
|
|
24515
|
+
}
|
|
24516
|
+
LewMessage$1.close({ id: "lew-request-loading" });
|
|
24517
|
+
LewMessage$1[type]({
|
|
24518
|
+
content,
|
|
24519
|
+
duration
|
|
24520
|
+
});
|
|
24546
24521
|
}
|
|
24547
|
-
|
|
24548
|
-
|
|
24549
|
-
|
|
24550
|
-
|
|
24551
|
-
|
|
24552
|
-
|
|
24553
|
-
|
|
24554
|
-
|
|
24522
|
+
).catch(
|
|
24523
|
+
({
|
|
24524
|
+
content = "加载失败!",
|
|
24525
|
+
duration = 3e3
|
|
24526
|
+
}) => {
|
|
24527
|
+
LewMessage$1.close({ id: "lew-request-loading" });
|
|
24528
|
+
LewMessage$1.error({
|
|
24529
|
+
id: "lew-request-fail",
|
|
24530
|
+
content,
|
|
24531
|
+
duration
|
|
24532
|
+
});
|
|
24555
24533
|
}
|
|
24556
|
-
|
|
24557
|
-
|
|
24558
|
-
|
|
24559
|
-
|
|
24560
|
-
|
|
24561
|
-
|
|
24534
|
+
);
|
|
24535
|
+
} catch (error2) {
|
|
24536
|
+
LewMessage$1.error({
|
|
24537
|
+
id: "lew-request-loading",
|
|
24538
|
+
content: "An error occurred",
|
|
24539
|
+
duration: 3e3,
|
|
24540
|
+
onClose: () => {
|
|
24562
24541
|
}
|
|
24563
|
-
}
|
|
24564
|
-
unmounted(el) {
|
|
24565
|
-
el.instance.hide();
|
|
24566
|
-
el.instance = null;
|
|
24567
|
-
}
|
|
24568
|
-
});
|
|
24569
|
-
}
|
|
24570
|
-
};
|
|
24571
|
-
const createBackTopHandler = (target) => {
|
|
24572
|
-
const dom = shallowRef(document.documentElement);
|
|
24573
|
-
if (target) {
|
|
24574
|
-
const targetElement = document.querySelector(`.${target}`);
|
|
24575
|
-
if (!targetElement) {
|
|
24576
|
-
throw new Error(`目标元素不存在: ${target}`);
|
|
24577
|
-
}
|
|
24578
|
-
dom.value = targetElement;
|
|
24579
|
-
}
|
|
24580
|
-
return () => {
|
|
24581
|
-
if (dom.value) {
|
|
24582
|
-
dom.value.scrollTo({ top: 0, behavior: "smooth" });
|
|
24542
|
+
});
|
|
24583
24543
|
}
|
|
24584
|
-
}
|
|
24544
|
+
},
|
|
24545
|
+
timer: {}
|
|
24585
24546
|
};
|
|
24586
|
-
|
|
24587
|
-
|
|
24588
|
-
|
|
24589
|
-
|
|
24590
|
-
|
|
24591
|
-
|
|
24592
|
-
|
|
24593
|
-
|
|
24594
|
-
|
|
24595
|
-
|
|
24596
|
-
|
|
24597
|
-
|
|
24598
|
-
|
|
24547
|
+
LewMessage$1.warning = (e2) => LewMessage$1.message({ type: "warning", e: e2 });
|
|
24548
|
+
LewMessage$1.error = (e2) => LewMessage$1.message({ type: "error", e: e2 });
|
|
24549
|
+
LewMessage$1.info = (e2) => LewMessage$1.message({ type: "info", e: e2 });
|
|
24550
|
+
LewMessage$1.normal = (e2) => LewMessage$1.message({ type: "normal", e: e2 });
|
|
24551
|
+
LewMessage$1.success = (e2) => LewMessage$1.message({ type: "success", e: e2 });
|
|
24552
|
+
LewMessage$1.loading = (e2) => LewMessage$1.message({ type: "loading", e: e2 });
|
|
24553
|
+
const dialogProps = {
|
|
24554
|
+
type: {
|
|
24555
|
+
type: String,
|
|
24556
|
+
default: "error",
|
|
24557
|
+
description: "对话框类型",
|
|
24558
|
+
validator: (value) => {
|
|
24559
|
+
const validTypes = [
|
|
24560
|
+
"primary",
|
|
24561
|
+
"success",
|
|
24562
|
+
"warning",
|
|
24563
|
+
"error",
|
|
24564
|
+
"info"
|
|
24565
|
+
];
|
|
24566
|
+
if (!validTypes.includes(value)) {
|
|
24567
|
+
console.warn(
|
|
24568
|
+
`[LewDialog] 无效的类型: ${value}。请使用 ${validTypes.join(", ")} 中的一个。`
|
|
24569
|
+
);
|
|
24570
|
+
return false;
|
|
24599
24571
|
}
|
|
24600
|
-
|
|
24601
|
-
}
|
|
24602
|
-
};
|
|
24603
|
-
const warning = ({ title, content, delay = 3e3 }) => {
|
|
24604
|
-
notification("warning", title, content, delay);
|
|
24605
|
-
};
|
|
24606
|
-
const error = ({ title, content, delay = 3e3 }) => {
|
|
24607
|
-
notification("error", title, content, delay);
|
|
24608
|
-
};
|
|
24609
|
-
const info = ({ title, content, delay = 3e3 }) => {
|
|
24610
|
-
notification("info", title, content, delay);
|
|
24611
|
-
};
|
|
24612
|
-
const normal = ({ title, content, delay = 3e3 }) => {
|
|
24613
|
-
notification("normal", title, content, delay);
|
|
24614
|
-
};
|
|
24615
|
-
const success = ({ title, content, delay = 3e3 }) => {
|
|
24616
|
-
notification("success", title, content, delay);
|
|
24617
|
-
};
|
|
24618
|
-
const createMessageList = () => {
|
|
24619
|
-
const div2 = document.createElement("div");
|
|
24620
|
-
div2.setAttribute("id", "lew-notification");
|
|
24621
|
-
document.body.appendChild(div2);
|
|
24622
|
-
};
|
|
24623
|
-
const notification = (type, title, content, delay) => {
|
|
24624
|
-
if (!document.getElementById("lew-notification")) {
|
|
24625
|
-
createMessageList();
|
|
24626
|
-
notification(type, title, content, delay);
|
|
24627
|
-
} else {
|
|
24628
|
-
add(type, title, content, delay);
|
|
24629
|
-
}
|
|
24630
|
-
};
|
|
24631
|
-
const add = (type, title, content, delay) => {
|
|
24632
|
-
const LewMessageDom = document.getElementById("lew-notification");
|
|
24633
|
-
const newMessage = document.createElement("div");
|
|
24634
|
-
newMessage.innerHTML = `
|
|
24635
|
-
<div class="lew-notification-box">
|
|
24636
|
-
<div class="lew-notification-icon">
|
|
24637
|
-
${getIconInnerHTML({ type, size: 18 })}
|
|
24638
|
-
</div>
|
|
24639
|
-
<div class="lew-notification-body">
|
|
24640
|
-
<div class="lew-notification-title">${title}</div>
|
|
24641
|
-
${content ? `<div class="lew-notification-content">${content}</div>` : ""}
|
|
24642
|
-
</div>
|
|
24643
|
-
<div class="lew-notification-close-icon">
|
|
24644
|
-
${getIconInnerHTML({ type: "close", size: 16 })}
|
|
24645
|
-
</div>
|
|
24646
|
-
</div>
|
|
24647
|
-
`;
|
|
24648
|
-
LewMessageDom == null ? void 0 : LewMessageDom.insertBefore(newMessage, LewMessageDom == null ? void 0 : LewMessageDom.childNodes[0]);
|
|
24649
|
-
newMessage.setAttribute("class", `lew-notification lew-notification-${type}`);
|
|
24650
|
-
let timer;
|
|
24651
|
-
let lock = false;
|
|
24652
|
-
function startTimer() {
|
|
24653
|
-
if (delay > 0) {
|
|
24654
|
-
({ stop: timer } = useTimeoutFn(() => {
|
|
24655
|
-
handleClose();
|
|
24656
|
-
}, delay));
|
|
24657
|
-
}
|
|
24658
|
-
}
|
|
24659
|
-
function clearTimer() {
|
|
24660
|
-
timer == null ? void 0 : timer();
|
|
24661
|
-
}
|
|
24662
|
-
function handleClose() {
|
|
24663
|
-
if (lock) {
|
|
24664
|
-
return;
|
|
24572
|
+
return true;
|
|
24665
24573
|
}
|
|
24666
|
-
|
|
24667
|
-
|
|
24668
|
-
|
|
24669
|
-
|
|
24670
|
-
|
|
24671
|
-
|
|
24672
|
-
|
|
24673
|
-
|
|
24674
|
-
|
|
24675
|
-
|
|
24574
|
+
},
|
|
24575
|
+
okText: {
|
|
24576
|
+
type: String,
|
|
24577
|
+
default: "确定",
|
|
24578
|
+
description: "确认按钮文本"
|
|
24579
|
+
},
|
|
24580
|
+
cancelText: {
|
|
24581
|
+
type: String,
|
|
24582
|
+
default: "取消",
|
|
24583
|
+
description: "取消按钮文本"
|
|
24584
|
+
},
|
|
24585
|
+
ok: {
|
|
24586
|
+
type: Function,
|
|
24587
|
+
default: () => true,
|
|
24588
|
+
description: "点击确认按钮时的回调函数"
|
|
24589
|
+
},
|
|
24590
|
+
cancel: {
|
|
24591
|
+
type: Function,
|
|
24592
|
+
default: () => true,
|
|
24593
|
+
description: "点击取消按钮时的回调函数"
|
|
24594
|
+
},
|
|
24595
|
+
layout: {
|
|
24596
|
+
type: String,
|
|
24597
|
+
default: "normal",
|
|
24598
|
+
description: "对话框布局方式",
|
|
24599
|
+
validator: (value) => {
|
|
24600
|
+
const validLayouts = ["normal", "mini"];
|
|
24601
|
+
if (!validLayouts.includes(value)) {
|
|
24602
|
+
console.warn(
|
|
24603
|
+
`[LewDialog] 无效的布局: ${value}。请使用 ${validLayouts.join(", ")} 中的一个。`
|
|
24604
|
+
);
|
|
24605
|
+
return false;
|
|
24676
24606
|
}
|
|
24607
|
+
return true;
|
|
24677
24608
|
}
|
|
24609
|
+
},
|
|
24610
|
+
closeOnClickOverlay: {
|
|
24611
|
+
type: Boolean,
|
|
24612
|
+
default: false,
|
|
24613
|
+
description: "是否在点击遮罩层时关闭对话框"
|
|
24614
|
+
},
|
|
24615
|
+
closeByEsc: {
|
|
24616
|
+
type: Boolean,
|
|
24617
|
+
default: false,
|
|
24618
|
+
description: "是否允许通过按下 ESC 键关闭对话框"
|
|
24619
|
+
},
|
|
24620
|
+
transformOrigin: {
|
|
24621
|
+
type: String,
|
|
24622
|
+
default: "0 0",
|
|
24623
|
+
description: "对话框变换原点(内部使用,无需手动设置)"
|
|
24678
24624
|
}
|
|
24679
|
-
newMessage.children[0].children[2].addEventListener("click", handleClose);
|
|
24680
|
-
newMessage.addEventListener("mouseenter", clearTimer);
|
|
24681
|
-
newMessage.addEventListener("mouseleave", startTimer);
|
|
24682
|
-
setTimeout(() => {
|
|
24683
|
-
lock = false;
|
|
24684
|
-
newMessage.setAttribute(
|
|
24685
|
-
"class",
|
|
24686
|
-
`lew-notification lew-notification-${type} lew-notification-show`
|
|
24687
|
-
);
|
|
24688
|
-
delay > 0 && startTimer();
|
|
24689
|
-
}, 10);
|
|
24690
24625
|
};
|
|
24691
|
-
const
|
|
24692
|
-
|
|
24693
|
-
|
|
24694
|
-
info,
|
|
24695
|
-
normal,
|
|
24696
|
-
success,
|
|
24697
|
-
error
|
|
24626
|
+
const _hoisted_1 = {
|
|
24627
|
+
key: 0,
|
|
24628
|
+
class: "lew-dialog-mask"
|
|
24698
24629
|
};
|
|
24699
|
-
const
|
|
24700
|
-
|
|
24701
|
-
|
|
24702
|
-
|
|
24703
|
-
|
|
24704
|
-
|
|
24705
|
-
|
|
24706
|
-
|
|
24707
|
-
|
|
24708
|
-
|
|
24709
|
-
|
|
24710
|
-
|
|
24711
|
-
|
|
24712
|
-
|
|
24713
|
-
|
|
24714
|
-
|
|
24715
|
-
|
|
24716
|
-
|
|
24717
|
-
|
|
24718
|
-
|
|
24719
|
-
el.classList.add("lew-loading-show");
|
|
24720
|
-
}
|
|
24721
|
-
},
|
|
24722
|
-
updated(el, binding) {
|
|
24723
|
-
const { tip, visible } = binding.value;
|
|
24724
|
-
const loadingBox = el.querySelector(".lew-loading-box");
|
|
24725
|
-
loadingBox && loadingBox.setAttribute("data-after", tip || "");
|
|
24726
|
-
if (visible) {
|
|
24727
|
-
el.classList.add("lew-loading-show");
|
|
24728
|
-
} else {
|
|
24729
|
-
el.classList.remove("lew-loading-show");
|
|
24730
|
-
}
|
|
24630
|
+
const _hoisted_2 = { class: "left" };
|
|
24631
|
+
const _hoisted_3 = { class: "right" };
|
|
24632
|
+
const _hoisted_4 = { class: "left" };
|
|
24633
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
24634
|
+
__name: "LewDialog",
|
|
24635
|
+
props: dialogProps,
|
|
24636
|
+
emits: ["close"],
|
|
24637
|
+
setup(__props, { emit: __emit }) {
|
|
24638
|
+
const { Escape } = useMagicKeys();
|
|
24639
|
+
useDOMCreate("lew-dialog");
|
|
24640
|
+
const props = __props;
|
|
24641
|
+
const emit = __emit;
|
|
24642
|
+
const visible = ref(false);
|
|
24643
|
+
const okLoading = ref(false);
|
|
24644
|
+
const cancelLoading = ref(false);
|
|
24645
|
+
const okRef1 = ref();
|
|
24646
|
+
const okRef2 = ref();
|
|
24647
|
+
const maskClick = () => {
|
|
24648
|
+
if (props.closeOnClickOverlay) {
|
|
24649
|
+
visible.value = false;
|
|
24731
24650
|
}
|
|
24651
|
+
};
|
|
24652
|
+
onMounted(() => {
|
|
24653
|
+
visible.value = true;
|
|
24654
|
+
nextTick(() => {
|
|
24655
|
+
if (okRef1.value) okRef1.value.focus();
|
|
24656
|
+
if (okRef2.value) okRef2.value.focus();
|
|
24657
|
+
});
|
|
24732
24658
|
});
|
|
24733
|
-
|
|
24734
|
-
|
|
24735
|
-
|
|
24736
|
-
|
|
24737
|
-
|
|
24738
|
-
|
|
24739
|
-
|
|
24740
|
-
|
|
24741
|
-
|
|
24742
|
-
|
|
24743
|
-
|
|
24744
|
-
|
|
24745
|
-
|
|
24746
|
-
delay: [250, 250],
|
|
24747
|
-
arrow: false,
|
|
24748
|
-
appendTo: () => document.body,
|
|
24749
|
-
allowHTML: true
|
|
24750
|
-
}),
|
|
24751
|
-
menuInstance: {}
|
|
24752
|
-
};
|
|
24753
|
-
window.LewContextMenu.instance.popper.children[0].setAttribute(
|
|
24754
|
-
"data-lew",
|
|
24755
|
-
"popover"
|
|
24756
|
-
);
|
|
24757
|
-
};
|
|
24758
|
-
const findContextMenuId = (el) => {
|
|
24759
|
-
try {
|
|
24760
|
-
const id = el.getAttribute("lew-context-menu-id");
|
|
24761
|
-
if (id) return id;
|
|
24762
|
-
return el.parentNode ? findContextMenuId(el.parentNode) : "";
|
|
24763
|
-
} catch {
|
|
24764
|
-
return "";
|
|
24765
|
-
}
|
|
24766
|
-
};
|
|
24767
|
-
const LewVContextMenu = {
|
|
24768
|
-
install(app) {
|
|
24769
|
-
app.directive("context-menu", {
|
|
24770
|
-
mounted(el, binding) {
|
|
24771
|
-
if (!window.LewContextMenu) {
|
|
24772
|
-
initLewContextMenu();
|
|
24773
|
-
}
|
|
24774
|
-
if (!el.id) {
|
|
24775
|
-
const id = getUniqueId();
|
|
24776
|
-
el.setAttribute("lew-context-menu-id", id);
|
|
24777
|
-
const { options } = binding.value;
|
|
24778
|
-
window.LewContextMenu.menu[id] = options || [];
|
|
24659
|
+
watch(visible, (newVal) => {
|
|
24660
|
+
if (!newVal) {
|
|
24661
|
+
setTimeout(() => emit("close"), 500);
|
|
24662
|
+
}
|
|
24663
|
+
});
|
|
24664
|
+
const handleAction = async (action) => {
|
|
24665
|
+
const actionFunction = props[action];
|
|
24666
|
+
const loadingRef = action === "ok" ? okLoading : cancelLoading;
|
|
24667
|
+
if (typeof actionFunction === "function") {
|
|
24668
|
+
loadingRef.value = true;
|
|
24669
|
+
const result = await actionFunction();
|
|
24670
|
+
if (result !== false) {
|
|
24671
|
+
visible.value = false;
|
|
24779
24672
|
}
|
|
24780
|
-
|
|
24781
|
-
|
|
24782
|
-
|
|
24783
|
-
|
|
24784
|
-
|
|
24785
|
-
|
|
24786
|
-
|
|
24787
|
-
|
|
24788
|
-
|
|
24789
|
-
Object.keys(window.LewContextMenu.menuInstance).forEach(
|
|
24790
|
-
(key) => {
|
|
24791
|
-
window.LewContextMenu.menuInstance[key].destroy();
|
|
24792
|
-
delete window.LewContextMenu.menuInstance[key];
|
|
24793
|
-
}
|
|
24794
|
-
);
|
|
24795
|
-
createApp({
|
|
24796
|
-
render() {
|
|
24797
|
-
return h$1(LewContextMenu, {
|
|
24798
|
-
options,
|
|
24799
|
-
onSelect: (item) => {
|
|
24800
|
-
const { selectHandler } = binding.value;
|
|
24801
|
-
if (isFunction(selectHandler)) {
|
|
24802
|
-
selectHandler(item);
|
|
24803
|
-
}
|
|
24804
|
-
if (!(item.children || []).length) {
|
|
24805
|
-
instance.hide();
|
|
24806
|
-
}
|
|
24807
|
-
}
|
|
24808
|
-
});
|
|
24809
|
-
}
|
|
24810
|
-
}).mount(menuDom);
|
|
24811
|
-
setTimeout(() => {
|
|
24812
|
-
instance.setProps({
|
|
24813
|
-
content: menuDom,
|
|
24814
|
-
getReferenceClientRect: () => ({
|
|
24815
|
-
width: 0,
|
|
24816
|
-
height: 0,
|
|
24817
|
-
top: e2.clientY,
|
|
24818
|
-
bottom: e2.clientY,
|
|
24819
|
-
left: e2.clientX,
|
|
24820
|
-
right: e2.clientX
|
|
24821
|
-
})
|
|
24822
|
-
});
|
|
24823
|
-
instance.show();
|
|
24824
|
-
}, 120);
|
|
24825
|
-
};
|
|
24826
|
-
window.addEventListener(
|
|
24827
|
-
"contextmenu",
|
|
24828
|
-
window.LewContextMenu.contextMenu
|
|
24829
|
-
);
|
|
24673
|
+
loadingRef.value = false;
|
|
24674
|
+
}
|
|
24675
|
+
};
|
|
24676
|
+
const ok = () => handleAction("ok");
|
|
24677
|
+
const cancel = () => handleAction("cancel");
|
|
24678
|
+
if (props.closeByEsc) {
|
|
24679
|
+
watch(Escape, (v2) => {
|
|
24680
|
+
if (v2 && visible.value) {
|
|
24681
|
+
visible.value = false;
|
|
24830
24682
|
}
|
|
24831
|
-
}
|
|
24832
|
-
|
|
24833
|
-
|
|
24834
|
-
|
|
24835
|
-
|
|
24836
|
-
|
|
24837
|
-
|
|
24838
|
-
|
|
24683
|
+
});
|
|
24684
|
+
}
|
|
24685
|
+
return (_ctx, _cache) => {
|
|
24686
|
+
return openBlock(), createBlock(Teleport, { to: "#lew-dialog" }, [
|
|
24687
|
+
createElementVNode("div", {
|
|
24688
|
+
class: "lew-dialog-container",
|
|
24689
|
+
style: normalizeStyle({
|
|
24690
|
+
"--lew-dialog-transform-origin": _ctx.transformOrigin
|
|
24691
|
+
})
|
|
24692
|
+
}, [
|
|
24693
|
+
createVNode(Transition, { name: "lew-dialog-mask" }, {
|
|
24694
|
+
default: withCtx(() => [
|
|
24695
|
+
visible.value ? (openBlock(), createElementBlock("div", _hoisted_1)) : createCommentVNode("", true)
|
|
24696
|
+
]),
|
|
24697
|
+
_: 1
|
|
24698
|
+
}),
|
|
24699
|
+
createVNode(Transition, { name: "lew-dialog" }, {
|
|
24700
|
+
default: withCtx(() => [
|
|
24701
|
+
visible.value ? (openBlock(), createElementBlock("div", {
|
|
24702
|
+
key: 0,
|
|
24703
|
+
class: "lew-dialog",
|
|
24704
|
+
onClick: maskClick
|
|
24705
|
+
}, [
|
|
24706
|
+
_ctx.layout === "normal" ? (openBlock(), createBlock(unref(LewFlex), {
|
|
24707
|
+
key: 0,
|
|
24708
|
+
direction: "y",
|
|
24709
|
+
gap: "20",
|
|
24710
|
+
class: "lew-dialog-box lew-dialog-box-normal",
|
|
24711
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
24712
|
+
}, ["stop"]))
|
|
24713
|
+
}, {
|
|
24714
|
+
default: withCtx(() => [
|
|
24715
|
+
createVNode(unref(LewFlex), { y: "start" }, {
|
|
24716
|
+
default: withCtx(() => [
|
|
24717
|
+
createElementVNode("div", _hoisted_2, [
|
|
24718
|
+
createVNode(Icon, {
|
|
24719
|
+
type: _ctx.type,
|
|
24720
|
+
size: 30
|
|
24721
|
+
}, null, 8, ["type"])
|
|
24722
|
+
]),
|
|
24723
|
+
createElementVNode("div", _hoisted_3, [
|
|
24724
|
+
createElementVNode("header", null, [
|
|
24725
|
+
renderSlot(_ctx.$slots, "title", {}, void 0, true)
|
|
24726
|
+
]),
|
|
24727
|
+
createElementVNode("main", null, [
|
|
24728
|
+
renderSlot(_ctx.$slots, "content", {}, void 0, true)
|
|
24729
|
+
])
|
|
24730
|
+
])
|
|
24731
|
+
]),
|
|
24732
|
+
_: 3
|
|
24733
|
+
}),
|
|
24734
|
+
createElementVNode("footer", null, [
|
|
24735
|
+
_ctx.cancelText ? (openBlock(), createBlock(unref(LewButton), {
|
|
24736
|
+
key: 0,
|
|
24737
|
+
text: _ctx.cancelText,
|
|
24738
|
+
color: "gray",
|
|
24739
|
+
type: "text",
|
|
24740
|
+
loading: cancelLoading.value,
|
|
24741
|
+
onClick: withModifiers(cancel, ["stop"])
|
|
24742
|
+
}, null, 8, ["text", "loading"])) : createCommentVNode("", true),
|
|
24743
|
+
_ctx.okText ? (openBlock(), createBlock(unref(LewButton), {
|
|
24744
|
+
key: 1,
|
|
24745
|
+
ref_key: "okRef1",
|
|
24746
|
+
ref: okRef1,
|
|
24747
|
+
text: _ctx.okText,
|
|
24748
|
+
type: "fill",
|
|
24749
|
+
color: _ctx.type,
|
|
24750
|
+
loading: okLoading.value,
|
|
24751
|
+
onClick: withModifiers(ok, ["stop"])
|
|
24752
|
+
}, null, 8, ["text", "color", "loading"])) : createCommentVNode("", true)
|
|
24753
|
+
])
|
|
24754
|
+
]),
|
|
24755
|
+
_: 3
|
|
24756
|
+
})) : createCommentVNode("", true),
|
|
24757
|
+
_ctx.layout === "mini" ? (openBlock(), createElementBlock("div", {
|
|
24758
|
+
key: 1,
|
|
24759
|
+
class: "lew-dialog-box lew-dialog-box-mini",
|
|
24760
|
+
onClick: _cache[1] || (_cache[1] = withModifiers(() => {
|
|
24761
|
+
}, ["stop"]))
|
|
24762
|
+
}, [
|
|
24763
|
+
createElementVNode("div", _hoisted_4, [
|
|
24764
|
+
createVNode(Icon, {
|
|
24765
|
+
size: 24,
|
|
24766
|
+
type: _ctx.type
|
|
24767
|
+
}, null, 8, ["type"])
|
|
24768
|
+
]),
|
|
24769
|
+
createVNode(unref(LewFlex), { class: "right" }, {
|
|
24770
|
+
default: withCtx(() => [
|
|
24771
|
+
createElementVNode("main", null, [
|
|
24772
|
+
renderSlot(_ctx.$slots, "content", {}, void 0, true)
|
|
24773
|
+
]),
|
|
24774
|
+
createVNode(unref(LewFlex), { x: "end" }, {
|
|
24775
|
+
default: withCtx(() => [
|
|
24776
|
+
_ctx.cancelText ? (openBlock(), createBlock(unref(LewButton), {
|
|
24777
|
+
key: 0,
|
|
24778
|
+
text: _ctx.cancelText,
|
|
24779
|
+
type: "text",
|
|
24780
|
+
size: "small",
|
|
24781
|
+
color: "gray",
|
|
24782
|
+
round: "",
|
|
24783
|
+
loading: cancelLoading.value,
|
|
24784
|
+
onClick: withModifiers(cancel, ["stop"])
|
|
24785
|
+
}, null, 8, ["text", "loading"])) : createCommentVNode("", true),
|
|
24786
|
+
_ctx.okText ? (openBlock(), createBlock(unref(LewButton), {
|
|
24787
|
+
key: 1,
|
|
24788
|
+
ref_key: "okRef2",
|
|
24789
|
+
ref: okRef2,
|
|
24790
|
+
text: _ctx.okText,
|
|
24791
|
+
type: "fill",
|
|
24792
|
+
size: "small",
|
|
24793
|
+
round: "",
|
|
24794
|
+
color: _ctx.type,
|
|
24795
|
+
loading: okLoading.value,
|
|
24796
|
+
onClick: withModifiers(ok, ["stop"])
|
|
24797
|
+
}, null, 8, ["text", "color", "loading"])) : createCommentVNode("", true)
|
|
24798
|
+
]),
|
|
24799
|
+
_: 1
|
|
24800
|
+
})
|
|
24801
|
+
]),
|
|
24802
|
+
_: 3
|
|
24803
|
+
})
|
|
24804
|
+
])) : createCommentVNode("", true)
|
|
24805
|
+
])) : createCommentVNode("", true)
|
|
24806
|
+
]),
|
|
24807
|
+
_: 3
|
|
24808
|
+
})
|
|
24809
|
+
], 4)
|
|
24810
|
+
]);
|
|
24811
|
+
};
|
|
24812
|
+
}
|
|
24813
|
+
});
|
|
24814
|
+
const _LewDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-46b17cfb"]]);
|
|
24815
|
+
const { x, y } = useMouse();
|
|
24816
|
+
const createDialog = (type) => (options) => dialog(type, options);
|
|
24817
|
+
const dialogTypes = {
|
|
24818
|
+
warning: createDialog("warning"),
|
|
24819
|
+
error: createDialog("error"),
|
|
24820
|
+
info: createDialog("info"),
|
|
24821
|
+
normal: createDialog("normal"),
|
|
24822
|
+
success: createDialog("success")
|
|
24823
|
+
};
|
|
24824
|
+
const dialog = (type, options) => {
|
|
24825
|
+
const {
|
|
24826
|
+
title,
|
|
24827
|
+
content,
|
|
24828
|
+
ok = () => true,
|
|
24829
|
+
cancel = () => true,
|
|
24830
|
+
okText,
|
|
24831
|
+
cancelText,
|
|
24832
|
+
layout,
|
|
24833
|
+
closeOnClickOverlay,
|
|
24834
|
+
closeByEsc
|
|
24835
|
+
} = options;
|
|
24836
|
+
const div2 = document.createElement("div");
|
|
24837
|
+
const transformOrigin = `${x.value}px ${y.value}px`;
|
|
24838
|
+
document.body.appendChild(div2);
|
|
24839
|
+
const app = createApp({
|
|
24840
|
+
render() {
|
|
24841
|
+
return h$1(
|
|
24842
|
+
_LewDialog,
|
|
24843
|
+
{
|
|
24844
|
+
closeOnClickOverlay,
|
|
24845
|
+
closeByEsc,
|
|
24846
|
+
type,
|
|
24847
|
+
layout,
|
|
24848
|
+
okText,
|
|
24849
|
+
cancelText,
|
|
24850
|
+
transformOrigin,
|
|
24851
|
+
ok,
|
|
24852
|
+
onClose: () => {
|
|
24853
|
+
app.unmount();
|
|
24854
|
+
div2.remove();
|
|
24855
|
+
},
|
|
24856
|
+
cancel
|
|
24857
|
+
},
|
|
24858
|
+
{
|
|
24859
|
+
title: () => title,
|
|
24860
|
+
content: () => content
|
|
24839
24861
|
}
|
|
24840
|
-
|
|
24841
|
-
}
|
|
24842
|
-
}
|
|
24862
|
+
);
|
|
24863
|
+
}
|
|
24864
|
+
});
|
|
24865
|
+
app.mount(div2);
|
|
24843
24866
|
};
|
|
24844
|
-
const
|
|
24845
|
-
|
|
24846
|
-
|
|
24847
|
-
|
|
24848
|
-
|
|
24867
|
+
const LewDialog$1 = {
|
|
24868
|
+
name: "LewDialog",
|
|
24869
|
+
...dialogTypes
|
|
24870
|
+
};
|
|
24871
|
+
const warning = ({ title, content, delay = 3e3 }) => {
|
|
24872
|
+
notification("warning", title, content, delay);
|
|
24873
|
+
};
|
|
24874
|
+
const error = ({ title, content, delay = 3e3 }) => {
|
|
24875
|
+
notification("error", title, content, delay);
|
|
24876
|
+
};
|
|
24877
|
+
const info = ({ title, content, delay = 3e3 }) => {
|
|
24878
|
+
notification("info", title, content, delay);
|
|
24879
|
+
};
|
|
24880
|
+
const normal = ({ title, content, delay = 3e3 }) => {
|
|
24881
|
+
notification("normal", title, content, delay);
|
|
24882
|
+
};
|
|
24883
|
+
const success = ({ title, content, delay = 3e3 }) => {
|
|
24884
|
+
notification("success", title, content, delay);
|
|
24885
|
+
};
|
|
24886
|
+
const createMessageList = () => {
|
|
24887
|
+
const div2 = document.createElement("div");
|
|
24888
|
+
div2.setAttribute("id", "lew-notification");
|
|
24889
|
+
document.body.appendChild(div2);
|
|
24890
|
+
};
|
|
24891
|
+
const notification = (type, title, content, delay) => {
|
|
24892
|
+
if (!document.getElementById("lew-notification")) {
|
|
24893
|
+
createMessageList();
|
|
24894
|
+
notification(type, title, content, delay);
|
|
24895
|
+
} else {
|
|
24896
|
+
add(type, title, content, delay);
|
|
24849
24897
|
}
|
|
24850
24898
|
};
|
|
24851
|
-
const
|
|
24852
|
-
const
|
|
24853
|
-
const
|
|
24854
|
-
|
|
24855
|
-
|
|
24856
|
-
|
|
24857
|
-
|
|
24858
|
-
|
|
24859
|
-
|
|
24860
|
-
|
|
24861
|
-
|
|
24862
|
-
|
|
24863
|
-
|
|
24864
|
-
|
|
24865
|
-
|
|
24866
|
-
|
|
24867
|
-
|
|
24868
|
-
|
|
24869
|
-
|
|
24870
|
-
|
|
24871
|
-
|
|
24872
|
-
|
|
24873
|
-
|
|
24874
|
-
|
|
24875
|
-
|
|
24876
|
-
|
|
24877
|
-
|
|
24878
|
-
}
|
|
24879
|
-
});
|
|
24880
|
-
}
|
|
24881
|
-
}).mount(menuDom);
|
|
24882
|
-
const uniqueId2 = getUniqueId();
|
|
24883
|
-
if (!window.LewContextMenu) {
|
|
24884
|
-
initLewContextMenu();
|
|
24885
|
-
}
|
|
24886
|
-
window.LewContextMenu.menuInstance[uniqueId2] = tippy(el, {
|
|
24887
|
-
theme: "light",
|
|
24888
|
-
animation: "shift-away-subtle",
|
|
24889
|
-
trigger: "mouseenter",
|
|
24890
|
-
interactive: true,
|
|
24891
|
-
placement: "right-start",
|
|
24892
|
-
duration: [250, 250],
|
|
24893
|
-
delay: [250, 250],
|
|
24894
|
-
arrow: false,
|
|
24895
|
-
offset: [0, 0],
|
|
24896
|
-
allowHTML: true,
|
|
24897
|
-
hideOnClick: false,
|
|
24898
|
-
zIndex: 9999,
|
|
24899
|
-
content: menuDom
|
|
24900
|
-
});
|
|
24901
|
-
window.LewContextMenu.menuInstance[uniqueId2].popper.children[0].setAttribute("data-lew", "popover");
|
|
24902
|
-
});
|
|
24903
|
-
};
|
|
24904
|
-
const renderIcon = ({ renderIcon: renderIcon2 }) => {
|
|
24905
|
-
if (renderIcon2) return renderIcon2();
|
|
24906
|
-
return "";
|
|
24907
|
-
};
|
|
24908
|
-
onMounted(() => {
|
|
24909
|
-
initTippy();
|
|
24910
|
-
});
|
|
24911
|
-
return (_ctx, _cache) => {
|
|
24912
|
-
return openBlock(), createBlock(unref(LewFlex), {
|
|
24913
|
-
direction: "y",
|
|
24914
|
-
gap: "0",
|
|
24915
|
-
class: "lew-context-menu"
|
|
24916
|
-
}, {
|
|
24917
|
-
default: withCtx(() => [
|
|
24918
|
-
(_ctx.options || []).length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.options, (item, index2) => {
|
|
24919
|
-
return openBlock(), createElementBlock("div", {
|
|
24920
|
-
key: index2,
|
|
24921
|
-
class: normalizeClass(["lew-context-menu-box", {
|
|
24922
|
-
"lew-context-menu-box-disabled": item.disabled,
|
|
24923
|
-
"lew-context-menu-box-divider-line": item.isDividerLine
|
|
24924
|
-
}])
|
|
24925
|
-
}, [
|
|
24926
|
-
createElementVNode("div", {
|
|
24927
|
-
ref_for: true,
|
|
24928
|
-
ref: (el) => unref(itemRefs).push(el),
|
|
24929
|
-
onClick: ($event) => clickItem(item),
|
|
24930
|
-
class: "lew-context-menu-item",
|
|
24931
|
-
style: normalizeStyle({ "animation-delay": index2 * 15 + "ms" })
|
|
24932
|
-
}, [
|
|
24933
|
-
createElementVNode("div", _hoisted_2, [
|
|
24934
|
-
item.renderIcon ? (openBlock(), createBlock(renderIcon, {
|
|
24935
|
-
key: 0,
|
|
24936
|
-
renderIcon: item.renderIcon
|
|
24937
|
-
}, null, 8, ["renderIcon"])) : createCommentVNode("", true),
|
|
24938
|
-
createElementVNode("div", {
|
|
24939
|
-
title: item.label,
|
|
24940
|
-
class: "lew-context-menu-label-text"
|
|
24941
|
-
}, toDisplayString(item.label), 9, _hoisted_3)
|
|
24942
|
-
]),
|
|
24943
|
-
(item.children || []).length > 0 ? (openBlock(), createBlock(Icon, {
|
|
24944
|
-
key: 0,
|
|
24945
|
-
size: 14,
|
|
24946
|
-
type: "chevron-right"
|
|
24947
|
-
})) : createCommentVNode("", true)
|
|
24948
|
-
], 12, _hoisted_1)
|
|
24949
|
-
], 2);
|
|
24950
|
-
}), 128)) : (openBlock(), createBlock(unref(_sfc_main$d), {
|
|
24951
|
-
key: 1,
|
|
24952
|
-
width: "120px",
|
|
24953
|
-
padding: "5px",
|
|
24954
|
-
"font-size": "12px",
|
|
24955
|
-
type: "search",
|
|
24956
|
-
title: "暂无操作"
|
|
24957
|
-
}))
|
|
24958
|
-
]),
|
|
24959
|
-
_: 1
|
|
24960
|
-
});
|
|
24961
|
-
};
|
|
24899
|
+
const add = (type, title, content, delay) => {
|
|
24900
|
+
const LewMessageDom = document.getElementById("lew-notification");
|
|
24901
|
+
const newMessage = document.createElement("div");
|
|
24902
|
+
newMessage.innerHTML = `
|
|
24903
|
+
<div class="lew-notification-box">
|
|
24904
|
+
<div class="lew-notification-icon">
|
|
24905
|
+
${getIconInnerHTML({ type, size: 18 })}
|
|
24906
|
+
</div>
|
|
24907
|
+
<div class="lew-notification-body">
|
|
24908
|
+
<div class="lew-notification-title">${title}</div>
|
|
24909
|
+
${content ? `<div class="lew-notification-content">${content}</div>` : ""}
|
|
24910
|
+
</div>
|
|
24911
|
+
<div class="lew-notification-close-icon">
|
|
24912
|
+
${getIconInnerHTML({ type: "close", size: 16 })}
|
|
24913
|
+
</div>
|
|
24914
|
+
</div>
|
|
24915
|
+
`;
|
|
24916
|
+
LewMessageDom == null ? void 0 : LewMessageDom.insertBefore(newMessage, LewMessageDom == null ? void 0 : LewMessageDom.childNodes[0]);
|
|
24917
|
+
newMessage.setAttribute("class", `lew-notification lew-notification-${type}`);
|
|
24918
|
+
let timer;
|
|
24919
|
+
let lock = false;
|
|
24920
|
+
function startTimer() {
|
|
24921
|
+
if (delay > 0) {
|
|
24922
|
+
({ stop: timer } = useTimeoutFn(() => {
|
|
24923
|
+
handleClose();
|
|
24924
|
+
}, delay));
|
|
24925
|
+
}
|
|
24962
24926
|
}
|
|
24963
|
-
|
|
24964
|
-
|
|
24965
|
-
|
|
24927
|
+
function clearTimer() {
|
|
24928
|
+
timer == null ? void 0 : timer();
|
|
24929
|
+
}
|
|
24930
|
+
function handleClose() {
|
|
24931
|
+
if (lock) {
|
|
24932
|
+
return;
|
|
24933
|
+
}
|
|
24934
|
+
lock = true;
|
|
24935
|
+
newMessage.setAttribute(
|
|
24936
|
+
"class",
|
|
24937
|
+
`lew-notification lew-notification-${type} lew-notification-hidden`
|
|
24938
|
+
);
|
|
24939
|
+
if (newMessage) {
|
|
24940
|
+
if (LewMessageDom) {
|
|
24941
|
+
setTimeout(() => {
|
|
24942
|
+
LewMessageDom.removeChild(newMessage);
|
|
24943
|
+
}, 250);
|
|
24944
|
+
}
|
|
24945
|
+
}
|
|
24946
|
+
}
|
|
24947
|
+
newMessage.children[0].children[2].addEventListener("click", handleClose);
|
|
24948
|
+
newMessage.addEventListener("mouseenter", clearTimer);
|
|
24949
|
+
newMessage.addEventListener("mouseleave", startTimer);
|
|
24950
|
+
setTimeout(() => {
|
|
24951
|
+
lock = false;
|
|
24952
|
+
newMessage.setAttribute(
|
|
24953
|
+
"class",
|
|
24954
|
+
`lew-notification lew-notification-${type} lew-notification-show`
|
|
24955
|
+
);
|
|
24956
|
+
delay > 0 && startTimer();
|
|
24957
|
+
}, 10);
|
|
24958
|
+
};
|
|
24959
|
+
const LewNotification = {
|
|
24960
|
+
name: "LewNotification",
|
|
24961
|
+
warning,
|
|
24962
|
+
info,
|
|
24963
|
+
normal,
|
|
24964
|
+
success,
|
|
24965
|
+
error
|
|
24966
|
+
};
|
|
24967
|
+
const methods = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
24966
24968
|
__proto__: null,
|
|
24967
|
-
LewBacktop: index$1,
|
|
24968
|
-
LewContextMenu,
|
|
24969
24969
|
LewDialog: LewDialog$1,
|
|
24970
|
-
LewLoading,
|
|
24971
24970
|
LewMessage: LewMessage$1,
|
|
24972
24971
|
LewNotification,
|
|
24973
|
-
|
|
24974
|
-
LewVContextMenu,
|
|
24975
|
-
contextMenuProps,
|
|
24976
|
-
dialogProps,
|
|
24977
|
-
initLewContextMenu
|
|
24972
|
+
dialogProps
|
|
24978
24973
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
24979
24974
|
const install = (Vue) => {
|
|
24980
|
-
|
|
24981
|
-
|
|
24982
|
-
|
|
24983
|
-
|
|
24984
|
-
(key) => directives[key]
|
|
24985
|
-
);
|
|
24986
|
-
componentList.forEach((component) => {
|
|
24987
|
-
if (Object.prototype.hasOwnProperty.call(component, "name") || Object.prototype.hasOwnProperty.call(component, "__name")) {
|
|
24988
|
-
Vue.component(`${component.name || component.__name}`, component);
|
|
24975
|
+
Object.keys(components).forEach((key) => {
|
|
24976
|
+
const component = components[key];
|
|
24977
|
+
if (component.name || component.__name) {
|
|
24978
|
+
Vue.component(component.name || component.__name, component);
|
|
24989
24979
|
}
|
|
24990
24980
|
});
|
|
24991
|
-
|
|
24992
|
-
|
|
24993
|
-
|
|
24994
|
-
|
|
24995
|
-
|
|
24996
|
-
|
|
24981
|
+
Object.keys(directives).forEach((key) => {
|
|
24982
|
+
Vue.use(directives[key]);
|
|
24983
|
+
});
|
|
24984
|
+
Object.keys(methods).forEach((key) => {
|
|
24985
|
+
const methodInstance = methods[key];
|
|
24986
|
+
if (methodInstance.name) {
|
|
24987
|
+
window[methodInstance.name] = methodInstance;
|
|
24997
24988
|
}
|
|
24998
24989
|
});
|
|
24999
24990
|
};
|