dreambuilders-ui 0.1.4 → 0.1.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.
@@ -0,0 +1,909 @@
1
+ import { Fragment as e, Transition as t, computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, defineComponent as l, nextTick as u, normalizeClass as d, normalizeStyle as f, onMounted as p, onUnmounted as m, openBlock as h, ref as g, render as _, renderSlot as v, resolveDynamicComponent as y, toDisplayString as b, unref as x, useSlots as S, useTemplateRef as C, vShow as w, watch as T, withCtx as E, withDirectives as D, withModifiers as O } from "vue";
2
+ //#region src/components/button/src/Button.vue?vue&type=script&setup=true&lang.ts
3
+ var k = {
4
+ key: 0,
5
+ class: "iconfont loading icon-loading"
6
+ }, A = /*@__PURE__*/ l({
7
+ name: "DbButton",
8
+ __name: "Button",
9
+ props: {
10
+ type: { default: "default" },
11
+ size: { default: "default" },
12
+ nativeType: { default: "button" },
13
+ tag: { default: "button" },
14
+ loadingIcon: { default: "" },
15
+ icon: { default: "" },
16
+ color: { default: "" },
17
+ disabled: {
18
+ type: Boolean,
19
+ default: !1
20
+ },
21
+ loading: {
22
+ type: Boolean,
23
+ default: !1
24
+ },
25
+ plain: {
26
+ type: Boolean,
27
+ default: !1
28
+ },
29
+ round: {
30
+ type: Boolean,
31
+ default: !1
32
+ },
33
+ dashed: {
34
+ type: Boolean,
35
+ default: !1
36
+ },
37
+ circle: {
38
+ type: Boolean,
39
+ default: !1
40
+ },
41
+ link: {
42
+ type: Boolean,
43
+ default: !1
44
+ },
45
+ text: {
46
+ type: Boolean,
47
+ default: !1
48
+ },
49
+ autofocus: {
50
+ type: Boolean,
51
+ default: !1
52
+ }
53
+ },
54
+ emits: ["click"],
55
+ setup(e, { emit: t }) {
56
+ let o = e, s = t, c = n(() => o.disabled || o.loading), l = n(() => [
57
+ "db-button",
58
+ `db-button-type__${o.type}`,
59
+ `db-button-size__${o.size}`,
60
+ {
61
+ "is-disabled": c.value,
62
+ "is-plain": o.plain,
63
+ "is-round": o.round,
64
+ "is-dashed": o.dashed,
65
+ "is-circle": o.circle,
66
+ "is-link": o.link,
67
+ "is-text": o.text,
68
+ "is-loading": o.loading
69
+ }
70
+ ]), u = n(() => {
71
+ if (!o.color) return {};
72
+ let e = o.color, t = {
73
+ "--db-button-background-color": e,
74
+ "--db-button-border-color": e,
75
+ "--db-button-color": "#ffffff",
76
+ "--db-button-background-color-hover": `color-mix(in srgb, ${e}, white 30%)`,
77
+ "--db-button-border-color-hover": `color-mix(in srgb, ${e}, white 30%)`,
78
+ "--db-button-color-hover": "#ffffff",
79
+ "--db-button-background-color-active": `color-mix(in srgb, ${e}, white 30%)`,
80
+ "--db-button-border-color-active": `color-mix(in srgb, ${e}, white 30%)`,
81
+ "--db-button-color-active": "#ffffff"
82
+ };
83
+ return o.plain && (t["--db-button-background-color"] = "transparent", t["--db-button-background-color-hover"] = "transparent", t["--db-button-background-color-active"] = "transparent", t["--db-button-color"] = e, t["--db-button-color-hover"] = `color-mix(in srgb, ${e}, white 30%)`, t["--db-button-color-active"] = `color-mix(in srgb, ${e}, white 30%)`, t["--db-button-border-color"] = e, t["--db-button-border-color-hover"] = `color-mix(in srgb, ${e}, white 30%)`, t["--db-button-border-color-active"] = `color-mix(in srgb, ${e}, white 30%)`), o.text && (t["--db-button-background-color"] = "transparent", t["--db-button-background-color-hover"] = `color-mix(in srgb, ${e}, white 92%)`, t["--db-button-background-color-active"] = `color-mix(in srgb, ${e}, white 92%)`, t["--db-button-border-color"] = "transparent", t["--db-button-border-color-hover"] = `color-mix(in srgb, ${e}, white 92%)`, t["--db-button-border-color-active"] = `color-mix(in srgb, ${e}, white 92%)`, t["--db-button-color"] = e, t["--db-button-color-hover"] = e, t["--db-button-color-active"] = e), o.link && (t["--db-button-background-color"] = "transparent", t["--db-button-background-color-hover"] = "transparent", t["--db-button-background-color-active"] = "transparent", t["--db-button-border-color"] = "transparent", t["--db-button-border-color-hover"] = "transparent", t["--db-button-border-color-active"] = "transparent", t["--db-button-color"] = e, t["--db-button-color-hover"] = `color-mix(in srgb, ${e}, white 30%)`, t["--db-button-color-active"] = `color-mix(in srgb, ${e}, white 30%)`), t;
84
+ });
85
+ function p(e) {
86
+ c.value || s("click", e);
87
+ }
88
+ return (t, n) => (h(), r(y(e.tag), {
89
+ class: d(l.value),
90
+ type: e.nativeType,
91
+ disabled: c.value,
92
+ autofocus: e.autofocus,
93
+ style: f(u.value),
94
+ onClick: p
95
+ }, {
96
+ default: E(() => [
97
+ e.loading && !e.loadingIcon ? (h(), a("i", k)) : i("", !0),
98
+ e.loading && e.loadingIcon ? (h(), a("image", {
99
+ key: 1,
100
+ class: d([
101
+ "iconfont",
102
+ "loading",
103
+ `icon-${e.loadingIcon}`
104
+ ])
105
+ }, null, 2)) : i("", !0),
106
+ e.icon && !e.loading ? (h(), a("i", {
107
+ key: 2,
108
+ class: d(["iconfont", `icon-${e.icon}`])
109
+ }, null, 2)) : i("", !0),
110
+ v(t.$slots, "default", {}, void 0, !0)
111
+ ]),
112
+ _: 3
113
+ }, 8, [
114
+ "class",
115
+ "type",
116
+ "disabled",
117
+ "autofocus",
118
+ "style"
119
+ ]));
120
+ }
121
+ }), j = (e, t) => {
122
+ let n = e.__vccOpts || e;
123
+ for (let [e, r] of t) n[e] = r;
124
+ return n;
125
+ }, M = /*#__PURE__*/ j(A, [["__scopeId", "data-v-bc3a041a"]]), N = /*#__PURE__*/ j(/* @__PURE__ */ l({
126
+ name: "DbButtonGroup",
127
+ __name: "ButtonGroup",
128
+ props: { direction: { default: "horizontal" } },
129
+ setup(e) {
130
+ let t = e, r = n(() => ["db-button-group", `db-button-group-direction__${t.direction}`]);
131
+ return (e, t) => (h(), a("div", { class: d(r.value) }, [v(e.$slots, "default", {}, void 0, !0)], 2));
132
+ }
133
+ }), [["__scopeId", "data-v-d8f67fe3"]]), P = {
134
+ key: 0,
135
+ class: "db-input-group__prepend"
136
+ }, ee = [
137
+ "value",
138
+ "placeholder",
139
+ "disabled",
140
+ "readonly",
141
+ "rows",
142
+ "name",
143
+ "autocomplete",
144
+ "autofocus",
145
+ "form",
146
+ "maxlength",
147
+ "minlength",
148
+ "tabindex"
149
+ ], te = {
150
+ key: 0,
151
+ class: "db-input-limit"
152
+ }, ne = { class: "db-input-limit__inner" }, re = [
153
+ "type",
154
+ "value",
155
+ "placeholder",
156
+ "disabled",
157
+ "readonly",
158
+ "name",
159
+ "autocomplete",
160
+ "autofocus",
161
+ "form",
162
+ "maxlength",
163
+ "minlength",
164
+ "tabindex"
165
+ ], ie = {
166
+ key: 3,
167
+ class: "db-input-group__append"
168
+ }, F = /*#__PURE__*/ j(/* @__PURE__ */ l({
169
+ name: "DbInput",
170
+ __name: "Input",
171
+ props: {
172
+ modelValue: { default: "" },
173
+ type: { default: "text" },
174
+ size: { default: "default" },
175
+ placeholder: { default: "" },
176
+ clearable: {
177
+ type: Boolean,
178
+ default: !1
179
+ },
180
+ showPassword: {
181
+ type: Boolean,
182
+ default: !1
183
+ },
184
+ disabled: {
185
+ type: Boolean,
186
+ default: !1
187
+ },
188
+ readonly: {
189
+ type: Boolean,
190
+ default: !1
191
+ },
192
+ suffixIcon: {},
193
+ prefixIcon: {},
194
+ rows: { default: 2 },
195
+ autosize: {
196
+ type: [Boolean, Object],
197
+ default: !1
198
+ },
199
+ autocomplete: { default: "off" },
200
+ autofocus: {
201
+ type: Boolean,
202
+ default: !1
203
+ },
204
+ form: { default: "" },
205
+ name: { default: "" },
206
+ minlength: {},
207
+ maxlength: {},
208
+ showWordLimit: {
209
+ type: Boolean,
210
+ default: !1
211
+ },
212
+ resize: { default: "vertical" },
213
+ tabindex: { default: void 0 }
214
+ },
215
+ emits: [
216
+ "update:modelValue",
217
+ "input",
218
+ "change",
219
+ "focus",
220
+ "blur",
221
+ "clear",
222
+ "keydown",
223
+ "keyup",
224
+ "keypress"
225
+ ],
226
+ setup(t, { expose: r, emit: s }) {
227
+ let c = t, l = s;
228
+ r({
229
+ focus: () => _.value?.focus(),
230
+ blur: () => _.value?.blur(),
231
+ select: () => _.value?.select()
232
+ });
233
+ let m = S(), _ = C("input-ref"), y = g(!1), x = g(!1), w = n(() => c.type === "textarea"), E = n(() => !!m.prepend), D = n(() => !!m.prepend), k = n(() => c.showPassword && c.type === "password" ? x.value ? "text" : "password" : c.type), A = n(() => String(c.modelValue ?? "")), j = n(() => c.clearable && A.value && !c.disabled && !c.readonly), M = n(() => A.value.length), N = n(() => c.showWordLimit && c.maxlength !== void 0), F = n(() => `db-input-size__${c.size}`), I = n(() => w.value ? [
234
+ "db-textarea",
235
+ F.value,
236
+ {
237
+ "is-disabled": c.disabled,
238
+ "is-focus": y.value
239
+ }
240
+ ] : E.value || D.value ? ["db-input-group", F.value] : [
241
+ "db-input",
242
+ F.value,
243
+ {
244
+ "is-disabled": c.disabled,
245
+ "is-focus": y.value
246
+ }
247
+ ]);
248
+ function L(e) {
249
+ let t = e.target.value;
250
+ l("update:modelValue", t), l("input", t), u(() => U());
251
+ }
252
+ function R(e) {
253
+ let t = e.target.value;
254
+ l("change", t);
255
+ }
256
+ function z(e) {
257
+ y.value = !0, l("focus", e);
258
+ }
259
+ function B(e) {
260
+ y.value = !1, l("blur", e);
261
+ }
262
+ function V() {
263
+ l("update:modelValue", ""), l("input", ""), l("change", ""), l("clear"), u(() => {
264
+ _.value?.focus(), U();
265
+ });
266
+ }
267
+ function H() {
268
+ x.value = !x.value;
269
+ }
270
+ function U() {
271
+ if (!w.value || !c.autosize || !_.value) return;
272
+ let e = _.value, { autosize: t } = c;
273
+ e.style.height = "auto";
274
+ let n = e.scrollHeight;
275
+ if (typeof t == "object") {
276
+ let { minRows: e, maxRows: r } = t;
277
+ if (e) {
278
+ let t = e * 20 + 22;
279
+ n = Math.max(n, t);
280
+ }
281
+ if (r) {
282
+ let e = r * 20 + 22;
283
+ n = Math.min(n, e);
284
+ }
285
+ }
286
+ e.style.height = `${n}px`;
287
+ }
288
+ return p(() => {
289
+ U();
290
+ }), T(() => c.modelValue, () => u(() => U())), (n, r) => (h(), a("div", { class: d(I.value) }, [
291
+ !w.value && E.value ? (h(), a("div", P, [v(n.$slots, "prepend", {}, void 0, !0)])) : i("", !0),
292
+ w.value ? (h(), a(e, { key: 1 }, [o("textarea", {
293
+ ref: "input-ref",
294
+ class: "db-textarea__inner",
295
+ style: f({ resize: t.resize }),
296
+ value: A.value,
297
+ placeholder: t.placeholder,
298
+ disabled: t.disabled,
299
+ readonly: t.readonly,
300
+ rows: t.rows,
301
+ name: t.name,
302
+ autocomplete: t.autocomplete,
303
+ autofocus: t.autofocus,
304
+ form: t.form,
305
+ maxlength: t.maxlength,
306
+ minlength: t.minlength,
307
+ tabindex: t.tabindex,
308
+ onInput: L,
309
+ onChange: R,
310
+ onFocus: z,
311
+ onBlur: B,
312
+ onKeydown: r[0] ||= (e) => l("keydown", e),
313
+ onKeyup: r[1] ||= (e) => l("keyup", e),
314
+ onKeypress: r[2] ||= (e) => l("keypress", e)
315
+ }, null, 44, ee), N.value ? (h(), a("div", te, [o("span", ne, b(M.value) + "/" + b(t.maxlength), 1)])) : i("", !0)], 64)) : i("", !0),
316
+ w.value ? i("", !0) : (h(), a("div", {
317
+ key: 2,
318
+ class: d(["db-input__wrapper", {
319
+ "is-focus": y.value,
320
+ "is-disabled": t.disabled
321
+ }])
322
+ }, [
323
+ t.prefixIcon ? (h(), a("i", {
324
+ key: 0,
325
+ class: d(["iconfont", `icon-${t.prefixIcon}`])
326
+ }, null, 2)) : i("", !0),
327
+ o("input", {
328
+ ref: "input-ref",
329
+ class: "db-input__inner",
330
+ type: k.value,
331
+ value: A.value,
332
+ placeholder: t.placeholder,
333
+ disabled: t.disabled,
334
+ readonly: t.readonly,
335
+ name: t.name,
336
+ autocomplete: t.autocomplete,
337
+ autofocus: t.autofocus,
338
+ form: t.form,
339
+ maxlength: t.maxlength,
340
+ minlength: t.minlength,
341
+ tabindex: t.tabindex,
342
+ onInput: L,
343
+ onChange: R,
344
+ onFocus: z,
345
+ onBlur: B,
346
+ onKeydown: r[3] ||= (e) => l("keydown", e),
347
+ onKeyup: r[4] ||= (e) => l("keyup", e),
348
+ onKeypress: r[5] ||= (e) => l("keypress", e)
349
+ }, null, 40, re),
350
+ j.value ? (h(), a("i", {
351
+ key: 1,
352
+ class: d(["iconfont", "icon-clear"]),
353
+ onClick: O(V, ["stop"])
354
+ })) : i("", !0),
355
+ t.type === "password" && t.showPassword ? (h(), a("image", {
356
+ key: 2,
357
+ class: d(["iconfont", "icon-showPassword"]),
358
+ onClick: O(H, ["stop"])
359
+ })) : i("", !0),
360
+ t.suffixIcon ? (h(), a("i", {
361
+ key: 3,
362
+ class: d(["iconfont", `icon-${t.suffixIcon}`])
363
+ }, null, 2)) : i("", !0)
364
+ ], 2)),
365
+ !w.value && D.value ? (h(), a("div", ie, [v(n.$slots, "append", {}, void 0, !0)])) : i("", !0)
366
+ ], 2));
367
+ }
368
+ }), [["__scopeId", "data-v-e3bb386b"]]), I = /*#__PURE__*/ j(/* @__PURE__ */ l({
369
+ name: "DbText",
370
+ __name: "Text",
371
+ props: {
372
+ type: { default: "default" },
373
+ size: { default: "default" },
374
+ tag: { default: "span" },
375
+ truncated: {
376
+ type: Boolean,
377
+ default: !1
378
+ },
379
+ lineClamp: { default: void 0 },
380
+ disabled: {
381
+ type: Boolean,
382
+ default: !1
383
+ },
384
+ strong: {
385
+ type: Boolean,
386
+ default: !1
387
+ },
388
+ italic: {
389
+ type: Boolean,
390
+ default: !1
391
+ },
392
+ underline: {
393
+ type: Boolean,
394
+ default: !1
395
+ },
396
+ delete: {
397
+ type: Boolean,
398
+ default: !1
399
+ },
400
+ marked: {
401
+ type: Boolean,
402
+ default: !1
403
+ },
404
+ code: {
405
+ type: Boolean,
406
+ default: !1
407
+ },
408
+ color: { default: "" }
409
+ },
410
+ setup(e) {
411
+ let t = e, i = n(() => [
412
+ "db-text",
413
+ `db-text-type__${t.type}`,
414
+ `db-text-size__${t.size}`,
415
+ {
416
+ "is-truncated": t.truncated && !t.lineClamp,
417
+ "is-disabled": t.disabled,
418
+ "is-strong": t.strong,
419
+ "is-italic": t.italic,
420
+ "is-underline": t.underline,
421
+ "is-delete": t.delete,
422
+ "is-marked": t.marked,
423
+ "is-code": t.code
424
+ }
425
+ ]), a = n(() => {
426
+ let e = {};
427
+ return t.color && (e.color = t.color), t.lineClamp && (e.overflow = "hidden", e.display = "-webkit-box", e.WebkitBoxOrient = "vertical", e.WebkitLineClamp = t.lineClamp, e.wordBreak = "break-all"), e;
428
+ });
429
+ return (t, n) => (h(), r(y(e.tag), {
430
+ class: d(i.value),
431
+ style: f(a.value)
432
+ }, {
433
+ default: E(() => [v(t.$slots, "default", {}, void 0, !0)]),
434
+ _: 3
435
+ }, 8, ["class", "style"]));
436
+ }
437
+ }), [["__scopeId", "data-v-34a235e5"]]), L = {
438
+ key: 0,
439
+ class: "db-alert__icon"
440
+ }, R = { class: "db-alert__content" }, z = { class: "db-alert__title" }, B = {
441
+ key: 0,
442
+ class: "db-alert__description"
443
+ }, V = /*#__PURE__*/ j(/* @__PURE__ */ l({
444
+ name: "DbAlert",
445
+ __name: "Alert",
446
+ props: {
447
+ type: { default: "info" },
448
+ title: { default: "" },
449
+ description: { default: "" },
450
+ closable: {
451
+ type: Boolean,
452
+ default: !0
453
+ },
454
+ closeText: { default: "" },
455
+ showIcon: {
456
+ type: Boolean,
457
+ default: !1
458
+ },
459
+ center: {
460
+ type: Boolean,
461
+ default: !1
462
+ },
463
+ effect: { default: "light" }
464
+ },
465
+ emits: ["close"],
466
+ setup(e, { emit: l }) {
467
+ let u = e, f = l, p = S(), m = g(!0), _ = n(() => u.description || p.description), y = n(() => [
468
+ "db-alert",
469
+ `db-alert--${u.type}`,
470
+ `db-alert--${u.effect}`,
471
+ {
472
+ "is-center": u.center,
473
+ "is-with-description": _.value,
474
+ "is-closable": u.closable
475
+ }
476
+ ]);
477
+ function C(e) {
478
+ m.value = !1, f("close", e);
479
+ }
480
+ return (n, l) => (h(), r(t, { name: "alert-fade" }, {
481
+ default: E(() => [m.value ? (h(), a("div", {
482
+ key: 0,
483
+ class: d(y.value),
484
+ role: "alert"
485
+ }, [
486
+ e.showIcon || x(p).icon ? (h(), a("span", L, [v(n.$slots, "icon", {}, () => [o("i", { class: d(["iconfont", `icon-${e.type}`]) }, null, 2)], !0)])) : i("", !0),
487
+ o("div", R, [o("span", z, [v(n.$slots, "default", {}, () => [s(b(e.title), 1)], !0)]), _.value ? (h(), a("p", B, [v(n.$slots, "description", {}, () => [s(b(e.description), 1)], !0)])) : i("", !0)]),
488
+ e.closable ? (h(), a("span", {
489
+ key: 1,
490
+ class: "db-alert__closebtn",
491
+ onClick: C
492
+ }, [v(n.$slots, "close", {}, () => [c(x(M), {
493
+ link: "",
494
+ icon: "close",
495
+ onClick: C
496
+ }, {
497
+ default: E(() => [s(b(e.closeText), 1)]),
498
+ _: 1
499
+ })], !0)])) : i("", !0)
500
+ ], 2)) : i("", !0)]),
501
+ _: 3
502
+ }));
503
+ }
504
+ }), [["__scopeId", "data-v-4674a767"]]), H = { class: "db-message__icon" }, U = { class: "db-message__content" }, W = /*#__PURE__*/ j(/* @__PURE__ */ l({
505
+ name: "DbMessage",
506
+ __name: "Message",
507
+ props: {
508
+ id: {},
509
+ message: {},
510
+ type: { default: "info" },
511
+ duration: { default: 3e3 },
512
+ showClose: {
513
+ type: Boolean,
514
+ default: !1
515
+ },
516
+ center: {
517
+ type: Boolean,
518
+ default: !1
519
+ },
520
+ plain: {
521
+ type: Boolean,
522
+ default: !1
523
+ },
524
+ offset: { default: 20 },
525
+ onClose: {}
526
+ },
527
+ emits: ["mounted"],
528
+ setup(e, { expose: a, emit: s }) {
529
+ let c = e, l = s, _ = g(!1), v = g(c.offset), y = C("message-ref"), S = null, T = n(() => [
530
+ "db-message",
531
+ `db-message--${c.type}`,
532
+ {
533
+ "is-center": c.center,
534
+ "is-plain": c.plain,
535
+ "is-closable": c.showClose
536
+ }
537
+ ]);
538
+ function O() {
539
+ c.duration <= 0 || (k(), S = window.setTimeout(() => {
540
+ A();
541
+ }, c.duration));
542
+ }
543
+ function k() {
544
+ S &&= (clearTimeout(S), null);
545
+ }
546
+ function A() {
547
+ _.value = !1, k(), c.onClose?.();
548
+ }
549
+ function j() {
550
+ k();
551
+ }
552
+ function N() {
553
+ O();
554
+ }
555
+ function P(e) {
556
+ v.value = e;
557
+ }
558
+ return a({
559
+ setTop: P,
560
+ close: A,
561
+ getHeight: () => y.value?.offsetHeight || 0
562
+ }), p(() => {
563
+ _.value = !0, u(() => {
564
+ l("mounted", y.value?.offsetHeight || 0), O();
565
+ });
566
+ }), m(() => {
567
+ k();
568
+ }), (n, a) => (h(), r(t, { name: "db-message-fade" }, {
569
+ default: E(() => [D(o("div", {
570
+ ref: "message-ref",
571
+ class: d(T.value),
572
+ style: f({ top: `${v.value}px` }),
573
+ onMouseenter: j,
574
+ onMouseleave: N
575
+ }, [
576
+ o("span", H, [o("i", { class: d(["iconfont", `icon-${e.type}`]) }, null, 2)]),
577
+ o("p", U, b(e.message), 1),
578
+ e.showClose ? (h(), r(x(M), {
579
+ key: 0,
580
+ link: "",
581
+ icon: "close",
582
+ onClick: A
583
+ })) : i("", !0)
584
+ ], 38), [[w, _.value]])]),
585
+ _: 1
586
+ }));
587
+ }
588
+ }), [["__scopeId", "data-v-5de577c2"]]), G = [], ae = 1, oe = 16, K = 20;
589
+ function q() {
590
+ let e = K;
591
+ G.forEach((t) => {
592
+ t.top = e, t.vm.setTop(e), e += t.height + oe;
593
+ });
594
+ }
595
+ function se(e) {
596
+ let t = G.findIndex((t) => t.id === e);
597
+ t !== -1 && (G.splice(t, 1), q());
598
+ }
599
+ function J(e) {
600
+ let t = typeof e == "string" ? { message: e } : e, n = `db-message-${ae++}`, r = document.createElement("div"), i = {
601
+ id: n,
602
+ vm: {
603
+ close: () => {},
604
+ setTop: () => {},
605
+ getHeight: () => 0
606
+ },
607
+ top: K,
608
+ height: 0
609
+ };
610
+ function a() {
611
+ t.onClose?.(), se(n), setTimeout(() => {
612
+ _(null, r), r.remove();
613
+ }, 300);
614
+ }
615
+ function o(e) {
616
+ let t = G.find((e) => e.id === n);
617
+ t && (t.height = e, q());
618
+ }
619
+ let s = c(W, {
620
+ id: n,
621
+ message: t.message,
622
+ type: t.type || "info",
623
+ duration: t.duration ?? 3e3,
624
+ showClose: t.showClose || !1,
625
+ center: t.center || !1,
626
+ plain: t.plain || !1,
627
+ offset: K,
628
+ onClose: a,
629
+ onMounted: o
630
+ });
631
+ return _(s, r), document.body.appendChild(r.firstElementChild), Promise.resolve().then(() => {
632
+ let e = s.component?.exposed;
633
+ e && (i.vm = {
634
+ close: e.close,
635
+ setTop: e.setTop,
636
+ getHeight: e.getHeight
637
+ });
638
+ }), G.push(i), { close: () => i.vm.close() };
639
+ }
640
+ var Y = {
641
+ open: J,
642
+ primary(e) {
643
+ return J(typeof e == "string" ? {
644
+ message: e,
645
+ type: "primary"
646
+ } : {
647
+ ...e,
648
+ type: "primary"
649
+ });
650
+ },
651
+ success(e) {
652
+ return J(typeof e == "string" ? {
653
+ message: e,
654
+ type: "success"
655
+ } : {
656
+ ...e,
657
+ type: "success"
658
+ });
659
+ },
660
+ warning(e) {
661
+ return J(typeof e == "string" ? {
662
+ message: e,
663
+ type: "warning"
664
+ } : {
665
+ ...e,
666
+ type: "warning"
667
+ });
668
+ },
669
+ danger(e) {
670
+ return J(typeof e == "string" ? {
671
+ message: e,
672
+ type: "danger"
673
+ } : {
674
+ ...e,
675
+ type: "danger"
676
+ });
677
+ },
678
+ info(e) {
679
+ return J(typeof e == "string" ? {
680
+ message: e,
681
+ type: "info"
682
+ } : {
683
+ ...e,
684
+ type: "info"
685
+ });
686
+ },
687
+ closeAll: () => {
688
+ [...G].forEach((e) => e.vm.close());
689
+ },
690
+ install: (e) => {
691
+ e.config.globalProperties.Message = Y;
692
+ }
693
+ }, ce = { class: "db-message-box__header" }, le = { class: "db-message-box__title" }, ue = { class: "db-message-box__content" }, de = { class: "db-message-box__message" }, fe = {
694
+ key: 1,
695
+ class: "db-message-box__input"
696
+ }, pe = [
697
+ "value",
698
+ "placeholder",
699
+ "type"
700
+ ], me = ["value", "placeholder"], he = { class: "db-message-box__btns" }, X = /*#__PURE__*/ j(/* @__PURE__ */ l({
701
+ name: "DbMessageBox",
702
+ __name: "MessageBox",
703
+ props: {
704
+ visible: { type: Boolean },
705
+ title: { default: "提示" },
706
+ message: { default: "" },
707
+ type: { default: "" },
708
+ showCancelButton: {
709
+ type: Boolean,
710
+ default: !1
711
+ },
712
+ showConfirmButton: {
713
+ type: Boolean,
714
+ default: !0
715
+ },
716
+ cancelButtonText: { default: "取消" },
717
+ confirmButtonText: { default: "确定" },
718
+ confirmButtonType: { default: "primary" },
719
+ cancelButtonType: { default: "default" },
720
+ showInput: {
721
+ type: Boolean,
722
+ default: !1
723
+ },
724
+ inputPlaceholder: { default: "" },
725
+ inputValue: { default: "" },
726
+ inputType: { default: "text" },
727
+ closeOnClickModal: {
728
+ type: Boolean,
729
+ default: !1
730
+ },
731
+ closeOnPressEscape: {
732
+ type: Boolean,
733
+ default: !0
734
+ },
735
+ showClose: {
736
+ type: Boolean,
737
+ default: !0
738
+ },
739
+ center: {
740
+ type: Boolean,
741
+ default: !1
742
+ },
743
+ lockScroll: {
744
+ type: Boolean,
745
+ default: !0
746
+ }
747
+ },
748
+ emits: [
749
+ "update:visible",
750
+ "confirm",
751
+ "cancel",
752
+ "close",
753
+ "input"
754
+ ],
755
+ setup(e, { emit: l }) {
756
+ let u = e, f = l, _ = g(u.inputValue);
757
+ n(() => ["db-message-box__input-inner", `db-message-box__input--${u.inputType}`]);
758
+ function y() {
759
+ f("update:visible", !1);
760
+ }
761
+ function S() {
762
+ f("confirm", _.value), y();
763
+ }
764
+ function C() {
765
+ f("cancel"), y();
766
+ }
767
+ function w() {
768
+ f("close"), y();
769
+ }
770
+ function D() {
771
+ u.closeOnClickModal && w();
772
+ }
773
+ function k(e) {
774
+ e.key === "Escape" && u.closeOnPressEscape && w(), e.key === "Enter" && S();
775
+ }
776
+ return T(() => u.inputValue, (e) => {
777
+ _.value = e;
778
+ }), T(() => u.visible, (e) => {
779
+ u.lockScroll && (document.body.style.overflow = e ? "hidden" : "");
780
+ }), p(() => {
781
+ document.addEventListener("keydown", k);
782
+ }), m(() => {
783
+ document.removeEventListener("keydown", k), u.lockScroll && (document.body.style.overflow = "");
784
+ }), (n, l) => (h(), r(t, { name: "message-box-fade" }, {
785
+ default: E(() => [e.visible ? (h(), a("div", {
786
+ key: 0,
787
+ class: "db-message-box__wrapper",
788
+ onClick: O(D, ["self"])
789
+ }, [c(t, { name: "message-box-zoom" }, {
790
+ default: E(() => [e.visible ? (h(), a("div", {
791
+ key: 0,
792
+ class: d(["db-message-box", { "is-center": e.center }])
793
+ }, [
794
+ e.showClose ? (h(), r(x(M), {
795
+ key: 0,
796
+ class: "db-message-box__close",
797
+ link: "",
798
+ icon: "close",
799
+ onClick: w
800
+ })) : i("", !0),
801
+ o("div", ce, [o("span", le, b(e.title), 1)]),
802
+ o("div", ue, [
803
+ e.type ? (h(), a("div", {
804
+ key: 0,
805
+ class: d(["db-message-box__status", `db-message-box__status--${e.type}`])
806
+ }, [o("i", { class: d(["iconfont", `icon-${e.type}`]) }, null, 2)], 2)) : i("", !0),
807
+ o("div", de, [v(n.$slots, "default", {}, () => [s(b(e.message), 1)], !0)]),
808
+ e.showInput ? (h(), a("div", fe, [e.inputType === "textarea" ? (h(), a("textarea", {
809
+ key: 1,
810
+ value: _.value,
811
+ placeholder: e.inputPlaceholder,
812
+ class: "db-message-box__textarea-inner",
813
+ onInput: l[1] ||= (e) => {
814
+ _.value = e.target.value, f("input", _.value);
815
+ }
816
+ }, null, 40, me)) : (h(), a("input", {
817
+ key: 0,
818
+ value: _.value,
819
+ placeholder: e.inputPlaceholder,
820
+ type: e.inputType,
821
+ class: "db-message-box__input-inner",
822
+ onInput: l[0] ||= (e) => {
823
+ _.value = e.target.value, f("input", _.value);
824
+ }
825
+ }, null, 40, pe))])) : i("", !0)
826
+ ]),
827
+ o("div", he, [e.showCancelButton ? (h(), r(x(M), {
828
+ key: 0,
829
+ type: e.cancelButtonType,
830
+ plain: !0,
831
+ onClick: C
832
+ }, {
833
+ default: E(() => [s(b(e.cancelButtonText), 1)]),
834
+ _: 1
835
+ }, 8, ["type"])) : i("", !0), e.showConfirmButton ? (h(), r(x(M), {
836
+ key: 1,
837
+ type: e.confirmButtonType,
838
+ onClick: S
839
+ }, {
840
+ default: E(() => [s(b(e.confirmButtonText), 1)]),
841
+ _: 1
842
+ }, 8, ["type"])) : i("", !0)])
843
+ ], 2)) : i("", !0)]),
844
+ _: 3
845
+ })])) : i("", !0)]),
846
+ _: 3
847
+ }));
848
+ }
849
+ }), [["__scopeId", "data-v-ded9658b"]]), Z = null, Q = (e) => new Promise((t, n) => {
850
+ Z || (Z = document.createElement("div"), document.body.appendChild(Z));
851
+ let r = (e) => {
852
+ _(null, Z), t(e);
853
+ }, i = () => {
854
+ _(null, Z), n(/* @__PURE__ */ Error("cancel"));
855
+ }, a = () => {
856
+ _(null, Z), n(/* @__PURE__ */ Error("close"));
857
+ };
858
+ _(c(X, {
859
+ visible: !0,
860
+ ...e,
861
+ onConfirm: r,
862
+ onCancel: i,
863
+ onClose: a,
864
+ "onUpdate:visible": (e) => {
865
+ e || a();
866
+ }
867
+ }), Z);
868
+ }), $ = {
869
+ open: Q,
870
+ alert: (e, t, n) => Q({
871
+ message: e,
872
+ title: t || "提示",
873
+ showCancelButton: !1,
874
+ ...n
875
+ }),
876
+ confirm: (e, t, n) => Q({
877
+ message: e,
878
+ title: t || "提示",
879
+ showCancelButton: !0,
880
+ ...n
881
+ }),
882
+ prompt: (e, t, n) => Q({
883
+ message: e,
884
+ title: t || "提示",
885
+ showCancelButton: !0,
886
+ showInput: !0,
887
+ ...n
888
+ }),
889
+ install: (e) => {
890
+ e.config.globalProperties.MessageBox = $, e.component("MessageBox", X);
891
+ }
892
+ }, ge = [
893
+ M,
894
+ N,
895
+ F,
896
+ I,
897
+ V,
898
+ Y,
899
+ $
900
+ ];
901
+ function _e(e) {
902
+ ge.forEach((t) => e.use(t));
903
+ }
904
+ var ve = {
905
+ install: _e,
906
+ version: "1.0.0"
907
+ };
908
+ //#endregion
909
+ export { V as DbAlert, M as DbButton, N as DbButtonGroup, F as DbInput, Y as DbMessage, $ as DbMessageBox, W as DbMessageComponent, I as DbText, ve as default };