orion-design 0.1.31 → 0.1.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. package/README.md +5 -5
  2. package/dist/Throne/index.js +14 -30
  3. package/dist/Throne/index.js.map +1 -1
  4. package/dist/components/Button/index.js +33 -40
  5. package/dist/components/Button/index.js.map +1 -1
  6. package/dist/components/Flex/index.js +89 -122
  7. package/dist/components/Flex/index.js.map +1 -1
  8. package/dist/components/Form/Form.js +2 -2
  9. package/dist/components/Form/Form.js.map +1 -1
  10. package/dist/components/Form/LovInput/LovInput.js +2 -2
  11. package/dist/components/Form/LovInput/LovInput.js.map +1 -1
  12. package/dist/components/Form/LovInput/hooks/useLov.js +5 -5
  13. package/dist/components/Form/LovInput/hooks/useLov.js.map +1 -1
  14. package/dist/components/Form/LovInput/index.js +4 -4
  15. package/dist/components/Form/hooks/FormItemValidateTrigger.js +2 -2
  16. package/dist/components/Form/hooks/FormItemValidateTrigger.js.map +1 -1
  17. package/dist/components/Form/hooks/index.js +68 -127
  18. package/dist/components/Form/hooks/index.js.map +1 -1
  19. package/dist/components/Form/index.js +656 -836
  20. package/dist/components/Form/index.js.map +1 -1
  21. package/dist/components/Form/utils/index.js +18 -30
  22. package/dist/components/Form/utils/index.js.map +1 -1
  23. package/dist/components/LovTable/LovPagetable.vue.d.ts +492 -0
  24. package/dist/components/LovTable/index.d.ts +246 -0
  25. package/dist/components/LovTable/index.js +106 -179
  26. package/dist/components/LovTable/index.js.map +1 -1
  27. package/dist/components/Modal/index.js +56 -111
  28. package/dist/components/Modal/index.js.map +1 -1
  29. package/dist/components/Modal/types.d.ts +1 -1
  30. package/dist/components/Modal/types.js +3 -4
  31. package/dist/components/Modal/types.js.map +1 -1
  32. package/dist/components/Modal/useModal.js +5 -5
  33. package/dist/components/Modal/useModal.js.map +1 -1
  34. package/dist/components/Pagetable/Pagetable.d.ts +92 -1
  35. package/dist/components/Pagetable/columns/PagetableColumnButtongroup.d.ts +13 -0
  36. package/dist/components/Pagetable/columns/PagetableColumnDate.d.ts +13 -0
  37. package/dist/components/Pagetable/columns/PagetableColumnLink.d.ts +13 -0
  38. package/dist/components/Pagetable/columns/PagetableColumnMultiselect.d.ts +13 -0
  39. package/dist/components/Pagetable/columns/PagetableColumnNumber.d.ts +13 -0
  40. package/dist/components/Pagetable/columns/PagetableColumnSingleselect.d.ts +13 -0
  41. package/dist/components/Pagetable/columns/PagetableColumnString.d.ts +13 -0
  42. package/dist/components/Pagetable/hooks/useColumns.js +85 -88
  43. package/dist/components/Pagetable/hooks/useColumns.js.map +1 -1
  44. package/dist/components/Pagetable/index.d.ts +155 -0
  45. package/dist/components/Pagetable/index.js +596 -683
  46. package/dist/components/Pagetable/index.js.map +1 -1
  47. package/dist/components/Pagetable/utils/index.js +54 -92
  48. package/dist/components/Pagetable/utils/index.js.map +1 -1
  49. package/dist/components/Querytable/hooks/useColumns.js +74 -82
  50. package/dist/components/Querytable/hooks/useColumns.js.map +1 -1
  51. package/dist/components/Querytable/index.js +469 -579
  52. package/dist/components/Querytable/index.js.map +1 -1
  53. package/dist/components/Querytable/utils/index.js +54 -92
  54. package/dist/components/Querytable/utils/index.js.map +1 -1
  55. package/dist/components/RichTextEditor/index.js +74 -100
  56. package/dist/components/RichTextEditor/index.js.map +1 -1
  57. package/dist/components/Tabs/constants.js +2 -2
  58. package/dist/components/Tabs/constants.js.map +1 -1
  59. package/dist/components/Tabs/index.js +358 -603
  60. package/dist/components/Tabs/index.js.map +1 -1
  61. package/dist/components/Tabs/tab-bar.js +6 -6
  62. package/dist/components/Tabs/tab-bar.js.map +1 -1
  63. package/dist/components/Tabs/tab-pane.js +3 -3
  64. package/dist/components/Tabs/tab-pane.js.map +1 -1
  65. package/dist/components/_constants/aria.js +2 -2
  66. package/dist/components/_constants/aria.js.map +1 -1
  67. package/dist/components/_constants/event.js +4 -6
  68. package/dist/components/_constants/event.js.map +1 -1
  69. package/dist/components/_constants/index.js +6 -6
  70. package/dist/components/_hooks/index.js +7 -7
  71. package/dist/components/_hooks/use-namespace/index.js +39 -74
  72. package/dist/components/_hooks/use-namespace/index.js.map +1 -1
  73. package/dist/components/_hooks/use-ordered-children/index.js +19 -29
  74. package/dist/components/_hooks/use-ordered-children/index.js.map +1 -1
  75. package/dist/components/_util/arrays.js +5 -9
  76. package/dist/components/_util/arrays.js.map +1 -1
  77. package/dist/components/_util/browser.js +6 -6
  78. package/dist/components/_util/browser.js.map +1 -1
  79. package/dist/components/_util/classNames.js +17 -22
  80. package/dist/components/_util/classNames.js.map +1 -1
  81. package/dist/components/_util/dom/aria.js +39 -74
  82. package/dist/components/_util/dom/aria.js.map +1 -1
  83. package/dist/components/_util/dom/element.js +8 -9
  84. package/dist/components/_util/dom/element.js.map +1 -1
  85. package/dist/components/_util/dom/event.js +7 -14
  86. package/dist/components/_util/dom/event.js.map +1 -1
  87. package/dist/components/_util/dom/index.js +36 -36
  88. package/dist/components/_util/dom/position.js +25 -49
  89. package/dist/components/_util/dom/position.js.map +1 -1
  90. package/dist/components/_util/dom/scroll.js +61 -103
  91. package/dist/components/_util/dom/scroll.js.map +1 -1
  92. package/dist/components/_util/dom/style.js +50 -65
  93. package/dist/components/_util/dom/style.js.map +1 -1
  94. package/dist/components/_util/easings.js +4 -8
  95. package/dist/components/_util/easings.js.map +1 -1
  96. package/dist/components/_util/error.js +11 -12
  97. package/dist/components/_util/error.js.map +1 -1
  98. package/dist/components/_util/functions.js +3 -3
  99. package/dist/components/_util/i18n.js +2 -2
  100. package/dist/components/_util/i18n.js.map +1 -1
  101. package/dist/components/_util/index.js +137 -137
  102. package/dist/components/_util/isValid.js +2 -4
  103. package/dist/components/_util/isValid.js.map +1 -1
  104. package/dist/components/_util/objects.js +14 -18
  105. package/dist/components/_util/objects.js.map +1 -1
  106. package/dist/components/_util/props-util/index.js +20 -46
  107. package/dist/components/_util/props-util/index.js.map +1 -1
  108. package/dist/components/_util/props-util/initDefaultProps.js +10 -18
  109. package/dist/components/_util/props-util/initDefaultProps.js.map +1 -1
  110. package/dist/components/_util/raf.js +4 -5
  111. package/dist/components/_util/raf.js.map +1 -1
  112. package/dist/components/_util/rand.js +3 -4
  113. package/dist/components/_util/rand.js.map +1 -1
  114. package/dist/components/_util/strings.js +8 -9
  115. package/dist/components/_util/strings.js.map +1 -1
  116. package/dist/components/_util/throttleByRaf.js +10 -16
  117. package/dist/components/_util/throttleByRaf.js.map +1 -1
  118. package/dist/components/_util/type.js +38 -41
  119. package/dist/components/_util/type.js.map +1 -1
  120. package/dist/components/_util/types.js +22 -41
  121. package/dist/components/_util/types.js.map +1 -1
  122. package/dist/components/_util/typescript.js +2 -2
  123. package/dist/components/_util/typescript.js.map +1 -1
  124. package/dist/components/_util/util.js +43 -85
  125. package/dist/components/_util/util.js.map +1 -1
  126. package/dist/components/_util/vue/global-node.js +15 -27
  127. package/dist/components/_util/vue/global-node.js.map +1 -1
  128. package/dist/components/_util/vue/icon.js +25 -29
  129. package/dist/components/_util/vue/icon.js.map +1 -1
  130. package/dist/components/_util/vue/index.js +41 -41
  131. package/dist/components/_util/vue/install.js +18 -35
  132. package/dist/components/_util/vue/install.js.map +1 -1
  133. package/dist/components/_util/vue/props/index.js +6 -6
  134. package/dist/components/_util/vue/props/runtime.js +30 -46
  135. package/dist/components/_util/vue/props/runtime.js.map +1 -1
  136. package/dist/components/_util/vue/refs.js +6 -12
  137. package/dist/components/_util/vue/refs.js.map +1 -1
  138. package/dist/components/_util/vue/size.js +3 -5
  139. package/dist/components/_util/vue/size.js.map +1 -1
  140. package/dist/components/_util/vue/validator.js +4 -5
  141. package/dist/components/_util/vue/validator.js.map +1 -1
  142. package/dist/components/_util/vue/vnode.js +54 -100
  143. package/dist/components/_util/vue/vnode.js.map +1 -1
  144. package/dist/components/_util/vue-types/index.js +220 -231
  145. package/dist/components/_util/vue-types/index.js.map +1 -1
  146. package/dist/components/components.js +20 -20
  147. package/dist/components/index.js +35 -38
  148. package/dist/components/index.js.map +1 -1
  149. package/dist/error/OrionError.js +4 -8
  150. package/dist/error/OrionError.js.map +1 -1
  151. package/dist/index.css +1 -797
  152. package/dist/index.js +36 -36
  153. package/dist/print/LodopFuncs.js +43 -101
  154. package/dist/print/LodopFuncs.js.map +1 -1
  155. package/dist/print/index.js +108 -200
  156. package/dist/print/index.js.map +1 -1
  157. package/dist/request/ErrorHandlerChain.js +14 -17
  158. package/dist/request/ErrorHandlerChain.js.map +1 -1
  159. package/dist/request/RequestFilterChain.js +13 -16
  160. package/dist/request/RequestFilterChain.js.map +1 -1
  161. package/dist/request/ResponseParserChain.js +14 -17
  162. package/dist/request/ResponseParserChain.js.map +1 -1
  163. package/dist/request/disivion/DateSerializer.js +22 -47
  164. package/dist/request/disivion/DateSerializer.js.map +1 -1
  165. package/dist/request/disivion/DivisionErrorHandler.js +25 -40
  166. package/dist/request/disivion/DivisionErrorHandler.js.map +1 -1
  167. package/dist/request/disivion/DivisionResponseParser.js +10 -16
  168. package/dist/request/disivion/DivisionResponseParser.js.map +1 -1
  169. package/dist/request/disivion/index.js +201 -305
  170. package/dist/request/disivion/index.js.map +1 -1
  171. package/dist/request/error/BizExceptionResponseError.js +5 -11
  172. package/dist/request/error/BizExceptionResponseError.js.map +1 -1
  173. package/dist/request/error/ExceptionResponseError.js +5 -11
  174. package/dist/request/error/ExceptionResponseError.js.map +1 -1
  175. package/dist/request/error/ResponseError.js +4 -9
  176. package/dist/request/error/ResponseError.js.map +1 -1
  177. package/dist/request/error/SessionExceptionResponseError.js +5 -11
  178. package/dist/request/error/SessionExceptionResponseError.js.map +1 -1
  179. package/dist/request/index.js +11 -11
  180. package/dist/utils/DateUtil.js +33 -48
  181. package/dist/utils/DateUtil.js.map +1 -1
  182. package/dist/utils/NumberUtil.js +6 -6
  183. package/dist/utils/NumberUtil.js.map +1 -1
  184. package/dist/utils/cloneDeep.js +2 -2
  185. package/dist/utils/delay.js +3 -3
  186. package/dist/utils/delay.js.map +1 -1
  187. package/dist/utils/functions.js +3 -3
  188. package/dist/utils/index.js +12 -12
  189. package/dist/utils/md5.js +93 -191
  190. package/dist/utils/md5.js.map +1 -1
  191. package/dist/utils/uuid.js +25 -35
  192. package/dist/utils/uuid.js.map +1 -1
  193. package/dist/version/index.js +2 -2
  194. package/dist/version/version.d.ts +1 -1
  195. package/dist/version/version.js +2 -2
  196. package/dist/version/version.js.map +1 -1
  197. package/package.json +1 -1
  198. package/dist/_commonjsHelpers-DWwsNxpa.js +0 -9
  199. package/dist/_commonjsHelpers-DWwsNxpa.js.map +0 -1
  200. package/dist/components-B3d9m_tn.js +0 -27
  201. package/dist/components-B3d9m_tn.js.map +0 -1
  202. package/dist/functions-BeMkokbY.js +0 -63
  203. package/dist/functions-BeMkokbY.js.map +0 -1
  204. package/dist/index-BOKLZnqH.js +0 -54
  205. package/dist/index-BOKLZnqH.js.map +0 -1
  206. package/dist/index-D1m0KTpK.js +0 -69
  207. package/dist/index-D1m0KTpK.js.map +0 -1
  208. package/dist/index-DR5ZP7mD.js +0 -160
  209. package/dist/index-DR5ZP7mD.js.map +0 -1
  210. package/dist/index-DkwIULcN.js +0 -200
  211. package/dist/index-DkwIULcN.js.map +0 -1
