ling-yun-custom-components 0.0.36 → 0.0.37

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.
@@ -1,231 +0,0 @@
1
- import { useAttrs as $, computed as d, onMounted as L, createBlock as p, openBlock as c, unref as a, mergeProps as U, withCtx as r, createElementBlock as y, renderSlot as g, createElementVNode as v, createCommentVNode as A, createTextVNode as h, toDisplayString as C, Fragment as R, createVNode as E } from "vue";
2
- import { ElDialog as q, ElButton as x, ElIcon as z } from "element-plus";
3
- import { IconClose as H, IconBack as J } from "color-message-lingyun-vue";
4
- import { emitsMap as e } from "ling-yun-methods";
5
- import { _ as K } from "./_plugin-vue_export-helper.CHgC5LLL.js";
6
- import '../assets/layout.css';const t = {
7
- DEFAULT: "default",
8
- PAGE: "page"
9
- }, Q = {
10
- key: 0,
11
- class: "flex justify-center w-full"
12
- }, W = {
13
- class: "dialog-content flex flex-col",
14
- style: { width: "60%" }
15
- }, X = {
16
- key: 0,
17
- class: "title-name flex items-center"
18
- }, Y = { class: "dialog-footer" }, Z = {
19
- key: 0,
20
- class: "flex justify-center items-center w-full"
21
- }, ee = {
22
- class: "flex justify-center items-center",
23
- style: { width: "60%" }
24
- }, oe = { class: "flex justify-end items-center w-full" }, te = /* @__PURE__ */ Object.assign({
25
- name: "CustomDialog"
26
- }, {
27
- __name: "layout",
28
- props: {
29
- // 绑定值
30
- modelValue: {
31
- type: Boolean,
32
- default: !1
33
- },
34
- // 对话框宽度
35
- width: {
36
- type: [String, Number],
37
- default: "50%"
38
- },
39
- // 是否可以通过点击 modal 关闭对话框
40
- closeOnClickModal: {
41
- type: Boolean,
42
- default: !1
43
- },
44
- // 是否可以通过按下 ESC 关闭对话框
45
- closeOnPressEscape: {
46
- type: Boolean,
47
- default: !1
48
- },
49
- // 是否在对话框出现时将 body 滚动锁定
50
- lockScroll: {
51
- type: Boolean,
52
- default: !0
53
- },
54
- // 关闭图标
55
- closeIcon: {
56
- type: Object,
57
- default: H
58
- },
59
- // 按钮配置对象
60
- buttons: {
61
- type: Object,
62
- default: () => ({})
63
- },
64
- appendToBody: {
65
- type: Boolean,
66
- default: !0
67
- },
68
- // 弹窗覆盖的模式 default|page
69
- dialogMode: {
70
- type: String,
71
- default: t.DEFAULT
72
- },
73
- // route模式下标题值
74
- titleName: {
75
- type: String,
76
- default: "默认标题"
77
- }
78
- },
79
- emits: [
80
- e.updateModelValue,
81
- e.open,
82
- e.opened,
83
- e.close,
84
- e.closed,
85
- e.openAutoFocus,
86
- e.closeAutoFocus,
87
- e.cancel,
88
- e.confirm
89
- ],
90
- setup(u, { emit: M }) {
91
- const P = {
92
- showCancel: !0,
93
- showConfirm: !0,
94
- cancelText: "取消",
95
- confirmText: "确认",
96
- onCancel: null,
97
- onConfirm: null
98
- }, o = u, m = $(), n = M, b = d(() => o.dialogMode === t.PAGE ? {
99
- marginLeft: "250px",
100
- borderRadius: "24px",
101
- boxShadow: "none"
102
- } : {}), _ = d(() => o.dialogMode === t.PAGE ? !1 : m.modal ? m.modal : !0), B = d(() => o.dialogMode === t.PAGE ? !0 : m.modalPenetrable ? m.modalPenetrable : !1), V = d(() => o.dialogMode === t.PAGE ? "calc(100% - 250px - 12px)" : o.width), F = d(() => o.dialogMode === t.PAGE ? "66px" : o.top || "15vh"), i = d({
103
- get: () => o.modelValue,
104
- set: (s) => {
105
- n(e.updateModelValue, s);
106
- }
107
- }), l = d(() => ({
108
- ...P,
109
- ...o.buttons
110
- })), G = d(() => {
111
- const { modelValue: s, ...f } = o;
112
- return f;
113
- }), O = () => {
114
- n(e.open);
115
- }, T = () => {
116
- n(e.opened);
117
- }, S = () => {
118
- n(e.close);
119
- }, j = () => {
120
- n(e.closed);
121
- }, N = () => {
122
- n(e.openAutoFocus);
123
- }, D = () => {
124
- n(e.closeAutoFocus);
125
- }, I = () => {
126
- l.value.onCancel ? l.value.onCancel() : i.value = !1, n(e.cancel);
127
- }, k = async () => {
128
- if (l.value.onConfirm)
129
- try {
130
- await l.value.onConfirm() !== !1 && (i.value = !1);
131
- } catch {
132
- }
133
- else
134
- i.value = !1;
135
- n(e.confirm);
136
- };
137
- return L(() => {
138
- o.dialogMode === t.PAGE && (document.querySelector(".el-overlay-dialog").style.overflow = "hidden");
139
- }), (s, f) => (c(), p(a(q), U({
140
- ref: "dialogRef",
141
- modelValue: i.value,
142
- "onUpdate:modelValue": f[1] || (f[1] = (w) => i.value = w)
143
- }, G.value, {
144
- width: V.value,
145
- top: F.value,
146
- style: b.value,
147
- modal: _.value,
148
- "modal-penetrable": B.value,
149
- onOpen: O,
150
- onOpened: T,
151
- onClose: S,
152
- onClosed: j,
153
- onOpenAutoFocus: N,
154
- onCloseAutoFocus: D,
155
- "append-to-body": u.appendToBody,
156
- class: {
157
- "custom-dialog-page": u.dialogMode === a(t).PAGE
158
- }
159
- }), {
160
- header: r(() => [
161
- u.dialogMode === a(t).PAGE ? (c(), y("div", X, [
162
- E(a(z), {
163
- size: 20,
164
- color: "var(--text-color-1)",
165
- class: "mg-r-6 pointer",
166
- onClick: f[0] || (f[0] = (w) => i.value = !1)
167
- }, {
168
- default: r(() => [
169
- E(a(J))
170
- ]),
171
- _: 1
172
- }),
173
- h(" " + C(u.titleName), 1)
174
- ])) : g(s.$slots, "header", { key: 1 }, void 0, !0)
175
- ]),
176
- footer: r(() => [
177
- g(s.$slots, "footer", {}, () => [
178
- v("div", Y, [
179
- u.dialogMode === a(t).PAGE ? (c(), y("div", Z, [
180
- v("div", ee, [
181
- v("div", oe, [
182
- l.value.showConfirm ? (c(), p(a(x), {
183
- key: 0,
184
- type: "primary",
185
- onClick: k
186
- }, {
187
- default: r(() => [
188
- h(C(l.value.confirmText), 1)
189
- ]),
190
- _: 1
191
- })) : A("", !0)
192
- ])
193
- ])
194
- ])) : (c(), y(R, { key: 1 }, [
195
- l.value.showCancel ? (c(), p(a(x), {
196
- key: 0,
197
- onClick: I
198
- }, {
199
- default: r(() => [
200
- h(C(l.value.cancelText), 1)
201
- ]),
202
- _: 1
203
- })) : A("", !0),
204
- l.value.showConfirm ? (c(), p(a(x), {
205
- key: 1,
206
- type: "primary",
207
- onClick: k
208
- }, {
209
- default: r(() => [
210
- h(C(l.value.confirmText), 1)
211
- ]),
212
- _: 1
213
- })) : A("", !0)
214
- ], 64))
215
- ])
216
- ], !0)
217
- ]),
218
- default: r(() => [
219
- u.dialogMode === a(t).PAGE ? (c(), y("div", Q, [
220
- v("div", W, [
221
- g(s.$slots, "default", {}, void 0, !0)
222
- ])
223
- ])) : g(s.$slots, "default", { key: 1 }, void 0, !0)
224
- ]),
225
- _: 3
226
- }, 16, ["modelValue", "width", "top", "style", "modal", "modal-penetrable", "append-to-body", "class"]));
227
- }
228
- }), ce = /* @__PURE__ */ K(te, [["__scopeId", "data-v-9fa594c0"]]);
229
- export {
230
- ce as C
231
- };
@@ -1,39 +0,0 @@
1
- import { useCssVars as o, createElementBlock as c, openBlock as n, toDisplayString as a } from "vue";
2
- import { _ as s } from "./_plugin-vue_export-helper.CHgC5LLL.js";
3
- import '../assets/layout3.css';const r = { class: "custom-title" }, i = /* @__PURE__ */ Object.assign({
4
- name: "CustomTitle"
5
- }, {
6
- __name: "layout",
7
- props: {
8
- // 标题内容
9
- content: {
10
- type: String,
11
- default: "自定义标题"
12
- },
13
- // 字体大小
14
- fontSize: {
15
- type: Number,
16
- default: 18
17
- },
18
- // 字体颜色
19
- color: {
20
- type: String,
21
- default: "var(--text-color-1)"
22
- },
23
- // 字体粗细
24
- fontWeight: {
25
- type: Number,
26
- default: 700
27
- }
28
- },
29
- setup(t) {
30
- return o((e) => ({
31
- v47d985ee: t.fontWeight,
32
- v6d50a5d6: t.fontSize + "px",
33
- v4b029cbc: t.color
34
- })), (e, l) => (n(), c("div", r, a(t.content), 1));
35
- }
36
- }), d = /* @__PURE__ */ s(i, [["__scopeId", "data-v-4d572364"]]);
37
- export {
38
- d as C
39
- };
@@ -1,149 +0,0 @@
1
- import { useCssVars as L, ref as N, watch as U, createElementBlock as u, createCommentVNode as v, openBlock as r, Fragment as x, renderList as j, normalizeClass as z, unref as o, createElementVNode as m, createBlock as f, normalizeStyle as O, withCtx as S, resolveDynamicComponent as T, toDisplayString as k, renderSlot as M, createVNode as E } from "vue";
2
- import { ElImage as R, ElIcon as w } from "element-plus";
3
- import { emitsMap as c, uploadFileTypeMap as P, uploadFileType as a } from "ling-yun-methods";
4
- import { IconTxt as A, IconPpt as F, IconXls as I, IconDoc as b, IconPdf as G, IconDelete as K } from "color-message-lingyun-vue";
5
- import { _ as X } from "./_plugin-vue_export-helper.CHgC5LLL.js";
6
- import '../assets/layout5.css';const i = {
7
- uploading: "uploading",
8
- success: "success",
9
- error: "error"
10
- }, q = {
11
- key: 0,
12
- class: "file-list display-grid pd-t-12 pd-b-12"
13
- }, H = { class: "flex overflow-hidden flex-1 pd-r-10" }, J = { class: "pd-l-8 flex-1 overflow-hidden" }, Q = ["title"], W = { class: "fz-12 text-ellipsis lh-16" }, Y = {
14
- key: 1,
15
- class: "text-74798c"
16
- }, Z = /* @__PURE__ */ Object.assign({
17
- name: "FileList"
18
- }, {
19
- __name: "layout",
20
- props: {
21
- // 文件列表数据
22
- modelValue: {
23
- type: Array,
24
- default: () => []
25
- },
26
- // 是否显示删除按钮
27
- showDelete: {
28
- type: Boolean,
29
- default: !0
30
- },
31
- // 字段映射配置
32
- fieldMapping: {
33
- type: Object,
34
- default: () => ({
35
- // fileName: 'fileName',
36
- // fileUrl: 'fileUrl',
37
- })
38
- },
39
- rowCount: {
40
- type: Number,
41
- default: 2
42
- },
43
- // 图标大小
44
- iconSize: {
45
- type: Number,
46
- default: 36
47
- }
48
- },
49
- emits: [c.delete, c.change, c.updateModelValue],
50
- setup(l, { emit: _ }) {
51
- L((e) => ({
52
- v247946fe: l.rowCount
53
- }));
54
- const p = l, y = _, n = N(p.modelValue), B = Object.fromEntries(
55
- Object.entries(P).map(([e, s]) => [s, e])
56
- ), g = (e) => e[p.fieldMapping.fileUrl] ? e[p.fieldMapping.fileUrl] : e.raw && e.raw instanceof File ? URL.createObjectURL(e.raw) : e instanceof File ? URL.createObjectURL(e) : "", C = {
57
- [a.pdf]: G,
58
- [a.doc]: b,
59
- [a.docx]: b,
60
- [a.xls]: I,
61
- [a.xlsx]: I,
62
- [a.ppt]: F,
63
- [a.pptx]: F,
64
- [a.txt]: A
65
- }, V = (e) => e?.includes("image"), $ = (e) => {
66
- const s = B[e];
67
- return C[s];
68
- }, h = (e) => {
69
- if (!e || e === 0) return "0 B";
70
- const s = 1024, t = ["B", "KB", "MB", "GB"], d = Math.floor(Math.log(e) / Math.log(s));
71
- return `${parseFloat((e / Math.pow(s, d)).toFixed(2))} ${t[d]}`;
72
- }, D = (e, s) => {
73
- n.value.splice(s, 1), y(c.delete, e), y(c.updateModelValue, n.value), y(c.change, n.value);
74
- };
75
- return U(
76
- () => p.modelValue,
77
- (e) => {
78
- n.value = e;
79
- },
80
- { immediate: !0 }
81
- ), (e, s) => n.value?.length ? (r(), u("div", q, [
82
- (r(!0), u(x, null, j(n.value, (t, d) => (r(), u("div", {
83
- key: d,
84
- class: z(["pd-l-8 pd-r-8 pd-t-6 pd-b-6 radius-8 file-item overflow-hidden flex items-center", {
85
- "bg-uploading": t.fileStatus === o(i).uploading,
86
- "bg-fcfdff": t.fileStatus !== o(i).uploading,
87
- "border-error": t.fileStatus === o(i).error,
88
- "border-normal": t.fileStatus !== o(i).error
89
- }])
90
- }, [
91
- m("div", H, [
92
- V(t?.type) && g(t) ? (r(), f(o(R), {
93
- key: 0,
94
- src: g(t),
95
- class: "radius-4",
96
- fit: "cover",
97
- style: O({ width: `${l.iconSize}px`, height: `${l.iconSize}px` })
98
- }, null, 8, ["src", "style"])) : (r(), f(o(w), {
99
- key: 1,
100
- size: l.iconSize,
101
- class: "pointer"
102
- }, {
103
- default: S(() => [
104
- (r(), f(T($(t?.type))))
105
- ]),
106
- _: 2
107
- }, 1032, ["size"])),
108
- m("div", J, [
109
- m("div", {
110
- class: z(["fz-14 text-ellipsis lh-20 flex-1", {
111
- "text-ec0e13": t.fileStatus === o(i).error,
112
- "text-262626": t.fileStatus !== o(i).error
113
- }]),
114
- title: t[l.fieldMapping.fileName]
115
- }, k(t[l.fieldMapping.fileName]), 11, Q),
116
- m("div", W, [
117
- e.$slots.status ? M(e.$slots, "status", {
118
- key: 0,
119
- file: t
120
- }, void 0, !0) : (r(), u(x, { key: 1 }, [
121
- e.$slots.size ? M(e.$slots, "size", {
122
- key: 0,
123
- file: t,
124
- size: h(t.size)
125
- }, void 0, !0) : (r(), u("span", Y, k(h(t.size)), 1))
126
- ], 64))
127
- ])
128
- ])
129
- ]),
130
- l.showDelete ? (r(), f(o(w), {
131
- key: 0,
132
- size: 16,
133
- color: t.fileStatus === o(i).error ? "var(--error-color-1)" : "var(--text-color-4)",
134
- class: "pointer",
135
- onClick: (ee) => D(t, d)
136
- }, {
137
- default: S(() => [
138
- E(o(K))
139
- ]),
140
- _: 1
141
- }, 8, ["color", "onClick"])) : v("", !0)
142
- ], 2))), 128))
143
- ])) : v("", !0);
144
- }
145
- }), ae = /* @__PURE__ */ X(Z, [["__scopeId", "data-v-0980a743"]]);
146
- export {
147
- ae as _,
148
- i as u
149
- };
File without changes