orion-design 0.1.16 → 0.1.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. package/README.md +5 -5
  2. package/dist/components/Form/FileInput/FileInput.vue.d.ts +1 -1
  3. package/dist/components/Form/index.js +247 -238
  4. package/dist/components/Form/index.js.map +1 -1
  5. package/dist/components/LovTable/LovPagetable.vue.d.ts +310 -2
  6. package/dist/components/LovTable/LovQuerytable.vue.d.ts +198 -2
  7. package/dist/components/LovTable/index.d.ts +295 -6
  8. package/dist/components/LovTable/index.js +114 -29
  9. package/dist/components/LovTable/index.js.map +1 -1
  10. package/dist/components/Pagetable/Pagetable.d.ts +13 -0
  11. package/dist/components/Pagetable/index.d.ts +9 -0
  12. package/dist/components/Pagetable/index.js +167 -161
  13. package/dist/components/Pagetable/index.js.map +1 -1
  14. package/dist/components/Querytable/Querytable.d.ts +13 -0
  15. package/dist/components/Querytable/index.d.ts +9 -0
  16. package/dist/components/Querytable/index.js +130 -125
  17. package/dist/components/Querytable/index.js.map +1 -1
  18. package/dist/components/RichTextEditor/RichTextEditor.d.ts +13 -0
  19. package/dist/components/RichTextEditor/index.d.ts +9 -0
  20. package/dist/components/RichTextEditor/index.js +20761 -0
  21. package/dist/components/RichTextEditor/index.js.map +1 -0
  22. package/dist/components/Tabs/index.js +371 -263
  23. package/dist/components/Tabs/index.js.map +1 -1
  24. package/dist/components/_util/arrays.js.map +1 -1
  25. package/dist/components/_util/browser.js +2 -2
  26. package/dist/components/_util/browser.js.map +1 -1
  27. package/dist/components/_util/dom/aria.js.map +1 -1
  28. package/dist/components/_util/dom/element.js +1 -1
  29. package/dist/components/_util/dom/element.js.map +1 -1
  30. package/dist/components/_util/dom/event.js.map +1 -1
  31. package/dist/components/_util/dom/position.js +1 -1
  32. package/dist/components/_util/dom/position.js.map +1 -1
  33. package/dist/components/_util/dom/scroll.js +1 -1
  34. package/dist/components/_util/dom/scroll.js.map +1 -1
  35. package/dist/components/_util/dom/style.js +1 -1
  36. package/dist/components/_util/dom/style.js.map +1 -1
  37. package/dist/components/_util/easings.js.map +1 -1
  38. package/dist/components/_util/error.js.map +1 -1
  39. package/dist/components/_util/i18n.js.map +1 -1
  40. package/dist/components/_util/index.js +1 -1
  41. package/dist/components/_util/objects.js.map +1 -1
  42. package/dist/components/_util/raf.js +1 -1
  43. package/dist/components/_util/raf.js.map +1 -1
  44. package/dist/components/_util/rand.js.map +1 -1
  45. package/dist/components/_util/strings.js.map +1 -1
  46. package/dist/components/_util/throttleByRaf.js.map +1 -1
  47. package/dist/components/_util/types.js.map +1 -1
  48. package/dist/components/_util/typescript.js.map +1 -1
  49. package/dist/components/_util/vue/global-node.js +1 -1
  50. package/dist/components/_util/vue/global-node.js.map +1 -1
  51. package/dist/components/_util/vue/icon.js.map +1 -1
  52. package/dist/components/_util/vue/install.js.map +1 -1
  53. package/dist/components/_util/vue/props/runtime.js.map +1 -1
  54. package/dist/components/_util/vue/refs.js.map +1 -1
  55. package/dist/components/_util/vue/size.js.map +1 -1
  56. package/dist/components/_util/vue/validator.js.map +1 -1
  57. package/dist/components/_util/vue/vnode.js.map +1 -1
  58. package/dist/components/components.d.ts +2 -0
  59. package/dist/components/components.js +12 -10
  60. package/dist/components/components.js.map +1 -1
  61. package/dist/components/index.js +16 -14
  62. package/dist/components/index.js.map +1 -1
  63. package/dist/components-Cx2JsH63.js +74 -0
  64. package/dist/{components-0PErqPHo.js.map → components-Cx2JsH63.js.map} +1 -1
  65. package/dist/{index-DG_8kbAs.js → index-C9tCD90X.js} +6 -6
  66. package/dist/{index-DG_8kbAs.js.map → index-C9tCD90X.js.map} +1 -1
  67. package/dist/index.css +1 -1
  68. package/dist/index.js +22 -20
  69. package/dist/index.js.map +1 -1
  70. package/dist/version/version.d.ts +1 -1
  71. package/dist/version/version.js +1 -1
  72. package/dist/version/version.js.map +1 -1
  73. package/global.d.ts +2 -0
  74. package/package.json +3 -1
  75. package/dist/components-0PErqPHo.js +0 -72
  76. package/dist/index-DLvlyWAh.js +0 -127
  77. package/dist/index-DLvlyWAh.js.map +0 -1
@@ -1,84 +1,192 @@
1
1
  import "lodash-es";