@@ -1,156 +1,93 @@
1
1
  import "lodash-es";
2
- import { ref, watch, defineComponent, getCurrentInstance, inject, nextTick, onBeforeUnmount, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, computed, onMounted, onUpdated, createVNode, provide, renderSlot, useSlots, reactive, onUnmounted, withDirectives, vShow, createCommentVNode } from "vue";
3
- import { withInstall } from "../_util/vue/install.js";
4
- import { ElIcon } from "element-plus";
5
- import { isNumber, isUndefined } from "../_util/types.js";
6
- import { e as isString$1 } from "../../functions-BeMkokbY.js";
7
- import { buildProps, definePropType } from "../_util/vue/props/runtime.js";
8
- import { UPDATE_MODEL_EVENT } from "../_constants/event.js";
9
- import { useNamespace } from "../_hooks/use-namespace/index.js";
10
- import { useOrderedChildren } from "../_hooks/use-ordered-children/index.js";
11
- import { tabsRootContextKey } from "./constants.js";
12
- import { t as tryOnScopeDispose, r as resolveUnref, i as isClient, b as isString, n as noop, c as tryOnMounted, d as identity, e as computedEager } from "../../index-D1m0KTpK.js";
13
- import { capitalize } from "../_util/strings.js";
14
- import { throwError } from "../_util/error.js";
15
- import { e as arrow_left_default, f as arrow_right_default } from "../../index-DkwIULcN.js";
16
- import { mutable } from "../_util/typescript.js";
17
- import { EVENT_CODE } from "../_constants/aria.js";
18
- import { tabBarProps } from "./tab-bar.js";
19
- import { tabPaneProps } from "./tab-pane.js";
20
- function unrefElement(elRef) {
21
- var _a;
22
- const plain = resolveUnref(elRef);
23
- return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
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-C6P_0wAy.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
24
  }
