lew-ui 2.4.4 → 2.4.5
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 +921 -939
- 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, resolveComponent, toRaw, vModelCheckbox, 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",
|
|
@@ -10125,11 +10123,11 @@ const radioProps = {
|
|
|
10125
10123
|
size: {
|
|
10126
10124
|
type: String,
|
|
10127
10125
|
default: "medium",
|
|
10128
|
-
description: "
|
|
10129
|
-
validator(value) {
|
|
10126
|
+
description: "复选框组中复选框的尺寸",
|
|
10127
|
+
validator: (value) => {
|
|
10130
10128
|
if (!validSizes.includes(value)) {
|
|
10131
10129
|
console.warn(
|
|
10132
|
-
|
|
10130
|
+
'[LewRadio] 无效的 size 值,请使用 "small"、"medium" 或 "large"'
|
|
10133
10131
|
);
|
|
10134
10132
|
return false;
|
|
10135
10133
|
}
|
|
@@ -10158,13 +10156,10 @@ const radioGroupProps = {
|
|
|
10158
10156
|
direction: {
|
|
10159
10157
|
type: String,
|
|
10160
10158
|
default: "x",
|
|
10161
|
-
description: "
|
|
10162
|
-
validator(value) {
|
|
10163
|
-
|
|
10164
|
-
|
|
10165
|
-
console.warn(
|
|
10166
|
-
`[LewRadioGroup] 无效的排列方向: ${value}。请使用 ${validDirections.join(", ")} 中的一个。`
|
|
10167
|
-
);
|
|
10159
|
+
description: "复选框组的排列方向",
|
|
10160
|
+
validator: (value) => {
|
|
10161
|
+
if (!validDirection.includes(value)) {
|
|
10162
|
+
console.warn('[LewRadioGroup] 无效的 direction 值,请使用 "x" 或 "y"');
|
|
10168
10163
|
return false;
|
|
10169
10164
|
}
|
|
10170
10165
|
return true;
|
|
@@ -10198,11 +10193,11 @@ const radioGroupProps = {
|
|
|
10198
10193
|
size: {
|
|
10199
10194
|
type: String,
|
|
10200
10195
|
default: "medium",
|
|
10201
|
-
description: "
|
|
10202
|
-
validator(value) {
|
|
10196
|
+
description: "复选框组中复选框的尺寸",
|
|
10197
|
+
validator: (value) => {
|
|
10203
10198
|
if (!validSizes.includes(value)) {
|
|
10204
10199
|
console.warn(
|
|
10205
|
-
|
|
10200
|
+
'[LewRadioGroup] 无效的 size 值,请使用 "small"、"medium" 或 "large"'
|
|
10206
10201
|
);
|
|
10207
10202
|
return false;
|
|
10208
10203
|
}
|
|
@@ -10595,8 +10590,6 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
10595
10590
|
);
|
|
10596
10591
|
__expose({ show, hide: hide2 });
|
|
10597
10592
|
return (_ctx, _cache) => {
|
|
10598
|
-
const _component_lew_empty = resolveComponent("lew-empty");
|
|
10599
|
-
const _component_lew_text_trim = resolveComponent("lew-text-trim");
|
|
10600
10593
|
return openBlock(), createBlock(unref(_sfc_main$k), {
|
|
10601
10594
|
ref_key: "lewPopoverRef",
|
|
10602
10595
|
ref: lewPopoverRef,
|
|
@@ -10665,7 +10658,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
10665
10658
|
class: "lew-not-found"
|
|
10666
10659
|
}, {
|
|
10667
10660
|
default: withCtx(() => [
|
|
10668
|
-
createVNode(
|
|
10661
|
+
createVNode(unref(_sfc_main$d), { title: "暂无结果" })
|
|
10669
10662
|
]),
|
|
10670
10663
|
_: 1
|
|
10671
10664
|
}))
|
|
@@ -10695,7 +10688,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
10695
10688
|
key: 1,
|
|
10696
10689
|
class: normalizeClass(["lew-select-item", getSelectItemClassName(templateProps)])
|
|
10697
10690
|
}, [
|
|
10698
|
-
createVNode(
|
|
10691
|
+
createVNode(unref(LewTextTrim), {
|
|
10699
10692
|
text: templateProps.label,
|
|
10700
10693
|
delay: [500, 0],
|
|
10701
10694
|
class: "lew-select-label"
|
|
@@ -10720,7 +10713,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
|
|
|
10720
10713
|
};
|
|
10721
10714
|
}
|
|
10722
10715
|
});
|
|
10723
|
-
const LewSelect = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-
|
|
10716
|
+
const LewSelect = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-aba2a338"]]);
|
|
10724
10717
|
const selectMultipleModel = {
|
|
10725
10718
|
modelValue: {
|
|
10726
10719
|
type: Array,
|
|
@@ -10998,11 +10991,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
10998
10991
|
});
|
|
10999
10992
|
__expose({ show, hide: hide2 });
|
|
11000
10993
|
return (_ctx, _cache) => {
|
|
11001
|
-
const _component_lew_tag = resolveComponent("lew-tag");
|
|
11002
|
-
const _component_lew_flex = resolveComponent("lew-flex");
|
|
11003
10994
|
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
10995
|
return openBlock(), createBlock(unref(_sfc_main$k), {
|
|
11007
10996
|
ref_key: "lewPopoverRef",
|
|
11008
10997
|
ref: lewPopoverRef,
|
|
@@ -11045,7 +11034,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
11045
11034
|
_: 1
|
|
11046
11035
|
}),
|
|
11047
11036
|
unref(getLabels) && unref(getLabels).length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
11048
|
-
_ctx.valueLayout === "tag" ? (openBlock(), createBlock(
|
|
11037
|
+
_ctx.valueLayout === "tag" ? (openBlock(), createBlock(unref(LewFlex), {
|
|
11049
11038
|
key: 0,
|
|
11050
11039
|
style: { "padding": "5px" },
|
|
11051
11040
|
x: "start",
|
|
@@ -11058,7 +11047,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
11058
11047
|
createVNode(TransitionGroup, { name: "list" }, {
|
|
11059
11048
|
default: withCtx(() => [
|
|
11060
11049
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(getLabels), (item, index2) => {
|
|
11061
|
-
return openBlock(), createBlock(
|
|
11050
|
+
return openBlock(), createBlock(unref(_sfc_main$o), {
|
|
11062
11051
|
key: index2,
|
|
11063
11052
|
type: "light",
|
|
11064
11053
|
size: _ctx.size,
|
|
@@ -11090,7 +11079,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
11090
11079
|
createElementVNode("div", _hoisted_1$t, toDisplayString(unref(getLabels).join(_ctx.valueTextSplit)), 1)
|
|
11091
11080
|
]),
|
|
11092
11081
|
"popover-body": withCtx(() => [
|
|
11093
|
-
createVNode(
|
|
11082
|
+
createVNode(unref(LewFlex), {
|
|
11094
11083
|
x: "start",
|
|
11095
11084
|
y: "center",
|
|
11096
11085
|
gap: 5,
|
|
@@ -11100,7 +11089,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
11100
11089
|
}, {
|
|
11101
11090
|
default: withCtx(() => [
|
|
11102
11091
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(getLabels), (item, index2) => {
|
|
11103
|
-
return openBlock(), createBlock(
|
|
11092
|
+
return openBlock(), createBlock(unref(_sfc_main$o), {
|
|
11104
11093
|
key: index2,
|
|
11105
11094
|
type: "light",
|
|
11106
11095
|
size: _ctx.size,
|
|
@@ -11145,7 +11134,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
11145
11134
|
])) : createCommentVNode("", true),
|
|
11146
11135
|
createElementVNode("div", _hoisted_3$g, [
|
|
11147
11136
|
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(
|
|
11137
|
+
_ctx.$slots.empty ? renderSlot(_ctx.$slots, "empty", { key: 0 }, void 0, true) : (openBlock(), createBlock(unref(LewFlex), {
|
|
11149
11138
|
key: 1,
|
|
11150
11139
|
direction: "y",
|
|
11151
11140
|
class: "lew-not-found"
|
|
@@ -11182,12 +11171,12 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
11182
11171
|
key: 1,
|
|
11183
11172
|
class: normalizeClass(["lew-select-item lew-select-item-mul", getSelectItemClassName(templateProps)])
|
|
11184
11173
|
}, [
|
|
11185
|
-
(openBlock(), createBlock(
|
|
11174
|
+
(openBlock(), createBlock(unref(LewCheckbox), {
|
|
11186
11175
|
key: templateProps.value,
|
|
11187
11176
|
class: "lew-select-checkbox",
|
|
11188
11177
|
checked: unref(getChecked)(templateProps.value)
|
|
11189
11178
|
}, null, 8, ["checked"])),
|
|
11190
|
-
createVNode(
|
|
11179
|
+
createVNode(unref(LewTextTrim), {
|
|
11191
11180
|
text: templateProps.label,
|
|
11192
11181
|
delay: [500, 0],
|
|
11193
11182
|
class: "lew-select-label"
|
|
@@ -11206,7 +11195,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
11206
11195
|
};
|
|
11207
11196
|
}
|
|
11208
11197
|
});
|
|
11209
|
-
const LewSelectMultiple = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-
|
|
11198
|
+
const LewSelectMultiple = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-3ebc2970"]]);
|
|
11210
11199
|
const switchModel = {
|
|
11211
11200
|
modelValue: {
|
|
11212
11201
|
type: Boolean,
|
|
@@ -14655,7 +14644,6 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
14655
14644
|
return styleObj;
|
|
14656
14645
|
});
|
|
14657
14646
|
return (_ctx, _cache) => {
|
|
14658
|
-
const _component_lew_text_trim = resolveComponent("lew-text-trim");
|
|
14659
14647
|
return openBlock(), createElementBlock("div", {
|
|
14660
14648
|
class: normalizeClass(["lew-tag", unref(tagClassName)]),
|
|
14661
14649
|
style: normalizeStyle(unref(getStyle))
|
|
@@ -14664,10 +14652,10 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
14664
14652
|
renderSlot(_ctx.$slots, "left")
|
|
14665
14653
|
]),
|
|
14666
14654
|
createElementVNode("div", _hoisted_2$b, [
|
|
14667
|
-
_ctx.text ? (openBlock(), createBlock(
|
|
14655
|
+
_ctx.text ? (openBlock(), createBlock(unref(LewTextTrim), {
|
|
14668
14656
|
key: 0,
|
|
14669
14657
|
text: _ctx.text
|
|
14670
|
-
}, null, 8, ["text"])) : (openBlock(), createBlock(
|
|
14658
|
+
}, null, 8, ["text"])) : (openBlock(), createBlock(unref(LewTextTrim), { key: 1 }, {
|
|
14671
14659
|
default: withCtx(() => [
|
|
14672
14660
|
renderSlot(_ctx.$slots, "default")
|
|
14673
14661
|
]),
|
|
@@ -19377,13 +19365,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19377
19365
|
}
|
|
19378
19366
|
});
|
|
19379
19367
|
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
19368
|
const _directive_tooltip = resolveDirective("tooltip");
|
|
19386
|
-
return openBlock(), createBlock(
|
|
19369
|
+
return openBlock(), createBlock(unref(LewFlex), {
|
|
19387
19370
|
class: "lew-upload-wrapper",
|
|
19388
19371
|
direction: "y",
|
|
19389
19372
|
gap: "10"
|
|
@@ -19401,7 +19384,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19401
19384
|
class: normalizeClass(["lew-upload-label", unref(getUploadLabelClass)]),
|
|
19402
19385
|
style: { "width": "100%" }
|
|
19403
19386
|
}, [
|
|
19404
|
-
createVNode(
|
|
19387
|
+
createVNode(unref(LewFlex), {
|
|
19405
19388
|
ref_key: "dropRef",
|
|
19406
19389
|
ref: dropRef,
|
|
19407
19390
|
direction: "y",
|
|
@@ -19456,12 +19439,12 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19456
19439
|
], 34), [
|
|
19457
19440
|
[vShow, (modelValue.value || []).length < _ctx.limit]
|
|
19458
19441
|
]),
|
|
19459
|
-
!unref(isFunction)(_ctx.uploadHelper) ? (openBlock(), createBlock(
|
|
19442
|
+
!unref(isFunction)(_ctx.uploadHelper) ? (openBlock(), createBlock(unref(LewAlert), {
|
|
19460
19443
|
key: 0,
|
|
19461
19444
|
type: "error",
|
|
19462
19445
|
title: "uploadHelper Error: 未配置上传方法"
|
|
19463
19446
|
})) : createCommentVNode("", true),
|
|
19464
|
-
withDirectives(createVNode(
|
|
19447
|
+
withDirectives(createVNode(unref(LewFlex), {
|
|
19465
19448
|
direction: "y",
|
|
19466
19449
|
class: "lew-upload-file-list",
|
|
19467
19450
|
gap: "10"
|
|
@@ -19470,7 +19453,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19470
19453
|
createVNode(TransitionGroup, { name: "upload-list" }, {
|
|
19471
19454
|
default: withCtx(() => [
|
|
19472
19455
|
(openBlock(true), createElementBlock(Fragment, null, renderList(modelValue.value, (item) => {
|
|
19473
|
-
return openBlock(), createBlock(
|
|
19456
|
+
return openBlock(), createBlock(unref(LewFlex), {
|
|
19474
19457
|
key: item.id,
|
|
19475
19458
|
class: "lew-upload-file-item",
|
|
19476
19459
|
mode: "between",
|
|
@@ -19480,7 +19463,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19480
19463
|
})
|
|
19481
19464
|
}, {
|
|
19482
19465
|
default: withCtx(() => [
|
|
19483
|
-
createVNode(
|
|
19466
|
+
createVNode(unref(LewFlex), {
|
|
19484
19467
|
style: normalizeStyle({
|
|
19485
19468
|
width: `${fileIconSizeMap[_ctx.size]}px`,
|
|
19486
19469
|
height: `${fileIconSizeMap[_ctx.size]}px`
|
|
@@ -19488,7 +19471,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19488
19471
|
class: "lew-upload-icon-wrapper"
|
|
19489
19472
|
}, {
|
|
19490
19473
|
default: withCtx(() => [
|
|
19491
|
-
checkUrlIsImg(item.url) ? (openBlock(), createBlock(
|
|
19474
|
+
checkUrlIsImg(item.url) ? (openBlock(), createBlock(unref(LewImage), {
|
|
19492
19475
|
key: 0,
|
|
19493
19476
|
class: "lew-upload-file-image",
|
|
19494
19477
|
src: item.url
|
|
@@ -19500,14 +19483,14 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19500
19483
|
]),
|
|
19501
19484
|
_: 2
|
|
19502
19485
|
}, 1032, ["style"]),
|
|
19503
|
-
createVNode(
|
|
19486
|
+
createVNode(unref(LewFlex), {
|
|
19504
19487
|
class: "lew-upload-file-info",
|
|
19505
19488
|
style: normalizeStyle({ width: `calc(100% - ${fileIconSizeMap[_ctx.size]}px - 8px)` }),
|
|
19506
19489
|
direction: "y",
|
|
19507
19490
|
gap: "0"
|
|
19508
19491
|
}, {
|
|
19509
19492
|
default: withCtx(() => [
|
|
19510
|
-
item.status === "fail" ? withDirectives((openBlock(), createBlock(
|
|
19493
|
+
item.status === "fail" ? withDirectives((openBlock(), createBlock(unref(LewFlex), {
|
|
19511
19494
|
key: 0,
|
|
19512
19495
|
onClick: withModifiers(($event) => reUpload(item.id), ["stop"]),
|
|
19513
19496
|
x: "center",
|
|
@@ -19532,7 +19515,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19532
19515
|
trigger: "mouseenter"
|
|
19533
19516
|
}]
|
|
19534
19517
|
]) : createCommentVNode("", true),
|
|
19535
|
-
withDirectives((openBlock(), createBlock(
|
|
19518
|
+
withDirectives((openBlock(), createBlock(unref(LewFlex), {
|
|
19536
19519
|
onClick: withModifiers(($event) => deleteFile(item.id), ["stop"]),
|
|
19537
19520
|
x: "center",
|
|
19538
19521
|
y: "center",
|
|
@@ -19556,19 +19539,19 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19556
19539
|
trigger: "mouseenter"
|
|
19557
19540
|
}]
|
|
19558
19541
|
]),
|
|
19559
|
-
createVNode(
|
|
19542
|
+
createVNode(unref(LewFlex), {
|
|
19560
19543
|
mode: "between",
|
|
19561
19544
|
gap: "5",
|
|
19562
19545
|
y: "center"
|
|
19563
19546
|
}, {
|
|
19564
19547
|
default: withCtx(() => [
|
|
19565
|
-
createVNode(
|
|
19548
|
+
createVNode(unref(LewFlex), {
|
|
19566
19549
|
y: "center",
|
|
19567
19550
|
x: "start",
|
|
19568
19551
|
gap: "5"
|
|
19569
19552
|
}, {
|
|
19570
19553
|
default: withCtx(() => [
|
|
19571
|
-
createVNode(
|
|
19554
|
+
createVNode(unref(LewTextTrim), {
|
|
19572
19555
|
text: unref(getFileName)(item),
|
|
19573
19556
|
style: normalizeStyle({
|
|
19574
19557
|
width: `calc(100% - 60px)`,
|
|
@@ -19582,12 +19565,12 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19582
19565
|
]),
|
|
19583
19566
|
_: 2
|
|
19584
19567
|
}, 1024),
|
|
19585
|
-
item.percent ? (openBlock(), createBlock(
|
|
19568
|
+
item.percent ? (openBlock(), createBlock(unref(LewFlex), {
|
|
19586
19569
|
key: 1,
|
|
19587
19570
|
class: normalizeClass(["lew-upload-progress", [`lew-upload-progress-${item.status}`]])
|
|
19588
19571
|
}, {
|
|
19589
19572
|
default: withCtx(() => [
|
|
19590
|
-
createVNode(
|
|
19573
|
+
createVNode(unref(LewFlex), {
|
|
19591
19574
|
y: "center",
|
|
19592
19575
|
class: "lew-upload-progress-box"
|
|
19593
19576
|
}, {
|
|
@@ -19605,7 +19588,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19605
19588
|
]),
|
|
19606
19589
|
_: 2
|
|
19607
19590
|
}, 1032, ["class"])) : createCommentVNode("", true),
|
|
19608
|
-
createVNode(
|
|
19591
|
+
createVNode(unref(LewFlex), {
|
|
19609
19592
|
mode: "between",
|
|
19610
19593
|
y: "center",
|
|
19611
19594
|
class: "lew-upload-footer"
|
|
@@ -19621,13 +19604,13 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19621
19604
|
], 64)) : createCommentVNode("", true),
|
|
19622
19605
|
item.size ? (openBlock(), createElementBlock("span", _hoisted_3$3, toDisplayString(unref(formatBytes)(item.size)), 1)) : createCommentVNode("", true)
|
|
19623
19606
|
], 4),
|
|
19624
|
-
createVNode(
|
|
19607
|
+
createVNode(unref(LewFlex), {
|
|
19625
19608
|
style: { "max-width": "200px" },
|
|
19626
19609
|
y: "center",
|
|
19627
19610
|
x: "end"
|
|
19628
19611
|
}, {
|
|
19629
19612
|
default: withCtx(() => [
|
|
19630
|
-
createVNode(
|
|
19613
|
+
createVNode(unref(_sfc_main$o), {
|
|
19631
19614
|
type: "light",
|
|
19632
19615
|
size: "small",
|
|
19633
19616
|
color: statusColorMap[item.status || "complete"]
|
|
@@ -19672,7 +19655,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
19672
19655
|
};
|
|
19673
19656
|
}
|
|
19674
19657
|
});
|
|
19675
|
-
const LewUpload = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-
|
|
19658
|
+
const LewUpload = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-6be88b57"]]);
|
|
19676
19659
|
const collapseModel = {
|
|
19677
19660
|
modelValue: {
|
|
19678
19661
|
type: [Array, String],
|
|
@@ -24063,937 +24046,936 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
24063
24046
|
treeSelectProps,
|
|
24064
24047
|
uploadProps
|
|
24065
24048
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
24066
|
-
const
|
|
24067
|
-
|
|
24068
|
-
|
|
24069
|
-
|
|
24070
|
-
|
|
24071
|
-
const
|
|
24072
|
-
|
|
24073
|
-
|
|
24074
|
-
|
|
24075
|
-
|
|
24076
|
-
|
|
24077
|
-
|
|
24078
|
-
|
|
24079
|
-
|
|
24080
|
-
|
|
24081
|
-
|
|
24082
|
-
|
|
24083
|
-
|
|
24084
|
-
|
|
24085
|
-
|
|
24086
|
-
|
|
24087
|
-
|
|
24088
|
-
|
|
24089
|
-
|
|
24090
|
-
|
|
24091
|
-
|
|
24092
|
-
|
|
24093
|
-
|
|
24094
|
-
|
|
24095
|
-
|
|
24096
|
-
|
|
24097
|
-
|
|
24098
|
-
|
|
24099
|
-
|
|
24100
|
-
|
|
24101
|
-
|
|
24102
|
-
|
|
24103
|
-
);
|
|
24104
|
-
|
|
24105
|
-
|
|
24106
|
-
|
|
24107
|
-
|
|
24108
|
-
|
|
24109
|
-
|
|
24049
|
+
const LewTooltip = {
|
|
24050
|
+
install(app) {
|
|
24051
|
+
app.directive("tooltip", {
|
|
24052
|
+
mounted(el, binding) {
|
|
24053
|
+
var _a;
|
|
24054
|
+
const { trigger, content, placement, allowHTML, delay } = binding.value;
|
|
24055
|
+
let _trigger = trigger;
|
|
24056
|
+
if (trigger === "hover") {
|
|
24057
|
+
_trigger = "mouseenter";
|
|
24058
|
+
}
|
|
24059
|
+
if (!trigger) {
|
|
24060
|
+
_trigger = "mouseenter";
|
|
24061
|
+
}
|
|
24062
|
+
el.instance = tippy(el, {
|
|
24063
|
+
theme: "light",
|
|
24064
|
+
trigger: _trigger,
|
|
24065
|
+
content,
|
|
24066
|
+
animation: "scale",
|
|
24067
|
+
interactive: true,
|
|
24068
|
+
appendTo: () => document.body,
|
|
24069
|
+
placement,
|
|
24070
|
+
allowHTML,
|
|
24071
|
+
arrow: ROUND_ARROW,
|
|
24072
|
+
maxWidth: 250,
|
|
24073
|
+
duration: [250, 250],
|
|
24074
|
+
delay: trigger === "mouseenter" ? delay || [80, 80] : void 0
|
|
24075
|
+
});
|
|
24076
|
+
el.instance.popper.children[0].setAttribute("data-lew", "tooltip");
|
|
24077
|
+
if (!((_a = binding == null ? void 0 : binding.value) == null ? void 0 : _a.content)) {
|
|
24078
|
+
el.instance.disable();
|
|
24079
|
+
}
|
|
24080
|
+
},
|
|
24081
|
+
updated(el, binding) {
|
|
24082
|
+
const { triggerFrom, content } = binding.value;
|
|
24083
|
+
if (!content) {
|
|
24084
|
+
el.instance.disable();
|
|
24085
|
+
} else {
|
|
24086
|
+
el.instance.enable();
|
|
24087
|
+
el.instance.setContent(content);
|
|
24088
|
+
}
|
|
24089
|
+
if (triggerFrom === "input-number") {
|
|
24090
|
+
if (content) {
|
|
24091
|
+
el.instance.show();
|
|
24092
|
+
} else {
|
|
24093
|
+
el.instance.hide();
|
|
24094
|
+
}
|
|
24095
|
+
}
|
|
24096
|
+
},
|
|
24097
|
+
unmounted(el) {
|
|
24098
|
+
el.instance.hide();
|
|
24099
|
+
el.instance = null;
|
|
24100
|
+
}
|
|
24110
24101
|
});
|
|
24111
|
-
}
|
|
24112
|
-
};
|
|
24113
|
-
const removeClass = (element, className) => {
|
|
24114
|
-
element.classList.remove(className);
|
|
24115
|
-
};
|
|
24116
|
-
const addClass = (element, className) => {
|
|
24117
|
-
element.classList.add(className);
|
|
24102
|
+
}
|
|
24118
24103
|
};
|
|
24119
|
-
const
|
|
24120
|
-
|
|
24121
|
-
|
|
24122
|
-
|
|
24123
|
-
|
|
24124
|
-
|
|
24125
|
-
} else {
|
|
24126
|
-
showMessage({ type, e: e2 });
|
|
24104
|
+
const createBackTopHandler = (target) => {
|
|
24105
|
+
const dom = shallowRef(document.documentElement);
|
|
24106
|
+
if (target) {
|
|
24107
|
+
const targetElement = document.querySelector(`.${target}`);
|
|
24108
|
+
if (!targetElement) {
|
|
24109
|
+
throw new Error(`目标元素不存在: ${target}`);
|
|
24127
24110
|
}
|
|
24128
|
-
|
|
24129
|
-
|
|
24130
|
-
|
|
24131
|
-
if (
|
|
24132
|
-
|
|
24133
|
-
addClass(messageElement, "lew-message-hidden");
|
|
24134
|
-
setTimeout(() => {
|
|
24135
|
-
clearTimeout(LewMessage$1.timer[id]);
|
|
24136
|
-
messageElement.remove();
|
|
24137
|
-
}, 350);
|
|
24111
|
+
dom.value = targetElement;
|
|
24112
|
+
}
|
|
24113
|
+
return () => {
|
|
24114
|
+
if (dom.value) {
|
|
24115
|
+
dom.value.scrollTo({ top: 0, behavior: "smooth" });
|
|
24138
24116
|
}
|
|
24139
|
-
}
|
|
24140
|
-
|
|
24141
|
-
|
|
24142
|
-
|
|
24143
|
-
|
|
24144
|
-
|
|
24145
|
-
|
|
24146
|
-
|
|
24147
|
-
|
|
24148
|
-
|
|
24149
|
-
|
|
24150
|
-
|
|
24151
|
-
|
|
24152
|
-
|
|
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
|
-
});
|
|
24117
|
+
};
|
|
24118
|
+
};
|
|
24119
|
+
const index$1 = {
|
|
24120
|
+
install(app) {
|
|
24121
|
+
app.directive("backtop", {
|
|
24122
|
+
mounted(el, binding) {
|
|
24123
|
+
const backTopHandler = createBackTopHandler(binding.value);
|
|
24124
|
+
el.addEventListener("click", backTopHandler);
|
|
24125
|
+
el._backTopHandler = backTopHandler;
|
|
24126
|
+
},
|
|
24127
|
+
unmounted(el) {
|
|
24128
|
+
if (el._backTopHandler) {
|
|
24129
|
+
el.removeEventListener("click", el._backTopHandler);
|
|
24130
|
+
delete el._backTopHandler;
|
|
24166
24131
|
}
|
|
24167
|
-
|
|
24168
|
-
|
|
24169
|
-
|
|
24170
|
-
|
|
24171
|
-
|
|
24172
|
-
|
|
24173
|
-
|
|
24174
|
-
|
|
24175
|
-
|
|
24176
|
-
|
|
24177
|
-
|
|
24132
|
+
}
|
|
24133
|
+
});
|
|
24134
|
+
}
|
|
24135
|
+
};
|
|
24136
|
+
const LewLoading = {
|
|
24137
|
+
install(app) {
|
|
24138
|
+
app.directive("loading", {
|
|
24139
|
+
mounted(el, binding) {
|
|
24140
|
+
const { tip, iconSize, visible } = binding.value;
|
|
24141
|
+
const loadingWrapper = document.createElement("div");
|
|
24142
|
+
const loadingBox = document.createElement("div");
|
|
24143
|
+
loadingWrapper.classList.add("lew-loading-wrapper");
|
|
24144
|
+
loadingBox.classList.add("lew-loading-box");
|
|
24145
|
+
el.classList.add("lew-loading");
|
|
24146
|
+
const loader = createApp(Icon, {
|
|
24147
|
+
type: "loader",
|
|
24148
|
+
spinning: true,
|
|
24149
|
+
size: iconSize || 24
|
|
24150
|
+
});
|
|
24151
|
+
loader.mount(loadingBox);
|
|
24152
|
+
loadingBox.setAttribute("data-after", tip || "");
|
|
24153
|
+
loadingWrapper.appendChild(loadingBox);
|
|
24154
|
+
el.appendChild(loadingWrapper);
|
|
24155
|
+
if (visible) {
|
|
24156
|
+
el.classList.add("lew-loading-show");
|
|
24178
24157
|
}
|
|
24179
|
-
|
|
24180
|
-
|
|
24181
|
-
|
|
24182
|
-
|
|
24183
|
-
|
|
24184
|
-
|
|
24185
|
-
|
|
24158
|
+
},
|
|
24159
|
+
updated(el, binding) {
|
|
24160
|
+
const { tip, visible } = binding.value;
|
|
24161
|
+
const loadingBox = el.querySelector(".lew-loading-box");
|
|
24162
|
+
loadingBox && loadingBox.setAttribute("data-after", tip || "");
|
|
24163
|
+
if (visible) {
|
|
24164
|
+
el.classList.add("lew-loading-show");
|
|
24165
|
+
} else {
|
|
24166
|
+
el.classList.remove("lew-loading-show");
|
|
24186
24167
|
}
|
|
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
24168
|
}
|
|
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
|
-
|
|
24169
|
+
});
|
|
24170
|
+
}
|
|
24171
|
+
};
|
|
24172
|
+
const initLewContextMenu = () => {
|
|
24173
|
+
window.LewContextMenu = {
|
|
24174
|
+
menu: {},
|
|
24175
|
+
contextMenu: null,
|
|
24176
|
+
instance: tippy(document.body, {
|
|
24177
|
+
theme: "light",
|
|
24178
|
+
animation: "shift-away-subtle",
|
|
24179
|
+
trigger: "manual",
|
|
24180
|
+
interactive: true,
|
|
24181
|
+
placement: "right-start",
|
|
24182
|
+
duration: [250, 250],
|
|
24183
|
+
delay: [250, 250],
|
|
24184
|
+
arrow: false,
|
|
24185
|
+
appendTo: () => document.body,
|
|
24186
|
+
allowHTML: true
|
|
24187
|
+
}),
|
|
24188
|
+
menuInstance: {}
|
|
24189
|
+
};
|
|
24190
|
+
window.LewContextMenu.instance.popper.children[0].setAttribute(
|
|
24191
|
+
"data-lew",
|
|
24192
|
+
"popover"
|
|
24193
|
+
);
|
|
24194
|
+
};
|
|
24195
|
+
const findContextMenuId = (el) => {
|
|
24196
|
+
try {
|
|
24197
|
+
const id = el.getAttribute("lew-context-menu-id");
|
|
24198
|
+
if (id) return id;
|
|
24199
|
+
return el.parentNode ? findContextMenuId(el.parentNode) : "";
|
|
24200
|
+
} catch {
|
|
24201
|
+
return "";
|
|
24202
|
+
}
|
|
24203
|
+
};
|
|
24204
|
+
const LewVContextMenu = {
|
|
24205
|
+
install(app) {
|
|
24206
|
+
app.directive("context-menu", {
|
|
24207
|
+
mounted(el, binding) {
|
|
24208
|
+
if (!window.LewContextMenu) {
|
|
24209
|
+
initLewContextMenu();
|
|
24210
|
+
}
|
|
24211
|
+
if (!el.id) {
|
|
24212
|
+
const id = getUniqueId();
|
|
24213
|
+
el.setAttribute("lew-context-menu-id", id);
|
|
24214
|
+
const { options } = binding.value;
|
|
24215
|
+
window.LewContextMenu.menu[id] = options || [];
|
|
24216
|
+
}
|
|
24217
|
+
if (!window.LewContextMenu.contextMenu) {
|
|
24218
|
+
window.LewContextMenu.contextMenu = (e2) => {
|
|
24219
|
+
const id = findContextMenuId(e2.target);
|
|
24220
|
+
if (!id) return;
|
|
24221
|
+
e2.preventDefault();
|
|
24222
|
+
const options = window.LewContextMenu.menu[id];
|
|
24223
|
+
const { instance } = window.LewContextMenu;
|
|
24224
|
+
instance.hide();
|
|
24225
|
+
const menuDom = document.createElement("div");
|
|
24226
|
+
Object.keys(window.LewContextMenu.menuInstance).forEach(
|
|
24227
|
+
(key) => {
|
|
24228
|
+
window.LewContextMenu.menuInstance[key].destroy();
|
|
24229
|
+
delete window.LewContextMenu.menuInstance[key];
|
|
24230
|
+
}
|
|
24231
|
+
);
|
|
24232
|
+
createApp({
|
|
24233
|
+
render() {
|
|
24234
|
+
return h$1(LewContextMenu, {
|
|
24235
|
+
options,
|
|
24236
|
+
onSelect: (item) => {
|
|
24237
|
+
const { selectHandler } = binding.value;
|
|
24238
|
+
if (isFunction(selectHandler)) {
|
|
24239
|
+
selectHandler(item);
|
|
24240
|
+
}
|
|
24241
|
+
if (!(item.children || []).length) {
|
|
24242
|
+
instance.hide();
|
|
24243
|
+
}
|
|
24244
|
+
}
|
|
24245
|
+
});
|
|
24246
|
+
}
|
|
24247
|
+
}).mount(menuDom);
|
|
24248
|
+
setTimeout(() => {
|
|
24249
|
+
instance.setProps({
|
|
24250
|
+
content: menuDom,
|
|
24251
|
+
getReferenceClientRect: () => ({
|
|
24252
|
+
width: 0,
|
|
24253
|
+
height: 0,
|
|
24254
|
+
top: e2.clientY,
|
|
24255
|
+
bottom: e2.clientY,
|
|
24256
|
+
left: e2.clientX,
|
|
24257
|
+
right: e2.clientX
|
|
24258
|
+
})
|
|
24259
|
+
});
|
|
24260
|
+
instance.show();
|
|
24261
|
+
}, 120);
|
|
24262
|
+
};
|
|
24263
|
+
window.addEventListener(
|
|
24264
|
+
"contextmenu",
|
|
24265
|
+
window.LewContextMenu.contextMenu
|
|
24266
|
+
);
|
|
24267
|
+
}
|
|
24268
|
+
},
|
|
24269
|
+
updated(el, binding) {
|
|
24270
|
+
const id = findContextMenuId(el);
|
|
24271
|
+
if (id) {
|
|
24272
|
+
const { options } = binding.value;
|
|
24273
|
+
window.LewContextMenu.menu[id] = options || [];
|
|
24274
|
+
} else {
|
|
24275
|
+
console.error("发生未知错误!找不到 lew-context-menu-id。");
|
|
24276
|
+
}
|
|
24251
24277
|
}
|
|
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: "对话框变换原点(内部使用,无需手动设置)"
|
|
24278
|
+
});
|
|
24269
24279
|
}
|
|
24270
24280
|
};
|
|
24271
|
-
const
|
|
24272
|
-
|
|
24273
|
-
|
|
24281
|
+
const contextMenuProps = {
|
|
24282
|
+
options: {
|
|
24283
|
+
type: Array,
|
|
24284
|
+
default: () => [],
|
|
24285
|
+
description: "右键菜单配置"
|
|
24286
|
+
}
|
|
24274
24287
|
};
|
|
24275
|
-
const
|
|
24276
|
-
const
|
|
24277
|
-
const
|
|
24288
|
+
const _hoisted_1$1 = ["onClick"];
|
|
24289
|
+
const _hoisted_2$1 = { class: "lew-context-menu-label" };
|
|
24290
|
+
const _hoisted_3$1 = ["title"];
|
|
24278
24291
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
24279
|
-
__name: "
|
|
24280
|
-
props:
|
|
24281
|
-
emits: ["
|
|
24292
|
+
__name: "LewContextMenu",
|
|
24293
|
+
props: contextMenuProps,
|
|
24294
|
+
emits: ["select"],
|
|
24282
24295
|
setup(__props, { emit: __emit }) {
|
|
24283
|
-
const { Escape } = useMagicKeys();
|
|
24284
|
-
useDOMCreate("lew-dialog");
|
|
24285
24296
|
const props = __props;
|
|
24286
24297
|
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
|
-
}
|
|
24296
|
-
};
|
|
24297
|
-
onMounted(() => {
|
|
24298
|
-
visible.value = true;
|
|
24299
|
-
nextTick(() => {
|
|
24300
|
-
if (okRef1.value) okRef1.value.focus();
|
|
24301
|
-
if (okRef2.value) okRef2.value.focus();
|
|
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;
|
|
24317
|
-
}
|
|
24318
|
-
loadingRef.value = false;
|
|
24319
|
-
}
|
|
24298
|
+
const clickItem = (item) => {
|
|
24299
|
+
emit("select", item);
|
|
24320
24300
|
};
|
|
24321
|
-
|
|
24322
|
-
const
|
|
24323
|
-
|
|
24324
|
-
|
|
24325
|
-
if (
|
|
24326
|
-
|
|
24301
|
+
let itemRefs = ref([]);
|
|
24302
|
+
const initTippy = () => {
|
|
24303
|
+
itemRefs.value.forEach((el, index2) => {
|
|
24304
|
+
const item = props.options[index2];
|
|
24305
|
+
if (!el || item.disabled || (item.children || []).length === 0) {
|
|
24306
|
+
return;
|
|
24327
24307
|
}
|
|
24328
|
-
|
|
24329
|
-
|
|
24330
|
-
|
|
24331
|
-
|
|
24332
|
-
|
|
24333
|
-
|
|
24334
|
-
|
|
24335
|
-
|
|
24336
|
-
|
|
24337
|
-
|
|
24338
|
-
|
|
24339
|
-
|
|
24340
|
-
|
|
24341
|
-
|
|
24342
|
-
|
|
24343
|
-
|
|
24344
|
-
|
|
24345
|
-
|
|
24346
|
-
|
|
24347
|
-
|
|
24348
|
-
|
|
24349
|
-
|
|
24308
|
+
const menuDom = document.createElement("div");
|
|
24309
|
+
createApp({
|
|
24310
|
+
render() {
|
|
24311
|
+
return h$1(LewContextMenu, {
|
|
24312
|
+
options: item.children,
|
|
24313
|
+
onSelect: (item2) => {
|
|
24314
|
+
emit("select", item2);
|
|
24315
|
+
}
|
|
24316
|
+
});
|
|
24317
|
+
}
|
|
24318
|
+
}).mount(menuDom);
|
|
24319
|
+
const uniqueId2 = getUniqueId();
|
|
24320
|
+
if (!window.LewContextMenu) {
|
|
24321
|
+
initLewContextMenu();
|
|
24322
|
+
}
|
|
24323
|
+
window.LewContextMenu.menuInstance[uniqueId2] = tippy(el, {
|
|
24324
|
+
theme: "light",
|
|
24325
|
+
animation: "shift-away-subtle",
|
|
24326
|
+
trigger: "mouseenter",
|
|
24327
|
+
interactive: true,
|
|
24328
|
+
placement: "right-start",
|
|
24329
|
+
duration: [250, 250],
|
|
24330
|
+
delay: [250, 250],
|
|
24331
|
+
arrow: false,
|
|
24332
|
+
offset: [0, 0],
|
|
24333
|
+
allowHTML: true,
|
|
24334
|
+
hideOnClick: false,
|
|
24335
|
+
zIndex: 9999,
|
|
24336
|
+
content: menuDom
|
|
24337
|
+
});
|
|
24338
|
+
window.LewContextMenu.menuInstance[uniqueId2].popper.children[0].setAttribute("data-lew", "popover");
|
|
24339
|
+
});
|
|
24340
|
+
};
|
|
24341
|
+
const renderIcon = ({ renderIcon: renderIcon2 }) => {
|
|
24342
|
+
if (renderIcon2) return renderIcon2();
|
|
24343
|
+
return "";
|
|
24344
|
+
};
|
|
24345
|
+
onMounted(() => {
|
|
24346
|
+
initTippy();
|
|
24347
|
+
});
|
|
24348
|
+
return (_ctx, _cache) => {
|
|
24349
|
+
return openBlock(), createBlock(unref(LewFlex), {
|
|
24350
|
+
direction: "y",
|
|
24351
|
+
gap: "0",
|
|
24352
|
+
class: "lew-context-menu"
|
|
24353
|
+
}, {
|
|
24354
|
+
default: withCtx(() => [
|
|
24355
|
+
(_ctx.options || []).length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.options, (item, index2) => {
|
|
24356
|
+
return openBlock(), createElementBlock("div", {
|
|
24357
|
+
key: index2,
|
|
24358
|
+
class: normalizeClass(["lew-context-menu-box", {
|
|
24359
|
+
"lew-context-menu-box-disabled": item.disabled,
|
|
24360
|
+
"lew-context-menu-box-divider-line": item.isDividerLine
|
|
24361
|
+
}])
|
|
24362
|
+
}, [
|
|
24363
|
+
createElementVNode("div", {
|
|
24364
|
+
ref_for: true,
|
|
24365
|
+
ref: (el) => unref(itemRefs).push(el),
|
|
24366
|
+
onClick: ($event) => clickItem(item),
|
|
24367
|
+
class: "lew-context-menu-item",
|
|
24368
|
+
style: normalizeStyle({ "animation-delay": index2 * 15 + "ms" })
|
|
24350
24369
|
}, [
|
|
24351
|
-
|
|
24370
|
+
createElementVNode("div", _hoisted_2$1, [
|
|
24371
|
+
item.renderIcon ? (openBlock(), createBlock(renderIcon, {
|
|
24372
|
+
key: 0,
|
|
24373
|
+
renderIcon: item.renderIcon
|
|
24374
|
+
}, null, 8, ["renderIcon"])) : createCommentVNode("", true),
|
|
24375
|
+
createElementVNode("div", {
|
|
24376
|
+
title: item.label,
|
|
24377
|
+
class: "lew-context-menu-label-text"
|
|
24378
|
+
}, toDisplayString(item.label), 9, _hoisted_3$1)
|
|
24379
|
+
]),
|
|
24380
|
+
(item.children || []).length > 0 ? (openBlock(), createBlock(Icon, {
|
|
24352
24381
|
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
|
-
]);
|
|
24382
|
+
size: 14,
|
|
24383
|
+
type: "chevron-right"
|
|
24384
|
+
})) : createCommentVNode("", true)
|
|
24385
|
+
], 12, _hoisted_1$1)
|
|
24386
|
+
], 2);
|
|
24387
|
+
}), 128)) : (openBlock(), createBlock(unref(_sfc_main$d), {
|
|
24388
|
+
key: 1,
|
|
24389
|
+
width: "120px",
|
|
24390
|
+
padding: "5px",
|
|
24391
|
+
"font-size": "12px",
|
|
24392
|
+
type: "search",
|
|
24393
|
+
title: "暂无操作"
|
|
24394
|
+
}))
|
|
24395
|
+
]),
|
|
24396
|
+
_: 1
|
|
24397
|
+
});
|
|
24456
24398
|
};
|
|
24457
24399
|
}
|
|
24458
24400
|
});
|
|
24459
|
-
const
|
|
24460
|
-
const
|
|
24461
|
-
|
|
24462
|
-
|
|
24463
|
-
|
|
24464
|
-
|
|
24465
|
-
|
|
24466
|
-
|
|
24467
|
-
|
|
24401
|
+
const LewContextMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-e1377a5c"]]);
|
|
24402
|
+
const directives = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
24403
|
+
__proto__: null,
|
|
24404
|
+
LewBacktop: index$1,
|
|
24405
|
+
LewContextMenu,
|
|
24406
|
+
LewLoading,
|
|
24407
|
+
LewTooltip,
|
|
24408
|
+
LewVContextMenu,
|
|
24409
|
+
contextMenuProps,
|
|
24410
|
+
initLewContextMenu
|
|
24411
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
24412
|
+
const createMessageList$1 = () => {
|
|
24413
|
+
const messageContainer = document.createElement("div");
|
|
24414
|
+
messageContainer.setAttribute("id", "lew-message");
|
|
24415
|
+
document.body.appendChild(messageContainer);
|
|
24468
24416
|
};
|
|
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
|
-
|
|
24417
|
+
const showMessage = ({ type, e: e2 }) => {
|
|
24418
|
+
const { id, content, duration } = e2;
|
|
24419
|
+
const messageContainer = document.getElementById("lew-message");
|
|
24420
|
+
const hasMessageById = id ? document.getElementById(`lew-message-id-${id}`) : false;
|
|
24421
|
+
const messageElement = hasMessageById || document.createElement("div");
|
|
24422
|
+
messageElement.innerHTML = `${getIconInnerHTML({ type, strokeWidth: type === "loading" ? 2.5 : void 0, spinning: type === "loading" })}<div class="lew-message-content">${content || e2}</div>`;
|
|
24423
|
+
if (!hasMessageById) {
|
|
24424
|
+
if (id) {
|
|
24425
|
+
messageElement.setAttribute("id", `lew-message-id-${id}`);
|
|
24426
|
+
}
|
|
24427
|
+
messageContainer == null ? void 0 : messageContainer.appendChild(
|
|
24428
|
+
messageElement,
|
|
24429
|
+
messageContainer == null ? void 0 : messageContainer.childNodes[0]
|
|
24430
|
+
);
|
|
24431
|
+
} else {
|
|
24432
|
+
clearTimeout(LewMessage$1.timer[id]);
|
|
24433
|
+
}
|
|
24434
|
+
messageElement.setAttribute(
|
|
24435
|
+
"class",
|
|
24436
|
+
`lew-message lew-message-${type} lew-message-id-${id}`
|
|
24437
|
+
);
|
|
24438
|
+
setTimeout(() => {
|
|
24439
|
+
nextTick(() => {
|
|
24440
|
+
messageElement.setAttribute(
|
|
24441
|
+
"class",
|
|
24442
|
+
`lew-message lew-message-${type} lew-message-show`
|
|
24443
|
+
);
|
|
24444
|
+
LewMessage$1.timer[id] = setTimeout(
|
|
24445
|
+
() => {
|
|
24446
|
+
messageElement.setAttribute(
|
|
24447
|
+
"class",
|
|
24448
|
+
`lew-message lew-message-${type} lew-message-hidden`
|
|
24449
|
+
);
|
|
24450
|
+
setTimeout(() => {
|
|
24451
|
+
if (messageElement) messageContainer == null ? void 0 : messageContainer.removeChild(messageElement);
|
|
24452
|
+
}, 250);
|
|
24502
24453
|
},
|
|
24503
|
-
|
|
24504
|
-
title: () => title,
|
|
24505
|
-
content: () => content
|
|
24506
|
-
}
|
|
24454
|
+
duration === 0 ? 31536e6 : duration || 3e3
|
|
24507
24455
|
);
|
|
24508
|
-
}
|
|
24509
|
-
});
|
|
24510
|
-
app.mount(div2);
|
|
24456
|
+
});
|
|
24457
|
+
}, 10);
|
|
24511
24458
|
};
|
|
24512
|
-
const
|
|
24513
|
-
|
|
24514
|
-
...dialogTypes
|
|
24459
|
+
const removeClass = (element, className) => {
|
|
24460
|
+
element.classList.remove(className);
|
|
24515
24461
|
};
|
|
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
|
-
|
|
24462
|
+
const addClass = (element, className) => {
|
|
24463
|
+
element.classList.add(className);
|
|
24464
|
+
};
|
|
24465
|
+
const LewMessage$1 = {
|
|
24466
|
+
name: "LewMessage",
|
|
24467
|
+
message: ({ type, e: e2 }) => {
|
|
24468
|
+
if (!document.getElementById("lew-message")) {
|
|
24469
|
+
createMessageList$1();
|
|
24470
|
+
LewMessage$1.message({ type, e: e2 });
|
|
24471
|
+
} else {
|
|
24472
|
+
showMessage({ type, e: e2 });
|
|
24473
|
+
}
|
|
24474
|
+
},
|
|
24475
|
+
close: ({ id }) => {
|
|
24476
|
+
const messageElement = document.getElementById(`lew-message-id-${id}`);
|
|
24477
|
+
if (messageElement) {
|
|
24478
|
+
removeClass(messageElement, "lew-message-show");
|
|
24479
|
+
addClass(messageElement, "lew-message-hidden");
|
|
24480
|
+
setTimeout(() => {
|
|
24481
|
+
clearTimeout(LewMessage$1.timer[id]);
|
|
24482
|
+
messageElement.remove();
|
|
24483
|
+
}, 350);
|
|
24484
|
+
}
|
|
24485
|
+
},
|
|
24486
|
+
request: async ({ loadingMessage }, asyncFn) => {
|
|
24487
|
+
try {
|
|
24488
|
+
LewMessage$1.loading({
|
|
24489
|
+
id: "lew-request-loading",
|
|
24490
|
+
content: loadingMessage,
|
|
24491
|
+
duration: 0
|
|
24492
|
+
});
|
|
24493
|
+
const startTime = (/* @__PURE__ */ new Date()).getTime();
|
|
24494
|
+
asyncFn().then(
|
|
24495
|
+
async ({
|
|
24496
|
+
content = "请求成功!",
|
|
24497
|
+
duration = 3e3,
|
|
24498
|
+
type = "success"
|
|
24499
|
+
}) => {
|
|
24500
|
+
const endTime = (/* @__PURE__ */ new Date()).getTime();
|
|
24501
|
+
const delay = 250;
|
|
24502
|
+
if (endTime - startTime < delay) {
|
|
24503
|
+
await new Promise(
|
|
24504
|
+
(resolve) => setTimeout(resolve, delay - (endTime - startTime))
|
|
24505
|
+
);
|
|
24506
|
+
}
|
|
24507
|
+
LewMessage$1.close({ id: "lew-request-loading" });
|
|
24508
|
+
LewMessage$1[type]({
|
|
24509
|
+
content,
|
|
24510
|
+
duration
|
|
24511
|
+
});
|
|
24546
24512
|
}
|
|
24547
|
-
|
|
24548
|
-
|
|
24549
|
-
|
|
24550
|
-
|
|
24551
|
-
|
|
24552
|
-
|
|
24553
|
-
|
|
24554
|
-
|
|
24513
|
+
).catch(
|
|
24514
|
+
({
|
|
24515
|
+
content = "加载失败!",
|
|
24516
|
+
duration = 3e3
|
|
24517
|
+
}) => {
|
|
24518
|
+
LewMessage$1.close({ id: "lew-request-loading" });
|
|
24519
|
+
LewMessage$1.error({
|
|
24520
|
+
id: "lew-request-fail",
|
|
24521
|
+
content,
|
|
24522
|
+
duration
|
|
24523
|
+
});
|
|
24555
24524
|
}
|
|
24556
|
-
|
|
24557
|
-
|
|
24558
|
-
|
|
24559
|
-
|
|
24560
|
-
|
|
24561
|
-
|
|
24525
|
+
);
|
|
24526
|
+
} catch (error2) {
|
|
24527
|
+
LewMessage$1.error({
|
|
24528
|
+
id: "lew-request-loading",
|
|
24529
|
+
content: "An error occurred",
|
|
24530
|
+
duration: 3e3,
|
|
24531
|
+
onClose: () => {
|
|
24562
24532
|
}
|
|
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" });
|
|
24533
|
+
});
|
|
24583
24534
|
}
|
|
24584
|
-
}
|
|
24535
|
+
},
|
|
24536
|
+
timer: {}
|
|
24585
24537
|
};
|
|
24586
|
-
|
|
24587
|
-
|
|
24588
|
-
|
|
24589
|
-
|
|
24590
|
-
|
|
24591
|
-
|
|
24592
|
-
|
|
24593
|
-
|
|
24594
|
-
|
|
24595
|
-
|
|
24596
|
-
|
|
24597
|
-
|
|
24598
|
-
|
|
24538
|
+
LewMessage$1.warning = (e2) => LewMessage$1.message({ type: "warning", e: e2 });
|
|
24539
|
+
LewMessage$1.error = (e2) => LewMessage$1.message({ type: "error", e: e2 });
|
|
24540
|
+
LewMessage$1.info = (e2) => LewMessage$1.message({ type: "info", e: e2 });
|
|
24541
|
+
LewMessage$1.normal = (e2) => LewMessage$1.message({ type: "normal", e: e2 });
|
|
24542
|
+
LewMessage$1.success = (e2) => LewMessage$1.message({ type: "success", e: e2 });
|
|
24543
|
+
LewMessage$1.loading = (e2) => LewMessage$1.message({ type: "loading", e: e2 });
|
|
24544
|
+
const dialogProps = {
|
|
24545
|
+
type: {
|
|
24546
|
+
type: String,
|
|
24547
|
+
default: "error",
|
|
24548
|
+
description: "对话框类型",
|
|
24549
|
+
validator: (value) => {
|
|
24550
|
+
const validTypes = [
|
|
24551
|
+
"primary",
|
|
24552
|
+
"success",
|
|
24553
|
+
"warning",
|
|
24554
|
+
"error",
|
|
24555
|
+
"info"
|
|
24556
|
+
];
|
|
24557
|
+
if (!validTypes.includes(value)) {
|
|
24558
|
+
console.warn(
|
|
24559
|
+
`[LewDialog] 无效的类型: ${value}。请使用 ${validTypes.join(", ")} 中的一个。`
|
|
24560
|
+
);
|
|
24561
|
+
return false;
|
|
24599
24562
|
}
|
|
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;
|
|
24563
|
+
return true;
|
|
24665
24564
|
}
|
|
24666
|
-
|
|
24667
|
-
|
|
24668
|
-
|
|
24669
|
-
|
|
24670
|
-
|
|
24671
|
-
|
|
24672
|
-
|
|
24673
|
-
|
|
24674
|
-
|
|
24675
|
-
|
|
24565
|
+
},
|
|
24566
|
+
okText: {
|
|
24567
|
+
type: String,
|
|
24568
|
+
default: "确定",
|
|
24569
|
+
description: "确认按钮文本"
|
|
24570
|
+
},
|
|
24571
|
+
cancelText: {
|
|
24572
|
+
type: String,
|
|
24573
|
+
default: "取消",
|
|
24574
|
+
description: "取消按钮文本"
|
|
24575
|
+
},
|
|
24576
|
+
ok: {
|
|
24577
|
+
type: Function,
|
|
24578
|
+
default: () => true,
|
|
24579
|
+
description: "点击确认按钮时的回调函数"
|
|
24580
|
+
},
|
|
24581
|
+
cancel: {
|
|
24582
|
+
type: Function,
|
|
24583
|
+
default: () => true,
|
|
24584
|
+
description: "点击取消按钮时的回调函数"
|
|
24585
|
+
},
|
|
24586
|
+
layout: {
|
|
24587
|
+
type: String,
|
|
24588
|
+
default: "normal",
|
|
24589
|
+
description: "对话框布局方式",
|
|
24590
|
+
validator: (value) => {
|
|
24591
|
+
const validLayouts = ["normal", "mini"];
|
|
24592
|
+
if (!validLayouts.includes(value)) {
|
|
24593
|
+
console.warn(
|
|
24594
|
+
`[LewDialog] 无效的布局: ${value}。请使用 ${validLayouts.join(", ")} 中的一个。`
|
|
24595
|
+
);
|
|
24596
|
+
return false;
|
|
24676
24597
|
}
|
|
24598
|
+
return true;
|
|
24677
24599
|
}
|
|
24600
|
+
},
|
|
24601
|
+
closeOnClickOverlay: {
|
|
24602
|
+
type: Boolean,
|
|
24603
|
+
default: false,
|
|
24604
|
+
description: "是否在点击遮罩层时关闭对话框"
|
|
24605
|
+
},
|
|
24606
|
+
closeByEsc: {
|
|
24607
|
+
type: Boolean,
|
|
24608
|
+
default: false,
|
|
24609
|
+
description: "是否允许通过按下 ESC 键关闭对话框"
|
|
24610
|
+
},
|
|
24611
|
+
transformOrigin: {
|
|
24612
|
+
type: String,
|
|
24613
|
+
default: "0 0",
|
|
24614
|
+
description: "对话框变换原点(内部使用,无需手动设置)"
|
|
24678
24615
|
}
|
|
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
24616
|
};
|
|
24691
|
-
const
|
|
24692
|
-
|
|
24693
|
-
|
|
24694
|
-
info,
|
|
24695
|
-
normal,
|
|
24696
|
-
success,
|
|
24697
|
-
error
|
|
24617
|
+
const _hoisted_1 = {
|
|
24618
|
+
key: 0,
|
|
24619
|
+
class: "lew-dialog-mask"
|
|
24698
24620
|
};
|
|
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
|
-
}
|
|
24621
|
+
const _hoisted_2 = { class: "left" };
|
|
24622
|
+
const _hoisted_3 = { class: "right" };
|
|
24623
|
+
const _hoisted_4 = { class: "left" };
|
|
24624
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
24625
|
+
__name: "LewDialog",
|
|
24626
|
+
props: dialogProps,
|
|
24627
|
+
emits: ["close"],
|
|
24628
|
+
setup(__props, { emit: __emit }) {
|
|
24629
|
+
const { Escape } = useMagicKeys();
|
|
24630
|
+
useDOMCreate("lew-dialog");
|
|
24631
|
+
const props = __props;
|
|
24632
|
+
const emit = __emit;
|
|
24633
|
+
const visible = ref(false);
|
|
24634
|
+
const okLoading = ref(false);
|
|
24635
|
+
const cancelLoading = ref(false);
|
|
24636
|
+
const okRef1 = ref();
|
|
24637
|
+
const okRef2 = ref();
|
|
24638
|
+
const maskClick = () => {
|
|
24639
|
+
if (props.closeOnClickOverlay) {
|
|
24640
|
+
visible.value = false;
|
|
24731
24641
|
}
|
|
24642
|
+
};
|
|
24643
|
+
onMounted(() => {
|
|
24644
|
+
visible.value = true;
|
|
24645
|
+
nextTick(() => {
|
|
24646
|
+
if (okRef1.value) okRef1.value.focus();
|
|
24647
|
+
if (okRef2.value) okRef2.value.focus();
|
|
24648
|
+
});
|
|
24732
24649
|
});
|
|
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 || [];
|
|
24650
|
+
watch(visible, (newVal) => {
|
|
24651
|
+
if (!newVal) {
|
|
24652
|
+
setTimeout(() => emit("close"), 500);
|
|
24653
|
+
}
|
|
24654
|
+
});
|
|
24655
|
+
const handleAction = async (action) => {
|
|
24656
|
+
const actionFunction = props[action];
|
|
24657
|
+
const loadingRef = action === "ok" ? okLoading : cancelLoading;
|
|
24658
|
+
if (typeof actionFunction === "function") {
|
|
24659
|
+
loadingRef.value = true;
|
|
24660
|
+
const result = await actionFunction();
|
|
24661
|
+
if (result !== false) {
|
|
24662
|
+
visible.value = false;
|
|
24779
24663
|
}
|
|
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
|
-
);
|
|
24664
|
+
loadingRef.value = false;
|
|
24665
|
+
}
|
|
24666
|
+
};
|
|
24667
|
+
const ok = () => handleAction("ok");
|
|
24668
|
+
const cancel = () => handleAction("cancel");
|
|
24669
|
+
if (props.closeByEsc) {
|
|
24670
|
+
watch(Escape, (v2) => {
|
|
24671
|
+
if (v2 && visible.value) {
|
|
24672
|
+
visible.value = false;
|
|
24830
24673
|
}
|
|
24831
|
-
}
|
|
24832
|
-
|
|
24833
|
-
|
|
24834
|
-
|
|
24835
|
-
|
|
24836
|
-
|
|
24837
|
-
|
|
24838
|
-
|
|
24674
|
+
});
|
|
24675
|
+
}
|
|
24676
|
+
return (_ctx, _cache) => {
|
|
24677
|
+
return openBlock(), createBlock(Teleport, { to: "#lew-dialog" }, [
|
|
24678
|
+
createElementVNode("div", {
|
|
24679
|
+
class: "lew-dialog-container",
|
|
24680
|
+
style: normalizeStyle({
|
|
24681
|
+
"--lew-dialog-transform-origin": _ctx.transformOrigin
|
|
24682
|
+
})
|
|
24683
|
+
}, [
|
|
24684
|
+
createVNode(Transition, { name: "lew-dialog-mask" }, {
|
|
24685
|
+
default: withCtx(() => [
|
|
24686
|
+
visible.value ? (openBlock(), createElementBlock("div", _hoisted_1)) : createCommentVNode("", true)
|
|
24687
|
+
]),
|
|
24688
|
+
_: 1
|
|
24689
|
+
}),
|
|
24690
|
+
createVNode(Transition, { name: "lew-dialog" }, {
|
|
24691
|
+
default: withCtx(() => [
|
|
24692
|
+
visible.value ? (openBlock(), createElementBlock("div", {
|
|
24693
|
+
key: 0,
|
|
24694
|
+
class: "lew-dialog",
|
|
24695
|
+
onClick: maskClick
|
|
24696
|
+
}, [
|
|
24697
|
+
_ctx.layout === "normal" ? (openBlock(), createBlock(unref(LewFlex), {
|
|
24698
|
+
key: 0,
|
|
24699
|
+
direction: "y",
|
|
24700
|
+
gap: "20",
|
|
24701
|
+
class: "lew-dialog-box lew-dialog-box-normal",
|
|
24702
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
24703
|
+
}, ["stop"]))
|
|
24704
|
+
}, {
|
|
24705
|
+
default: withCtx(() => [
|
|
24706
|
+
createVNode(unref(LewFlex), { y: "start" }, {
|
|
24707
|
+
default: withCtx(() => [
|
|
24708
|
+
createElementVNode("div", _hoisted_2, [
|
|
24709
|
+
createVNode(Icon, {
|
|
24710
|
+
type: _ctx.type,
|
|
24711
|
+
size: 30
|
|
24712
|
+
}, null, 8, ["type"])
|
|
24713
|
+
]),
|
|
24714
|
+
createElementVNode("div", _hoisted_3, [
|
|
24715
|
+
createElementVNode("header", null, [
|
|
24716
|
+
renderSlot(_ctx.$slots, "title", {}, void 0, true)
|
|
24717
|
+
]),
|
|
24718
|
+
createElementVNode("main", null, [
|
|
24719
|
+
renderSlot(_ctx.$slots, "content", {}, void 0, true)
|
|
24720
|
+
])
|
|
24721
|
+
])
|
|
24722
|
+
]),
|
|
24723
|
+
_: 3
|
|
24724
|
+
}),
|
|
24725
|
+
createElementVNode("footer", null, [
|
|
24726
|
+
_ctx.cancelText ? (openBlock(), createBlock(unref(LewButton), {
|
|
24727
|
+
key: 0,
|
|
24728
|
+
text: _ctx.cancelText,
|
|
24729
|
+
color: "gray",
|
|
24730
|
+
type: "text",
|
|
24731
|
+
loading: cancelLoading.value,
|
|
24732
|
+
onClick: withModifiers(cancel, ["stop"])
|
|
24733
|
+
}, null, 8, ["text", "loading"])) : createCommentVNode("", true),
|
|
24734
|
+
_ctx.okText ? (openBlock(), createBlock(unref(LewButton), {
|
|
24735
|
+
key: 1,
|
|
24736
|
+
ref_key: "okRef1",
|
|
24737
|
+
ref: okRef1,
|
|
24738
|
+
text: _ctx.okText,
|
|
24739
|
+
type: "fill",
|
|
24740
|
+
color: _ctx.type,
|
|
24741
|
+
loading: okLoading.value,
|
|
24742
|
+
onClick: withModifiers(ok, ["stop"])
|
|
24743
|
+
}, null, 8, ["text", "color", "loading"])) : createCommentVNode("", true)
|
|
24744
|
+
])
|
|
24745
|
+
]),
|
|
24746
|
+
_: 3
|
|
24747
|
+
})) : createCommentVNode("", true),
|
|
24748
|
+
_ctx.layout === "mini" ? (openBlock(), createElementBlock("div", {
|
|
24749
|
+
key: 1,
|
|
24750
|
+
class: "lew-dialog-box lew-dialog-box-mini",
|
|
24751
|
+
onClick: _cache[1] || (_cache[1] = withModifiers(() => {
|
|
24752
|
+
}, ["stop"]))
|
|
24753
|
+
}, [
|
|
24754
|
+
createElementVNode("div", _hoisted_4, [
|
|
24755
|
+
createVNode(Icon, {
|
|
24756
|
+
size: 24,
|
|
24757
|
+
type: _ctx.type
|
|
24758
|
+
}, null, 8, ["type"])
|
|
24759
|
+
]),
|
|
24760
|
+
createVNode(unref(LewFlex), { class: "right" }, {
|
|
24761
|
+
default: withCtx(() => [
|
|
24762
|
+
createElementVNode("main", null, [
|
|
24763
|
+
renderSlot(_ctx.$slots, "content", {}, void 0, true)
|
|
24764
|
+
]),
|
|
24765
|
+
createVNode(unref(LewFlex), { x: "end" }, {
|
|
24766
|
+
default: withCtx(() => [
|
|
24767
|
+
_ctx.cancelText ? (openBlock(), createBlock(unref(LewButton), {
|
|
24768
|
+
key: 0,
|
|
24769
|
+
text: _ctx.cancelText,
|
|
24770
|
+
type: "text",
|
|
24771
|
+
size: "small",
|
|
24772
|
+
color: "gray",
|
|
24773
|
+
round: "",
|
|
24774
|
+
loading: cancelLoading.value,
|
|
24775
|
+
onClick: withModifiers(cancel, ["stop"])
|
|
24776
|
+
}, null, 8, ["text", "loading"])) : createCommentVNode("", true),
|
|
24777
|
+
_ctx.okText ? (openBlock(), createBlock(unref(LewButton), {
|
|
24778
|
+
key: 1,
|
|
24779
|
+
ref_key: "okRef2",
|
|
24780
|
+
ref: okRef2,
|
|
24781
|
+
text: _ctx.okText,
|
|
24782
|
+
type: "fill",
|
|
24783
|
+
size: "small",
|
|
24784
|
+
round: "",
|
|
24785
|
+
color: _ctx.type,
|
|
24786
|
+
loading: okLoading.value,
|
|
24787
|
+
onClick: withModifiers(ok, ["stop"])
|
|
24788
|
+
}, null, 8, ["text", "color", "loading"])) : createCommentVNode("", true)
|
|
24789
|
+
]),
|
|
24790
|
+
_: 1
|
|
24791
|
+
})
|
|
24792
|
+
]),
|
|
24793
|
+
_: 3
|
|
24794
|
+
})
|
|
24795
|
+
])) : createCommentVNode("", true)
|
|
24796
|
+
])) : createCommentVNode("", true)
|
|
24797
|
+
]),
|
|
24798
|
+
_: 3
|
|
24799
|
+
})
|
|
24800
|
+
], 4)
|
|
24801
|
+
]);
|
|
24802
|
+
};
|
|
24803
|
+
}
|
|
24804
|
+
});
|
|
24805
|
+
const _LewDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-46b17cfb"]]);
|
|
24806
|
+
const { x, y } = useMouse();
|
|
24807
|
+
const createDialog = (type) => (options) => dialog(type, options);
|
|
24808
|
+
const dialogTypes = {
|
|
24809
|
+
warning: createDialog("warning"),
|
|
24810
|
+
error: createDialog("error"),
|
|
24811
|
+
info: createDialog("info"),
|
|
24812
|
+
normal: createDialog("normal"),
|
|
24813
|
+
success: createDialog("success")
|
|
24814
|
+
};
|
|
24815
|
+
const dialog = (type, options) => {
|
|
24816
|
+
const {
|
|
24817
|
+
title,
|
|
24818
|
+
content,
|
|
24819
|
+
ok = () => true,
|
|
24820
|
+
cancel = () => true,
|
|
24821
|
+
okText,
|
|
24822
|
+
cancelText,
|
|
24823
|
+
layout,
|
|
24824
|
+
closeOnClickOverlay,
|
|
24825
|
+
closeByEsc
|
|
24826
|
+
} = options;
|
|
24827
|
+
const div2 = document.createElement("div");
|
|
24828
|
+
const transformOrigin = `${x.value}px ${y.value}px`;
|
|
24829
|
+
document.body.appendChild(div2);
|
|
24830
|
+
const app = createApp({
|
|
24831
|
+
render() {
|
|
24832
|
+
return h$1(
|
|
24833
|
+
_LewDialog,
|
|
24834
|
+
{
|
|
24835
|
+
closeOnClickOverlay,
|
|
24836
|
+
closeByEsc,
|
|
24837
|
+
type,
|
|
24838
|
+
layout,
|
|
24839
|
+
okText,
|
|
24840
|
+
cancelText,
|
|
24841
|
+
transformOrigin,
|
|
24842
|
+
ok,
|
|
24843
|
+
onClose: () => {
|
|
24844
|
+
app.unmount();
|
|
24845
|
+
div2.remove();
|
|
24846
|
+
},
|
|
24847
|
+
cancel
|
|
24848
|
+
},
|
|
24849
|
+
{
|
|
24850
|
+
title: () => title,
|
|
24851
|
+
content: () => content
|
|
24839
24852
|
}
|
|
24840
|
-
|
|
24841
|
-
}
|
|
24842
|
-
}
|
|
24853
|
+
);
|
|
24854
|
+
}
|
|
24855
|
+
});
|
|
24856
|
+
app.mount(div2);
|
|
24843
24857
|
};
|
|
24844
|
-
const
|
|
24845
|
-
|
|
24846
|
-
|
|
24847
|
-
|
|
24848
|
-
|
|
24858
|
+
const LewDialog$1 = {
|
|
24859
|
+
name: "LewDialog",
|
|
24860
|
+
...dialogTypes
|
|
24861
|
+
};
|
|
24862
|
+
const warning = ({ title, content, delay = 3e3 }) => {
|
|
24863
|
+
notification("warning", title, content, delay);
|
|
24864
|
+
};
|
|
24865
|
+
const error = ({ title, content, delay = 3e3 }) => {
|
|
24866
|
+
notification("error", title, content, delay);
|
|
24867
|
+
};
|
|
24868
|
+
const info = ({ title, content, delay = 3e3 }) => {
|
|
24869
|
+
notification("info", title, content, delay);
|
|
24870
|
+
};
|
|
24871
|
+
const normal = ({ title, content, delay = 3e3 }) => {
|
|
24872
|
+
notification("normal", title, content, delay);
|
|
24873
|
+
};
|
|
24874
|
+
const success = ({ title, content, delay = 3e3 }) => {
|
|
24875
|
+
notification("success", title, content, delay);
|
|
24876
|
+
};
|
|
24877
|
+
const createMessageList = () => {
|
|
24878
|
+
const div2 = document.createElement("div");
|
|
24879
|
+
div2.setAttribute("id", "lew-notification");
|
|
24880
|
+
document.body.appendChild(div2);
|
|
24881
|
+
};
|
|
24882
|
+
const notification = (type, title, content, delay) => {
|
|
24883
|
+
if (!document.getElementById("lew-notification")) {
|
|
24884
|
+
createMessageList();
|
|
24885
|
+
notification(type, title, content, delay);
|
|
24886
|
+
} else {
|
|
24887
|
+
add(type, title, content, delay);
|
|
24849
24888
|
}
|
|
24850
24889
|
};
|
|
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
|
-
};
|
|
24890
|
+
const add = (type, title, content, delay) => {
|
|
24891
|
+
const LewMessageDom = document.getElementById("lew-notification");
|
|
24892
|
+
const newMessage = document.createElement("div");
|
|
24893
|
+
newMessage.innerHTML = `
|
|
24894
|
+
<div class="lew-notification-box">
|
|
24895
|
+
<div class="lew-notification-icon">
|
|
24896
|
+
${getIconInnerHTML({ type, size: 18 })}
|
|
24897
|
+
</div>
|
|
24898
|
+
<div class="lew-notification-body">
|
|
24899
|
+
<div class="lew-notification-title">${title}</div>
|
|
24900
|
+
${content ? `<div class="lew-notification-content">${content}</div>` : ""}
|
|
24901
|
+
</div>
|
|
24902
|
+
<div class="lew-notification-close-icon">
|
|
24903
|
+
${getIconInnerHTML({ type: "close", size: 16 })}
|
|
24904
|
+
</div>
|
|
24905
|
+
</div>
|
|
24906
|
+
`;
|
|
24907
|
+
LewMessageDom == null ? void 0 : LewMessageDom.insertBefore(newMessage, LewMessageDom == null ? void 0 : LewMessageDom.childNodes[0]);
|
|
24908
|
+
newMessage.setAttribute("class", `lew-notification lew-notification-${type}`);
|
|
24909
|
+
let timer;
|
|
24910
|
+
let lock = false;
|
|
24911
|
+
function startTimer() {
|
|
24912
|
+
if (delay > 0) {
|
|
24913
|
+
({ stop: timer } = useTimeoutFn(() => {
|
|
24914
|
+
handleClose();
|
|
24915
|
+
}, delay));
|
|
24916
|
+
}
|
|
24962
24917
|
}
|
|
24963
|
-
|
|
24964
|
-
|
|
24965
|
-
|
|
24918
|
+
function clearTimer() {
|
|
24919
|
+
timer == null ? void 0 : timer();
|
|
24920
|
+
}
|
|
24921
|
+
function handleClose() {
|
|
24922
|
+
if (lock) {
|
|
24923
|
+
return;
|
|
24924
|
+
}
|
|
24925
|
+
lock = true;
|
|
24926
|
+
newMessage.setAttribute(
|
|
24927
|
+
"class",
|
|
24928
|
+
`lew-notification lew-notification-${type} lew-notification-hidden`
|
|
24929
|
+
);
|
|
24930
|
+
if (newMessage) {
|
|
24931
|
+
if (LewMessageDom) {
|
|
24932
|
+
setTimeout(() => {
|
|
24933
|
+
LewMessageDom.removeChild(newMessage);
|
|
24934
|
+
}, 250);
|
|
24935
|
+
}
|
|
24936
|
+
}
|
|
24937
|
+
}
|
|
24938
|
+
newMessage.children[0].children[2].addEventListener("click", handleClose);
|
|
24939
|
+
newMessage.addEventListener("mouseenter", clearTimer);
|
|
24940
|
+
newMessage.addEventListener("mouseleave", startTimer);
|
|
24941
|
+
setTimeout(() => {
|
|
24942
|
+
lock = false;
|
|
24943
|
+
newMessage.setAttribute(
|
|
24944
|
+
"class",
|
|
24945
|
+
`lew-notification lew-notification-${type} lew-notification-show`
|
|
24946
|
+
);
|
|
24947
|
+
delay > 0 && startTimer();
|
|
24948
|
+
}, 10);
|
|
24949
|
+
};
|
|
24950
|
+
const LewNotification = {
|
|
24951
|
+
name: "LewNotification",
|
|
24952
|
+
warning,
|
|
24953
|
+
info,
|
|
24954
|
+
normal,
|
|
24955
|
+
success,
|
|
24956
|
+
error
|
|
24957
|
+
};
|
|
24958
|
+
const methods = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
24966
24959
|
__proto__: null,
|
|
24967
|
-
LewBacktop: index$1,
|
|
24968
|
-
LewContextMenu,
|
|
24969
24960
|
LewDialog: LewDialog$1,
|
|
24970
|
-
LewLoading,
|
|
24971
24961
|
LewMessage: LewMessage$1,
|
|
24972
24962
|
LewNotification,
|
|
24973
|
-
|
|
24974
|
-
LewVContextMenu,
|
|
24975
|
-
contextMenuProps,
|
|
24976
|
-
dialogProps,
|
|
24977
|
-
initLewContextMenu
|
|
24963
|
+
dialogProps
|
|
24978
24964
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
24979
24965
|
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);
|
|
24966
|
+
Object.keys(components).forEach((key) => {
|
|
24967
|
+
const component = components[key];
|
|
24968
|
+
if (component.name || component.__name) {
|
|
24969
|
+
Vue.component(component.name || component.__name, component);
|
|
24989
24970
|
}
|
|
24990
24971
|
});
|
|
24991
|
-
|
|
24992
|
-
|
|
24993
|
-
|
|
24994
|
-
|
|
24995
|
-
|
|
24996
|
-
|
|
24972
|
+
Object.keys(directives).forEach((key) => {
|
|
24973
|
+
Vue.use(directives[key]);
|
|
24974
|
+
});
|
|
24975
|
+
Object.keys(methods).forEach((key) => {
|
|
24976
|
+
const methodInstance = methods[key];
|
|
24977
|
+
if (methodInstance.name) {
|
|
24978
|
+
window[methodInstance.name] = methodInstance;
|
|
24997
24979
|
}
|
|
24998
24980
|
});
|
|
24999
24981
|
};
|