2
- import { defineComponent as V, getCurrentInstance as q, inject as H, ref as P, watch as R, nextTick as K, onBeforeUnmount as ue, openBlock as ae, createElementBlock as se, normalizeClass as ne, unref as B, normalizeStyle as fe, computed as A, onMounted as oe, onUpdated as de, createVNode as f, provide as be, renderSlot as M, useSlots as ve, reactive as me, onUnmounted as pe, withDirectives as he, vShow as ge, createCommentVNode as ye } from "vue";
3
- import { withInstall as Ne } from "../_util/vue/install.js";
4
- import { ElIcon as G } from "element-plus";
5
- import { isNumber as Pe, isUndefined as xe } from "../_util/types.js";
6
- import { e as Te } from "../../functions-DzLqXvGt.js";
7
- import { buildProps as re, definePropType as ie } from "../_util/vue/props/runtime.js";
8
- import { UPDATE_MODEL_EVENT as le } from "../_constants/event.js";
9
- import { useNamespace as D } from "../_hooks/use-namespace/index.js";
10
- import { useOrderedChildren as $e } from "../_hooks/use-ordered-children/index.js";
11
- import { tabsRootContextKey as I } from "./constants.js";
12
- import { u as W, a as Ce, b as Se } from "../../index-DLvlyWAh.js";
13
- import { capitalize as k } from "../_util/strings.js";
14
- import { throwError as j } from "../_util/error.js";
15
- import { e as Oe, f as we } from "../../index-BwWeqwHB.js";
16
- import { mutable as Ee } from "../_util/typescript.js";
17
- import { EVENT_CODE as _e } from "../_constants/aria.js";
18
- import { tabBarProps as ke } from "./tab-bar.js";
19
- import { tabPaneProps as Be } from "./tab-pane.js";
20
- import { e as J } from "../../index-DG_8kbAs.js";
21
- const Q = "OTabBar", ze = /* @__PURE__ */ V({
22
- name: Q,
2
+ import { ref as h, watch as B, defineComponent as M, getCurrentInstance as D, inject as H, nextTick as K, onBeforeUnmount as Pe, openBlock as ue, createElementBlock as fe, normalizeClass as de, unref as k, normalizeStyle as Ne, computed as F, onMounted as ve, onUpdated as Ee, createVNode as O, provide as we, renderSlot as L, useSlots as Te, reactive as Se, onUnmounted as xe, withDirectives as $e, vShow as Ce, createCommentVNode as Ie } from "vue";
3
+ import { withInstall as Be } from "../_util/vue/install.js";
4
+ import { ElIcon as J } from "element-plus";
5
+ import { isNumber as ke, isUndefined as ze } from "../_util/types.js";
6
+ import { e as Re } from "../../functions-DzLqXvGt.js";
7
+ import { buildProps as be, definePropType as pe } from "../_util/vue/props/runtime.js";
8
+ import { UPDATE_MODEL_EVENT as me } from "../_constants/event.js";
9
+ import { useNamespace as V } from "../_hooks/use-namespace/index.js";
10
+ import { useOrderedChildren as Ae } from "../_hooks/use-ordered-children/index.js";
11
+ import { tabsRootContextKey as Q } from "./constants.js";
12
+ import { t as he, r as ye, i as Oe, b as Le, n as Fe, c as Me, d as Ve, e as Z } from "../../index-C9tCD90X.js";
13
+ import { capitalize as I } from "../_util/strings.js";
14
+ import { throwError as q } from "../_util/error.js";
15
+ import { e as Qe, f as Ue } from "../../index-BwWeqwHB.js";
16
+ import { mutable as We } from "../_util/typescript.js";
17
+ import { EVENT_CODE as je } from "../_constants/aria.js";
18
+ import { tabBarProps as De } from "./tab-bar.js";
19
+ import { tabPaneProps as He } from "./tab-pane.js";
20
+ function ge(e) {
21
+ var t;
22
+ const a = ye(e);
23
+ return (t = a == null ? void 0 : a.$el) != null ? t : a;
24
+ }
25
+ const G = Oe ? window : void 0, Ke = Oe ? window.document : void 0;
26
+ function W(...e) {
27
+ let t, a, s, n;
28
+ if (Le(e[0]) || Array.isArray(e[0]) ? ([a, s, n] = e, t = G) : [t, a, s, n] = e, !t)
29
+ return Fe;
30
+ Array.isArray(a) || (a = [a]), Array.isArray(s) || (s = [s]);
31
+ const P = [], d = () => {
32
+ P.forEach((r) => r()), P.length = 0;
33
+ }, u = (r, i, f, b) => (r.addEventListener(i, f, b), () => r.removeEventListener(i, f, b)), y = B(() => [ge(t), ye(n)], ([r, i]) => {
34
+ d(), r && P.push(...a.flatMap((f) => s.map((b) => u(r, f, b, i))));
35
+ }, { immediate: !0, flush: "post" }), v = () => {
36
+ y(), d();
37
+ };
38
+ return he(v), v;
39
+ }
40
+ function qe(e, t = !1) {
41
+ const a = h(), s = () => a.value = !!e();
42
+ return s(), Me(s, t), a;
43
+ }
44
+ const ee = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, te = "__vueuse_ssr_handlers__";
45
+ ee[te] = ee[te] || {};
46
+ function Ge({ document: e = Ke } = {}) {
47
+ if (!e)
48
+ return h("visible");
49
+ const t = h(e.visibilityState);
50
+ return W(e, "visibilitychange", () => {
51
+ t.value = e.visibilityState;
52
+ }), t;
53
+ }
54
+ var ae = Object.getOwnPropertySymbols, Xe = Object.prototype.hasOwnProperty, Ye = Object.prototype.propertyIsEnumerable, Je = (e, t) => {
55
+ var a = {};
56
+ for (var s in e)
57
+ Xe.call(e, s) && t.indexOf(s) < 0 && (a[s] = e[s]);
58
+ if (e != null && ae)
59
+ for (var s of ae(e))
60
+ t.indexOf(s) < 0 && Ye.call(e, s) && (a[s] = e[s]);
61
+ return a;
62
+ };
63
+ function j(e, t, a = {}) {
64
+ const s = a, { window: n = G } = s, P = Je(s, ["window"]);
65
+ let d;
66
+ const u = qe(() => n && "ResizeObserver" in n), y = () => {
67
+ d && (d.disconnect(), d = void 0);
68
+ }, v = B(() => ge(e), (i) => {
69
+ y(), u.value && n && i && (d = new ResizeObserver(t), d.observe(i, P));
70
+ }, { immediate: !0, flush: "post" }), r = () => {
71
+ y(), v();
72
+ };
73
+ return he(r), {
74
+ isSupported: u,
75
+ stop: r
76
+ };
77
+ }
78
+ var ne;
79
+ (function(e) {
80
+ e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE";
81
+ })(ne || (ne = {}));
82
+ var Ze = Object.defineProperty, se = Object.getOwnPropertySymbols, et = Object.prototype.hasOwnProperty, tt = Object.prototype.propertyIsEnumerable, oe = (e, t, a) => t in e ? Ze(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, at = (e, t) => {
83
+ for (var a in t || (t = {}))
84
+ et.call(t, a) && oe(e, a, t[a]);
85
+ if (se)
86
+ for (var a of se(t))
87
+ tt.call(t, a) && oe(e, a, t[a]);
88
+ return e;
89
+ };
90
+ const nt = {
91
+ easeInSine: [0.12, 0, 0.39, 0],
92
+ easeOutSine: [0.61, 1, 0.88, 1],
93
+ easeInOutSine: [0.37, 0, 0.63, 1],
94
+ easeInQuad: [0.11, 0, 0.5, 0],
95
+ easeOutQuad: [0.5, 1, 0.89, 1],
96
+ easeInOutQuad: [0.45, 0, 0.55, 1],
97
+ easeInCubic: [0.32, 0, 0.67, 0],
98
+ easeOutCubic: [0.33, 1, 0.68, 1],
99
+ easeInOutCubic: [0.65, 0, 0.35, 1],
100
+ easeInQuart: [0.5, 0, 0.75, 0],
101
+ easeOutQuart: [0.25, 1, 0.5, 1],
102
+ easeInOutQuart: [0.76, 0, 0.24, 1],
103
+ easeInQuint: [0.64, 0, 0.78, 0],
104
+ easeOutQuint: [0.22, 1, 0.36, 1],
105
+ easeInOutQuint: [0.83, 0, 0.17, 1],
106
+ easeInExpo: [0.7, 0, 0.84, 0],
107
+ easeOutExpo: [0.16, 1, 0.3, 1],
108
+ easeInOutExpo: [0.87, 0, 0.13, 1],
109
+ easeInCirc: [0.55, 0, 1, 0.45],
110
+ easeOutCirc: [0, 0.55, 0.45, 1],
111
+ easeInOutCirc: [0.85, 0, 0.15, 1],
112
+ easeInBack: [0.36, 0, 0.66, -0.56],
113
+ easeOutBack: [0.34, 1.56, 0.64, 1],
114
+ easeInOutBack: [0.68, -0.6, 0.32, 1.6]
115
+ };
116
+ at({
117
+ linear: Ve
118
+ }, nt);
119
+ function st({ window: e = G } = {}) {
120
+ if (!e)
121
+ return h(!1);
122
+ const t = h(e.document.hasFocus());
123
+ return W(e, "blur", () => {
124
+ t.value = !1;
125
+ }), W(e, "focus", () => {
126
+ t.value = !0;
127
+ }), t;
128
+ }
129
+ const re = "OTabBar", ot = /* @__PURE__ */ M({
130
+ name: re,
23
131
  __name: "tab-bar",
24
- props: ke,
25
- setup(a, { expose: d }) {
26
- const h = a, g = q(), e = H(I);
27
- e || j(Q, "<o-tabs><o-tab-bar /></p-tabs>");
28
- const _ = D("tabs"), x = P(), i = P(), T = () => {
29
- let v = 0, t = 0;
30
- const o = ["top", "bottom"].includes(e.props.tabPosition) ? "width" : "height", y = o === "width" ? "x" : "y", O = y === "x" ? "left" : "top";
31
- return h.tabs.every((E) => {
32
- var L, F;
33
- const w = (F = (L = g.parent) == null ? void 0 : L.refs) == null ? void 0 : F[`tab-${E.uid}`];
34
- if (!w) return !1;
35
- if (!E.active)
132
+ props: De,
133
+ setup(e, { expose: t }) {
134
+ const a = e, s = D(), n = H(Q);
135
+ n || q(re, "<o-tabs><o-tab-bar /></p-tabs>");
136
+ const P = V("tabs"), d = h(), u = h(), y = () => {
137
+ let b = 0, o = 0;
138
+ const p = ["top", "bottom"].includes(n.props.tabPosition) ? "width" : "height", N = p === "width" ? "x" : "y", x = N === "x" ? "left" : "top";
139
+ return a.tabs.every((C) => {
140
+ var A, R;
141
+ const $ = (R = (A = s.parent) == null ? void 0 : A.refs) == null ? void 0 : R[`tab-${C.uid}`];
142
+ if (!$) return !1;
143
+ if (!C.active)
36
144
  return !0;
37
- v = w[`offset${k(O)}`], t = w[`client${k(o)}`];
38
- const z = window.getComputedStyle(w);
39
- return o === "width" && (t -= Number.parseFloat(z.paddingLeft) + Number.parseFloat(z.paddingRight), v += Number.parseFloat(z.paddingLeft)), !1;
145
+ b = $[`offset${I(x)}`], o = $[`client${I(p)}`];
146
+ const z = window.getComputedStyle($);
147
+ return p === "width" && (o -= Number.parseFloat(z.paddingLeft) + Number.parseFloat(z.paddingRight), b += Number.parseFloat(z.paddingLeft)), !1;
40
148
  }), {
41
- [o]: `${t}px`,
42
- transform: `translate${k(y)}(${v}px)`
149
+ [p]: `${o}px`,
150
+ transform: `translate${I(N)}(${b}px)`
43
151
  };
44
- }, b = () => i.value = T(), c = [], l = () => {
45
- var t;
46
- c.forEach((o) => o.stop()), c.length = 0;
47
- const v = (t = g.parent) == null ? void 0 : t.refs;
48
- if (v) {
49
- for (const o in v)
50
- if (o.startsWith("tab-")) {
51
- const y = v[o];
52
- y && c.push(W(y, b));
152
+ }, v = () => u.value = y(), r = [], i = () => {
153
+ var o;
154
+ r.forEach((p) => p.stop()), r.length = 0;
155
+ const b = (o = s.parent) == null ? void 0 : o.refs;
156
+ if (b) {
157
+ for (const p in b)
158
+ if (p.startsWith("tab-")) {
159
+ const N = b[p];
160
+ N && r.push(j(N, v));
53
161
  }
54
162
  }
55
163
  };
56
- R(
57
- () => h.tabs,
164
+ B(
165
+ () => a.tabs,
58
166
  async () => {
59
- await K(), b(), l();
167
+ await K(), v(), i();
60
168
  },
61
169
  { immediate: !0 }
62
170
  );
63
- const u = W(x, () => b());
64
- return ue(() => {
65
- c.forEach((v) => v.stop()), c.length = 0, u.stop();
66
- }), d({
171
+ const f = j(d, () => v());
172
+ return Pe(() => {
173
+ r.forEach((b) => b.stop()), r.length = 0, f.stop();
174
+ }), t({
67
175
  /** @description tab root html element */
68
- ref: x,
176
+ ref: d,
69
177
  /** @description method to manually update tab bar style */
70
- update: b
71
- }), (v, t) => (ae(), se("div", {
178
+ update: v
179
+ }), (b, o) => (ue(), fe("div", {
72
180
  ref_key: "barRef",
73
- ref: x,
74
- class: ne([B(_).e("active-bar"), B(_).is(B(e).props.tabPosition)]),
75
- style: fe(i.value)
181
+ ref: d,
182
+ class: de([k(P).e("active-bar"), k(P).is(k(n).props.tabPosition)]),
183
+ style: Ne(u.value)
76
184
  }, null, 6));
77
185
  }
78
- }), Re = re({
186
+ }), rt = be({
79
187
  panes: {
80
- type: ie(Array),
81
- default: () => Ee([])
188
+ type: pe(Array),
189
+ default: () => We([])
82
190
  },
83
191
  currentName: {
84
192
  type: [String, Number],
@@ -90,122 +198,122 @@ const Q = "OTabBar", ze = /* @__PURE__ */ V({
90
198
  default: "card"
91
199
  },
92
200
  stretch: Boolean
93
- }), Fe = {
94
- tabClick: (a, d, h) => h instanceof Event,
95
- tabRemove: (a, d) => d instanceof Event
96
- }, Z = "OTabNav", Le = /* @__PURE__ */ V({
97
- name: Z,
98
- props: Re,
99
- emits: Fe,
100
- setup(a, {
101
- expose: d,
102
- emit: h
201
+ }), it = {
202
+ tabClick: (e, t, a) => a instanceof Event,
203
+ tabRemove: (e, t) => t instanceof Event
204
+ }, ie = "OTabNav", lt = /* @__PURE__ */ M({
205
+ name: ie,
206
+ props: rt,
207
+ emits: it,
208
+ setup(e, {
209
+ expose: t,
210
+ emit: a
103
211
  }) {
104
- const g = H(I);
105
- g || j(Z, "<o-tabs><o-tab-nav /></o-tabs>");
106
- const e = D("tabs"), _ = Ce(), x = Se(), i = P(), T = P(), b = P(), c = P(), l = P(!1), u = P(0), v = P(!1), t = P(!0), o = A(() => ["top", "bottom"].includes(g.props.tabPosition) ? "width" : "height"), y = A(() => ({
107
- transform: `translate${o.value === "width" ? "X" : "Y"}(-${u.value}px)`
108
- })), O = () => {
109
- if (!i.value) return;
110
- const s = i.value[`offset${k(o.value)}`], r = u.value;
111
- if (!r) return;
112
- const n = r > s ? r - s : 0;
113
- u.value = n;
114
- }, E = () => {
115
- if (!i.value || !T.value) return;
116
- const s = T.value[`offset${k(o.value)}`], r = i.value[`offset${k(o.value)}`], n = u.value;
117
- if (s - n <= r) return;
118
- const $ = s - n > r * 2 ? n + r : s - r;
119
- u.value = $;
120
- }, w = async () => {
121
- const s = T.value;
122
- if (!l.value || !b.value || !i.value || !s) return;
212
+ const s = H(Q);
213
+ s || q(ie, "<o-tabs><o-tab-nav /></o-tabs>");
214
+ const n = V("tabs"), P = Ge(), d = st(), u = h(), y = h(), v = h(), r = h(), i = h(!1), f = h(0), b = h(!1), o = h(!0), p = F(() => ["top", "bottom"].includes(s.props.tabPosition) ? "width" : "height"), N = F(() => ({
215
+ transform: `translate${p.value === "width" ? "X" : "Y"}(-${f.value}px)`
216
+ })), x = () => {
217
+ if (!u.value) return;
218
+ const l = u.value[`offset${I(p.value)}`], m = f.value;
219
+ if (!m) return;
220
+ const c = m > l ? m - l : 0;
221
+ f.value = c;
222
+ }, C = () => {
223
+ if (!u.value || !y.value) return;
224
+ const l = y.value[`offset${I(p.value)}`], m = u.value[`offset${I(p.value)}`], c = f.value;
225
+ if (l - c <= m) return;
226
+ const w = l - c > m * 2 ? c + m : l - m;
227
+ f.value = w;
228
+ }, $ = async () => {
229
+ const l = y.value;
230
+ if (!i.value || !v.value || !u.value || !l) return;
123
231
  await K();
124
- const r = b.value.querySelector(".is-active");
125
- if (!r) return;
126
- const n = i.value, $ = ["top", "bottom"].includes(g.props.tabPosition), N = r.getBoundingClientRect(), p = n.getBoundingClientRect(), S = $ ? s.offsetWidth - p.width : s.offsetHeight - p.height, C = u.value;
127
- let m = C;
128
- $ ? (N.left < p.left && (m = C - (p.left - N.left)), N.right > p.right && (m = C + N.right - p.right)) : (N.top < p.top && (m = C - (p.top - N.top)), N.bottom > p.bottom && (m = C + (N.bottom - p.bottom))), m = Math.max(m, 0), u.value = Math.min(m, S);
232
+ const m = v.value.querySelector(".is-active");
233
+ if (!m) return;
234
+ const c = u.value, w = ["top", "bottom"].includes(s.props.tabPosition), E = m.getBoundingClientRect(), _ = c.getBoundingClientRect(), S = w ? l.offsetWidth - _.width : l.offsetHeight - _.height, T = f.value;
235
+ let g = T;
236
+ w ? (E.left < _.left && (g = T - (_.left - E.left)), E.right > _.right && (g = T + E.right - _.right)) : (E.top < _.top && (g = T - (_.top - E.top)), E.bottom > _.bottom && (g = T + (E.bottom - _.bottom))), g = Math.max(g, 0), f.value = Math.min(g, S);
129
237
  }, z = () => {
130
- var $;
131
- if (!T.value || !i.value) return;
132
- a.stretch && (($ = c.value) == null || $.update());
133
- const s = T.value[`offset${k(o.value)}`], r = i.value[`offset${k(o.value)}`], n = u.value;
134
- r < s ? (l.value = l.value || {}, l.value.prev = n, l.value.next = n + r < s, s - n < r && (u.value = s - r)) : (l.value = !1, n > 0 && (u.value = 0));
135
- }, L = (s) => {
136
- const r = s.code, {
137
- up: n,
138
- down: $,
139
- left: N,
140
- right: p
141
- } = _e;
142
- if (![n, $, N, p].includes(r)) return;
143
- const S = Array.from(s.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)")), C = S.indexOf(s.target);
144
- let m;
145
- r === N || r === n ? C === 0 ? m = S.length - 1 : m = C - 1 : C < S.length - 1 ? m = C + 1 : m = 0, S[m].focus({
238
+ var w;
239
+ if (!y.value || !u.value) return;
240
+ e.stretch && ((w = r.value) == null || w.update());
241
+ const l = y.value[`offset${I(p.value)}`], m = u.value[`offset${I(p.value)}`], c = f.value;
242
+ m < l ? (i.value = i.value || {}, i.value.prev = c, i.value.next = c + m < l, l - c < m && (f.value = l - m)) : (i.value = !1, c > 0 && (f.value = 0));
243
+ }, A = (l) => {
244
+ const m = l.code, {
245
+ up: c,
246
+ down: w,
247
+ left: E,
248
+ right: _
249
+ } = je;
250
+ if (![c, w, E, _].includes(m)) return;
251
+ const S = Array.from(l.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)")), T = S.indexOf(l.target);
252
+ let g;
253
+ m === E || m === c ? T === 0 ? g = S.length - 1 : g = T - 1 : T < S.length - 1 ? g = T + 1 : g = 0, S[g].focus({
146
254
  preventScroll: !0
147
- }), S[m].click(), F();
148
- }, F = () => {
149
- t.value && (v.value = !0);
150
- }, U = () => v.value = !1;
151
- return R(_, (s) => {
152
- s === "hidden" ? t.value = !1 : s === "visible" && setTimeout(() => t.value = !0, 50);
153
- }), R(x, (s) => {
154
- s ? setTimeout(() => t.value = !0, 50) : t.value = !1;
155
- }), W(b, z), oe(() => setTimeout(() => w(), 0)), de(() => z()), d({
156
- scrollToActiveTab: w,
255
+ }), S[g].click(), R();
256
+ }, R = () => {
257
+ o.value && (b.value = !0);
258
+ }, U = () => b.value = !1;
259
+ return B(P, (l) => {
260
+ l === "hidden" ? o.value = !1 : l === "visible" && setTimeout(() => o.value = !0, 50);
261
+ }), B(d, (l) => {
262
+ l ? setTimeout(() => o.value = !0, 50) : o.value = !1;
263
+ }), j(v, z), ve(() => setTimeout(() => $(), 0)), Ee(() => z()), t({
264
+ scrollToActiveTab: $,
157
265
  removeFocus: U
158
266
  }), () => {
159
- const s = l.value ? [f("span", {
160
- class: [e.e("nav-prev"), e.is("disabled", !l.value.prev)],
161
- onClick: O
162
- }, [f(G, null, {
163
- default: () => [f(Oe, null, null)]
164
- })]), f("span", {
165
- class: [e.e("nav-next"), e.is("disabled", !l.value.next)],
166
- onClick: E
167
- }, [f(G, null, {
168
- default: () => [f(we, null, null)]
169
- })])] : null, r = a.panes.map((n, $) => {
267
+ const l = i.value ? [O("span", {
268
+ class: [n.e("nav-prev"), n.is("disabled", !i.value.prev)],
269
+ onClick: x
270
+ }, [O(J, null, {
271
+ default: () => [O(Qe, null, null)]
272
+ })]), O("span", {
273
+ class: [n.e("nav-next"), n.is("disabled", !i.value.next)],
274
+ onClick: C
275
+ }, [O(J, null, {
276
+ default: () => [O(Ue, null, null)]
277
+ })])] : null, m = e.panes.map((c, w) => {
170
278
  var X, Y;
171
- const N = n.uid, p = n.props.disabled, S = n.props.name ?? n.index ?? `${$}`;
172
- n.index = `${$}`;
173
- const C = ((Y = (X = n.slots).label) == null ? void 0 : Y.call(X)) || n.props.label, m = !p && n.active ? 0 : -1;
174
- return f("div", {
175
- ref: `tab-${N}`,
176
- class: [e.e("item"), e.is(g.props.tabPosition), e.is("active", n.active), e.is("disabled", p), e.is("focus", v.value)],
279
+ const E = c.uid, _ = c.props.disabled, S = c.props.name ?? c.index ?? `${w}`;
280
+ c.index = `${w}`;
281
+ const T = ((Y = (X = c.slots).label) == null ? void 0 : Y.call(X)) || c.props.label, g = !_ && c.active ? 0 : -1;
282
+ return O("div", {
283
+ ref: `tab-${E}`,
284
+ class: [n.e("item"), n.is(s.props.tabPosition), n.is("active", c.active), n.is("disabled", _), n.is("focus", b.value)],
177
285
  id: `tab-${S}`,
178
- key: `tab-${N}`,
286
+ key: `tab-${E}`,
179
287
  "aria-controls": `pane-${S}`,
180
288
  role: "tab",
181
- "aria-selected": n.active,
182
- tabindex: m,
183
- onFocus: () => F(),
289
+ "aria-selected": c.active,
290
+ tabindex: g,
291
+ onFocus: () => R(),
184
292
  onBlur: () => U(),
185
- onClick: (ce) => {
186
- U(), h("tabClick", n, S, ce);
293
+ onClick: (_e) => {
294
+ U(), a("tabClick", c, S, _e);
187
295
  }
188
- }, [C]);
296
+ }, [T]);
189
297
  });
190
- return f("div", {
191
- ref: b,
192
- class: [e.e("nav-wrap"), e.is("scrollable", !!l.value), e.is(g.props.tabPosition)]
193
- }, [s, f("div", {
194
- class: e.e("nav-scroll"),
195
- ref: i
196
- }, [f("div", {
197
- class: [e.e("nav"), e.is(g.props.tabPosition), e.is("stretch", a.stretch && ["top", "bottom"].includes(g.props.tabPosition))],
198
- ref: T,
199
- style: y.value,
298
+ return O("div", {
299
+ ref: v,
300
+ class: [n.e("nav-wrap"), n.is("scrollable", !!i.value), n.is(s.props.tabPosition)]
301
+ }, [l, O("div", {
302
+ class: n.e("nav-scroll"),
303
+ ref: u
304
+ }, [O("div", {
305
+ class: [n.e("nav"), n.is(s.props.tabPosition), n.is("stretch", e.stretch && ["top", "bottom"].includes(s.props.tabPosition))],
306
+ ref: y,
307
+ style: N.value,
200
308
  role: "tablist",
201
- onKeydown: L
202
- }, [a.type ? null : f(ze, {
203
- ref: c,
204
- tabs: [...a.panes]
205
- }, null), r])])]);
309
+ onKeydown: A
310
+ }, [e.type ? null : O(ot, {
311
+ ref: r,
312
+ tabs: [...e.panes]
313
+ }, null), m])])]);
206
314
  };
207
315
  }
208
- }), Me = re({
316
+ }), ct = be({
209
317
  /**
210
318
  * @description type of Tab
211
319
  */
@@ -232,136 +340,136 @@ const Q = "OTabBar", ze = /* @__PURE__ */ V({
232
340
  * @description hook function before switching tab. If `false` is returned or a `Promise` is returned and then is rejected, switching will be prevented
233
341
  */
234
342
  beforeLeave: {
235
- type: ie(Function),
343
+ type: pe(Function),
236
344
  default: () => !0
237
345
  },
238
346
  /**
239
347
  * @description whether width of tab automatically fits its container
240
348
  */
241
349
  stretch: Boolean
242
- }), ee = (a) => Te(a) || Pe(a), Ae = {
243
- [le]: (a) => ee(a),
244
- tabClick: (a, d) => d instanceof Event,
245
- tabChange: (a) => ee(a)
246
- }, Ve = /* @__PURE__ */ V({
350
+ }), le = (e) => Re(e) || ke(e), ut = {
351
+ [me]: (e) => le(e),
352
+ tabClick: (e, t) => t instanceof Event,
353
+ tabChange: (e) => le(e)
354
+ }, ft = /* @__PURE__ */ M({
247
355
  name: "OTabs",
248
- props: Me,
249
- emits: Ae,
250
- setup(a, {
251
- emit: d,
252
- slots: h,
253
- expose: g
356
+ props: ct,
357
+ emits: ut,
358
+ setup(e, {
359
+ emit: t,
360
+ slots: a,
361
+ expose: s
254
362
  }) {
255
- const e = D("tabs"), _ = A(() => ["left", "right"].includes(a.tabPosition)), {
256
- children: x,
257
- addChild: i,
258
- removeChild: T
259
- } = $e(q(), "OTabPane"), b = P(), c = P(a.modelValue ?? "0"), l = async (t, o = !1) => {
260
- var y, O, E;
261
- if (!(c.value === t || xe(t)))
363
+ const n = V("tabs"), P = F(() => ["left", "right"].includes(e.tabPosition)), {
364
+ children: d,
365
+ addChild: u,
366
+ removeChild: y
367
+ } = Ae(D(), "OTabPane"), v = h(), r = h(e.modelValue ?? "0"), i = async (o, p = !1) => {
368
+ var N, x, C;
369
+ if (!(r.value === o || ze(o)))
262
370
  try {
263
- await ((y = a.beforeLeave) == null ? void 0 : y.call(a, t, c.value)) !== !1 && (c.value = t, o && (d(le, t), d("tabChange", t)), (E = (O = b.value) == null ? void 0 : O.removeFocus) == null || E.call(O));
371
+ await ((N = e.beforeLeave) == null ? void 0 : N.call(e, o, r.value)) !== !1 && (r.value = o, p && (t(me, o), t("tabChange", o)), (C = (x = v.value) == null ? void 0 : x.removeFocus) == null || C.call(x));
264
372
  } catch {
265
373
  }
266
- }, u = (t, o, y) => {
267
- t.props.disabled || (l(o, !0), d("tabClick", t, y));
374
+ }, f = (o, p, N) => {
375
+ o.props.disabled || (i(p, !0), t("tabClick", o, N));
268
376
  };
269
- R(() => a.modelValue, (t) => l(t)), R(c, async () => {
270
- var t;
271
- await K(), (t = b.value) == null || t.scrollToActiveTab();
272
- }), be(I, {
273
- props: a,
274
- currentName: c,
275
- registerPane: (t) => {
276
- x.value.push(t);
377
+ B(() => e.modelValue, (o) => i(o)), B(r, async () => {
378
+ var o;
379
+ await K(), (o = v.value) == null || o.scrollToActiveTab();
380
+ }), we(Q, {
381
+ props: e,
382
+ currentName: r,
383
+ registerPane: (o) => {
384
+ d.value.push(o);
277
385
  },
278
- sortPane: i,
279
- unregisterPane: T
280
- }), g({
281
- currentName: c
386
+ sortPane: u,
387
+ unregisterPane: y
388
+ }), s({
389
+ currentName: r
282
390
  });
283
- const v = ({
284
- render: t
285
- }) => t();
391
+ const b = ({
392
+ render: o
393
+ }) => o();
286
394
  return () => {
287
- const t = h["left-extra"], o = h["right-extra"], y = f("div", {
288
- class: [e.e("header"), _.value && e.e("header-vertical"), e.is(a.tabPosition)]
289
- }, [t && f("div", {
290
- class: e.e("extra-content-left")
291
- }, [M(h, "left-extra")]), f(v, {
395
+ const o = a["left-extra"], p = a["right-extra"], N = O("div", {
396
+ class: [n.e("header"), P.value && n.e("header-vertical"), n.is(e.tabPosition)]
397
+ }, [o && O("div", {
398
+ class: n.e("extra-content-left")
399
+ }, [L(a, "left-extra")]), O(b, {
292
400
  render: () => {
293
- const E = x.value.some((w) => w.slots.label);
294
- return f(Le, {
295
- ref: b,
296
- currentName: c.value,
297
- type: a.type,
298
- panes: x.value,
299
- stretch: a.stretch,
300
- onTabClick: u
401
+ const C = d.value.some(($) => $.slots.label);
402
+ return O(lt, {
403
+ ref: v,
404
+ currentName: r.value,
405
+ type: e.type,
406
+ panes: d.value,
407
+ stretch: e.stretch,
408
+ onTabClick: f
301
409
  }, {
302
- $stable: !E
410
+ $stable: !C
303
411
  });
304
412
  }
305
- }, null), o && f("div", {
306
- class: e.e("extra-content-right")
307
- }, [M(h, "right-extra")])]), O = f("div", {
308
- class: e.e("content")
309
- }, [M(h, "default")]);
310
- return f("div", {
311
- class: [e.b(), e.m(a.tabPosition), {
312
- [e.m("card")]: a.type === "card",
313
- [e.m("border-card")]: a.type === "border-card"
413
+ }, null), p && O("div", {
414
+ class: n.e("extra-content-right")
415
+ }, [L(a, "right-extra")])]), x = O("div", {
416
+ class: n.e("content")
417
+ }, [L(a, "default")]);
418
+ return O("div", {
419
+ class: [n.b(), n.m(e.tabPosition), {
420
+ [n.m("card")]: e.type === "card",
421
+ [n.m("border-card")]: e.type === "border-card"
314
422
  }]
315
- }, [O, y]);
423
+ }, [x, N]);
316
424
  };
317
425
  }
318
- }), De = ["id", "aria-hidden", "aria-labelledby"], te = "OTabPane", Ie = /* @__PURE__ */ V({
319
- name: te,
426
+ }), dt = ["id", "aria-hidden", "aria-labelledby"], ce = "OTabPane", vt = /* @__PURE__ */ M({
427
+ name: ce,
320
428
  __name: "tab-pane",
321
- props: Be,
322
- setup(a) {
323
- const d = a, h = q(), g = ve(), e = H(I);
324
- e || j(te, "usage: <o-tabs><o-tab-pane /></o-tabs/>");
325
- const _ = D("tab-pane"), x = P(), i = J(() => e.currentName.value === (d.name ?? x.value)), T = P(i.value), b = A(() => d.name ?? x.value), c = J(() => !d.lazy || T.value || i.value);
326
- R(i, (u) => {
327
- u && (T.value = !0);
429
+ props: He,
430
+ setup(e) {
431
+ const t = e, a = D(), s = Te(), n = H(Q);
432
+ n || q(ce, "usage: <o-tabs><o-tab-pane /></o-tabs/>");
433
+ const P = V("tab-pane"), d = h(), u = Z(() => n.currentName.value === (t.name ?? d.value)), y = h(u.value), v = F(() => t.name ?? d.value), r = Z(() => !t.lazy || y.value || u.value);
434
+ B(u, (f) => {
435
+ f && (y.value = !0);
328
436
  });
329
- const l = me({
330
- uid: h.uid,
331
- slots: g,
332
- props: d,
333
- paneName: b,
334
- active: i,
335
- index: x
437
+ const i = Se({
438
+ uid: a.uid,
439
+ slots: s,
440
+ props: t,
441
+ paneName: v,
442
+ active: u,
443
+ index: d
336
444
  });
337
- return e.registerPane(l), oe(() => {
338
- e.sortPane(l);
339
- }), pe(() => {
340
- e.unregisterPane(l.uid);
341
- }), (u, v) => B(c) ? he((ae(), se("div", {
445
+ return n.registerPane(i), ve(() => {
446
+ n.sortPane(i);
447
+ }), xe(() => {
448
+ n.unregisterPane(i.uid);
449
+ }), (f, b) => k(r) ? $e((ue(), fe("div", {
342
450
  key: 0,
343
- id: `pane-${b.value}`,
344
- class: ne(B(_).b()),
451
+ id: `pane-${v.value}`,
452
+ class: de(k(P).b()),
345
453
  role: "tabpanel",
346
- "aria-hidden": !B(i),
347
- "aria-labelledby": `tab-${b.value}`
454
+ "aria-hidden": !k(u),
455
+ "aria-labelledby": `tab-${v.value}`
348
456
  }, [
349
- M(u.$slots, "default")
350
- ], 10, De)), [
351
- [ge, B(i)]
352
- ]) : ye("", !0);
457
+ L(f.$slots, "default")
458
+ ], 10, dt)), [
459
+ [Ce, k(u)]
460
+ ]) : Ie("", !0);
353
461
  }
354
- }), lt = Ne(Ve, {
355
- TabPane: Ie
462
+ }), kt = Be(ft, {
463
+ TabPane: vt
356
464
  });
357
465
  export {
358
- lt as default,
359
- ke as tabBarProps,
360
- Fe as tabNavEmits,
361
- Re as tabNavProps,
362
- Be as tabPaneProps,
363
- Ae as tabsEmits,
364
- Me as tabsProps,
365
- I as tabsRootContextKey
466
+ kt as default,
467
+ De as tabBarProps,
468
+ it as tabNavEmits,
469
+ rt as tabNavProps,
470
+ He as tabPaneProps,
471
+ ut as tabsEmits,
472
+ ct as tabsProps,
473
+ Q as tabsRootContextKey
366
474
  };
367
475
  //# sourceMappingURL=index.js.map