25
- const defaultWindow = isClient ? window : void 0;
26
- const defaultDocument = isClient ? window.document : void 0;
27
- function useEventListener(...args) {
28
- let target;
29
- let events;
30
- let listeners;
31
- let options;
32
- if (isString(args[0]) || Array.isArray(args[0])) {
33
- [events, listeners, options] = args;
34
- target = defaultWindow;
35
- } else {
36
- [target, events, listeners, options] = args;
37
- }
38
- if (!target)
39
- return noop;
40
- if (!Array.isArray(events))
41
- events = [events];
42
- if (!Array.isArray(listeners))
43
- listeners = [listeners];
44
- const cleanups = [];
45
- const cleanup = () => {
46
- cleanups.forEach((fn) => fn());
47
- cleanups.length = 0;
48
- };
49
- const register = (el, event, listener, options2) => {
50
- el.addEventListener(event, listener, options2);
51
- return () => el.removeEventListener(event, listener, options2);
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();
52
37
  };
53
- const stopWatch = watch(() => [unrefElement(target), resolveUnref(options)], ([el, options2]) => {
54
- cleanup();
55
- if (!el)
56
- return;
57
- cleanups.push(...events.flatMap((event) => {
58
- return listeners.map((listener) => register(el, event, listener, options2));
59
- }));
60
- }, { immediate: true, flush: "post" });
61
- const stop = () => {
62
- stopWatch();
63
- cleanup();
64
- };
65
- tryOnScopeDispose(stop);
66
- return stop;
38
+ return he(v), v;
67
39
  }
