@farris/ui-vue 1.0.0-beta.1 → 1.0.0-beta.3
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/accordion/index.esm.js +93 -0
- package/accordion/index.umd.js +1 -0
- package/accordion/package.json +7 -0
- package/accordion/style.css +1 -0
- package/avatar/index.esm.js +94 -0
- package/avatar/index.umd.js +1 -0
- package/avatar/package.json +7 -0
- package/avatar/style.css +1 -0
- package/button/index.esm.js +206 -0
- package/button/index.umd.js +1 -0
- package/button/package.json +7 -0
- package/button-edit/index.esm.js +300 -0
- package/button-edit/index.umd.js +1 -0
- package/button-edit/package.json +7 -0
- package/checkbox/index.esm.js +97 -0
- package/checkbox/index.umd.js +1 -0
- package/checkbox/package.json +7 -0
- package/combo-list/index.esm.js +457 -0
- package/combo-list/index.umd.js +1 -0
- package/combo-list/package.json +7 -0
- package/data-grid/index.esm.js +1536 -0
- package/data-grid/index.umd.js +1 -0
- package/data-grid/package.json +7 -0
- package/data-grid/style.css +1 -0
- package/date-picker/index.esm.js +1479 -0
- package/date-picker/index.umd.js +1 -0
- package/date-picker/package.json +7 -0
- package/date-picker/style.css +1 -0
- package/farris.all.esm.js +6378 -0
- package/farris.all.umd.js +1 -0
- package/list-view/index.esm.js +144 -0
- package/list-view/index.umd.js +1 -0
- package/list-view/package.json +7 -0
- package/list-view/style.css +1 -0
- package/message-box/index.esm.js +499 -0
- package/message-box/index.umd.js +1 -0
- package/message-box/package.json +7 -0
- package/modal/index.esm.js +165 -0
- package/modal/index.umd.js +1 -0
- package/modal/package.json +7 -0
- package/notify/index.esm.js +187 -0
- package/notify/index.umd.js +1 -0
- package/notify/package.json +7 -0
- package/notify/style.css +1 -0
- package/package.json +4 -4
- package/pagination/index.esm.js +334 -0
- package/pagination/index.umd.js +1 -0
- package/pagination/package.json +7 -0
- package/pagination/style.css +1 -0
- package/popover/index.esm.js +83 -0
- package/popover/index.umd.js +1 -0
- package/popover/package.json +7 -0
- package/popover/style.css +1 -0
- package/radio-group/index.esm.js +79 -0
- package/radio-group/index.umd.js +1 -0
- package/radio-group/package.json +7 -0
- package/section/index.esm.js +70 -0
- package/section/index.umd.js +1 -0
- package/section/package.json +7 -0
- package/switch/index.esm.js +78 -0
- package/switch/index.umd.js +1 -0
- package/switch/package.json +7 -0
- package/tabs/index.esm.js +385 -0
- package/tabs/index.umd.js +1 -0
- package/tabs/package.json +7 -0
- package/tabs/style.css +1 -0
- package/text/index.esm.js +33 -0
- package/text/index.umd.js +1 -0
- package/text/package.json +7 -0
- package/tooltip/index.esm.js +195 -0
- package/tooltip/index.umd.js +1 -0
- package/tooltip/package.json +7 -0
- package/tooltip/style.css +1 -0
- package/src/index.esm.js +0 -10535
- package/src/index.umd.js +0 -8
- /package/{src/style.css → style.css} +0 -0
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
import { defineComponent as Z, ref as t, computed as s, createVNode as e, createTextVNode as re, Fragment as ie, watch as de, Teleport as pe, reactive as g, createApp as ve, onUnmounted as me, mergeProps as ye } from "vue";
|
|
2
|
+
const fe = {
|
|
3
|
+
type: { Type: String, default: "info" },
|
|
4
|
+
title: { Type: String, default: "" },
|
|
5
|
+
detail: { Type: String, default: "" },
|
|
6
|
+
okButtonText: { Type: String, default: "\u786E\u5B9A" },
|
|
7
|
+
cancelButtonText: { Type: String, default: "\u53D6\u6D88" },
|
|
8
|
+
exceptionInfo: { Type: Object, default: { date: "", message: "", detail: "" } }
|
|
9
|
+
};
|
|
10
|
+
function K() {
|
|
11
|
+
return new DOMException("The request is not allowed", "NotAllowedError");
|
|
12
|
+
}
|
|
13
|
+
async function he(l) {
|
|
14
|
+
if (!navigator.clipboard)
|
|
15
|
+
throw K();
|
|
16
|
+
return navigator.clipboard.writeText(l);
|
|
17
|
+
}
|
|
18
|
+
async function ge(l) {
|
|
19
|
+
const n = document.createElement("span");
|
|
20
|
+
n.textContent = l, n.style.whiteSpace = "pre", n.style.webkitUserSelect = "auto", n.style.userSelect = "all", document.body.appendChild(n);
|
|
21
|
+
const a = window.getSelection(), c = window.document.createRange();
|
|
22
|
+
a == null || a.removeAllRanges(), c.selectNode(n), a == null || a.addRange(c);
|
|
23
|
+
let i = !1;
|
|
24
|
+
try {
|
|
25
|
+
i = window.document.execCommand("copy");
|
|
26
|
+
} finally {
|
|
27
|
+
a == null || a.removeAllRanges(), window.document.body.removeChild(n);
|
|
28
|
+
}
|
|
29
|
+
if (!i)
|
|
30
|
+
throw K();
|
|
31
|
+
}
|
|
32
|
+
async function xe(l) {
|
|
33
|
+
try {
|
|
34
|
+
await he(l);
|
|
35
|
+
} catch (n) {
|
|
36
|
+
try {
|
|
37
|
+
await ge(l);
|
|
38
|
+
} catch (a) {
|
|
39
|
+
throw a || n || K();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function be(l, n) {
|
|
44
|
+
async function a(c) {
|
|
45
|
+
await xe(c);
|
|
46
|
+
}
|
|
47
|
+
return { onCopy: a };
|
|
48
|
+
}
|
|
49
|
+
const J = Z({
|
|
50
|
+
name: "FMessageBox",
|
|
51
|
+
props: fe,
|
|
52
|
+
emits: ["accept", "reject", "close"],
|
|
53
|
+
setup(l, n) {
|
|
54
|
+
const a = t(l.type), c = t(l.title), i = t(l.detail), r = t(l.exceptionInfo);
|
|
55
|
+
t("");
|
|
56
|
+
const B = t(14), p = t(140);
|
|
57
|
+
t(""), t("");
|
|
58
|
+
const h = t(!1), x = t(""), S = t(i.value.length), m = t([]), T = t(l.okButtonText), b = t(l.cancelButtonText), A = t(!0), $ = t(!0), H = t(!0), j = t("\u590D\u5236\u8BE6\u7EC6\u4FE1\u606F"), w = t(3), D = t(480), C = s(() => {
|
|
59
|
+
const o = {
|
|
60
|
+
"modal-tips": !0,
|
|
61
|
+
"d-flex": !0,
|
|
62
|
+
"flex-row": !0
|
|
63
|
+
}, v = `messager-type-${a.value}`;
|
|
64
|
+
return o[v] = !0, o;
|
|
65
|
+
}), M = s(() => {
|
|
66
|
+
const o = {};
|
|
67
|
+
return a.value === "prompt" ? o.padding = "0.5rem 0.5rem 1rem 1.5rem" : a.value === "error" && (o.padding = "0.5rem 1.5rem 1rem 1.5rem"), o;
|
|
68
|
+
}), z = s(() => {
|
|
69
|
+
const o = {
|
|
70
|
+
"f-icon": !0
|
|
71
|
+
}, v = `f-icon-${a.value}`;
|
|
72
|
+
return o[v] = !0, o;
|
|
73
|
+
}), V = s(() => c.value || r.value && r.value.message), O = s(() => i.value), I = s(() => !!i.value), R = s(() => !!r.value), N = s(() => !!r.value && !!r.value.date), q = s(() => `\u53D1\u751F\u65F6\u95F4 : ${r.value && r.value.date || ""}`), L = s(() => !!r.value && !!r.value.detail), _ = s(() => {
|
|
74
|
+
const o = `${D.value}px`;
|
|
75
|
+
return {
|
|
76
|
+
overflow: "hidden",
|
|
77
|
+
"text-overflow": "ellipsis",
|
|
78
|
+
display: "-webkit-box",
|
|
79
|
+
"-webkit-box-orient": "vertical",
|
|
80
|
+
"-webkit-line-clamp": w.value,
|
|
81
|
+
"max-height": o
|
|
82
|
+
};
|
|
83
|
+
}), F = s(() => r.value && r.value.detail || ""), P = s(() => !0), y = t(!1), U = t("\u5C55\u5F00"), W = t("\u6536\u8D77"), G = s(() => {
|
|
84
|
+
const o = {
|
|
85
|
+
display: "block",
|
|
86
|
+
color: "#2A87FF"
|
|
87
|
+
};
|
|
88
|
+
return o["text-align"] = y.value ? "" : "right", o;
|
|
89
|
+
});
|
|
90
|
+
function u(o, v) {
|
|
91
|
+
y.value = !y.value, w.value = y.value ? 20 : 3;
|
|
92
|
+
}
|
|
93
|
+
function f(o) {
|
|
94
|
+
return u();
|
|
95
|
+
}
|
|
96
|
+
function d(o) {
|
|
97
|
+
return u();
|
|
98
|
+
}
|
|
99
|
+
const k = s(() => ({
|
|
100
|
+
"font-size": `${B.value}px`,
|
|
101
|
+
height: "100%"
|
|
102
|
+
}));
|
|
103
|
+
function ee(o) {
|
|
104
|
+
if (o.currentTarget) {
|
|
105
|
+
const v = o.currentTarget.value || "";
|
|
106
|
+
S.value = v.length;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
s(() => h.value && p.value);
|
|
110
|
+
const te = s(() => !(m.value && m.value.length) && (T.value || b.value));
|
|
111
|
+
s(() => a.value === "prompt" && A.value);
|
|
112
|
+
const ae = s(() => $.value && b.value), le = s(() => H.value && T.value);
|
|
113
|
+
function oe(o) {
|
|
114
|
+
a.value === "question" && n.emit("reject"), n.emit("close");
|
|
115
|
+
}
|
|
116
|
+
function se(o) {
|
|
117
|
+
a.value === "question" && n.emit("accept"), n.emit("close");
|
|
118
|
+
}
|
|
119
|
+
const ne = s(() => !!(m.value && m.value.length)), Q = s(() => r.value && r.value.date && r.value.message && r.value.detail), {
|
|
120
|
+
onCopy: ce
|
|
121
|
+
} = be(), X = t("\u590D\u5236\u6210\u529F"), E = t(!1);
|
|
122
|
+
function Y(o) {
|
|
123
|
+
ce(F.value).catch((v) => {
|
|
124
|
+
X.value = "\u590D\u5236\u5931\u8D25";
|
|
125
|
+
}).finally(() => {
|
|
126
|
+
E.value = !0, setTimeout(() => {
|
|
127
|
+
E.value = !1;
|
|
128
|
+
}, 700);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
const ue = s(() => {
|
|
132
|
+
const o = {
|
|
133
|
+
position: "absolute",
|
|
134
|
+
left: "50%",
|
|
135
|
+
top: "50%",
|
|
136
|
+
width: "100px",
|
|
137
|
+
height: "40px",
|
|
138
|
+
background: "#303C53",
|
|
139
|
+
"line-height": "40px",
|
|
140
|
+
"text-align": "center",
|
|
141
|
+
"margin-left": "-30px",
|
|
142
|
+
"margin-top": "-50px",
|
|
143
|
+
"border-radius": "10px",
|
|
144
|
+
"box-shadow": "0px 2px 8px 0px",
|
|
145
|
+
color: "#fff",
|
|
146
|
+
transition: "all .3s ease"
|
|
147
|
+
};
|
|
148
|
+
return o.opacity = E.value ? "0.8" : "0", o.display = E.value ? "" : "none", o;
|
|
149
|
+
});
|
|
150
|
+
return () => e("div", {
|
|
151
|
+
class: "farris-messager"
|
|
152
|
+
}, [a.value !== "prompt" && e("section", {
|
|
153
|
+
class: C.value,
|
|
154
|
+
style: M.value
|
|
155
|
+
}, [e("div", {
|
|
156
|
+
class: "float-left modal-tips-iconwrap"
|
|
157
|
+
}, [e("span", {
|
|
158
|
+
class: z.value
|
|
159
|
+
}, null)]), e("div", {
|
|
160
|
+
class: "modal-tips-content"
|
|
161
|
+
}, [e("p", {
|
|
162
|
+
class: "toast-msg-title",
|
|
163
|
+
innerHTML: V.value
|
|
164
|
+
}, null), I.value && e("p", {
|
|
165
|
+
class: "toast-msg-detail",
|
|
166
|
+
innerHTML: O.value
|
|
167
|
+
}, null), R.value && e("div", {
|
|
168
|
+
class: "toast-msg-detail"
|
|
169
|
+
}, [N.value && e("div", null, [q.value]), L.value && e("div", {
|
|
170
|
+
id: "exception_error_msg",
|
|
171
|
+
ref: "exceptionMessageRef",
|
|
172
|
+
style: _.value
|
|
173
|
+
}, [re("\u8BE6\u7EC6\u4FE1\u606F : "), e("span", {
|
|
174
|
+
innerHTML: F.value
|
|
175
|
+
}, null)]), P.value && e("span", {
|
|
176
|
+
style: G.value
|
|
177
|
+
}, [y.value && e("span", {
|
|
178
|
+
onClick: f,
|
|
179
|
+
style: "cursor: pointer;"
|
|
180
|
+
}, [W.value]), !y.value && e("span", {
|
|
181
|
+
onClick: d,
|
|
182
|
+
style: "cursor: pointer;"
|
|
183
|
+
}, [U.value])])])])]), a.value === "prompt" && e(ie, null, [e("section", {
|
|
184
|
+
class: C.value,
|
|
185
|
+
style: M.value
|
|
186
|
+
}, [e("div", {
|
|
187
|
+
class: "flex-fill fixdiv mb-1 mr-3"
|
|
188
|
+
}, [e("textarea", {
|
|
189
|
+
title: "promptMessage",
|
|
190
|
+
name: "promptMessage",
|
|
191
|
+
class: "form-control",
|
|
192
|
+
style: k.value,
|
|
193
|
+
rows: "4",
|
|
194
|
+
maxlength: p.value,
|
|
195
|
+
onInput: (o) => ee(o)
|
|
196
|
+
}, [O.value])])]), e("span", {
|
|
197
|
+
class: "textarea-wordcount",
|
|
198
|
+
title: x.value,
|
|
199
|
+
style: "position: absolute; bottom: 76px; right: 32px; cursor: pointer; text-align: right;"
|
|
200
|
+
}, [S.value + " / " + p.value])]), te.value && e("div", {
|
|
201
|
+
class: "modal-footer"
|
|
202
|
+
}, [Q.value && e("span", {
|
|
203
|
+
style: "width: 100%;color: #2A87FF;padding-left: 37px;"
|
|
204
|
+
}, [e("span", {
|
|
205
|
+
onClick: Y,
|
|
206
|
+
style: "cursor: pointer;"
|
|
207
|
+
}, [j.value])]), ae.value && e("button", {
|
|
208
|
+
type: "button",
|
|
209
|
+
class: "btn btn-secondary btn-lg",
|
|
210
|
+
onClick: oe
|
|
211
|
+
}, [b.value]), le.value && e("button", {
|
|
212
|
+
type: "button",
|
|
213
|
+
class: "btn btn-primary btn-lg",
|
|
214
|
+
onClick: se
|
|
215
|
+
}, [T.value])]), ne.value && e("div", {
|
|
216
|
+
class: "modal-footer"
|
|
217
|
+
}, [Q.value && e("span", {
|
|
218
|
+
style: "width: 100%;color: #2A87FF;padding-left: 37px;"
|
|
219
|
+
}, [e("span", {
|
|
220
|
+
onClick: Y,
|
|
221
|
+
style: "cursor: pointer;"
|
|
222
|
+
}, [j.value])]), m.value.length && m.value.map((o) => e("button", {
|
|
223
|
+
type: "button",
|
|
224
|
+
onClick: o.handle,
|
|
225
|
+
class: o.class
|
|
226
|
+
}, [o.iconClass && e("span", {
|
|
227
|
+
class: o.iconClass
|
|
228
|
+
}, null), o.text]))]), e("div", {
|
|
229
|
+
style: ue.value
|
|
230
|
+
}, [X.value])]);
|
|
231
|
+
}
|
|
232
|
+
}), we = {
|
|
233
|
+
class: { type: String, default: "" },
|
|
234
|
+
title: { type: String, default: "" },
|
|
235
|
+
width: { type: Number, default: 500 },
|
|
236
|
+
height: { type: Number, default: 320 },
|
|
237
|
+
buttons: {
|
|
238
|
+
type: Array,
|
|
239
|
+
default: []
|
|
240
|
+
},
|
|
241
|
+
modelValue: { type: Boolean, default: !1 },
|
|
242
|
+
showHeader: { type: Boolean, default: !0 },
|
|
243
|
+
showButtons: { type: Boolean, default: !0 }
|
|
244
|
+
}, Ce = Z({
|
|
245
|
+
name: "FModal",
|
|
246
|
+
props: we,
|
|
247
|
+
emits: ["update:modelValue"],
|
|
248
|
+
setup(l, n) {
|
|
249
|
+
const a = t(l.width), c = t(l.height), i = t(l.modelValue), r = t(""), B = t(l.class), p = t(!0), h = t(l.showHeader), x = t(""), S = t(!0), m = t(!1), T = t(!1), b = t(""), A = t(""), $ = t(""), H = t(l.showButtons), j = t(l.title);
|
|
250
|
+
function w(u, f) {
|
|
251
|
+
i.value = !1, n.emit("update:modelValue", !1);
|
|
252
|
+
}
|
|
253
|
+
const D = [{
|
|
254
|
+
text: "\u53D6\u6D88",
|
|
255
|
+
class: "btn btn-light",
|
|
256
|
+
handle: (u) => {
|
|
257
|
+
w();
|
|
258
|
+
}
|
|
259
|
+
}, {
|
|
260
|
+
text: "\u786E\u5B9A",
|
|
261
|
+
class: "btn btn-primary",
|
|
262
|
+
handle: (u) => {
|
|
263
|
+
w();
|
|
264
|
+
}
|
|
265
|
+
}], C = t(l.buttons && l.buttons.length ? l.buttons : D), M = s(() => !!x.value), z = s(() => !!H.value && !!C.value);
|
|
266
|
+
t(), t(), de(() => l.modelValue, () => {
|
|
267
|
+
i.value = l.modelValue;
|
|
268
|
+
});
|
|
269
|
+
const V = t(!1), O = s(() => i.value), I = s(() => {
|
|
270
|
+
const u = {
|
|
271
|
+
modal: !0,
|
|
272
|
+
"farris-modal": !0
|
|
273
|
+
};
|
|
274
|
+
return u["f-modal-fitContent"] = p.value, u;
|
|
275
|
+
}), R = s(() => ({
|
|
276
|
+
display: O.value ? "block" : "none !important"
|
|
277
|
+
})), N = s(() => {
|
|
278
|
+
const u = {
|
|
279
|
+
"modal-dialog": !0
|
|
280
|
+
};
|
|
281
|
+
return B.value.split(" ").reduce((d, k) => (d[k] = !0, d), u), u;
|
|
282
|
+
}), q = s(() => ({
|
|
283
|
+
position: "absolute",
|
|
284
|
+
top: "50%",
|
|
285
|
+
left: "50%",
|
|
286
|
+
width: `${a.value}px`,
|
|
287
|
+
height: p.value ? "auto" : `${c.value}px`,
|
|
288
|
+
"margin-left": `${0 - a.value / 2}px`,
|
|
289
|
+
"margin-top": p.value ? "auto" : `${0 - c.value / 2}px`
|
|
290
|
+
})), L = s(() => ({
|
|
291
|
+
"modal-content": !0,
|
|
292
|
+
"modal-content-has-header": h.value
|
|
293
|
+
})), _ = s(() => ({
|
|
294
|
+
display: h.value ? "" : "none"
|
|
295
|
+
})), F = s(() => ({
|
|
296
|
+
"f-icon": !0,
|
|
297
|
+
modal_maximize: !0,
|
|
298
|
+
modalrevert: V.value
|
|
299
|
+
})), P = s(() => ({
|
|
300
|
+
height: "10px",
|
|
301
|
+
"z-index": 1,
|
|
302
|
+
display: h.value ? "none" : ""
|
|
303
|
+
})), y = s(() => ({
|
|
304
|
+
"modal-body": !0,
|
|
305
|
+
"f-utils-flex-column": b.value === "iframe"
|
|
306
|
+
}));
|
|
307
|
+
function U() {
|
|
308
|
+
return {};
|
|
309
|
+
}
|
|
310
|
+
const W = s(() => {
|
|
311
|
+
const u = {
|
|
312
|
+
textAlgin: $.value
|
|
313
|
+
}, f = U();
|
|
314
|
+
return Object.assign(u, f);
|
|
315
|
+
});
|
|
316
|
+
function G(u) {
|
|
317
|
+
}
|
|
318
|
+
return () => e(pe, {
|
|
319
|
+
to: "body"
|
|
320
|
+
}, {
|
|
321
|
+
default: () => {
|
|
322
|
+
var u, f;
|
|
323
|
+
return [e("div", {
|
|
324
|
+
class: I.value,
|
|
325
|
+
style: R.value
|
|
326
|
+
}, [e("div", {
|
|
327
|
+
id: r.value,
|
|
328
|
+
class: N.value,
|
|
329
|
+
style: q.value
|
|
330
|
+
}, [e("div", {
|
|
331
|
+
class: L.value
|
|
332
|
+
}, [e("div", {
|
|
333
|
+
ref: "modalHeaderRef",
|
|
334
|
+
class: "modal-header",
|
|
335
|
+
style: _.value
|
|
336
|
+
}, [e("div", {
|
|
337
|
+
class: "modal-title"
|
|
338
|
+
}, [M.value && e("span", {
|
|
339
|
+
class: x.value,
|
|
340
|
+
style: "margin-right: 8px"
|
|
341
|
+
}, null), e("span", {
|
|
342
|
+
class: "modal-title-label"
|
|
343
|
+
}, [j.value])]), e("div", {
|
|
344
|
+
class: "actions"
|
|
345
|
+
}, [e("ul", null, [T.value && e("li", {
|
|
346
|
+
class: "f-btn-icon f-bare"
|
|
347
|
+
}, [e("span", {
|
|
348
|
+
class: "f-icon modal_minimize"
|
|
349
|
+
}, null)]), m.value && e("li", {
|
|
350
|
+
onClick: G,
|
|
351
|
+
class: "f-btn-icon f-bare"
|
|
352
|
+
}, [e("span", {
|
|
353
|
+
class: F.value
|
|
354
|
+
}, null)]), S.value && e("li", {
|
|
355
|
+
class: "f-btn-icon f-bare",
|
|
356
|
+
onClick: (d) => w()
|
|
357
|
+
}, [e("span", {
|
|
358
|
+
class: "f-icon modal_close"
|
|
359
|
+
}, null)])])])]), e("div", {
|
|
360
|
+
ref: "dragableElementRef",
|
|
361
|
+
class: "f-utils-absolute-all",
|
|
362
|
+
style: P.value
|
|
363
|
+
}, null), e("div", {
|
|
364
|
+
class: y.value
|
|
365
|
+
}, [(f = (u = n.slots).default) == null ? void 0 : f.call(u), b.value === "iframe" && e("iframe", {
|
|
366
|
+
title: r.value,
|
|
367
|
+
class: "f-utils-fill",
|
|
368
|
+
width: "100%",
|
|
369
|
+
frameborder: "0",
|
|
370
|
+
src: A.value
|
|
371
|
+
}, null)]), z.value && e("div", {
|
|
372
|
+
class: "modal-footer",
|
|
373
|
+
style: W.value
|
|
374
|
+
}, [C.value && C.value.map((d) => e("button", {
|
|
375
|
+
type: "button",
|
|
376
|
+
class: d.class,
|
|
377
|
+
onClick: (k) => {
|
|
378
|
+
d.handle && d.handle(k);
|
|
379
|
+
}
|
|
380
|
+
}, [!!d.iconClass && e("span", {
|
|
381
|
+
class: d.iconClass
|
|
382
|
+
}, [d.text]), !d.iconClass && e("span", null, [d.text])]))])])])])];
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
function Be(l, n) {
|
|
388
|
+
const a = document.createElement("div");
|
|
389
|
+
a.style.display = "contents";
|
|
390
|
+
const c = ve({
|
|
391
|
+
setup() {
|
|
392
|
+
me(() => {
|
|
393
|
+
document.body.removeChild(a);
|
|
394
|
+
});
|
|
395
|
+
const i = t(!0), r = l.type === "error" || l.type === "prompt", B = l.type === "error" ? "\u9519\u8BEF\u63D0\u793A" : l.type === "prompt" ? l.title : "", p = l.acceptCallback || (() => {
|
|
396
|
+
}), h = l.rejectCallback || (() => {
|
|
397
|
+
});
|
|
398
|
+
return () => e(Ce, {
|
|
399
|
+
class: "modal-message modal-message-type-info",
|
|
400
|
+
title: B,
|
|
401
|
+
modelValue: i.value,
|
|
402
|
+
"onUpdate:modelValue": (x) => i.value = x,
|
|
403
|
+
"show-header": r,
|
|
404
|
+
"show-buttons": !1
|
|
405
|
+
}, {
|
|
406
|
+
default: () => [e(J, ye(l, {
|
|
407
|
+
onAccept: p,
|
|
408
|
+
onReject: h,
|
|
409
|
+
onClose: c.unmount
|
|
410
|
+
}), null)]
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
return document.body.appendChild(a), c.mount(a), c;
|
|
415
|
+
}
|
|
416
|
+
class Te {
|
|
417
|
+
static show(n) {
|
|
418
|
+
const a = g({
|
|
419
|
+
...n
|
|
420
|
+
});
|
|
421
|
+
Be(a);
|
|
422
|
+
}
|
|
423
|
+
static info(n, a) {
|
|
424
|
+
const c = g({
|
|
425
|
+
type: "info",
|
|
426
|
+
title: n,
|
|
427
|
+
detail: a,
|
|
428
|
+
okButtonText: "\u77E5\u9053\u4E86",
|
|
429
|
+
cancelButtonText: ""
|
|
430
|
+
});
|
|
431
|
+
this.show(c);
|
|
432
|
+
}
|
|
433
|
+
static warning(n, a) {
|
|
434
|
+
const c = g({
|
|
435
|
+
type: "warning",
|
|
436
|
+
title: n,
|
|
437
|
+
detail: a,
|
|
438
|
+
okButtonText: "\u77E5\u9053\u4E86",
|
|
439
|
+
cancelButtonText: ""
|
|
440
|
+
});
|
|
441
|
+
this.show(c);
|
|
442
|
+
}
|
|
443
|
+
static success(n, a) {
|
|
444
|
+
const c = g({
|
|
445
|
+
type: "success",
|
|
446
|
+
title: n,
|
|
447
|
+
detail: a,
|
|
448
|
+
okButtonText: "\u5173\u95ED",
|
|
449
|
+
cancelButtonText: ""
|
|
450
|
+
});
|
|
451
|
+
this.show(c);
|
|
452
|
+
}
|
|
453
|
+
static error(n, a, c) {
|
|
454
|
+
const i = g({
|
|
455
|
+
type: "error",
|
|
456
|
+
okButtonText: "\u5173\u95ED",
|
|
457
|
+
cancelButtonText: "",
|
|
458
|
+
exceptionInfo: {
|
|
459
|
+
date: c,
|
|
460
|
+
message: n,
|
|
461
|
+
detail: a
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
this.show(i);
|
|
465
|
+
}
|
|
466
|
+
static prompt(n, a) {
|
|
467
|
+
const c = g({
|
|
468
|
+
type: "prompt",
|
|
469
|
+
title: n,
|
|
470
|
+
detail: a,
|
|
471
|
+
okButtonText: "\u786E\u5B9A",
|
|
472
|
+
cancelButtonText: "\u53D6\u6D88"
|
|
473
|
+
});
|
|
474
|
+
this.show(c);
|
|
475
|
+
}
|
|
476
|
+
static question(n, a, c, i) {
|
|
477
|
+
const r = g({
|
|
478
|
+
type: "question",
|
|
479
|
+
title: n,
|
|
480
|
+
detail: a,
|
|
481
|
+
okButtonText: "\u786E\u5B9A",
|
|
482
|
+
cancelButtonText: "\u53D6\u6D88",
|
|
483
|
+
acceptCallback: c,
|
|
484
|
+
rejectCallback: i
|
|
485
|
+
});
|
|
486
|
+
this.show(r);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
const Se = {
|
|
490
|
+
install(l) {
|
|
491
|
+
l.component(J.name, J), l.provide("MessageBoxService", Te);
|
|
492
|
+
}
|
|
493
|
+
};
|
|
494
|
+
export {
|
|
495
|
+
J as FMessageBox,
|
|
496
|
+
Te as MessageBoxService,
|
|
497
|
+
Se as default,
|
|
498
|
+
fe as messageBoxProps
|
|
499
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(d,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(d=typeof globalThis<"u"?globalThis:d||self,e(d["message-box"]={},d.Vue))})(this,function(d,e){"use strict";const J={type:{Type:String,default:"info"},title:{Type:String,default:""},detail:{Type:String,default:""},okButtonText:{Type:String,default:"\u786E\u5B9A"},cancelButtonText:{Type:String,default:"\u53D6\u6D88"},exceptionInfo:{Type:Object,default:{date:"",message:"",detail:""}}};function O(){return new DOMException("The request is not allowed","NotAllowedError")}async function Z(o){if(!navigator.clipboard)throw O();return navigator.clipboard.writeText(o)}async function ee(o){const l=document.createElement("span");l.textContent=o,l.style.whiteSpace="pre",l.style.webkitUserSelect="auto",l.style.userSelect="all",document.body.appendChild(l);const t=window.getSelection(),n=window.document.createRange();t==null||t.removeAllRanges(),n.selectNode(l),t==null||t.addRange(n);let r=!1;try{r=window.document.execCommand("copy")}finally{t==null||t.removeAllRanges(),window.document.body.removeChild(l)}if(!r)throw O()}async function te(o){try{await Z(o)}catch(l){try{await ee(o)}catch(t){throw t||l||O()}}}function oe(o,l){async function t(n){await te(n)}return{onCopy:t}}const B=e.defineComponent({name:"FMessageBox",props:J,emits:["accept","reject","close"],setup(o,l){const t=e.ref(o.type),n=e.ref(o.title),r=e.ref(o.detail),c=e.ref(o.exceptionInfo);e.ref("");const C=e.ref(14),u=e.ref(140);e.ref(""),e.ref("");const h=e.ref(!1),g=e.ref(""),T=e.ref(r.value.length),m=e.ref([]),V=e.ref(o.okButtonText),x=e.ref(o.cancelButtonText),F=e.ref(!0),E=e.ref(!0),A=e.ref(!0),k=e.ref("\u590D\u5236\u8BE6\u7EC6\u4FE1\u606F"),b=e.ref(3),$=e.ref(480),w=e.computed(()=>{const a={"modal-tips":!0,"d-flex":!0,"flex-row":!0},p=`messager-type-${t.value}`;return a[p]=!0,a}),v=e.computed(()=>{const a={};return t.value==="prompt"?a.padding="0.5rem 0.5rem 1rem 1.5rem":t.value==="error"&&(a.padding="0.5rem 1.5rem 1rem 1.5rem"),a}),H=e.computed(()=>{const a={"f-icon":!0},p=`f-icon-${t.value}`;return a[p]=!0,a}),D=e.computed(()=>n.value||c.value&&c.value.message),S=e.computed(()=>r.value),z=e.computed(()=>!!r.value),I=e.computed(()=>!!c.value),R=e.computed(()=>!!c.value&&!!c.value.date),_=e.computed(()=>`\u53D1\u751F\u65F6\u95F4 : ${c.value&&c.value.date||""}`),q=e.computed(()=>!!c.value&&!!c.value.detail),L=e.computed(()=>{const a=`${$.value}px`;return{overflow:"hidden","text-overflow":"ellipsis",display:"-webkit-box","-webkit-box-orient":"vertical","-webkit-line-clamp":b.value,"max-height":a}}),M=e.computed(()=>c.value&&c.value.detail||""),P=e.computed(()=>!0),f=e.ref(!1),U=e.ref("\u5C55\u5F00"),W=e.ref("\u6536\u8D77"),G=e.computed(()=>{const a={display:"block",color:"#2A87FF"};return a["text-align"]=f.value?"":"right",a});function s(a,p){f.value=!f.value,b.value=f.value?20:3}function y(a){return s()}function i(a){return s()}const N=e.computed(()=>({"font-size":`${C.value}px`,height:"100%"}));function ce(a){if(a.currentTarget){const p=a.currentTarget.value||"";T.value=p.length}}e.computed(()=>h.value&&u.value);const re=e.computed(()=>!(m.value&&m.value.length)&&(V.value||x.value));e.computed(()=>t.value==="prompt"&&F.value);const ie=e.computed(()=>E.value&&x.value),de=e.computed(()=>A.value&&V.value);function ue(a){t.value==="question"&&l.emit("reject"),l.emit("close")}function pe(a){t.value==="question"&&l.emit("accept"),l.emit("close")}const me=e.computed(()=>!!(m.value&&m.value.length)),Q=e.computed(()=>c.value&&c.value.date&&c.value.message&&c.value.detail),{onCopy:fe}=oe(),X=e.ref("\u590D\u5236\u6210\u529F"),j=e.ref(!1);function Y(a){fe(M.value).catch(p=>{X.value="\u590D\u5236\u5931\u8D25"}).finally(()=>{j.value=!0,setTimeout(()=>{j.value=!1},700)})}const ye=e.computed(()=>{const a={position:"absolute",left:"50%",top:"50%",width:"100px",height:"40px",background:"#303C53","line-height":"40px","text-align":"center","margin-left":"-30px","margin-top":"-50px","border-radius":"10px","box-shadow":"0px 2px 8px 0px",color:"#fff",transition:"all .3s ease"};return a.opacity=j.value?"0.8":"0",a.display=j.value?"":"none",a});return()=>e.createVNode("div",{class:"farris-messager"},[t.value!=="prompt"&&e.createVNode("section",{class:w.value,style:v.value},[e.createVNode("div",{class:"float-left modal-tips-iconwrap"},[e.createVNode("span",{class:H.value},null)]),e.createVNode("div",{class:"modal-tips-content"},[e.createVNode("p",{class:"toast-msg-title",innerHTML:D.value},null),z.value&&e.createVNode("p",{class:"toast-msg-detail",innerHTML:S.value},null),I.value&&e.createVNode("div",{class:"toast-msg-detail"},[R.value&&e.createVNode("div",null,[_.value]),q.value&&e.createVNode("div",{id:"exception_error_msg",ref:"exceptionMessageRef",style:L.value},[e.createTextVNode("\u8BE6\u7EC6\u4FE1\u606F : "),e.createVNode("span",{innerHTML:M.value},null)]),P.value&&e.createVNode("span",{style:G.value},[f.value&&e.createVNode("span",{onClick:y,style:"cursor: pointer;"},[W.value]),!f.value&&e.createVNode("span",{onClick:i,style:"cursor: pointer;"},[U.value])])])])]),t.value==="prompt"&&e.createVNode(e.Fragment,null,[e.createVNode("section",{class:w.value,style:v.value},[e.createVNode("div",{class:"flex-fill fixdiv mb-1 mr-3"},[e.createVNode("textarea",{title:"promptMessage",name:"promptMessage",class:"form-control",style:N.value,rows:"4",maxlength:u.value,onInput:a=>ce(a)},[S.value])])]),e.createVNode("span",{class:"textarea-wordcount",title:g.value,style:"position: absolute; bottom: 76px; right: 32px; cursor: pointer; text-align: right;"},[T.value+" / "+u.value])]),re.value&&e.createVNode("div",{class:"modal-footer"},[Q.value&&e.createVNode("span",{style:"width: 100%;color: #2A87FF;padding-left: 37px;"},[e.createVNode("span",{onClick:Y,style:"cursor: pointer;"},[k.value])]),ie.value&&e.createVNode("button",{type:"button",class:"btn btn-secondary btn-lg",onClick:ue},[x.value]),de.value&&e.createVNode("button",{type:"button",class:"btn btn-primary btn-lg",onClick:pe},[V.value])]),me.value&&e.createVNode("div",{class:"modal-footer"},[Q.value&&e.createVNode("span",{style:"width: 100%;color: #2A87FF;padding-left: 37px;"},[e.createVNode("span",{onClick:Y,style:"cursor: pointer;"},[k.value])]),m.value.length&&m.value.map(a=>e.createVNode("button",{type:"button",onClick:a.handle,class:a.class},[a.iconClass&&e.createVNode("span",{class:a.iconClass},null),a.text]))]),e.createVNode("div",{style:ye.value},[X.value])])}}),ae={class:{type:String,default:""},title:{type:String,default:""},width:{type:Number,default:500},height:{type:Number,default:320},buttons:{type:Array,default:[]},modelValue:{type:Boolean,default:!1},showHeader:{type:Boolean,default:!0},showButtons:{type:Boolean,default:!0}},le=e.defineComponent({name:"FModal",props:ae,emits:["update:modelValue"],setup(o,l){const t=e.ref(o.width),n=e.ref(o.height),r=e.ref(o.modelValue),c=e.ref(""),C=e.ref(o.class),u=e.ref(!0),h=e.ref(o.showHeader),g=e.ref(""),T=e.ref(!0),m=e.ref(!1),V=e.ref(!1),x=e.ref(""),F=e.ref(""),E=e.ref(""),A=e.ref(o.showButtons),k=e.ref(o.title);function b(s,y){r.value=!1,l.emit("update:modelValue",!1)}const $=[{text:"\u53D6\u6D88",class:"btn btn-light",handle:s=>{b()}},{text:"\u786E\u5B9A",class:"btn btn-primary",handle:s=>{b()}}],w=e.ref(o.buttons&&o.buttons.length?o.buttons:$),v=e.computed(()=>!!g.value),H=e.computed(()=>!!A.value&&!!w.value);e.ref(),e.ref(),e.watch(()=>o.modelValue,()=>{r.value=o.modelValue});const D=e.ref(!1),S=e.computed(()=>r.value),z=e.computed(()=>{const s={modal:!0,"farris-modal":!0};return s["f-modal-fitContent"]=u.value,s}),I=e.computed(()=>({display:S.value?"block":"none !important"})),R=e.computed(()=>{const s={"modal-dialog":!0};return C.value.split(" ").reduce((i,N)=>(i[N]=!0,i),s),s}),_=e.computed(()=>({position:"absolute",top:"50%",left:"50%",width:`${t.value}px`,height:u.value?"auto":`${n.value}px`,"margin-left":`${0-t.value/2}px`,"margin-top":u.value?"auto":`${0-n.value/2}px`})),q=e.computed(()=>({"modal-content":!0,"modal-content-has-header":h.value})),L=e.computed(()=>({display:h.value?"":"none"})),M=e.computed(()=>({"f-icon":!0,modal_maximize:!0,modalrevert:D.value})),P=e.computed(()=>({height:"10px","z-index":1,display:h.value?"none":""})),f=e.computed(()=>({"modal-body":!0,"f-utils-flex-column":x.value==="iframe"}));function U(){return{}}const W=e.computed(()=>{const s={textAlgin:E.value},y=U();return Object.assign(s,y)});function G(s){}return()=>e.createVNode(e.Teleport,{to:"body"},{default:()=>{var s,y;return[e.createVNode("div",{class:z.value,style:I.value},[e.createVNode("div",{id:c.value,class:R.value,style:_.value},[e.createVNode("div",{class:q.value},[e.createVNode("div",{ref:"modalHeaderRef",class:"modal-header",style:L.value},[e.createVNode("div",{class:"modal-title"},[v.value&&e.createVNode("span",{class:g.value,style:"margin-right: 8px"},null),e.createVNode("span",{class:"modal-title-label"},[k.value])]),e.createVNode("div",{class:"actions"},[e.createVNode("ul",null,[V.value&&e.createVNode("li",{class:"f-btn-icon f-bare"},[e.createVNode("span",{class:"f-icon modal_minimize"},null)]),m.value&&e.createVNode("li",{onClick:G,class:"f-btn-icon f-bare"},[e.createVNode("span",{class:M.value},null)]),T.value&&e.createVNode("li",{class:"f-btn-icon f-bare",onClick:i=>b()},[e.createVNode("span",{class:"f-icon modal_close"},null)])])])]),e.createVNode("div",{ref:"dragableElementRef",class:"f-utils-absolute-all",style:P.value},null),e.createVNode("div",{class:f.value},[(y=(s=l.slots).default)==null?void 0:y.call(s),x.value==="iframe"&&e.createVNode("iframe",{title:c.value,class:"f-utils-fill",width:"100%",frameborder:"0",src:F.value},null)]),H.value&&e.createVNode("div",{class:"modal-footer",style:W.value},[w.value&&w.value.map(i=>e.createVNode("button",{type:"button",class:i.class,onClick:N=>{i.handle&&i.handle(N)}},[!!i.iconClass&&e.createVNode("span",{class:i.iconClass},[i.text]),!i.iconClass&&e.createVNode("span",null,[i.text])]))])])])])]}})}});function ne(o,l){const t=document.createElement("div");t.style.display="contents";const n=e.createApp({setup(){e.onUnmounted(()=>{document.body.removeChild(t)});const r=e.ref(!0),c=o.type==="error"||o.type==="prompt",C=o.type==="error"?"\u9519\u8BEF\u63D0\u793A":o.type==="prompt"?o.title:"",u=o.acceptCallback||(()=>{}),h=o.rejectCallback||(()=>{});return()=>e.createVNode(le,{class:"modal-message modal-message-type-info",title:C,modelValue:r.value,"onUpdate:modelValue":g=>r.value=g,"show-header":c,"show-buttons":!1},{default:()=>[e.createVNode(B,e.mergeProps(o,{onAccept:u,onReject:h,onClose:n.unmount}),null)]})}});return document.body.appendChild(t),n.mount(t),n}class K{static show(l){const t=e.reactive({...l});ne(t)}static info(l,t){const n=e.reactive({type:"info",title:l,detail:t,okButtonText:"\u77E5\u9053\u4E86",cancelButtonText:""});this.show(n)}static warning(l,t){const n=e.reactive({type:"warning",title:l,detail:t,okButtonText:"\u77E5\u9053\u4E86",cancelButtonText:""});this.show(n)}static success(l,t){const n=e.reactive({type:"success",title:l,detail:t,okButtonText:"\u5173\u95ED",cancelButtonText:""});this.show(n)}static error(l,t,n){const r=e.reactive({type:"error",okButtonText:"\u5173\u95ED",cancelButtonText:"",exceptionInfo:{date:n,message:l,detail:t}});this.show(r)}static prompt(l,t){const n=e.reactive({type:"prompt",title:l,detail:t,okButtonText:"\u786E\u5B9A",cancelButtonText:"\u53D6\u6D88"});this.show(n)}static question(l,t,n,r){const c=e.reactive({type:"question",title:l,detail:t,okButtonText:"\u786E\u5B9A",cancelButtonText:"\u53D6\u6D88",acceptCallback:n,rejectCallback:r});this.show(c)}}const se={install(o){o.component(B.name,B),o.provide("MessageBoxService",K)}};d.FMessageBox=B,d.MessageBoxService=K,d.default=se,d.messageBoxProps=J,Object.defineProperties(d,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|