orion-design 0.1.29 → 0.1.31
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Throne/index.js +30 -14
- package/dist/Throne/index.js.map +1 -1
- package/dist/_commonjsHelpers-DWwsNxpa.js +9 -0
- package/dist/_commonjsHelpers-DWwsNxpa.js.map +1 -0
- package/dist/components/Button/index.js +40 -33
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Flex/index.js +122 -89
- package/dist/components/Flex/index.js.map +1 -1
- package/dist/components/Form/Form.js +2 -2
- package/dist/components/Form/Form.js.map +1 -1
- package/dist/components/Form/LovInput/LovInput.js +2 -2
- package/dist/components/Form/LovInput/LovInput.js.map +1 -1
- package/dist/components/Form/LovInput/hooks/useLov.js +5 -5
- package/dist/components/Form/LovInput/hooks/useLov.js.map +1 -1
- package/dist/components/Form/LovInput/index.js +4 -4
- package/dist/components/Form/hooks/FormItemValidateTrigger.js +2 -2
- package/dist/components/Form/hooks/FormItemValidateTrigger.js.map +1 -1
- package/dist/components/Form/hooks/index.js +128 -66
- package/dist/components/Form/hooks/index.js.map +1 -1
- package/dist/components/Form/index.js +836 -656
- package/dist/components/Form/index.js.map +1 -1
- package/dist/components/Form/utils/index.js +30 -18
- package/dist/components/Form/utils/index.js.map +1 -1
- package/dist/components/LovTable/LovPagetable.vue.d.ts +28 -0
- package/dist/components/LovTable/index.d.ts +14 -0
- package/dist/components/LovTable/index.js +179 -105
- package/dist/components/LovTable/index.js.map +1 -1
- package/dist/components/Modal/Modal.d.ts +2 -0
- package/dist/components/Modal/ModalLocator.vue.d.ts +20 -0
- package/dist/components/Modal/index.d.ts +4 -1
- package/dist/components/Modal/index.js +127 -0
- package/dist/components/Modal/index.js.map +1 -0
- package/dist/components/Modal/types.d.ts +18 -0
- package/dist/components/Modal/types.js +7 -0
- package/dist/components/Modal/types.js.map +1 -0
- package/dist/components/Modal/useModal.d.ts +1 -3
- package/dist/components/Modal/useModal.js +5 -4
- package/dist/components/Modal/useModal.js.map +1 -1
- package/dist/components/Pagetable/Pagetable.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnButtongroup.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnDate.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnDiy.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnLink.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnMultiselect.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnNumber.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnSingleselect.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnString.d.ts +13 -0
- package/dist/components/Pagetable/hooks/useColumns.js +88 -74
- package/dist/components/Pagetable/hooks/useColumns.js.map +1 -1
- package/dist/components/Pagetable/index.d.ts +9 -0
- package/dist/components/Pagetable/index.js +697 -491
- package/dist/components/Pagetable/index.js.map +1 -1
- package/dist/components/Pagetable/utils/index.js +92 -54
- package/dist/components/Pagetable/utils/index.js.map +1 -1
- package/dist/components/Querytable/hooks/useColumns.js +82 -74
- package/dist/components/Querytable/hooks/useColumns.js.map +1 -1
- package/dist/components/Querytable/index.js +579 -469
- package/dist/components/Querytable/index.js.map +1 -1
- package/dist/components/Querytable/utils/index.js +92 -54
- package/dist/components/Querytable/utils/index.js.map +1 -1
- package/dist/components/RichTextEditor/index.js +100 -74
- package/dist/components/RichTextEditor/index.js.map +1 -1
- package/dist/components/Tabs/constants.js +2 -2
- package/dist/components/Tabs/constants.js.map +1 -1
- package/dist/components/Tabs/index.js +603 -358
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/tab-bar.js +6 -6
- package/dist/components/Tabs/tab-bar.js.map +1 -1
- package/dist/components/Tabs/tab-pane.js +3 -3
- package/dist/components/Tabs/tab-pane.js.map +1 -1
- package/dist/components/_constants/aria.js +2 -2
- package/dist/components/_constants/aria.js.map +1 -1
- package/dist/components/_constants/event.js +6 -4
- package/dist/components/_constants/event.js.map +1 -1
- package/dist/components/_constants/index.js +6 -6
- package/dist/components/_hooks/index.js +7 -7
- package/dist/components/_hooks/use-namespace/index.js +74 -39
- package/dist/components/_hooks/use-namespace/index.js.map +1 -1
- package/dist/components/_hooks/use-ordered-children/index.js +29 -19
- package/dist/components/_hooks/use-ordered-children/index.js.map +1 -1
- package/dist/components/_util/arrays.js +9 -5
- package/dist/components/_util/arrays.js.map +1 -1
- package/dist/components/_util/browser.js +6 -6
- package/dist/components/_util/browser.js.map +1 -1
- package/dist/components/_util/classNames.js +22 -17
- package/dist/components/_util/classNames.js.map +1 -1
- package/dist/components/_util/dom/aria.js +74 -39
- package/dist/components/_util/dom/aria.js.map +1 -1
- package/dist/components/_util/dom/element.js +9 -8
- package/dist/components/_util/dom/element.js.map +1 -1
- package/dist/components/_util/dom/event.js +14 -7
- package/dist/components/_util/dom/event.js.map +1 -1
- package/dist/components/_util/dom/index.js +36 -36
- package/dist/components/_util/dom/position.js +49 -25
- package/dist/components/_util/dom/position.js.map +1 -1
- package/dist/components/_util/dom/scroll.js +103 -61
- package/dist/components/_util/dom/scroll.js.map +1 -1
- package/dist/components/_util/dom/style.js +65 -50
- package/dist/components/_util/dom/style.js.map +1 -1
- package/dist/components/_util/easings.js +8 -4
- package/dist/components/_util/easings.js.map +1 -1
- package/dist/components/_util/error.js +12 -11
- package/dist/components/_util/error.js.map +1 -1
- package/dist/components/_util/functions.js +3 -3
- package/dist/components/_util/i18n.js +2 -2
- package/dist/components/_util/i18n.js.map +1 -1
- package/dist/components/_util/index.js +137 -137
- package/dist/components/_util/isValid.js +4 -2
- package/dist/components/_util/isValid.js.map +1 -1
- package/dist/components/_util/objects.js +18 -14
- package/dist/components/_util/objects.js.map +1 -1
- package/dist/components/_util/props-util/index.js +46 -20
- package/dist/components/_util/props-util/index.js.map +1 -1
- package/dist/components/_util/props-util/initDefaultProps.js +18 -10
- package/dist/components/_util/props-util/initDefaultProps.js.map +1 -1
- package/dist/components/_util/raf.js +5 -4
- package/dist/components/_util/raf.js.map +1 -1
- package/dist/components/_util/rand.js +4 -3
- package/dist/components/_util/rand.js.map +1 -1
- package/dist/components/_util/strings.js +9 -8
- package/dist/components/_util/strings.js.map +1 -1
- package/dist/components/_util/throttleByRaf.js +16 -10
- package/dist/components/_util/throttleByRaf.js.map +1 -1
- package/dist/components/_util/type.js +41 -38
- package/dist/components/_util/type.js.map +1 -1
- package/dist/components/_util/types.js +41 -22
- package/dist/components/_util/types.js.map +1 -1
- package/dist/components/_util/typescript.js +2 -2
- package/dist/components/_util/typescript.js.map +1 -1
- package/dist/components/_util/util.js +85 -43
- package/dist/components/_util/util.js.map +1 -1
- package/dist/components/_util/vue/global-node.js +27 -15
- package/dist/components/_util/vue/global-node.js.map +1 -1
- package/dist/components/_util/vue/icon.js +29 -25
- package/dist/components/_util/vue/icon.js.map +1 -1
- package/dist/components/_util/vue/index.js +41 -41
- package/dist/components/_util/vue/install.js +35 -18
- package/dist/components/_util/vue/install.js.map +1 -1
- package/dist/components/_util/vue/props/index.js +6 -6
- package/dist/components/_util/vue/props/runtime.js +46 -30
- package/dist/components/_util/vue/props/runtime.js.map +1 -1
- package/dist/components/_util/vue/refs.js +12 -6
- package/dist/components/_util/vue/refs.js.map +1 -1
- package/dist/components/_util/vue/size.js +5 -3
- package/dist/components/_util/vue/size.js.map +1 -1
- package/dist/components/_util/vue/validator.js +5 -4
- package/dist/components/_util/vue/validator.js.map +1 -1
- package/dist/components/_util/vue/vnode.js +100 -54
- package/dist/components/_util/vue/vnode.js.map +1 -1
- package/dist/components/_util/vue-types/index.js +231 -220
- package/dist/components/_util/vue-types/index.js.map +1 -1
- package/dist/components/components.js +20 -20
- package/dist/components/index.js +38 -35
- package/dist/components/index.js.map +1 -1
- package/dist/components-8oZ2kpUC.js +27 -0
- package/dist/components-8oZ2kpUC.js.map +1 -0
- package/dist/components-B3d9m_tn.js +27 -0
- package/dist/components-B3d9m_tn.js.map +1 -0
- package/dist/error/OrionError.js +8 -4
- package/dist/error/OrionError.js.map +1 -1
- package/dist/functions-BeMkokbY.js +63 -0
- package/dist/functions-BeMkokbY.js.map +1 -0
- package/dist/index-BOKLZnqH.js +54 -0
- package/dist/index-BOKLZnqH.js.map +1 -0
- package/dist/index-D1m0KTpK.js +69 -0
- package/dist/index-D1m0KTpK.js.map +1 -0
- package/dist/index-DR5ZP7mD.js +160 -0
- package/dist/index-DR5ZP7mD.js.map +1 -0
- package/dist/index-DkwIULcN.js +200 -0
- package/dist/index-DkwIULcN.js.map +1 -0
- package/dist/index.css +797 -1
- package/dist/index.js +36 -36
- package/dist/print/LodopFuncs.js +101 -43
- package/dist/print/LodopFuncs.js.map +1 -1
- package/dist/print/index.js +200 -108
- package/dist/print/index.js.map +1 -1
- package/dist/request/ErrorHandlerChain.js +17 -14
- package/dist/request/ErrorHandlerChain.js.map +1 -1
- package/dist/request/RequestFilterChain.js +16 -13
- package/dist/request/RequestFilterChain.js.map +1 -1
- package/dist/request/ResponseParserChain.js +17 -14
- package/dist/request/ResponseParserChain.js.map +1 -1
- package/dist/request/disivion/DateSerializer.js +47 -22
- package/dist/request/disivion/DateSerializer.js.map +1 -1
- package/dist/request/disivion/DivisionErrorHandler.js +40 -25
- package/dist/request/disivion/DivisionErrorHandler.js.map +1 -1
- package/dist/request/disivion/DivisionResponseParser.js +16 -10
- package/dist/request/disivion/DivisionResponseParser.js.map +1 -1
- package/dist/request/disivion/index.js +305 -201
- package/dist/request/disivion/index.js.map +1 -1
- package/dist/request/error/BizExceptionResponseError.js +11 -5
- package/dist/request/error/BizExceptionResponseError.js.map +1 -1
- package/dist/request/error/ExceptionResponseError.js +11 -5
- package/dist/request/error/ExceptionResponseError.js.map +1 -1
- package/dist/request/error/ResponseError.js +9 -4
- package/dist/request/error/ResponseError.js.map +1 -1
- package/dist/request/error/SessionExceptionResponseError.js +11 -5
- package/dist/request/error/SessionExceptionResponseError.js.map +1 -1
- package/dist/request/index.js +11 -11
- package/dist/utils/DateUtil.js +48 -33
- package/dist/utils/DateUtil.js.map +1 -1
- package/dist/utils/NumberUtil.js +6 -6
- package/dist/utils/NumberUtil.js.map +1 -1
- package/dist/utils/cloneDeep.js +2 -2
- package/dist/utils/delay.js +3 -3
- package/dist/utils/delay.js.map +1 -1
- package/dist/utils/functions.js +3 -3
- package/dist/utils/index.js +12 -12
- package/dist/utils/md5.js +191 -93
- package/dist/utils/md5.js.map +1 -1
- package/dist/utils/uuid.js +35 -25
- package/dist/utils/uuid.js.map +1 -1
- package/dist/version/index.js +2 -2
- package/dist/version/version.d.ts +1 -1
- package/dist/version/version.js +2 -2
- package/dist/version/version.js.map +1 -1
- package/package.json +1 -1
- package/dist/components-J6-qau6Y.js +0 -73
- package/dist/components-J6-qau6Y.js.map +0 -1
@@ -1,93 +1,156 @@
|
|
1
1
|
import "lodash-es";
|
2
|
-
import { ref
|
3
|
-
import { withInstall
|
4
|
-
import { ElIcon
|
5
|
-
import { isNumber
|
6
|
-
import { e as
|
7
|
-
import { buildProps
|
8
|
-
import { UPDATE_MODEL_EVENT
|
9
|
-
import { useNamespace
|
10
|
-
import { useOrderedChildren
|
11
|
-
import { tabsRootContextKey
|
12
|
-
import { t as
|
13
|
-
import { capitalize
|
14
|
-
import { throwError
|
15
|
-
import { e as
|
16
|
-
import { mutable
|
17
|
-
import { EVENT_CODE
|
18
|
-
import { tabBarProps
|
19
|
-
import { tabPaneProps
|
20
|
-
function
|
21
|
-
var
|
22
|
-
const
|
23
|
-
return (
|
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;
|
24
24
|
}
|
25
|
-
const
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
}
|
36
|
-
|
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);
|
37
52
|
};
|
38
|
-
|
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;
|
39
67
|
}
|
40
|
-
function
|
41
|
-
const
|
42
|
-
|
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;
|
43
74
|
}
|
44
|
-
const
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
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;
|
53
86
|
}
|
54
|
-
var
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
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;
|
62
101
|
};
|
63
|
-
function
|
64
|
-
const
|
65
|
-
let
|
66
|
-
const
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
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
|
+
}
|
72
111
|
};
|
73
|
-
|
74
|
-
|
75
|
-
|
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
|
76
127
|
};
|
77
128
|
}
|
78
|
-
var
|
79
|
-
(function(
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
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;
|
89
152
|
};
|
90
|
-
const
|
153
|
+
const _TransitionPresets = {
|
91
154
|
easeInSine: [0.12, 0, 0.39, 0],
|
92
155
|
easeOutSine: [0.61, 1, 0.88, 1],
|
93
156
|
easeInOutSine: [0.37, 0, 0.63, 1],
|
@@ -113,80 +176,115 @@ const nt = {
|
|
113
176
|
easeOutBack: [0.34, 1.56, 0.64, 1],
|
114
177
|
easeInOutBack: [0.68, -0.6, 0.32, 1.6]
|
115
178
|
};
|
116
|
-
|
117
|
-
linear:
|
118
|
-
},
|
119
|
-
function
|
120
|
-
if (!
|
121
|
-
return
|
122
|
-
const
|
123
|
-
|
124
|
-
|
125
|
-
})
|
126
|
-
|
127
|
-
|
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;
|
128
193
|
}
|
129
|
-
const
|
130
|
-
|
194
|
+
const COMPONENT_NAME$2 = "OTabBar";
|
195
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
196
|
+
...{
|
197
|
+
name: COMPONENT_NAME$2
|
198
|
+
},
|
131
199
|
__name: "tab-bar",
|
132
|
-
props:
|
133
|
-
setup(
|
134
|
-
const
|
135
|
-
|
136
|
-
const
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
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)`
|
151
234
|
};
|
152
|
-
}
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
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));
|
161
249
|
}
|
250
|
+
}
|
162
251
|
}
|
163
252
|
};
|
164
|
-
|
165
|
-
() =>
|
253
|
+
watch(
|
254
|
+
() => props.tabs,
|
166
255
|
async () => {
|
167
|
-
await
|
256
|
+
await nextTick();
|
257
|
+
update();
|
258
|
+
observerTabs();
|
168
259
|
},
|
169
|
-
{ immediate:
|
260
|
+
{ immediate: true }
|
170
261
|
);
|
171
|
-
const
|
172
|
-
|
173
|
-
|
174
|
-
|
262
|
+
const barObserever = useResizeObserver(barRef, () => update());
|
263
|
+
onBeforeUnmount(() => {
|
264
|
+
saveObserver.forEach((observer) => observer.stop());
|
265
|
+
saveObserver.length = 0;
|
266
|
+
barObserever.stop();
|
267
|
+
});
|
268
|
+
__expose({
|
175
269
|
/** @description tab root html element */
|
176
|
-
ref:
|
270
|
+
ref: barRef,
|
177
271
|
/** @description method to manually update tab bar style */
|
178
|
-
update
|
179
|
-
})
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
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
|
+
};
|
185
282
|
}
|
186
|
-
})
|
283
|
+
});
|
284
|
+
const tabNavProps = buildProps({
|
187
285
|
panes: {
|
188
|
-
type:
|
189
|
-
default: () =>
|
286
|
+
type: definePropType(Array),
|
287
|
+
default: () => mutable([])
|
190
288
|
},
|
191
289
|
currentName: {
|
192
290
|
type: [String, Number],
|
@@ -198,122 +296,222 @@ const re = "OTabBar", ot = /* @__PURE__ */ M({
|
|
198
296
|
default: "card"
|
199
297
|
},
|
200
298
|
stretch: Boolean
|
201
|
-
})
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
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
|
211
312
|
}) {
|
212
|
-
const
|
213
|
-
|
214
|
-
const
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
if (!
|
234
|
-
const
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
const
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
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);
|
295
492
|
}
|
296
|
-
}, [
|
493
|
+
}, [...[tabLabelContent]]);
|
297
494
|
});
|
298
|
-
return
|
299
|
-
ref:
|
300
|
-
class: [
|
301
|
-
}, [
|
302
|
-
class:
|
303
|
-
ref:
|
304
|
-
}, [
|
305
|
-
class: [
|
306
|
-
ref:
|
307
|
-
style:
|
308
|
-
role: "tablist",
|
309
|
-
onKeydown:
|
310
|
-
}, [
|
311
|
-
ref:
|
312
|
-
tabs: [...
|
313
|
-
}, null),
|
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]])])]);
|
314
511
|
};
|
315
512
|
}
|
316
|
-
})
|
513
|
+
});
|
514
|
+
const tabsProps = buildProps({
|
317
515
|
/**
|
318
516
|
* @description type of Tab
|
319
517
|
*/
|
@@ -340,136 +538,183 @@ const re = "OTabBar", ot = /* @__PURE__ */ M({
|
|
340
538
|
* @description hook function before switching tab. If `false` is returned or a `Promise` is returned and then is rejected, switching will be prevented
|
341
539
|
*/
|
342
540
|
beforeLeave: {
|
343
|
-
type:
|
344
|
-
default: () =>
|
541
|
+
type: definePropType(Function),
|
542
|
+
default: () => true
|
345
543
|
},
|
346
544
|
/**
|
347
545
|
* @description whether width of tab automatically fits its container
|
348
546
|
*/
|
349
547
|
stretch: Boolean
|
350
|
-
})
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
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({
|
355
556
|
name: "OTabs",
|
356
|
-
props:
|
357
|
-
emits:
|
358
|
-
setup(
|
359
|
-
emit
|
360
|
-
slots
|
361
|
-
expose
|
557
|
+
props: tabsProps,
|
558
|
+
emits: tabsEmits,
|
559
|
+
setup(props, {
|
560
|
+
emit,
|
561
|
+
slots,
|
562
|
+
expose
|
362
563
|
}) {
|
363
|
-
const
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
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);
|
373
585
|
}
|
374
|
-
|
375
|
-
|
586
|
+
} catch {
|
587
|
+
}
|
376
588
|
};
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
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);
|
385
605
|
},
|
386
|
-
sortPane
|
387
|
-
unregisterPane
|
388
|
-
})
|
389
|
-
|
606
|
+
sortPane,
|
607
|
+
unregisterPane
|
608
|
+
});
|
609
|
+
expose({
|
610
|
+
currentName
|
390
611
|
});
|
391
|
-
const
|
392
|
-
render
|
393
|
-
}) =>
|
612
|
+
const TabNavRenderer = ({
|
613
|
+
render
|
614
|
+
}) => {
|
615
|
+
return render();
|
616
|
+
};
|
394
617
|
return () => {
|
395
|
-
const
|
396
|
-
|
397
|
-
|
398
|
-
class:
|
399
|
-
}, [
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
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
|
409
634
|
}, {
|
410
|
-
$stable: !
|
635
|
+
$stable: !hasLabelSlot
|
411
636
|
});
|
412
637
|
}
|
413
|
-
}, null),
|
414
|
-
class:
|
415
|
-
}, [
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
[
|
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"
|
422
648
|
}]
|
423
|
-
}, [
|
649
|
+
}, [panels, header]);
|
424
650
|
};
|
425
651
|
}
|
426
|
-
})
|
427
|
-
|
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
|
+
},
|
428
659
|
__name: "tab-pane",
|
429
|
-
props:
|
430
|
-
setup(
|
431
|
-
const
|
432
|
-
|
433
|
-
const
|
434
|
-
|
435
|
-
|
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
|
436
683
|
});
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
props: t,
|
441
|
-
paneName: v,
|
442
|
-
active: u,
|
443
|
-
index: d
|
684
|
+
tabsRoot.registerPane(pane);
|
685
|
+
onMounted(() => {
|
686
|
+
tabsRoot.sortPane(pane);
|
444
687
|
});
|
445
|
-
|
446
|
-
|
447
|
-
})
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
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
|
+
};
|
461
705
|
}
|
462
|
-
})
|
463
|
-
|
706
|
+
});
|
707
|
+
const index = withInstall(Tabs, {
|
708
|
+
TabPane: _sfc_main
|
464
709
|
});
|
465
710
|
export {
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
711
|
+
index as default,
|
712
|
+
tabBarProps,
|
713
|
+
tabNavEmits,
|
714
|
+
tabNavProps,
|
715
|
+
tabPaneProps,
|
716
|
+
tabsEmits,
|
717
|
+
tabsProps,
|
718
|
+
tabsRootContextKey
|
474
719
|
};
|
475
720
|
//# sourceMappingURL=index.js.map
|