68
- function useSupported(callback, sync = false) {
69
- const isSupported = ref();
70
- const update = () => isSupported.value = Boolean(callback());
71
- update();
72
- tryOnMounted(update, sync);
73
- return isSupported;
40
+ function qe(e, t = !1) {
41
+ const a = h(), s = () => a.value = !!e();
42
+ return s(), Me(s, t), a;
74
43
  }
75
- const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
76
- const globalKey = "__vueuse_ssr_handlers__";
77
- _global[globalKey] = _global[globalKey] || {};
78
- function useDocumentVisibility({ document = defaultDocument } = {}) {
79
- if (!document)
80
- return ref("visible");
81
- const visibility = ref(document.visibilityState);
82
- useEventListener(document, "visibilitychange", () => {
83
- visibility.value = document.visibilityState;
84
- });
85
- return visibility;
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;
86
53
  }
87
- var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
88
- var __hasOwnProp$g = Object.prototype.hasOwnProperty;
89
- var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
90
- var __objRest$2 = (source, exclude) => {
91
- var target = {};
92
- for (var prop in source)
93
- if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0)
94
- target[prop] = source[prop];
95
- if (source != null && __getOwnPropSymbols$g)
96
- for (var prop of __getOwnPropSymbols$g(source)) {
97
- if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(source, prop))
98
- target[prop] = source[prop];
99
- }
100
- return target;
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;
101
62
  };
