@done-coding/admin-core 0.20.1-alpha.0 → 0.21.1-alpha.0
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/es/components/app-layout/AppLayout.vue.mjs +1 -1
- package/es/components/app-layout/AppLayout.vue2.mjs +51 -6
- package/es/components/app-layout/AppPage.vue.mjs +1 -1
- package/es/components/app-layout/AppPage.vue2.mjs +16 -9
- package/es/components/display/ShadowClone.vue.mjs +32 -0
- package/es/components/display/ShadowClone.vue2.mjs +4 -0
- package/es/components/display/use-shadow-target.mjs +76 -0
- package/es/components/form/FormActiveFilter.vue.mjs +7 -0
- package/es/components/form/FormActiveFilter.vue2.mjs +62 -0
- package/es/components/form/FormInput.vue.mjs +27 -0
- package/es/components/form/FormInput.vue2.mjs +4 -0
- package/es/components/form/FormInputShadowClone.vue.mjs +47 -0
- package/es/components/form/FormInputShadowClone.vue2.mjs +4 -0
- package/es/components/form/FormMain.vue.mjs +1 -1
- package/es/components/form/FormMain.vue2.mjs +5 -25
- package/es/components/form/FormSelectShadowClone.vue.mjs +57 -0
- package/es/components/form/FormSelectShadowClone.vue2.mjs +4 -0
- package/es/components/form/FormShadowCloneDispatch.vue.mjs +7 -0
- package/es/components/form/FormShadowCloneDispatch.vue2.mjs +74 -0
- package/es/components/form/FormSortSwitch.vue.mjs +7 -0
- package/es/components/form/FormSortSwitch.vue2.mjs +188 -0
- package/es/components/form/FormSortSwitchGroup.vue.mjs +7 -0
- package/es/components/form/FormSortSwitchGroup.vue2.mjs +68 -0
- package/es/components/form/FormUpload.vue.mjs +8 -0
- package/es/components/form/FormUpload.vue2.mjs +112 -0
- package/es/components/form/FormUploadAudio.vue.mjs +7 -0
- package/es/components/form/FormUploadAudio.vue2.mjs +88 -0
- package/es/components/form/FormUploadCard.vue.mjs +7 -0
- package/es/components/form/FormUploadCard.vue2.mjs +56 -0
- package/es/components/form/FormUploadFileInfo.vue.mjs +7 -0
- package/es/components/form/FormUploadFileInfo.vue2.mjs +36 -0
- package/es/components/form/FormUploadImage.vue.mjs +7 -0
- package/es/components/form/FormUploadImage.vue2.mjs +77 -0
- package/es/components/form/FormUploadTrigger.vue.mjs +7 -0
- package/es/components/form/FormUploadTrigger.vue2.mjs +34 -0
- package/es/components/form/FormUploadVideo.vue.mjs +7 -0
- package/es/components/form/FormUploadVideo.vue2.mjs +74 -0
- package/es/components/form/use-password-autofill.mjs +34 -0
- package/es/components/form/use-upload-state.mjs +98 -0
- package/es/components/list-layout/ListLayout.vue.mjs +1 -1
- package/es/components/list-layout/ListLayout.vue2.mjs +36 -9
- package/es/components/list-layout/use-active-filter.mjs +133 -0
- package/es/components/modal/ImagePreviewTrigger.vue.mjs +34 -0
- package/es/components/modal/ImagePreviewTrigger.vue2.mjs +4 -0
- package/es/components/modal/ModalImagePreview.vue.mjs +52 -0
- package/es/components/modal/ModalImagePreview.vue2.mjs +4 -0
- package/es/components/modal/ModalPorter.vue.mjs +49 -2
- package/es/components/modal/ModalShelf.vue.mjs +13 -4
- package/es/components/modal/ModalVideoPreview.vue.mjs +8 -0
- package/es/components/modal/ModalVideoPreview.vue2.mjs +93 -0
- package/es/components/modal/VideoPreviewTrigger.vue.mjs +7 -0
- package/es/components/modal/VideoPreviewTrigger.vue2.mjs +96 -0
- package/es/components/modal/modal-global-keys.mjs +11 -0
- package/es/components/modal/modal-global-symbol.mjs +6 -0
- package/es/components/modal/modal-shelf-core.mjs +53 -4
- package/es/components/table/TableEmpty.vue.mjs +36 -0
- package/es/components/table/TableEmpty.vue2.mjs +4 -0
- package/es/components/table/TableMain.vue.mjs +1 -1
- package/es/components/table/TableMain.vue2.mjs +21 -8
- package/es/components/view-layout/ViewLayout.vue.mjs +1 -1
- package/es/components/view-layout/ViewLayout.vue2.mjs +1 -1
- package/es/hooks/menus-dispatch.mjs +8 -3
- package/es/index.mjs +127 -91
- package/es/style.css +412 -33
- package/package.json +2 -2
- package/src/components/app-layout/docs/README-AppLayout.md +48 -0
- package/src/components/app-layout/docs/README-AppPage.md +40 -2
- package/src/components/display/README.md +9 -3
- package/src/components/display/docs/README-ShadowClone.md +75 -0
- package/src/components/form/README.md +15 -2
- package/src/components/form/docs/README-FormActiveFilter.md +57 -0
- package/src/components/form/docs/README-FormInput.md +66 -0
- package/src/components/form/docs/README-FormSelect.md +77 -0
- package/src/components/form/docs/README-FormShadowCloneDispatch.md +65 -0
- package/src/components/form/docs/README-FormSortSwitchGroup.md +131 -0
- package/src/components/form/docs/README-FormUpload.md +108 -0
- package/src/components/form/docs/README-FormUploadAudio.md +80 -0
- package/src/components/form/docs/README-FormUploadImage.md +83 -0
- package/src/components/form/docs/README-FormUploadVideo.md +82 -0
- package/src/components/list-layout/README.md +6 -2
- package/src/components/list-layout/docs/README-ListLayout.md +1 -0
- package/src/components/modal/README.md +7 -2
- package/src/components/modal/docs/README-ImagePreviewTrigger.md +78 -0
- package/src/components/modal/docs/README-ModalImagePreview.md +78 -0
- package/src/components/modal/docs/README-ModalPorter.md +10 -0
- package/src/components/modal/docs/README-ModalShelf.md +11 -2
- package/src/components/modal/docs/README-ModalVideoPreview.md +89 -0
- package/src/components/modal/docs/README-VideoPreviewTrigger.md +91 -0
- package/src/components/table/docs/README-TableMain.md +3 -0
- package/types/components/app-layout/AppLayout.vue.d.ts +31 -1
- package/types/components/app-layout/AppPage.vue.d.ts +7 -2
- package/types/components/app-layout/types.d.ts +25 -0
- package/types/components/display/ShadowClone.vue.d.ts +20 -0
- package/types/components/display/TabsTile.vue.d.ts +2 -2
- package/types/components/display/index.d.ts +8 -1
- package/types/components/display/types.d.ts +7 -0
- package/types/components/display/use-shadow-target.d.ts +9 -0
- package/types/components/form/FormActiveFilter.vue.d.ts +9 -0
- package/types/components/form/FormInput.vue.d.ts +3 -0
- package/types/components/form/FormInputShadowClone.vue.d.ts +7 -0
- package/types/components/form/FormSearch.vue.d.ts +1 -1
- package/types/components/form/FormSelectShadowClone.vue.d.ts +39 -0
- package/types/components/form/FormShadowCloneDispatch.vue.d.ts +44 -0
- package/types/components/form/FormSortSwitch.vue.d.ts +17 -0
- package/types/components/form/FormSortSwitchGroup.vue.d.ts +15 -0
- package/types/components/form/FormUpload.vue.d.ts +57 -0
- package/types/components/form/FormUploadAudio.vue.d.ts +30 -0
- package/types/components/form/FormUploadCard.vue.d.ts +24 -0
- package/types/components/form/FormUploadFileInfo.vue.d.ts +10 -0
- package/types/components/form/FormUploadImage.vue.d.ts +34 -0
- package/types/components/form/FormUploadTrigger.vue.d.ts +11 -0
- package/types/components/form/FormUploadVideo.vue.d.ts +34 -0
- package/types/components/form/index.d.ts +12 -1
- package/types/components/form/types.d.ts +158 -0
- package/types/components/form/use-password-autofill.d.ts +11 -0
- package/types/components/form/use-upload-state.d.ts +29 -0
- package/types/components/list-layout/ListLayout.vue.d.ts +3 -0
- package/types/components/list-layout/types.d.ts +16 -0
- package/types/components/list-layout/use-active-filter.d.ts +27 -0
- package/types/components/modal/ImagePreviewTrigger.vue.d.ts +41 -0
- package/types/components/modal/ModalConfirm.vue.d.ts +1 -1
- package/types/components/modal/ModalImagePreview.vue.d.ts +31 -0
- package/types/components/modal/ModalPorter.vue.d.ts +7 -0
- package/types/components/modal/ModalShelf.vue.d.ts +12 -3
- package/types/components/modal/ModalVideoPreview.vue.d.ts +40 -0
- package/types/components/modal/VideoPreviewTrigger.vue.d.ts +43 -0
- package/types/components/modal/index.d.ts +6 -1
- package/types/components/modal/modal-global-keys.d.ts +25 -0
- package/types/components/modal/modal-global-symbol.d.ts +8 -0
- package/types/components/modal/modal-shelf-core.d.ts +11 -3
- package/types/components/modal/modal-shelf-types.d.ts +50 -0
- package/types/components/table/TableEmpty.vue.d.ts +11 -0
- package/types/components/table/types.d.ts +11 -0
- package/types/components/view-layout/types.d.ts +1 -1
- package/types/injectInfo.json.d.ts +1 -1
- package/types/store/app.d.ts +1 -1
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { defineComponent, useModel, computed, openBlock, createBlock, unref, withCtx, createVNode, normalizeClass, createElementVNode, toDisplayString, createElementBlock, createCommentVNode, mergeModels } from "vue";
|
|
2
|
+
import { ElButton, ElIcon } from "element-plus";
|
|
3
|
+
import { CaretTop, CaretBottom } from "@element-plus/icons-vue";
|
|
4
|
+
import _sfc_main$1 from "../display/ShadowClone.vue.mjs";
|
|
5
|
+
const _hoisted_1 = { class: "form-sort__icon" };
|
|
6
|
+
const _hoisted_2 = { class: "form-sort__label" };
|
|
7
|
+
const _hoisted_3 = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "form-sort__order"
|
|
10
|
+
};
|
|
11
|
+
const _hoisted_4 = { class: "form-sort__icon" };
|
|
12
|
+
const _hoisted_5 = { class: "form-sort__label" };
|
|
13
|
+
const _hoisted_6 = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "form-sort__order"
|
|
16
|
+
};
|
|
17
|
+
const _hoisted_7 = { class: "form-sort__icon" };
|
|
18
|
+
const _hoisted_8 = { class: "form-sort__label" };
|
|
19
|
+
const _hoisted_9 = {
|
|
20
|
+
key: 0,
|
|
21
|
+
class: "form-sort__order"
|
|
22
|
+
};
|
|
23
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
24
|
+
__name: "FormSortSwitch",
|
|
25
|
+
props: /* @__PURE__ */ mergeModels({
|
|
26
|
+
modelValue: {},
|
|
27
|
+
mode: { default: "cycle" },
|
|
28
|
+
textType: { default: "state" },
|
|
29
|
+
label: {},
|
|
30
|
+
showOrder: { type: Boolean, default: false },
|
|
31
|
+
order: {},
|
|
32
|
+
shadowClone: { type: Boolean, default: false },
|
|
33
|
+
teleportTo: {},
|
|
34
|
+
teleportMode: { default: "dual-arrow" }
|
|
35
|
+
}, {
|
|
36
|
+
"modelValue": { default: void 0 },
|
|
37
|
+
"modelModifiers": {}
|
|
38
|
+
}),
|
|
39
|
+
emits: ["update:modelValue"],
|
|
40
|
+
setup(__props) {
|
|
41
|
+
const props = __props;
|
|
42
|
+
const model = useModel(__props, "modelValue");
|
|
43
|
+
const NEXT = {
|
|
44
|
+
undefined: "asc",
|
|
45
|
+
asc: "desc",
|
|
46
|
+
desc: void 0
|
|
47
|
+
};
|
|
48
|
+
const STATE_TEXT = {
|
|
49
|
+
asc: "升序",
|
|
50
|
+
desc: "降序"
|
|
51
|
+
};
|
|
52
|
+
const text = computed(() => {
|
|
53
|
+
if (props.textType === "label") {
|
|
54
|
+
return props.label;
|
|
55
|
+
}
|
|
56
|
+
return model.value ? STATE_TEXT[model.value] : "默认";
|
|
57
|
+
});
|
|
58
|
+
const activeClass = computed(
|
|
59
|
+
() => model.value ? "form-sort__chip_active" : ""
|
|
60
|
+
);
|
|
61
|
+
function caretClass(dir) {
|
|
62
|
+
return model.value === dir ? "form-sort__caret_on" : "";
|
|
63
|
+
}
|
|
64
|
+
function onChipClick(m) {
|
|
65
|
+
if (m === "cycle") {
|
|
66
|
+
model.value = NEXT[String(model.value)];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function onArrowClick(m, dir) {
|
|
70
|
+
if (m !== "dual-arrow") {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
model.value = model.value === dir ? void 0 : dir;
|
|
74
|
+
}
|
|
75
|
+
return (_ctx, _cache) => {
|
|
76
|
+
return __props.shadowClone && __props.teleportTo ? (openBlock(), createBlock(unref(_sfc_main$1), {
|
|
77
|
+
key: 0,
|
|
78
|
+
to: __props.teleportTo
|
|
79
|
+
}, {
|
|
80
|
+
clone: withCtx(() => [
|
|
81
|
+
createVNode(unref(ElButton), {
|
|
82
|
+
class: normalizeClass(["dc-form-sort-switch form-sort__chip", [`form-sort--${__props.teleportMode}`, activeClass.value]]),
|
|
83
|
+
size: "small",
|
|
84
|
+
plain: "",
|
|
85
|
+
text: "",
|
|
86
|
+
onClick: _cache[5] || (_cache[5] = ($event) => onChipClick(__props.teleportMode))
|
|
87
|
+
}, {
|
|
88
|
+
default: withCtx(() => [
|
|
89
|
+
createElementVNode("span", _hoisted_4, [
|
|
90
|
+
createVNode(unref(ElIcon), {
|
|
91
|
+
class: normalizeClass(["form-sort__caret", caretClass("asc")]),
|
|
92
|
+
onClick: _cache[3] || (_cache[3] = ($event) => onArrowClick(__props.teleportMode, "asc"))
|
|
93
|
+
}, {
|
|
94
|
+
default: withCtx(() => [
|
|
95
|
+
createVNode(unref(CaretTop))
|
|
96
|
+
]),
|
|
97
|
+
_: 1
|
|
98
|
+
}, 8, ["class"]),
|
|
99
|
+
createVNode(unref(ElIcon), {
|
|
100
|
+
class: normalizeClass(["form-sort__caret", caretClass("desc")]),
|
|
101
|
+
onClick: _cache[4] || (_cache[4] = ($event) => onArrowClick(__props.teleportMode, "desc"))
|
|
102
|
+
}, {
|
|
103
|
+
default: withCtx(() => [
|
|
104
|
+
createVNode(unref(CaretBottom))
|
|
105
|
+
]),
|
|
106
|
+
_: 1
|
|
107
|
+
}, 8, ["class"])
|
|
108
|
+
]),
|
|
109
|
+
createElementVNode("span", _hoisted_5, toDisplayString(text.value), 1),
|
|
110
|
+
__props.showOrder && __props.order ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(__props.order), 1)) : createCommentVNode("", true)
|
|
111
|
+
]),
|
|
112
|
+
_: 1
|
|
113
|
+
}, 8, ["class"])
|
|
114
|
+
]),
|
|
115
|
+
default: withCtx(() => [
|
|
116
|
+
createVNode(unref(ElButton), {
|
|
117
|
+
class: normalizeClass(["dc-form-sort-switch form-sort__chip", [`form-sort--${__props.mode}`, activeClass.value]]),
|
|
118
|
+
size: "small",
|
|
119
|
+
plain: "",
|
|
120
|
+
onClick: _cache[2] || (_cache[2] = ($event) => onChipClick(__props.mode))
|
|
121
|
+
}, {
|
|
122
|
+
default: withCtx(() => [
|
|
123
|
+
createElementVNode("span", _hoisted_1, [
|
|
124
|
+
createVNode(unref(ElIcon), {
|
|
125
|
+
class: normalizeClass(["form-sort__caret", caretClass("asc")]),
|
|
126
|
+
onClick: _cache[0] || (_cache[0] = ($event) => onArrowClick(__props.mode, "asc"))
|
|
127
|
+
}, {
|
|
128
|
+
default: withCtx(() => [
|
|
129
|
+
createVNode(unref(CaretTop))
|
|
130
|
+
]),
|
|
131
|
+
_: 1
|
|
132
|
+
}, 8, ["class"]),
|
|
133
|
+
createVNode(unref(ElIcon), {
|
|
134
|
+
class: normalizeClass(["form-sort__caret", caretClass("desc")]),
|
|
135
|
+
onClick: _cache[1] || (_cache[1] = ($event) => onArrowClick(__props.mode, "desc"))
|
|
136
|
+
}, {
|
|
137
|
+
default: withCtx(() => [
|
|
138
|
+
createVNode(unref(CaretBottom))
|
|
139
|
+
]),
|
|
140
|
+
_: 1
|
|
141
|
+
}, 8, ["class"])
|
|
142
|
+
]),
|
|
143
|
+
createElementVNode("span", _hoisted_2, toDisplayString(text.value), 1),
|
|
144
|
+
__props.showOrder && __props.order ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(__props.order), 1)) : createCommentVNode("", true)
|
|
145
|
+
]),
|
|
146
|
+
_: 1
|
|
147
|
+
}, 8, ["class"])
|
|
148
|
+
]),
|
|
149
|
+
_: 1
|
|
150
|
+
}, 8, ["to"])) : (openBlock(), createBlock(unref(ElButton), {
|
|
151
|
+
key: 1,
|
|
152
|
+
class: normalizeClass(["dc-form-sort-switch form-sort__chip", [`form-sort--${__props.mode}`, activeClass.value]]),
|
|
153
|
+
size: "small",
|
|
154
|
+
plain: "",
|
|
155
|
+
onClick: _cache[8] || (_cache[8] = ($event) => onChipClick(__props.mode))
|
|
156
|
+
}, {
|
|
157
|
+
default: withCtx(() => [
|
|
158
|
+
createElementVNode("span", _hoisted_7, [
|
|
159
|
+
createVNode(unref(ElIcon), {
|
|
160
|
+
class: normalizeClass(["form-sort__caret", caretClass("asc")]),
|
|
161
|
+
onClick: _cache[6] || (_cache[6] = ($event) => onArrowClick(__props.mode, "asc"))
|
|
162
|
+
}, {
|
|
163
|
+
default: withCtx(() => [
|
|
164
|
+
createVNode(unref(CaretTop))
|
|
165
|
+
]),
|
|
166
|
+
_: 1
|
|
167
|
+
}, 8, ["class"]),
|
|
168
|
+
createVNode(unref(ElIcon), {
|
|
169
|
+
class: normalizeClass(["form-sort__caret", caretClass("desc")]),
|
|
170
|
+
onClick: _cache[7] || (_cache[7] = ($event) => onArrowClick(__props.mode, "desc"))
|
|
171
|
+
}, {
|
|
172
|
+
default: withCtx(() => [
|
|
173
|
+
createVNode(unref(CaretBottom))
|
|
174
|
+
]),
|
|
175
|
+
_: 1
|
|
176
|
+
}, 8, ["class"])
|
|
177
|
+
]),
|
|
178
|
+
createElementVNode("span", _hoisted_8, toDisplayString(text.value), 1),
|
|
179
|
+
__props.showOrder && __props.order ? (openBlock(), createElementBlock("span", _hoisted_9, toDisplayString(__props.order), 1)) : createCommentVNode("", true)
|
|
180
|
+
]),
|
|
181
|
+
_: 1
|
|
182
|
+
}, 8, ["class"]));
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
export {
|
|
187
|
+
_sfc_main as default
|
|
188
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _sfc_main from "./FormSortSwitchGroup.vue2.mjs";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
+
const FormSortSwitchGroup = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e86178b8"]]);
|
|
5
|
+
export {
|
|
6
|
+
FormSortSwitchGroup as default
|
|
7
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { defineComponent, useModel, computed, openBlock, createBlock, unref, withCtx, createElementBlock, Fragment, renderList, mergeModels } from "vue";
|
|
2
|
+
import { ElButtonGroup } from "element-plus";
|
|
3
|
+
import FormSortSwitch from "./FormSortSwitch.vue.mjs";
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
__name: "FormSortSwitchGroup",
|
|
6
|
+
props: /* @__PURE__ */ mergeModels({
|
|
7
|
+
options: {},
|
|
8
|
+
mode: { default: "cycle" },
|
|
9
|
+
shadowClone: { type: Boolean, default: false },
|
|
10
|
+
teleportMode: { default: "dual-arrow" }
|
|
11
|
+
}, {
|
|
12
|
+
"modelValue": { default: () => [] },
|
|
13
|
+
"modelModifiers": {}
|
|
14
|
+
}),
|
|
15
|
+
emits: ["update:modelValue"],
|
|
16
|
+
setup(__props) {
|
|
17
|
+
const props = __props;
|
|
18
|
+
const model = useModel(__props, "modelValue");
|
|
19
|
+
const showOrder = computed(() => props.options.length > 1);
|
|
20
|
+
function dirOf(field) {
|
|
21
|
+
var _a;
|
|
22
|
+
return (_a = model.value.find((r) => r.field === field)) == null ? void 0 : _a.dir;
|
|
23
|
+
}
|
|
24
|
+
function orderOf(field) {
|
|
25
|
+
const i = model.value.findIndex((r) => r.field === field);
|
|
26
|
+
return i === -1 ? 0 : i + 1;
|
|
27
|
+
}
|
|
28
|
+
function onDirChange(field, dir) {
|
|
29
|
+
const list = model.value.map((r) => ({ ...r }));
|
|
30
|
+
const idx = list.findIndex((r) => r.field === field);
|
|
31
|
+
if (dir === void 0) {
|
|
32
|
+
if (idx !== -1) {
|
|
33
|
+
list.splice(idx, 1);
|
|
34
|
+
}
|
|
35
|
+
} else if (idx === -1) {
|
|
36
|
+
list.push({ field, dir });
|
|
37
|
+
} else {
|
|
38
|
+
list[idx].dir = dir;
|
|
39
|
+
}
|
|
40
|
+
model.value = list;
|
|
41
|
+
}
|
|
42
|
+
return (_ctx, _cache) => {
|
|
43
|
+
return openBlock(), createBlock(unref(ElButtonGroup), { class: "dc-form-sort-switch-group form-sort" }, {
|
|
44
|
+
default: withCtx(() => [
|
|
45
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (opt) => {
|
|
46
|
+
return openBlock(), createBlock(FormSortSwitch, {
|
|
47
|
+
key: opt.field,
|
|
48
|
+
"model-value": dirOf(opt.field),
|
|
49
|
+
mode: __props.mode,
|
|
50
|
+
"shadow-clone": __props.shadowClone,
|
|
51
|
+
"teleport-to": opt.teleportTo,
|
|
52
|
+
"teleport-mode": __props.teleportMode,
|
|
53
|
+
"text-type": "label",
|
|
54
|
+
label: opt.label,
|
|
55
|
+
"show-order": showOrder.value,
|
|
56
|
+
order: orderOf(opt.field),
|
|
57
|
+
"onUpdate:modelValue": (dir) => onDirChange(opt.field, dir)
|
|
58
|
+
}, null, 8, ["model-value", "mode", "shadow-clone", "teleport-to", "teleport-mode", "label", "show-order", "order", "onUpdate:modelValue"]);
|
|
59
|
+
}), 128))
|
|
60
|
+
]),
|
|
61
|
+
_: 1
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
export {
|
|
67
|
+
_sfc_main as default
|
|
68
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _sfc_main from "./FormUpload.vue2.mjs";
|
|
2
|
+
/* empty css */
|
|
3
|
+
/* empty css */
|
|
4
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
5
|
+
const FormUpload = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-158fc67d"]]);
|
|
6
|
+
export {
|
|
7
|
+
FormUpload as default
|
|
8
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { defineComponent, useModel, useAttrs, computed, openBlock, createElementBlock, normalizeClass, unref, createVNode, mergeProps, isRef, withCtx, renderSlot, createCommentVNode, toDisplayString, mergeModels } from "vue";
|
|
2
|
+
import { ElUpload, ElMessage } from "element-plus";
|
|
3
|
+
import _omit from "lodash/omit";
|
|
4
|
+
import { useUploadState } from "./use-upload-state.mjs";
|
|
5
|
+
import FormUploadTrigger from "./FormUploadTrigger.vue.mjs";
|
|
6
|
+
const _hoisted_1 = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "dc-form-upload__placeholder"
|
|
9
|
+
};
|
|
10
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
11
|
+
...{
|
|
12
|
+
name: "FormUpload",
|
|
13
|
+
inheritAttrs: false
|
|
14
|
+
},
|
|
15
|
+
__name: "FormUpload",
|
|
16
|
+
props: /* @__PURE__ */ mergeModels({
|
|
17
|
+
uploadFn: {},
|
|
18
|
+
loadingKey: {},
|
|
19
|
+
maxCount: { default: 1 },
|
|
20
|
+
maxSize: {},
|
|
21
|
+
accept: {},
|
|
22
|
+
drag: { type: Boolean, default: false },
|
|
23
|
+
disabled: { type: Boolean, default: false },
|
|
24
|
+
showProgress: { type: Boolean, default: true },
|
|
25
|
+
placeholder: {}
|
|
26
|
+
}, {
|
|
27
|
+
"modelValue": {},
|
|
28
|
+
"modelModifiers": {}
|
|
29
|
+
}),
|
|
30
|
+
emits: /* @__PURE__ */ mergeModels(["uploadSuccess", "uploadError", "triggerChangeLink"], ["update:modelValue"]),
|
|
31
|
+
setup(__props, { emit: __emit }) {
|
|
32
|
+
const props = __props;
|
|
33
|
+
const emit = __emit;
|
|
34
|
+
const modelValue = useModel(__props, "modelValue");
|
|
35
|
+
const NETWORK_ATTRS = [
|
|
36
|
+
"action",
|
|
37
|
+
"headers",
|
|
38
|
+
"data",
|
|
39
|
+
"withCredentials",
|
|
40
|
+
"httpRequest"
|
|
41
|
+
];
|
|
42
|
+
const attrs = useAttrs();
|
|
43
|
+
const attrsOut = computed(() => _omit(attrs, [...NETWORK_ATTRS, "onRemove"]));
|
|
44
|
+
const consumerOnRemove = computed(
|
|
45
|
+
() => "onRemove" in attrs ? attrs.onRemove : void 0
|
|
46
|
+
);
|
|
47
|
+
const { fileList, handleUpload, handleRemove } = useUploadState(modelValue, {
|
|
48
|
+
maxCount: () => props.maxCount,
|
|
49
|
+
maxSize: () => props.maxSize,
|
|
50
|
+
uploadFn: () => props.uploadFn,
|
|
51
|
+
loadingKey: () => props.loadingKey,
|
|
52
|
+
onUploadSuccess: (url, file) => emit("uploadSuccess", { file, url }),
|
|
53
|
+
onUploadError: (error, file) => {
|
|
54
|
+
ElMessage.error(`上传失败:${error.message || "未知错误"}`);
|
|
55
|
+
emit("uploadError", {
|
|
56
|
+
file,
|
|
57
|
+
error
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const handleRemoveComposed = (file, files) => {
|
|
62
|
+
var _a;
|
|
63
|
+
handleRemove(file);
|
|
64
|
+
(_a = consumerOnRemove.value) == null ? void 0 : _a.call(consumerOnRemove, file, files);
|
|
65
|
+
};
|
|
66
|
+
const showEmptyHint = computed(
|
|
67
|
+
() => Boolean(props.placeholder) && fileList.value.length === 0
|
|
68
|
+
);
|
|
69
|
+
return (_ctx, _cache) => {
|
|
70
|
+
return openBlock(), createElementBlock("div", {
|
|
71
|
+
class: normalizeClass(["dc-form-upload", { "dc-form-upload_full": unref(fileList).length >= props.maxCount }])
|
|
72
|
+
}, [
|
|
73
|
+
createVNode(unref(ElUpload), mergeProps(attrsOut.value, {
|
|
74
|
+
"file-list": unref(fileList),
|
|
75
|
+
"onUpdate:fileList": _cache[0] || (_cache[0] = ($event) => isRef(fileList) ? fileList.value = $event : null),
|
|
76
|
+
class: "dc-form-upload__inner",
|
|
77
|
+
"http-request": unref(handleUpload),
|
|
78
|
+
limit: __props.maxCount,
|
|
79
|
+
multiple: __props.maxCount > 1,
|
|
80
|
+
accept: __props.accept,
|
|
81
|
+
drag: __props.drag,
|
|
82
|
+
disabled: __props.disabled,
|
|
83
|
+
"show-progress": __props.showProgress,
|
|
84
|
+
"on-remove": handleRemoveComposed
|
|
85
|
+
}), {
|
|
86
|
+
tip: withCtx(() => [
|
|
87
|
+
renderSlot(_ctx.$slots, "tip", {}, void 0, true)
|
|
88
|
+
]),
|
|
89
|
+
file: withCtx(({ file, index }) => [
|
|
90
|
+
renderSlot(_ctx.$slots, "file", {
|
|
91
|
+
file,
|
|
92
|
+
index,
|
|
93
|
+
remove: () => unref(handleRemove)(file)
|
|
94
|
+
}, void 0, true)
|
|
95
|
+
]),
|
|
96
|
+
default: withCtx(() => [
|
|
97
|
+
unref(fileList).length < props.maxCount ? renderSlot(_ctx.$slots, "default", { key: 0 }, () => [
|
|
98
|
+
createVNode(FormUploadTrigger, {
|
|
99
|
+
text: __props.drag ? "点击或拖拽上传" : "点击上传"
|
|
100
|
+
}, null, 8, ["text"])
|
|
101
|
+
], true) : createCommentVNode("", true)
|
|
102
|
+
]),
|
|
103
|
+
_: 3
|
|
104
|
+
}, 16, ["file-list", "http-request", "limit", "multiple", "accept", "drag", "disabled", "show-progress"]),
|
|
105
|
+
showEmptyHint.value ? (openBlock(), createElementBlock("div", _hoisted_1, toDisplayString(__props.placeholder), 1)) : createCommentVNode("", true)
|
|
106
|
+
], 2);
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
export {
|
|
111
|
+
_sfc_main as default
|
|
112
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _sfc_main from "./FormUploadAudio.vue2.mjs";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
+
const FormUploadAudio = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-3884f0f6"]]);
|
|
5
|
+
export {
|
|
6
|
+
FormUploadAudio as default
|
|
7
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createBlock, mergeProps, withCtx, renderSlot, createVNode, createElementVNode, createElementBlock, withModifiers, unref, createCommentVNode } from "vue";
|
|
2
|
+
import { ElIcon } from "element-plus";
|
|
3
|
+
import { Close } from "@element-plus/icons-vue";
|
|
4
|
+
import FormUpload from "./FormUpload.vue.mjs";
|
|
5
|
+
import FormUploadFileInfo from "./FormUploadFileInfo.vue.mjs";
|
|
6
|
+
import FormUploadTrigger from "./FormUploadTrigger.vue.mjs";
|
|
7
|
+
const _hoisted_1 = { class: "dc-form-upload-audio__item" };
|
|
8
|
+
const _hoisted_2 = ["src"];
|
|
9
|
+
const _hoisted_3 = {
|
|
10
|
+
key: 1,
|
|
11
|
+
class: "dc-form-upload-audio__player dc-form-upload-audio__player_empty"
|
|
12
|
+
};
|
|
13
|
+
const _hoisted_4 = ["onClick"];
|
|
14
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
15
|
+
...{ inheritAttrs: false },
|
|
16
|
+
__name: "FormUploadAudio",
|
|
17
|
+
props: {
|
|
18
|
+
uploadFn: {},
|
|
19
|
+
loadingKey: {},
|
|
20
|
+
maxCount: { default: 1 },
|
|
21
|
+
maxSize: {},
|
|
22
|
+
accept: { default: "audio/*" },
|
|
23
|
+
drag: { type: Boolean, default: false },
|
|
24
|
+
disabled: { type: Boolean, default: false },
|
|
25
|
+
showProgress: { type: Boolean, default: true },
|
|
26
|
+
placeholder: {}
|
|
27
|
+
},
|
|
28
|
+
setup(__props) {
|
|
29
|
+
return (_ctx, _cache) => {
|
|
30
|
+
return openBlock(), createBlock(FormUpload, mergeProps({ class: "dc-form-upload-audio" }, _ctx.$attrs, {
|
|
31
|
+
"upload-fn": __props.uploadFn,
|
|
32
|
+
"loading-key": __props.loadingKey,
|
|
33
|
+
"max-count": __props.maxCount,
|
|
34
|
+
"max-size": __props.maxSize,
|
|
35
|
+
accept: __props.accept,
|
|
36
|
+
drag: __props.drag,
|
|
37
|
+
disabled: __props.disabled,
|
|
38
|
+
"show-progress": __props.showProgress,
|
|
39
|
+
placeholder: __props.placeholder
|
|
40
|
+
}), {
|
|
41
|
+
tip: withCtx(() => [
|
|
42
|
+
renderSlot(_ctx.$slots, "tip", {}, void 0, true)
|
|
43
|
+
]),
|
|
44
|
+
file: withCtx(({ file, index, remove }) => [
|
|
45
|
+
renderSlot(_ctx.$slots, "file", {
|
|
46
|
+
file,
|
|
47
|
+
index,
|
|
48
|
+
remove
|
|
49
|
+
}, () => [
|
|
50
|
+
createElementVNode("div", _hoisted_1, [
|
|
51
|
+
file.url ? (openBlock(), createElementBlock("audio", {
|
|
52
|
+
key: 0,
|
|
53
|
+
class: "dc-form-upload-audio__player",
|
|
54
|
+
src: file.url,
|
|
55
|
+
controls: "",
|
|
56
|
+
preload: "metadata"
|
|
57
|
+
}, null, 8, _hoisted_2)) : (openBlock(), createElementBlock("div", _hoisted_3)),
|
|
58
|
+
createVNode(FormUploadFileInfo, { file }, null, 8, ["file"]),
|
|
59
|
+
file.status !== "uploading" ? (openBlock(), createElementBlock("button", {
|
|
60
|
+
key: 2,
|
|
61
|
+
class: "dc-form-upload-audio__remove",
|
|
62
|
+
onClick: withModifiers(remove, ["stop"])
|
|
63
|
+
}, [
|
|
64
|
+
createVNode(unref(ElIcon), null, {
|
|
65
|
+
default: withCtx(() => [
|
|
66
|
+
createVNode(unref(Close))
|
|
67
|
+
]),
|
|
68
|
+
_: 1
|
|
69
|
+
})
|
|
70
|
+
], 8, _hoisted_4)) : createCommentVNode("", true)
|
|
71
|
+
])
|
|
72
|
+
], true)
|
|
73
|
+
]),
|
|
74
|
+
default: withCtx(() => [
|
|
75
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
76
|
+
createVNode(FormUploadTrigger, {
|
|
77
|
+
text: __props.drag ? "点击或拖拽上传" : "点击上传"
|
|
78
|
+
}, null, 8, ["text"])
|
|
79
|
+
], true)
|
|
80
|
+
]),
|
|
81
|
+
_: 3
|
|
82
|
+
}, 16, ["upload-fn", "loading-key", "max-count", "max-size", "accept", "drag", "disabled", "show-progress", "placeholder"]);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
export {
|
|
87
|
+
_sfc_main as default
|
|
88
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _sfc_main from "./FormUploadCard.vue2.mjs";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
+
const FormUploadCard = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-48323f64"]]);
|
|
5
|
+
export {
|
|
6
|
+
FormUploadCard as default
|
|
7
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, renderSlot, createElementVNode, toDisplayString, normalizeStyle, createCommentVNode, withModifiers, createVNode, unref, withCtx } from "vue";
|
|
2
|
+
import { ElIcon } from "element-plus";
|
|
3
|
+
import { Close } from "@element-plus/icons-vue";
|
|
4
|
+
const _hoisted_1 = { class: "dc-form-upload-card" };
|
|
5
|
+
const _hoisted_2 = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "dc-form-upload-card__mask"
|
|
8
|
+
};
|
|
9
|
+
const _hoisted_3 = ["title"];
|
|
10
|
+
const _hoisted_4 = { class: "dc-form-upload-card__mask-percent" };
|
|
11
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
|
+
__name: "FormUploadCard",
|
|
13
|
+
props: {
|
|
14
|
+
file: {},
|
|
15
|
+
remove: { type: Function }
|
|
16
|
+
},
|
|
17
|
+
setup(__props) {
|
|
18
|
+
return (_ctx, _cache) => {
|
|
19
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
20
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true),
|
|
21
|
+
__props.file.status === "uploading" ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
22
|
+
createElementVNode("span", {
|
|
23
|
+
class: "dc-form-upload-card__mask-name",
|
|
24
|
+
title: __props.file.name
|
|
25
|
+
}, toDisplayString(__props.file.name), 9, _hoisted_3),
|
|
26
|
+
createElementVNode("span", _hoisted_4, toDisplayString(Math.round(__props.file.percentage ?? 0)) + "% ", 1),
|
|
27
|
+
createElementVNode("div", {
|
|
28
|
+
class: "dc-form-upload-card__mask-bar",
|
|
29
|
+
style: normalizeStyle({
|
|
30
|
+
width: `${Math.min(100, Math.round(__props.file.percentage ?? 0))}%`
|
|
31
|
+
})
|
|
32
|
+
}, null, 4)
|
|
33
|
+
])) : createCommentVNode("", true),
|
|
34
|
+
__props.file.status !== "uploading" ? (openBlock(), createElementBlock("button", {
|
|
35
|
+
key: 1,
|
|
36
|
+
class: "dc-form-upload-card__remove",
|
|
37
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(
|
|
38
|
+
//@ts-ignore
|
|
39
|
+
(...args) => __props.remove && __props.remove(...args),
|
|
40
|
+
["stop"]
|
|
41
|
+
))
|
|
42
|
+
}, [
|
|
43
|
+
createVNode(unref(ElIcon), null, {
|
|
44
|
+
default: withCtx(() => [
|
|
45
|
+
createVNode(unref(Close))
|
|
46
|
+
]),
|
|
47
|
+
_: 1
|
|
48
|
+
})
|
|
49
|
+
])) : createCommentVNode("", true)
|
|
50
|
+
]);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
export {
|
|
55
|
+
_sfc_main as default
|
|
56
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _sfc_main from "./FormUploadFileInfo.vue2.mjs";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
+
const FormUploadFileInfo = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6a6d170c"]]);
|
|
5
|
+
export {
|
|
6
|
+
FormUploadFileInfo as default
|
|
7
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, Fragment, createTextVNode } from "vue";
|
|
2
|
+
const _hoisted_1 = { class: "dc-form-upload-file-info" };
|
|
3
|
+
const _hoisted_2 = ["title"];
|
|
4
|
+
const _hoisted_3 = { class: "dc-form-upload-file-info__meta" };
|
|
5
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
|
+
__name: "FormUploadFileInfo",
|
|
7
|
+
props: {
|
|
8
|
+
file: {}
|
|
9
|
+
},
|
|
10
|
+
setup(__props) {
|
|
11
|
+
const formatSize = (size) => {
|
|
12
|
+
if (!size) return "";
|
|
13
|
+
if (size < 1024) return `${size} B`;
|
|
14
|
+
if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)} KB`;
|
|
15
|
+
return `${(size / 1024 / 1024).toFixed(1)} MB`;
|
|
16
|
+
};
|
|
17
|
+
return (_ctx, _cache) => {
|
|
18
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
19
|
+
createElementVNode("div", {
|
|
20
|
+
class: "dc-form-upload-file-info__name",
|
|
21
|
+
title: __props.file.name
|
|
22
|
+
}, toDisplayString(__props.file.name), 9, _hoisted_2),
|
|
23
|
+
createElementVNode("div", _hoisted_3, [
|
|
24
|
+
__props.file.status === "uploading" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
25
|
+
createTextVNode(" 上传中 " + toDisplayString(Math.round(__props.file.percentage ?? 0)) + "% ", 1)
|
|
26
|
+
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
27
|
+
createTextVNode(toDisplayString(formatSize(__props.file.size)), 1)
|
|
28
|
+
], 64))
|
|
29
|
+
])
|
|
30
|
+
]);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
export {
|
|
35
|
+
_sfc_main as default
|
|
36
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _sfc_main from "./FormUploadImage.vue2.mjs";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
+
const FormUploadImage = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-9d62114a"]]);
|
|
5
|
+
export {
|
|
6
|
+
FormUploadImage as default
|
|
7
|
+
};
|