bani-ui 1.0.2-alpha.5 → 1.0.2-alpha.7

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,9 +1,9 @@
1
1
  import { defineComponent as $, inject as N, computed as l, useSlots as O, ref as U, openBlock as m, createBlock as y, resolveDynamicComponent as w, unref as B, normalizeClass as D, withCtx as I, renderSlot as g, createVNode as R, normalizeStyle as b, createCommentVNode as v } from "vue";
2
- import { _ as h } from "./Icon-CL9G-J0o.js";
2
+ import { _ as h } from "./Icon-DmRQNZdt.js";
3
3
  import { faSpinner as p } from "@fortawesome/free-solid-svg-icons";
4
4
  import { library as E } from "@fortawesome/fontawesome-svg-core";
5
- import { t as G } from "./vendor-CZxuzErw.js";
6
- import { w as K } from "./utils-CKyHXHob.js";
5
+ import { t as G } from "./vendor-BvCJXmoZ.js";
6
+ import { w as K } from "./utils-D7OMQX6l.js";
7
7
  const P = Symbol(
8
8
  "BUTTON_GROUP_CTX_KEY"
9
9
  ), V = /* @__PURE__ */ $({
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as n, provide as s, reactive as p, toRef as t, openBlock as i, createElementBlock as a, renderSlot as l } from "vue";
2
- import { B as c } from "./Button-eQN4Iutg.js";
3
- import { w as d } from "./utils-CKyHXHob.js";
2
+ import { B as c } from "./Button-Cx5Es0NL.js";
3
+ import { w as d } from "./utils-D7OMQX6l.js";
4
4
  import "@fortawesome/free-solid-svg-icons";
5
5
  const m = { class: "er-button-group" }, u = /* @__PURE__ */ n({
6
6
  name: "BnButtonGroup",
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as l, computed as t, openBlock as p, createElementBlock as s, mergeProps as i, createVNode as c, unref as m, normalizeProps as y, guardReactiveProps as B } from "vue";
2
2
  import { FontAwesomeIcon as u } from "@fortawesome/vue-fontawesome";
3
- import { o as f } from "./vendor-CZxuzErw.js";
4
- import { w as d } from "./utils-CKyHXHob.js";
3
+ import { o as f } from "./vendor-BvCJXmoZ.js";
4
+ import { w as d } from "./utils-D7OMQX6l.js";
5
5
  import "@fortawesome/free-solid-svg-icons";
6
6
  const v = /* @__PURE__ */ l({
7
7
  name: "BnIcon",
@@ -0,0 +1,196 @@
1
+ import { defineComponent as E, useCssVars as T, computed as V, openBlock as m, createBlock as k, Transition as w, withCtx as D, withDirectives as z, createElementVNode as x, normalizeClass as F, createCommentVNode as C, createElementBlock as M, toDisplayString as H, vShow as R, nextTick as K, ref as A, reactive as O, createApp as P } from "vue";
2
+ import { c as Y } from "./hooks-CkxWXunh.js";
3
+ import { _ as Z } from "./Icon-DmRQNZdt.js";
4
+ import { h, d as q, a as G, e as U } from "./vendor-BvCJXmoZ.js";
5
+ const j = { class: "er-loading__spinner" }, J = {
6
+ key: 1,
7
+ class: "er-loading-text"
8
+ }, Q = /* @__PURE__ */ E({
9
+ name: "BnLoading",
10
+ inheritAttrs: !1,
11
+ __name: "Loading",
12
+ props: {
13
+ visible: {},
14
+ background: {},
15
+ spinner: {},
16
+ text: {},
17
+ fullscreen: {},
18
+ lock: {},
19
+ beforeClose: { type: Function },
20
+ closed: { type: Function },
21
+ target: {},
22
+ body: { type: Boolean },
23
+ zIndex: {},
24
+ onAfterLeave: { type: Function }
25
+ },
26
+ setup(e) {
27
+ T((t) => ({
28
+ v098d7d6e: t.background,
29
+ v1880a613: t.zIndex
30
+ }));
31
+ const n = e, o = V(() => h(n.spinner) ? n.spinner : "spinner");
32
+ return (t, r) => (m(), k(w, {
33
+ name: "fade-in-linear",
34
+ onAfterLeave: e.onAfterLeave
35
+ }, {
36
+ default: D(() => [
37
+ z(x("div", {
38
+ class: F(["er-loading er-loading__mask", { "is-fullscreen": e.fullscreen }])
39
+ }, [
40
+ x("div", j, [
41
+ n.spinner !== !1 ? (m(), k(Z, {
42
+ key: 0,
43
+ icon: o.value,
44
+ spin: ""
45
+ }, null, 8, ["icon"])) : C("", !0),
46
+ e.text ? (m(), M("p", J, H(e.text), 1)) : C("", !0)
47
+ ])
48
+ ], 2), [
49
+ [R, n.visible.value]
50
+ ])
51
+ ]),
52
+ _: 1
53
+ }, 8, ["onAfterLeave"]));
54
+ }
55
+ }), I = "er-loading-parent--relative", S = "er-loading-parent--hiden", f = "er-loading-numb", d = /* @__PURE__ */ new Map(), { nextZIndex: W } = Y(3e4);
56
+ function X(e) {
57
+ const n = A(e.visible), o = A(!1), t = () => {
58
+ o.value && s();
59
+ }, r = O({
60
+ ...e,
61
+ onAfterLeave: t
62
+ }), c = (a) => r.text = a, s = () => {
63
+ var L, p;
64
+ const a = r.parent;
65
+ ce(a), !v(a) && (G(() => {
66
+ te(a), $(a);
67
+ }, 1), d.delete(a ?? document.body), (p = (L = i.$el) == null ? void 0 : L.parentNode) == null || p.removeChild(i.$el), y.unmount());
68
+ };
69
+ let g;
70
+ const B = () => {
71
+ var a;
72
+ e.beforeClose && !e.beforeClose() || (o.value = !0, clearTimeout(g), g = q(t), n.value = !1, (a = e.closed) == null || a.call(e));
73
+ }, y = P(Q, {
74
+ ...r,
75
+ zIndex: r.fullscreen ? W() : void 0,
76
+ visible: n
77
+ }), i = y.mount(document.createElement("div"));
78
+ return {
79
+ get $el() {
80
+ return i.$el;
81
+ },
82
+ vm: i,
83
+ close: B,
84
+ visible: n,
85
+ setText: c
86
+ };
87
+ }
88
+ function ee(e) {
89
+ let n;
90
+ return h(e.target) ? n = document.querySelector(e.target) ?? document.body : n = e.target || document.body, {
91
+ parent: n === document.body || e.body ? document.body : n,
92
+ background: e.background ?? "rgba(0, 0, 0, 0.5)",
93
+ spinner: e.spinner,
94
+ text: e.text,
95
+ fullscreen: n === document.body && (e.fullscreen ?? !0),
96
+ lock: e.lock ?? !1,
97
+ visible: e.visible ?? !0,
98
+ target: n
99
+ };
100
+ }
101
+ function ne(e = document.body) {
102
+ e.classList.add(I);
103
+ }
104
+ function te(e = document.body) {
105
+ e.classList.remove(I);
106
+ }
107
+ function oe(e = document.body) {
108
+ e.classList.add(S);
109
+ }
110
+ function $(e = document.body) {
111
+ e.classList.remove(S);
112
+ }
113
+ function v(e = document.body) {
114
+ return e.getAttribute(f);
115
+ }
116
+ function re(e = document.body) {
117
+ e.removeAttribute(f);
118
+ }
119
+ function ae(e = document.body) {
120
+ const n = v(e) ?? "0";
121
+ e.setAttribute(f, `${Number.parseInt(n) + 1}`);
122
+ }
123
+ function ce(e = document.body) {
124
+ const n = v(e);
125
+ if (n) {
126
+ const o = Number.parseInt(n) - 1;
127
+ o === 0 ? re(e) : e.setAttribute(f, `${o}`);
128
+ }
129
+ }
130
+ function se(e, n = document.body) {
131
+ e.lock ? oe(n) : $(n), ne(n);
132
+ }
133
+ let l = null;
134
+ function b(e = {}) {
135
+ var r;
136
+ const n = ee(e), o = n.parent ?? document.body;
137
+ if (n.fullscreen && !U(l))
138
+ return l;
139
+ if (ae(n == null ? void 0 : n.parent), d.has(o))
140
+ return d.get(o);
141
+ const t = X({
142
+ ...n,
143
+ closed: () => {
144
+ var c;
145
+ (c = n.closed) == null || c.call(n), n.fullscreen && (l = null);
146
+ }
147
+ });
148
+ return se(e, n == null ? void 0 : n.parent), (r = n.parent) == null || r.appendChild(t.$el), K(() => t.visible.value = !!n.visible), n.fullscreen && (l = t), d.set(o, t), t;
149
+ }
150
+ const u = Symbol("loading");
151
+ function N(e, n) {
152
+ const o = (s) => e.getAttribute(`er-loading-${s}`), t = (s) => n.modifiers[s], r = t("fullscreen"), c = {
153
+ text: o("text"),
154
+ spinner: o("spinner"),
155
+ background: o("background"),
156
+ target: r ? void 0 : e,
157
+ body: t("body"),
158
+ lock: t("lock"),
159
+ fullscreen: r
160
+ };
161
+ e[u] = {
162
+ options: c,
163
+ instance: b(c)
164
+ };
165
+ }
166
+ const _ = {
167
+ mounted(e, n) {
168
+ n.value && N(e, n);
169
+ },
170
+ updated(e, n) {
171
+ var o, t;
172
+ if (n.oldValue !== n.value) {
173
+ if (n.value && !n.oldValue) {
174
+ N(e, n);
175
+ return;
176
+ }
177
+ (t = (o = e[u]) == null ? void 0 : o.instance) == null || t.close();
178
+ }
179
+ },
180
+ unmounted(e) {
181
+ var n;
182
+ (n = e[u]) == null || n.instance.close(), e[u] = void 0;
183
+ }
184
+ }, fe = {
185
+ name: "BnLoading",
186
+ install(e) {
187
+ e.directive("loading", _), e.config.globalProperties.$loading = b;
188
+ },
189
+ directive: _,
190
+ service: b
191
+ };
192
+ export {
193
+ fe as B,
194
+ b as L,
195
+ _ as v
196
+ };
@@ -1,8 +1,8 @@
1
1
  import { defineComponent as R, ref as g, computed as x, onMounted as $, watch as D, openBlock as v, createBlock as w, Transition as S, withCtx as T, withDirectives as V, createElementVNode as B, normalizeStyle as L, normalizeClass as A, createVNode as C, renderSlot as Z, unref as F, createCommentVNode as I, createElementBlock as H, withModifiers as j, vShow as q, shallowReactive as G, isVNode as J, h as K, render as N } from "vue";
2
2
  import { b as P, u as Q, c as U, a as W } from "./hooks-CkxWXunh.js";
3
- import { t as X, R as Y, a as _ } from "./utils-CKyHXHob.js";
4
- import { _ as k } from "./Icon-CL9G-J0o.js";
5
- import { b as ee, d as te, a as z, c as se, f as M, g as ne, s as oe } from "./vendor-CZxuzErw.js";
3
+ import { t as X, R as Y, a as _ } from "./utils-D7OMQX6l.js";
4
+ import { _ as k } from "./Icon-DmRQNZdt.js";
5
+ import { b as ee, a as te, c as z, h as se, f as M, g as ne, s as oe } from "./vendor-BvCJXmoZ.js";
6
6
  import "@fortawesome/free-solid-svg-icons";
7
7
  const ae = [
8
8
  "info",
@@ -29,20 +29,20 @@ const ae = [
29
29
  onDestory: {}
30
30
  },
31
31
  setup(e, { expose: t }) {
32
- const s = e, n = g(!1), i = g(), c = x(() => X.get(s.type) ?? "circle-info"), o = g(0), { topOffset: p, bottomOffset: d } = P({
32
+ const s = e, n = g(!1), i = g(), c = x(() => X.get(s.type) ?? "circle-info"), o = g(0), { topOffset: h, bottomOffset: d } = P({
33
33
  getLastBottomOffset: ee(ue, s),
34
34
  offset: s.offset,
35
35
  boxHeight: o
36
36
  }), f = x(() => ({
37
- top: p.value + "px",
37
+ top: h.value + "px",
38
38
  zIndex: s.zIndex
39
39
  }));
40
- let h;
40
+ let p;
41
41
  function y() {
42
- s.duration !== 0 && (h = te(u, s.duration));
42
+ s.duration !== 0 && (p = te(u, s.duration));
43
43
  }
44
44
  function E() {
45
- clearTimeout(h);
45
+ clearTimeout(p);
46
46
  }
47
47
  function u() {
48
48
  n.value = !1;
@@ -162,6 +162,5 @@ z(
162
162
  m.closeAll = me;
163
163
  const we = _(m, "$message");
164
164
  export {
165
- we as B,
166
- ae as m
165
+ we as B
167
166
  };
package/dist/es/index.js CHANGED
@@ -1,16 +1,26 @@
1
- import { m as o } from "./utils-CKyHXHob.js";
1
+ import { m as o } from "./utils-D7OMQX6l.js";
2
2
  import "@fortawesome/free-solid-svg-icons";
3
- import { a as t } from "./Button-eQN4Iutg.js";
4
- import { B as m } from "./ButtonGroup-BequUrIT.js";
5
- import { B as r } from "./Message-Daog7bhg.js";
6
- import { m as g } from "./Message-Daog7bhg.js";
7
- import { B as s } from "./Icon-CL9G-J0o.js";
8
- const a = [t, m, s, r], l = o(a);
3
+ import { a as r } from "./Button-Cx5Es0NL.js";
4
+ import { B as a } from "./ButtonGroup-BiVl0zub.js";
5
+ import { B as n } from "./Message-Bm1CGxbe.js";
6
+ import { B as t } from "./Icon-DmRQNZdt.js";
7
+ import { B as m } from "./Loading-P_9XOqlc.js";
8
+ import { v as L, L as u, v as x } from "./Loading-P_9XOqlc.js";
9
+ const s = [
10
+ r,
11
+ a,
12
+ t,
13
+ n,
14
+ m
15
+ ], g = o(s);
9
16
  export {
10
- t as BnButton,
11
- m as BnButtonGroup,
12
- s as BnIcon,
13
- r as BnMessage,
14
- l as default,
15
- g as messageTypes
17
+ r as BnButton,
18
+ a as BnButtonGroup,
19
+ t as BnIcon,
20
+ m as BnLoading,
21
+ L as BnLoadingDirective,
22
+ u as BnLoadingService,
23
+ n as BnMessage,
24
+ g as default,
25
+ x as vLoading
16
26
  };
@@ -1,5 +1,5 @@
1
- import { a as o, i } from "./vendor-CZxuzErw.js";
2
- import { faCircleInfo as s, faCheckCircle as l, faCircleExclamation as c, faCircleXmark as r } from "@fortawesome/free-solid-svg-icons";
1
+ import { c as o, i } from "./vendor-BvCJXmoZ.js";
2
+ import { faCircleInfo as s, faCheckCircle as c, faCircleExclamation as l, faCircleXmark as r } from "@fortawesome/free-solid-svg-icons";
3
3
  import { defineComponent as u } from "vue";
4
4
  function p(e) {
5
5
  return (n) => o(e, (a) => n.use(a));
@@ -11,8 +11,8 @@ const C = (e) => (e.install = (t) => {
11
11
  n.config.globalProperties[t] = e;
12
12
  }, e), w = /* @__PURE__ */ new Map([
13
13
  ["info", s],
14
- ["success", l],
15
- ["warning", c],
14
+ ["success", c],
15
+ ["warning", l],
16
16
  ["danger", r],
17
17
  ["error", r]
18
18
  ]), I = u({