102
- function useResizeObserver(target, callback, options = {}) {
103
- const _a = options, { window: window2 = defaultWindow } = _a, observerOptions = __objRest$2(_a, ["window"]);
104
- let observer;
105
- const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
106
- const cleanup = () => {
107
- if (observer) {
108
- observer.disconnect();
109
- observer = void 0;
110
- }
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();
111
72
  };
112
- const stopWatch = watch(() => unrefElement(target), (el) => {
113
- cleanup();
114
- if (isSupported.value && window2 && el) {
115
- observer = new ResizeObserver(callback);
116
- observer.observe(el, observerOptions);
117
- }
118
- }, { immediate: true, flush: "post" });
119
- const stop = () => {
120
- cleanup();
121
- stopWatch();
122
- };
123
- tryOnScopeDispose(stop);
124
- return {
125
- isSupported,
126
- stop
73
+ return he(r), {
74
+ isSupported: u,
75
+ stop: r
127
76
  };
128
77
  }
129
- var SwipeDirection;
130
- (function(SwipeDirection2) {
131
- SwipeDirection2["UP"] = "UP";
132
- SwipeDirection2["RIGHT"] = "RIGHT";
133
- SwipeDirection2["DOWN"] = "DOWN";
134
- SwipeDirection2["LEFT"] = "LEFT";
135
- SwipeDirection2["NONE"] = "NONE";
136
- })(SwipeDirection || (SwipeDirection = {}));
137
- var __defProp = Object.defineProperty;
138
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
139
- var __hasOwnProp = Object.prototype.hasOwnProperty;
140
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
141
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
142
- var __spreadValues = (a, b) => {
143
- for (var prop in b || (b = {}))
144
- if (__hasOwnProp.call(b, prop))
145
- __defNormalProp(a, prop, b[prop]);
146
- if (__getOwnPropSymbols)
147
- for (var prop of __getOwnPropSymbols(b)) {
148
- if (__propIsEnum.call(b, prop))
149
- __defNormalProp(a, prop, b[prop]);
150
- }
151
- return a;
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;
152
89
  };
153
- const _TransitionPresets = {
90
+ const nt = {
154
91
  easeInSine: [0.12, 0, 0.39, 0],
155
92
  easeOutSine: [0.61, 1, 0.88, 1],
156
93
  easeInOutSine: [0.37, 0, 0.63, 1],
@@ -176,115 +113,80 @@ const _TransitionPresets = {
176
113
  easeOutBack: [0.34, 1.56, 0.64, 1],
177
114
  easeInOutBack: [0.68, -0.6, 0.32, 1.6]
178
115
  };
179
- __spreadValues({
180
- linear: identity
181
- }, _TransitionPresets);
182
- function useWindowFocus({ window: window2 = defaultWindow } = {}) {
183
- if (!window2)
184
- return ref(false);
185
- const focused = ref(window2.document.hasFocus());
186
- useEventListener(window2, "blur", () => {
187
- focused.value = false;
188
- });
189
- useEventListener(window2, "focus", () => {
190
- focused.value = true;
191
- });
192
- return focused;
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;
193
128
  }
194
- const COMPONENT_NAME$2 = "OTabBar";
195
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
196
- ...{
197
- name: COMPONENT_NAME$2
198
- },
129
+ const re = "OTabBar", ot = /* @__PURE__ */ M({
130
+ name: re,
199
131
  __name: "tab-bar",
200
- props: tabBarProps,
201
- setup(__props, { expose: __expose }) {
202
- const props = __props;
203
- const instance = getCurrentInstance();
204
- const rootTabs = inject(tabsRootContextKey);
205
- if (!rootTabs) throwError(COMPONENT_NAME$2, "<o-tabs><o-tab-bar /></p-tabs>");
206
- const ns = useNamespace("tabs");
207
- const barRef = ref();
208
- const barStyle = ref();
209
- const getBarStyle = () => {
210
- let offset = 0;
211
- let tabSize = 0;
212
- const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height";
213
- const sizeDir = sizeName === "width" ? "x" : "y";
214
- const position = sizeDir === "x" ? "left" : "top";
215
- props.tabs.every((tab) => {
216
- var _a, _b;
217
- const $el = (_b = (_a = instance.parent) == null ? void 0 : _a.refs) == null ? void 0 : _b[`tab-${tab.uid}`];
218
- if (!$el) return false;
219
- if (!tab.active) {
220
- return true;
221
- }
222
- offset = $el[`offset${capitalize(position)}`];
223
- tabSize = $el[`client${capitalize(sizeName)}`];
224
- const tabStyles = window.getComputedStyle($el);
225
- if (sizeName === "width") {
226
- tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight);
227
- offset += Number.parseFloat(tabStyles.paddingLeft);
228
- }
229
- return false;
230
- });
231
- return {
232
- [sizeName]: `${tabSize}px`,
233
- transform: `translate${capitalize(sizeDir)}(${offset}px)`
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)
144
+ return !0;
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;
148
+ }), {
149
+ [p]: `${o}px`,
150
+ transform: `translate${I(N)}(${b}px)`
234
151
  };
235
- };
236
- const update = () => barStyle.value = getBarStyle();
237
- const saveObserver = [];
238
- const observerTabs = () => {
239
- var _a;
240
- saveObserver.forEach((observer) => observer.stop());
241
- saveObserver.length = 0;
242
- const list = (_a = instance.parent) == null ? void 0 : _a.refs;
243
- if (!list) return;
244
- for (const key in list) {
245
- if (key.startsWith("tab-")) {
246
- const _el = list[key];
247
- if (_el) {
248
- saveObserver.push(useResizeObserver(_el, update));
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));
249
161
  }
250
- }
251
162
  }
252
163
  };
253
- watch(
254
- () => props.tabs,
164
+ B(
165
+ () => a.tabs,
255
166
  async () => {
256
- await nextTick();
257
- update();
258
- observerTabs();
167
+ await K(), v(), i();
259
168
  },
260
- { immediate: true }
169
+ { immediate: !0 }
261
170
  );
262
- const barObserever = useResizeObserver(barRef, () => update());
263
- onBeforeUnmount(() => {
264
- saveObserver.forEach((observer) => observer.stop());
265
- saveObserver.length = 0;
266
- barObserever.stop();
267
- });
268
- __expose({
171
+ const f = j(d, () => v());
172
+ return Pe(() => {
173
+ r.forEach((b) => b.stop()), r.length = 0, f.stop();
174
+ }), t({
269
175
  /** @description tab root html element */
270
- ref: barRef,
176
+ ref: d,
271
177
  /** @description method to manually update tab bar style */
272
- update
273
- });
274
- return (_ctx, _cache) => {
275
- return openBlock(), createElementBlock("div", {
276
- ref_key: "barRef",
277
- ref: barRef,
278
- class: normalizeClass([unref(ns).e("active-bar"), unref(ns).is(unref(rootTabs).props.tabPosition)]),
279
- style: normalizeStyle(barStyle.value)
280
- }, null, 6);
281
- };
178
+ update: v
179
+ }), (b, o) => (ue(), fe("div", {
180
+ ref_key: "barRef",
181
+ ref: d,
182
+ class: de([k(P).e("active-bar"), k(P).is(k(n).props.tabPosition)]),
183
+ style: Ne(u.value)
184
+ }, null, 6));
282
185
  }
283
- });
284
- const tabNavProps = buildProps({
186
+ }), rt = be({
285
187
  panes: {
286
- type: definePropType(Array),
287
- default: () => mutable([])
188
+ type: pe(Array),
189
+ default: () => We([])
288
190
  },
289
191
  currentName: {
290
192
  type: [String, Number],
@@ -296,222 +198,122 @@ const tabNavProps = buildProps({
296
198
  default: "card"
297
199
  },
298
200
  stretch: Boolean
299
- });
300
- const tabNavEmits = {
301
- tabClick: (tab, tabName, ev) => ev instanceof Event,
302
- tabRemove: (tab, ev) => ev instanceof Event
303
- };
304
- const COMPONENT_NAME$1 = "OTabNav";
305
- const TabNav = /* @__PURE__ */ defineComponent({
306
- name: COMPONENT_NAME$1,
307
- props: tabNavProps,
308
- emits: tabNavEmits,
309
- setup(props, {
310
- expose,
311
- emit
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
312
211
  }) {
313
- const rootTabs = inject(tabsRootContextKey);
314
- if (!rootTabs) throwError(COMPONENT_NAME$1, `<o-tabs><o-tab-nav /></o-tabs>`);
315
- const ns = useNamespace("tabs");
316
- const visibility = useDocumentVisibility();
317
- const focused = useWindowFocus();
318
- const navScroll$ = ref();
319
- const nav$ = ref();
320
- const el$ = ref();
321
- const tabBarRef = ref();
322
- const scrollable = ref(false);
323
- const navOffset = ref(0);
324
- const isFocus = ref(false);
325
- const focusable = ref(true);
326
- const sizeName = computed(() => ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height");
327
- const navStyle = computed(() => {
328
- const dir = sizeName.value === "width" ? "X" : "Y";
329
- return {
330
- transform: `translate${dir}(-${navOffset.value}px)`
331
- };
332
- });
333
- const scrollPrev = () => {
334
- if (!navScroll$.value) return;
335
- const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
336
- const currentOffset = navOffset.value;
337
- if (!currentOffset) return;
338
- const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;
339
- navOffset.value = newOffset;
340
- };
341
- const scrollNext = () => {
342
- if (!navScroll$.value || !nav$.value) return;
343
- const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
344
- const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
345
- const currentOffset = navOffset.value;
346
- if (navSize - currentOffset <= containerSize) return;
347
- const newOffset = navSize - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize - containerSize;
348
- navOffset.value = newOffset;
349
- };
350
- const scrollToActiveTab = async () => {
351
- const nav = nav$.value;
352
- if (!scrollable.value || !el$.value || !navScroll$.value || !nav) return;
353
- await nextTick();
354
- const activeTab = el$.value.querySelector(".is-active");
355
- if (!activeTab) return;
356
- const navScroll = navScroll$.value;
357
- const isHorizontal = ["top", "bottom"].includes(rootTabs.props.tabPosition);
358
- const activeTabBounding = activeTab.getBoundingClientRect();
359
- const navScrollBounding = navScroll.getBoundingClientRect();
360
- const maxOffset = isHorizontal ? nav.offsetWidth - navScrollBounding.width : nav.offsetHeight - navScrollBounding.height;
361
- const currentOffset = navOffset.value;
362
- let newOffset = currentOffset;
363
- if (isHorizontal) {
364
- if (activeTabBounding.left < navScrollBounding.left) {
365
- newOffset = currentOffset - (navScrollBounding.left - activeTabBounding.left);
366
- }
367
- if (activeTabBounding.right > navScrollBounding.right) {
368
- newOffset = currentOffset + activeTabBounding.right - navScrollBounding.right;
369
- }
370
- } else {
371
- if (activeTabBounding.top < navScrollBounding.top) {
372
- newOffset = currentOffset - (navScrollBounding.top - activeTabBounding.top);
373
- }
374
- if (activeTabBounding.bottom > navScrollBounding.bottom) {
375
- newOffset = currentOffset + (activeTabBounding.bottom - navScrollBounding.bottom);
376
- }
377
- }
378
- newOffset = Math.max(newOffset, 0);
379
- navOffset.value = Math.min(newOffset, maxOffset);
380
- };
381
- const update = () => {
382
- var _a;
383
- if (!nav$.value || !navScroll$.value) return;
384
- props.stretch && ((_a = tabBarRef.value) == null ? void 0 : _a.update());
385
- const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
386
- const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
387
- const currentOffset = navOffset.value;
388
- if (containerSize < navSize) {
389
- scrollable.value = scrollable.value || {};
390
- scrollable.value.prev = currentOffset;
391
- scrollable.value.next = currentOffset + containerSize < navSize;
392
- if (navSize - currentOffset < containerSize) {
393
- navOffset.value = navSize - containerSize;
394
- }
395
- } else {
396
- scrollable.value = false;
397
- if (currentOffset > 0) {
398
- navOffset.value = 0;
399
- }
400
- }
401
- };
402
- const changeTab = (e) => {
403
- const code = e.code;
404
- const {
405
- up,
406
- down,
407
- left,
408
- right
409
- } = EVENT_CODE;
410
- if (![up, down, left, right].includes(code)) return;
411
- const tabList = Array.from(e.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)"));
412
- const currentIndex = tabList.indexOf(e.target);
413
- let nextIndex;
414
- if (code === left || code === up) {
415
- if (currentIndex === 0) {
416
- nextIndex = tabList.length - 1;
417
- } else {
418
- nextIndex = currentIndex - 1;
419
- }
420
- } else {
421
- if (currentIndex < tabList.length - 1) {
422
- nextIndex = currentIndex + 1;
423
- } else {
424
- nextIndex = 0;
425
- }
426
- }
427
- tabList[nextIndex].focus({
428
- preventScroll: true
429
- });
430
- tabList[nextIndex].click();
431
- setFocus();
432
- };
433
- const setFocus = () => {
434
- if (focusable.value) isFocus.value = true;
435
- };
436
- const removeFocus = () => isFocus.value = false;
437
- watch(visibility, (visibility2) => {
438
- if (visibility2 === "hidden") {
439
- focusable.value = false;
440
- } else if (visibility2 === "visible") {
441
- setTimeout(() => focusable.value = true, 50);
442
- }
443
- });
444
- watch(focused, (focused2) => {
445
- if (focused2) {
446
- setTimeout(() => focusable.value = true, 50);
447
- } else {
448
- focusable.value = false;
449
- }
450
- });
451
- useResizeObserver(el$, update);
452
- onMounted(() => setTimeout(() => scrollToActiveTab(), 0));
453
- onUpdated(() => update());
454
- expose({
455
- scrollToActiveTab,
456
- removeFocus
457
- });
458
- return () => {
459
- const scrollBtn = scrollable.value ? [createVNode("span", {
460
- "class": [ns.e("nav-prev"), ns.is("disabled", !scrollable.value.prev)],
461
- "onClick": scrollPrev
462
- }, [createVNode(ElIcon, null, {
463
- default: () => [createVNode(arrow_left_default, null, null)]
464
- })]), createVNode("span", {
465
- "class": [ns.e("nav-next"), ns.is("disabled", !scrollable.value.next)],
466
- "onClick": scrollNext
467
- }, [createVNode(ElIcon, null, {
468
- default: () => [createVNode(arrow_right_default, null, null)]
469
- })])] : null;
470
- const tabs = props.panes.map((pane, index2) => {
471
- var _a, _b;
472
- const uid = pane.uid;
473
- const disabled = pane.props.disabled;
474
- const tabName = pane.props.name ?? pane.index ?? `${index2}`;
475
- pane.index = `${index2}`;
476
- const tabLabelContent = ((_b = (_a = pane.slots).label) == null ? void 0 : _b.call(_a)) || pane.props.label;
477
- const tabindex = !disabled && pane.active ? 0 : -1;
478
- return createVNode("div", {
479
- "ref": `tab-${uid}`,
480
- "class": [ns.e("item"), ns.is(rootTabs.props.tabPosition), ns.is("active", pane.active), ns.is("disabled", disabled), ns.is("focus", isFocus.value)],
481
- "id": `tab-${tabName}`,
482
- "key": `tab-${uid}`,
483
- "aria-controls": `pane-${tabName}`,
484
- "role": "tab",
485
- "aria-selected": pane.active,
486
- "tabindex": tabindex,
487
- "onFocus": () => setFocus(),
488
- "onBlur": () => removeFocus(),
489
- "onClick": (ev) => {
490
- removeFocus();
491
- emit("tabClick", pane, tabName, ev);
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;
231
+ await K();
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);
237
+ }, z = () => {
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({
254
+ preventScroll: !0
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: $,
265
+ removeFocus: U
266
+ }), () => {
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) => {
278
+ var X, Y;
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)],
285
+ id: `tab-${S}`,
286
+ key: `tab-${E}`,
287
+ "aria-controls": `pane-${S}`,
288
+ role: "tab",
289
+ "aria-selected": c.active,
290
+ tabindex: g,
291
+ onFocus: () => R(),
292
+ onBlur: () => U(),
293
+ onClick: (_e) => {
294
+ U(), a("tabClick", c, S, _e);
492
295
  }
493
- }, [...[tabLabelContent]]);
296
+ }, [T]);
494
297
  });
495
- return createVNode("div", {
496
- "ref": el$,
497
- "class": [ns.e("nav-wrap"), ns.is("scrollable", !!scrollable.value), ns.is(rootTabs.props.tabPosition)]
498
- }, [scrollBtn, createVNode("div", {
499
- "class": ns.e("nav-scroll"),
500
- "ref": navScroll$
501
- }, [createVNode("div", {
502
- "class": [ns.e("nav"), ns.is(rootTabs.props.tabPosition), ns.is("stretch", props.stretch && ["top", "bottom"].includes(rootTabs.props.tabPosition))],
503
- "ref": nav$,
504
- "style": navStyle.value,
505
- "role": "tablist",
506
- "onKeydown": changeTab
507
- }, [...[!props.type ? createVNode(_sfc_main$1, {
508
- "ref": tabBarRef,
509
- "tabs": [...props.panes]
510
- }, null) : null, tabs]])])]);
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,
308
+ role: "tablist",
309
+ onKeydown: A
310
+ }, [e.type ? null : O(ot, {
311
+ ref: r,
312
+ tabs: [...e.panes]
313
+ }, null), m])])]);
511
314
  };
512
315
  }
513
- });
514
- const tabsProps = buildProps({
316
+ }), ct = be({
515
317
  /**
516
318
  * @description type of Tab
517
319
  */
@@ -538,183 +340,136 @@ const tabsProps = buildProps({
538
340
  * @description hook function before switching tab. If `false` is returned or a `Promise` is returned and then is rejected, switching will be prevented
539
341
  */
540
342
  beforeLeave: {
541
- type: definePropType(Function),
542
- default: () => true
343
+ type: pe(Function),
344
+ default: () => !0
543
345
  },
544
346
  /**
545
347
  * @description whether width of tab automatically fits its container
546
348
  */
547
349
  stretch: Boolean
548
- });
549
- const isPaneName = (value) => isString$1(value) || isNumber(value);
550
- const tabsEmits = {
551
- [UPDATE_MODEL_EVENT]: (name) => isPaneName(name),
552
- tabClick: (pane, ev) => ev instanceof Event,
553
- tabChange: (name) => isPaneName(name)
554
- };
555
- const Tabs = /* @__PURE__ */ defineComponent({
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({
556
355
  name: "OTabs",
557
- props: tabsProps,
558
- emits: tabsEmits,
559
- setup(props, {
560
- emit,
561
- slots,
562
- expose
356
+ props: ct,
357
+ emits: ut,
358
+ setup(e, {
359
+ emit: t,
360
+ slots: a,
361
+ expose: s
563
362
  }) {
564
- const ns = useNamespace("tabs");
565
- const isVertical = computed(() => ["left", "right"].includes(props.tabPosition));
566
- const {
567
- children: panes,
568
- addChild: sortPane,
569
- removeChild: unregisterPane
570
- } = useOrderedChildren(getCurrentInstance(), "OTabPane");
571
- const nav$ = ref();
572
- const currentName = ref(props.modelValue ?? "0");
573
- const setCurrentName = async (value, trigger = false) => {
574
- var _a, _b, _c;
575
- if (currentName.value === value || isUndefined(value)) return;
576
- try {
577
- const canLeave = await ((_a = props.beforeLeave) == null ? void 0 : _a.call(props, value, currentName.value));
578
- if (canLeave !== false) {
579
- currentName.value = value;
580
- if (trigger) {
581
- emit(UPDATE_MODEL_EVENT, value);
582
- emit("tabChange", value);
583
- }
584
- (_c = (_b = nav$.value) == null ? void 0 : _b.removeFocus) == null ? void 0 : _c.call(_b);
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)))
370
+ try {
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));
372
+ } catch {
585
373
  }
586
- } catch {
587
- }
374
+ }, f = (o, p, N) => {
375
+ o.props.disabled || (i(p, !0), t("tabClick", o, N));
588
376
  };
589
- const handleTabClick = (tab, tabName, event) => {
590
- if (tab.props.disabled) return;
591
- setCurrentName(tabName, true);
592
- emit("tabClick", tab, event);
593
- };
594
- watch(() => props.modelValue, (modelValue) => setCurrentName(modelValue));
595
- watch(currentName, async () => {
596
- var _a;
597
- await nextTick();
598
- (_a = nav$.value) == null ? void 0 : _a.scrollToActiveTab();
599
- });
600
- provide(tabsRootContextKey, {
601
- props,
602
- currentName,
603
- registerPane: (pane) => {
604
- panes.value.push(pane);
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);
605
385
  },
606
- sortPane,
607
- unregisterPane
608
- });
609
- expose({
610
- currentName
386
+ sortPane: u,
387
+ unregisterPane: y
388
+ }), s({
389
+ currentName: r
611
390
  });
612
- const TabNavRenderer = ({
613
- render
614
- }) => {
615
- return render();
616
- };
391
+ const b = ({
392
+ render: o
393
+ }) => o();
617
394
  return () => {
618
- const leftExtra = slots["left-extra"];
619
- const rightExtra = slots["right-extra"];
620
- const header = createVNode("div", {
621
- "class": [ns.e("header"), isVertical.value && ns.e("header-vertical"), ns.is(props.tabPosition)]
622
- }, [leftExtra && createVNode("div", {
623
- "class": ns.e("extra-content-left")
624
- }, [renderSlot(slots, "left-extra")]), createVNode(TabNavRenderer, {
625
- "render": () => {
626
- const hasLabelSlot = panes.value.some((pane) => pane.slots.label);
627
- return createVNode(TabNav, {
628
- ref: nav$,
629
- currentName: currentName.value,
630
- type: props.type,
631
- panes: panes.value,
632
- stretch: props.stretch,
633
- onTabClick: handleTabClick
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, {
400
+ render: () => {
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
634
409
  }, {
635
- $stable: !hasLabelSlot
410
+ $stable: !C
636
411
  });
637
412
  }
638
- }, null), rightExtra && createVNode("div", {
639
- "class": ns.e("extra-content-right")
640
- }, [renderSlot(slots, "right-extra")])]);
641
- const panels = createVNode("div", {
642
- "class": ns.e("content")
643
- }, [renderSlot(slots, "default")]);
644
- return createVNode("div", {
645
- "class": [ns.b(), ns.m(props.tabPosition), {
646
- [ns.m("card")]: props.type === "card",
647
- [ns.m("border-card")]: props.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"
648
422
  }]
649
- }, [panels, header]);
423
+ }, [x, N]);
650
424
  };
651
425
  }
652
- });
653
- const _hoisted_1 = ["id", "aria-hidden", "aria-labelledby"];
654
- const COMPONENT_NAME = "OTabPane";
655
- const _sfc_main = /* @__PURE__ */ defineComponent({
656
- ...{
657
- name: COMPONENT_NAME
658
- },
426
+ }), dt = ["id", "aria-hidden", "aria-labelledby"], ce = "OTabPane", vt = /* @__PURE__ */ M({
427
+ name: ce,
659
428
  __name: "tab-pane",
660
- props: tabPaneProps,
661
- setup(__props) {
662
- const props = __props;
663
- const instance = getCurrentInstance();
664
- const slots = useSlots();
665
- const tabsRoot = inject(tabsRootContextKey);
666
- if (!tabsRoot) throwError(COMPONENT_NAME, "usage: <o-tabs><o-tab-pane /></o-tabs/>");
667
- const ns = useNamespace("tab-pane");
668
- const index2 = ref();
669
- const active = computedEager(() => tabsRoot.currentName.value === (props.name ?? index2.value));
670
- const loaded = ref(active.value);
671
- const paneName = computed(() => props.name ?? index2.value);
672
- const shouldBeRender = computedEager(() => !props.lazy || loaded.value || active.value);
673
- watch(active, (val) => {
674
- if (val) loaded.value = true;
675
- });
676
- const pane = reactive({
677
- uid: instance.uid,
678
- slots,
679
- props,
680
- paneName,
681
- active,
682
- index: index2
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);
683
436
  });
684
- tabsRoot.registerPane(pane);
685
- onMounted(() => {
686
- tabsRoot.sortPane(pane);
437
+ const i = Se({
438
+ uid: a.uid,
439
+ slots: s,
440
+ props: t,
441
+ paneName: v,
442
+ active: u,
443
+ index: d
687
444
  });
688
- onUnmounted(() => {
689
- tabsRoot.unregisterPane(pane.uid);
690
- });
691
- return (_ctx, _cache) => {
692
- return unref(shouldBeRender) ? withDirectives((openBlock(), createElementBlock("div", {
693
- key: 0,
694
- id: `pane-${paneName.value}`,
695
- class: normalizeClass(unref(ns).b()),
696
- role: "tabpanel",
697
- "aria-hidden": !unref(active),
698
- "aria-labelledby": `tab-${paneName.value}`
699
- }, [
700
- renderSlot(_ctx.$slots, "default")
701
- ], 10, _hoisted_1)), [
702
- [vShow, unref(active)]
703
- ]) : createCommentVNode("", true);
704
- };
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", {
450
+ key: 0,
451
+ id: `pane-${v.value}`,
452
+ class: de(k(P).b()),
453
+ role: "tabpanel",
454
+ "aria-hidden": !k(u),
455
+ "aria-labelledby": `tab-${v.value}`
456
+ }, [
457
+ L(f.$slots, "default")
458
+ ], 10, dt)), [
459
+ [Ce, k(u)]
460
+ ]) : Ie("", !0);
705
461
  }
706
- });
707
- const index = withInstall(Tabs, {
708
- TabPane: _sfc_main
462
+ }), kt = Be(ft, {
463
+ TabPane: vt
709
464
  });
710
465
  export {
711
- index as default,
712
- tabBarProps,
713
- tabNavEmits,
714
- tabNavProps,
715
- tabPaneProps,
716
- tabsEmits,
717
- tabsProps,
718
- 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
719
474
  };
720
475
  //# sourceMappingURL=index.js.map