@semi-kit/component 1.4.9 → 1.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{index-BScreGz5.d.ts → index-B7r2qmH2.d.ts} +4 -4
- package/lib/index-CXNKqOza.d.ts +7 -0
- package/lib/index-D_b-QxXC.d.ts +7 -0
- package/lib/index-Dn5-VvYJ.d.ts +7 -0
- package/lib/index.d.ts +4 -4
- package/lib/index.js +1 -1
- package/lib/tab-view/index.d.ts +1 -1
- package/lib/tab-view/index.js +1 -1
- package/lib/tab-view-BXYSwLG9.js +199 -0
- package/lib/wrapper/flex-col-wrapper/index.d.ts +1 -1
- package/lib/wrapper/flex-row-wrapper/index.d.ts +1 -1
- package/lib/wrapper/scroll-wrapper/index.d.ts +1 -1
- package/package.json +1 -1
- package/lib/index-BkYadMq_.d.ts +0 -7
- package/lib/index-C5y1Tk9t.d.ts +0 -7
- package/lib/index-HCwdt_km.d.ts +0 -7
- package/lib/tab-view-BktgxoMW.js +0 -168
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vue14 from "vue";
|
|
2
2
|
import { VNode } from "vue";
|
|
3
3
|
|
|
4
4
|
//#region src/tab-view/index.d.ts
|
|
@@ -7,7 +7,7 @@ interface PropsType<T> {
|
|
|
7
7
|
rowKey: (item: T) => string | number;
|
|
8
8
|
activeTab: (item: T) => boolean;
|
|
9
9
|
tabs: T[];
|
|
10
|
-
type?: 'chrome' | 'tab';
|
|
10
|
+
type?: 'chrome' | 'tab' | 'tag';
|
|
11
11
|
onClickItem?: (item: T) => void;
|
|
12
12
|
onMouseUpItem?: (e: MouseEvent, item: T, index: number) => void;
|
|
13
13
|
onDropdownSelect?: (key: TabActionType, index: number) => void;
|
|
@@ -20,7 +20,7 @@ interface SlotType<T> {
|
|
|
20
20
|
}) => VNode;
|
|
21
21
|
extra?: () => VNode;
|
|
22
22
|
}
|
|
23
|
-
declare const TabView:
|
|
23
|
+
declare const TabView: vue14.DefineSetupFnComponent<{
|
|
24
24
|
tabs: any;
|
|
25
25
|
rowKey: any;
|
|
26
26
|
activeTab: any;
|
|
@@ -36,6 +36,6 @@ declare const TabView: vue0.DefineSetupFnComponent<{
|
|
|
36
36
|
onClickItem: any;
|
|
37
37
|
onMouseUpItem: any;
|
|
38
38
|
onContextMenuItem: any;
|
|
39
|
-
} & {},
|
|
39
|
+
} & {}, vue14.PublicProps>;
|
|
40
40
|
//#endregion
|
|
41
41
|
export { TabView as i, SlotType as n, TabActionType as r, PropsType as t };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as vue0 from "vue";
|
|
2
|
+
import * as vue_jsx_runtime0 from "vue/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/wrapper/flex-col-wrapper/index.d.ts
|
|
5
|
+
declare const _default: vue0.DefineComponent<{}, () => vue_jsx_runtime0.JSX.Element, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue0.ComponentProvideOptions, true, {}, any>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { _default as t };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as vue4 from "vue";
|
|
2
|
+
import * as vue_jsx_runtime0 from "vue/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/wrapper/scroll-wrapper/index.d.ts
|
|
5
|
+
declare const _default: vue4.DefineComponent<{}, () => vue_jsx_runtime0.JSX.Element, {}, {}, {}, vue4.ComponentOptionsMixin, vue4.ComponentOptionsMixin, {}, string, vue4.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue4.ComponentProvideOptions, true, {}, any>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { _default as t };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as vue9 from "vue";
|
|
2
|
+
import * as vue_jsx_runtime1 from "vue/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/wrapper/flex-row-wrapper/index.d.ts
|
|
5
|
+
declare const _default: vue9.DefineComponent<{}, () => vue_jsx_runtime1.JSX.Element, {}, {}, {}, vue9.ComponentOptionsMixin, vue9.ComponentOptionsMixin, {}, string, vue9.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue9.ComponentProvideOptions, true, {}, any>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { _default as t };
|
package/lib/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as AppProviderContext, r as AppProviderFormRuleConfig, t as _default } from "./index-C-Oqap1P.js";
|
|
2
|
-
import { t as _default$3 } from "./index-
|
|
3
|
-
import { t as _default$2 } from "./index-
|
|
4
|
-
import { t as _default$1 } from "./index-
|
|
2
|
+
import { t as _default$3 } from "./index-D_b-QxXC.js";
|
|
3
|
+
import { t as _default$2 } from "./index-Dn5-VvYJ.js";
|
|
4
|
+
import { t as _default$1 } from "./index-CXNKqOza.js";
|
|
5
5
|
import { t as SemiComponentResolver } from "./resolver-BVvgCCAW.js";
|
|
6
|
-
import { i as TabView } from "./index-
|
|
6
|
+
import { i as TabView } from "./index-B7r2qmH2.js";
|
|
7
7
|
|
|
8
8
|
//#region src/_utils/get-provider.d.ts
|
|
9
9
|
declare function getAppProvider(): AppProviderContext;
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as getAppProvider, t as tab_view_default } from "./tab-view-
|
|
1
|
+
import { n as getAppProvider, t as tab_view_default } from "./tab-view-BXYSwLG9.js";
|
|
2
2
|
import "./cssr-D9_M6jAV.js";
|
|
3
3
|
import { t as scroll_wrapper_default } from "./scroll-wrapper-DVAnbCLj.js";
|
|
4
4
|
import { t as flex_row_wrapper_default } from "./flex-row-wrapper-70R3tK7w.js";
|
package/lib/tab-view/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as TabView, n as SlotType, r as TabActionType, t as PropsType } from "../index-
|
|
1
|
+
import { i as TabView, n as SlotType, r as TabActionType, t as PropsType } from "../index-B7r2qmH2.js";
|
|
2
2
|
export { PropsType, SlotType, TabActionType, TabView as default };
|
package/lib/tab-view/index.js
CHANGED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { a as useStyle, i as cM, n as cB, r as cE, t as c } from "./cssr-D9_M6jAV.js";
|
|
2
|
+
import { computed, createVNode, defineComponent, getCurrentInstance, inject, isVNode, nextTick, onMounted, ref } from "vue";
|
|
3
|
+
import { NTag } from "naive-ui";
|
|
4
|
+
import { useRouter } from "vue-router";
|
|
5
|
+
import { useEventListener } from "@vueuse/core";
|
|
6
|
+
|
|
7
|
+
//#region src/_utils/get-provider.ts
|
|
8
|
+
let cachedProvider = null;
|
|
9
|
+
function getAppProvider() {
|
|
10
|
+
if (cachedProvider) return cachedProvider;
|
|
11
|
+
if (getCurrentInstance()) {
|
|
12
|
+
const provider = inject("app-provider");
|
|
13
|
+
if (provider) {
|
|
14
|
+
cachedProvider = provider;
|
|
15
|
+
return provider;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
throw new Error("No outer <AppProvider /> founded.");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/tab-view/styles/index.ts
|
|
23
|
+
var styles_default = c([c("@keyframes fade", {
|
|
24
|
+
"0%": { opacity: 0 },
|
|
25
|
+
"100%": { opacity: 1 }
|
|
26
|
+
}), cB("tab-view", {
|
|
27
|
+
display: "flex",
|
|
28
|
+
gap: "4px",
|
|
29
|
+
height: "42px",
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
backgroundColor: "#fff"
|
|
32
|
+
}, [
|
|
33
|
+
cE("tabs-wrapper", {
|
|
34
|
+
display: "flex",
|
|
35
|
+
flex: 1,
|
|
36
|
+
height: "100%",
|
|
37
|
+
overflowX: "auto",
|
|
38
|
+
padding: "0 10px",
|
|
39
|
+
whiteSpace: "nowrap",
|
|
40
|
+
"&::-webkit-scrollbar": { display: "none" },
|
|
41
|
+
scrollbarWidth: "none"
|
|
42
|
+
}),
|
|
43
|
+
cE("tab-item", {
|
|
44
|
+
cursor: "pointer",
|
|
45
|
+
display: "flex",
|
|
46
|
+
height: "100%",
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
margin: "0 4px",
|
|
49
|
+
padding: "0 8px",
|
|
50
|
+
position: "relative",
|
|
51
|
+
transition: "all 200ms"
|
|
52
|
+
}),
|
|
53
|
+
cM("chrome", [cE("tab-item", [c("&:hover:not(.sk-tab-view__tab-item--active)::before", {
|
|
54
|
+
content: "\"\"",
|
|
55
|
+
position: "absolute",
|
|
56
|
+
left: "1px",
|
|
57
|
+
right: 0,
|
|
58
|
+
top: "50%",
|
|
59
|
+
height: "80%",
|
|
60
|
+
transform: "translateY(-50%)",
|
|
61
|
+
background: "rgba(0, 0, 0, 0.06)",
|
|
62
|
+
borderRadius: "var(--sk-tab-radius)"
|
|
63
|
+
}), cM("active", {
|
|
64
|
+
color: "var(--sk-tab-primary-color)",
|
|
65
|
+
"&::before": {
|
|
66
|
+
content: "\"\"",
|
|
67
|
+
position: "absolute",
|
|
68
|
+
left: 0,
|
|
69
|
+
right: 0,
|
|
70
|
+
bottom: 0,
|
|
71
|
+
height: "85%",
|
|
72
|
+
backgroundColor: "var(--sk-tab-secondary-color)",
|
|
73
|
+
borderRadius: "10px 10px 0 0"
|
|
74
|
+
},
|
|
75
|
+
"&::after": {
|
|
76
|
+
content: "\"\"",
|
|
77
|
+
position: "absolute",
|
|
78
|
+
bottom: 0,
|
|
79
|
+
left: "-14px",
|
|
80
|
+
right: "-14px",
|
|
81
|
+
height: "14px",
|
|
82
|
+
background: "radial-gradient(circle at 0 0, transparent 14px, var(--sk-tab-secondary-color) 14px) left bottom / 14px 14px no-repeat, radial-gradient(circle at 100% 0, transparent 14px, var(--sk-tab-secondary-color) 14px) right bottom / 14px 14px no-repeat"
|
|
83
|
+
}
|
|
84
|
+
})])]),
|
|
85
|
+
cM("tab", [cE("tab-item", {
|
|
86
|
+
padding: "0 4px",
|
|
87
|
+
marginRight: "10px",
|
|
88
|
+
transition: "border var(--duration) ease",
|
|
89
|
+
animation: "fade var(--duration) ease",
|
|
90
|
+
boxSizing: "border-box",
|
|
91
|
+
borderBottom: "2px solid transparent",
|
|
92
|
+
"&:hover": {
|
|
93
|
+
borderBottom: "2px solid var(--sk-tab-primary-color)",
|
|
94
|
+
color: "var(--sk-tab-primary-color)"
|
|
95
|
+
}
|
|
96
|
+
}, [cM("active", {
|
|
97
|
+
color: "var(--sk-tab-primary-color)",
|
|
98
|
+
borderBottom: "2px solid var(--sk-tab-primary-color)"
|
|
99
|
+
})])]),
|
|
100
|
+
cM("tag", [cE("tabs-wrapper", { alignItems: "center" }), cE("tab-item", {
|
|
101
|
+
height: "75%",
|
|
102
|
+
padding: 0
|
|
103
|
+
}, [c(".n-tag", {
|
|
104
|
+
height: "100%",
|
|
105
|
+
cursor: "pointer"
|
|
106
|
+
}), c("&:hover .n-tag", {
|
|
107
|
+
color: "var(--sk-tab-primary-color)",
|
|
108
|
+
backgroundColor: "var(--sk-tab-secondary-color)"
|
|
109
|
+
}, [c("button", { color: "var(--sk-tab-primary-color)" })])])])
|
|
110
|
+
])]);
|
|
111
|
+
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/tab-view/index.tsx
|
|
114
|
+
function _isSlot(s) {
|
|
115
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
116
|
+
}
|
|
117
|
+
const TabView = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
118
|
+
const router = useRouter();
|
|
119
|
+
useStyle("tab-view", styles_default);
|
|
120
|
+
const provider = getAppProvider();
|
|
121
|
+
const radiusPX = computed(() => `${provider.theme?.value?.radius}px`);
|
|
122
|
+
const scrollContainer = ref();
|
|
123
|
+
const syncScroll = () => {
|
|
124
|
+
nextTick(() => {
|
|
125
|
+
const container = scrollContainer.value;
|
|
126
|
+
const activeTab = container?.querySelector(".sk-tab-view__tab-item--active");
|
|
127
|
+
if (!container || !activeTab) return;
|
|
128
|
+
const containerRect = container.getBoundingClientRect();
|
|
129
|
+
const activeRect = activeTab.getBoundingClientRect();
|
|
130
|
+
const scrollLeft = container.scrollLeft;
|
|
131
|
+
const offset = activeRect.left + activeRect.width / 2 - (containerRect.left + containerRect.width / 2);
|
|
132
|
+
container.scrollTo({
|
|
133
|
+
left: scrollLeft + offset,
|
|
134
|
+
behavior: "smooth"
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
onMounted(syncScroll);
|
|
139
|
+
router.afterEach(syncScroll);
|
|
140
|
+
useEventListener(scrollContainer, "wheel", (e) => {
|
|
141
|
+
if (e.deltaY === 0) return;
|
|
142
|
+
e.preventDefault();
|
|
143
|
+
if (scrollContainer.value) scrollContainer.value.scrollLeft += e.deltaY;
|
|
144
|
+
});
|
|
145
|
+
return () => {
|
|
146
|
+
return createVNode("div", {
|
|
147
|
+
"class": ["sk-tab-view", props.type && `sk-tab-view--${props.type}`],
|
|
148
|
+
"style": {
|
|
149
|
+
"--sk-tab-radius": radiusPX.value,
|
|
150
|
+
"--sk-tab-primary-color": provider.theme?.value?.primaryColor,
|
|
151
|
+
"--sk-tab-secondary-color": provider.theme?.value?.secondaryColor
|
|
152
|
+
}
|
|
153
|
+
}, [createVNode("div", {
|
|
154
|
+
"ref": scrollContainer,
|
|
155
|
+
"class": "sk-tab-view__tabs-wrapper"
|
|
156
|
+
}, [props.tabs?.map((item, index) => {
|
|
157
|
+
const isActive = props.activeTab(item);
|
|
158
|
+
const content = slots?.default?.({
|
|
159
|
+
item,
|
|
160
|
+
index
|
|
161
|
+
});
|
|
162
|
+
if (props.type === "tag") return createVNode("div", {
|
|
163
|
+
"class": "sk-tab-view__tab-item",
|
|
164
|
+
"key": props.rowKey(item),
|
|
165
|
+
"onClick": () => props.onClickItem?.(item),
|
|
166
|
+
"onMouseup": (e) => props.onMouseUpItem?.(e, item, index),
|
|
167
|
+
"onContextmenu": (e) => {
|
|
168
|
+
e.preventDefault();
|
|
169
|
+
props.onContextMenuItem?.(e, item, index);
|
|
170
|
+
}
|
|
171
|
+
}, [createVNode(NTag, {
|
|
172
|
+
"type": isActive ? "primary" : "default",
|
|
173
|
+
"bordered": false
|
|
174
|
+
}, _isSlot(content) ? content : { default: () => [content] })]);
|
|
175
|
+
return createVNode("div", {
|
|
176
|
+
"key": props.rowKey(item),
|
|
177
|
+
"class": ["sk-tab-view__tab-item", { "sk-tab-view__tab-item--active": isActive }],
|
|
178
|
+
"onClick": () => props.onClickItem?.(item),
|
|
179
|
+
"onMouseup": (e) => props.onMouseUpItem?.(e, item, index),
|
|
180
|
+
"onContextmenu": (e) => {
|
|
181
|
+
e.preventDefault();
|
|
182
|
+
props.onContextMenuItem?.(e, item, index);
|
|
183
|
+
}
|
|
184
|
+
}, [content]);
|
|
185
|
+
})]), slots?.extra?.()]);
|
|
186
|
+
};
|
|
187
|
+
}, { props: [
|
|
188
|
+
"tabs",
|
|
189
|
+
"rowKey",
|
|
190
|
+
"activeTab",
|
|
191
|
+
"type",
|
|
192
|
+
"onClickItem",
|
|
193
|
+
"onMouseUpItem",
|
|
194
|
+
"onContextMenuItem"
|
|
195
|
+
] });
|
|
196
|
+
var tab_view_default = TabView;
|
|
197
|
+
|
|
198
|
+
//#endregion
|
|
199
|
+
export { getAppProvider as n, tab_view_default as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _default } from "../../index-
|
|
1
|
+
import { t as _default } from "../../index-CXNKqOza.js";
|
|
2
2
|
export { _default as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _default } from "../../index-
|
|
1
|
+
import { t as _default } from "../../index-Dn5-VvYJ.js";
|
|
2
2
|
export { _default as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _default } from "../../index-
|
|
1
|
+
import { t as _default } from "../../index-D_b-QxXC.js";
|
|
2
2
|
export { _default as default };
|
package/package.json
CHANGED
package/lib/index-BkYadMq_.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as vue6 from "vue";
|
|
2
|
-
import * as vue_jsx_runtime0 from "vue/jsx-runtime";
|
|
3
|
-
|
|
4
|
-
//#region src/wrapper/flex-col-wrapper/index.d.ts
|
|
5
|
-
declare const _default: vue6.DefineComponent<{}, () => vue_jsx_runtime0.JSX.Element, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue6.ComponentProvideOptions, true, {}, any>;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { _default as t };
|
package/lib/index-C5y1Tk9t.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as vue1 from "vue";
|
|
2
|
-
import * as vue_jsx_runtime0 from "vue/jsx-runtime";
|
|
3
|
-
|
|
4
|
-
//#region src/wrapper/scroll-wrapper/index.d.ts
|
|
5
|
-
declare const _default: vue1.DefineComponent<{}, () => vue_jsx_runtime0.JSX.Element, {}, {}, {}, vue1.ComponentOptionsMixin, vue1.ComponentOptionsMixin, {}, string, vue1.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue1.ComponentProvideOptions, true, {}, any>;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { _default as t };
|
package/lib/index-HCwdt_km.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as vue11 from "vue";
|
|
2
|
-
import * as vue_jsx_runtime1 from "vue/jsx-runtime";
|
|
3
|
-
|
|
4
|
-
//#region src/wrapper/flex-row-wrapper/index.d.ts
|
|
5
|
-
declare const _default: vue11.DefineComponent<{}, () => vue_jsx_runtime1.JSX.Element, {}, {}, {}, vue11.ComponentOptionsMixin, vue11.ComponentOptionsMixin, {}, string, vue11.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue11.ComponentProvideOptions, true, {}, any>;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { _default as t };
|
package/lib/tab-view-BktgxoMW.js
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { a as useStyle, i as cM, n as cB, r as cE, t as c } from "./cssr-D9_M6jAV.js";
|
|
2
|
-
import { computed, createVNode, defineComponent, getCurrentInstance, inject, nextTick, onMounted, ref } from "vue";
|
|
3
|
-
import { useRouter } from "vue-router";
|
|
4
|
-
import { useEventListener } from "@vueuse/core";
|
|
5
|
-
|
|
6
|
-
//#region src/_utils/get-provider.ts
|
|
7
|
-
let cachedProvider = null;
|
|
8
|
-
function getAppProvider() {
|
|
9
|
-
if (cachedProvider) return cachedProvider;
|
|
10
|
-
if (getCurrentInstance()) {
|
|
11
|
-
const provider = inject("app-provider");
|
|
12
|
-
if (provider) {
|
|
13
|
-
cachedProvider = provider;
|
|
14
|
-
return provider;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
throw new Error("No outer <AppProvider /> founded.");
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/tab-view/styles/index.ts
|
|
22
|
-
var styles_default = c([c("@keyframes fade", {
|
|
23
|
-
"0%": { opacity: 0 },
|
|
24
|
-
"100%": { opacity: 1 }
|
|
25
|
-
}), cB("tab-view", {
|
|
26
|
-
backgroundColor: "#fff",
|
|
27
|
-
display: "flex",
|
|
28
|
-
gap: "4px",
|
|
29
|
-
height: "42px",
|
|
30
|
-
alignItems: "center"
|
|
31
|
-
}, [cE("tabs-wrapper", {
|
|
32
|
-
display: "flex",
|
|
33
|
-
flex: 1,
|
|
34
|
-
height: "100%",
|
|
35
|
-
overflowX: "auto",
|
|
36
|
-
padding: "0 10px",
|
|
37
|
-
whiteSpace: "nowrap",
|
|
38
|
-
"&::-webkit-scrollbar": { display: "none" },
|
|
39
|
-
scrollbarWidth: "none"
|
|
40
|
-
}), cE("tab-item", {
|
|
41
|
-
cursor: "pointer",
|
|
42
|
-
display: "flex",
|
|
43
|
-
height: "100%",
|
|
44
|
-
alignItems: "center",
|
|
45
|
-
margin: "0 4px",
|
|
46
|
-
padding: "0 8px",
|
|
47
|
-
position: "relative",
|
|
48
|
-
transition: "all 200ms"
|
|
49
|
-
}, [cM("chrome", {}, [
|
|
50
|
-
c("&:hover:not(.sk-tab-view__tab-item--active)::before", {
|
|
51
|
-
content: "\"\"",
|
|
52
|
-
position: "absolute",
|
|
53
|
-
left: "1px",
|
|
54
|
-
right: 0,
|
|
55
|
-
top: "50%",
|
|
56
|
-
height: "80%",
|
|
57
|
-
transform: "translateY(-50%)",
|
|
58
|
-
background: "rgba(0, 0, 0, 0.06)",
|
|
59
|
-
borderRadius: "var(--sk-tab-radius)"
|
|
60
|
-
}),
|
|
61
|
-
c("&.sk-tab-view__tab-item--active", { color: "var(--sk-tab-primary-color)" }),
|
|
62
|
-
c("&.sk-tab-view__tab-item--active::before", {
|
|
63
|
-
content: "\"\"",
|
|
64
|
-
position: "absolute",
|
|
65
|
-
left: 0,
|
|
66
|
-
right: 0,
|
|
67
|
-
bottom: 0,
|
|
68
|
-
height: "85%",
|
|
69
|
-
backgroundColor: "var(--sk-tab-secondary-color)",
|
|
70
|
-
borderRadius: "10px 10px 0 0"
|
|
71
|
-
}),
|
|
72
|
-
c("&.sk-tab-view__tab-item--active::after", {
|
|
73
|
-
content: "\"\"",
|
|
74
|
-
position: "absolute",
|
|
75
|
-
bottom: 0,
|
|
76
|
-
left: "-14px",
|
|
77
|
-
right: "-14px",
|
|
78
|
-
height: "14px",
|
|
79
|
-
background: "radial-gradient(circle at 0 0, transparent 14px, var(--sk-tab-secondary-color) 14px) left bottom / 14px 14px no-repeat, radial-gradient(circle at 100% 0, transparent 14px, var(--sk-tab-secondary-color) 14px) right bottom / 14px 14px no-repeat"
|
|
80
|
-
})
|
|
81
|
-
]), cM("tab", {
|
|
82
|
-
padding: "0 4px",
|
|
83
|
-
marginRight: "10px",
|
|
84
|
-
cursor: "pointer",
|
|
85
|
-
transition: "border var(--duration) ease",
|
|
86
|
-
animation: "fade var(--duration) ease",
|
|
87
|
-
boxSizing: "border-box",
|
|
88
|
-
borderBottom: "2px solid transparent"
|
|
89
|
-
}, [c("&:hover", {
|
|
90
|
-
borderBottom: "2px solid var(--sk-tab-primary-color)",
|
|
91
|
-
color: "var(--sk-tab-primary-color)"
|
|
92
|
-
}), c("&.sk-tab-view__tab-item--active", {
|
|
93
|
-
color: "var(--sk-tab-primary-color)",
|
|
94
|
-
borderBottom: "2px solid var(--sk-tab-primary-color)"
|
|
95
|
-
})])])])]);
|
|
96
|
-
|
|
97
|
-
//#endregion
|
|
98
|
-
//#region src/tab-view/index.tsx
|
|
99
|
-
const TabView = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
100
|
-
const router = useRouter();
|
|
101
|
-
useStyle("tab-view", styles_default);
|
|
102
|
-
const provider = getAppProvider();
|
|
103
|
-
const radiusPX = computed(() => `${provider.theme?.value?.radius}px`);
|
|
104
|
-
const scrollContainer = ref();
|
|
105
|
-
const syncScroll = () => {
|
|
106
|
-
nextTick(() => {
|
|
107
|
-
const container = scrollContainer.value;
|
|
108
|
-
const activeTab = container?.querySelector(".sk-tab-view__tab-item--active");
|
|
109
|
-
if (!container || !activeTab) return;
|
|
110
|
-
const containerRect = container.getBoundingClientRect();
|
|
111
|
-
const activeRect = activeTab.getBoundingClientRect();
|
|
112
|
-
const scrollLeft = container.scrollLeft;
|
|
113
|
-
const offset = activeRect.left + activeRect.width / 2 - (containerRect.left + containerRect.width / 2);
|
|
114
|
-
container.scrollTo({
|
|
115
|
-
left: scrollLeft + offset,
|
|
116
|
-
behavior: "smooth"
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
onMounted(syncScroll);
|
|
121
|
-
router.afterEach(syncScroll);
|
|
122
|
-
useEventListener(scrollContainer, "wheel", (e) => {
|
|
123
|
-
if (e.deltaY === 0) return;
|
|
124
|
-
e.preventDefault();
|
|
125
|
-
if (scrollContainer.value) scrollContainer.value.scrollLeft += e.deltaY;
|
|
126
|
-
});
|
|
127
|
-
return () => {
|
|
128
|
-
return createVNode("div", {
|
|
129
|
-
"class": "sk-tab-view",
|
|
130
|
-
"style": {
|
|
131
|
-
"--sk-tab-radius": radiusPX.value,
|
|
132
|
-
"--sk-tab-primary-color": provider.theme?.value?.primaryColor,
|
|
133
|
-
"--sk-tab-secondary-color": provider.theme?.value?.secondaryColor
|
|
134
|
-
}
|
|
135
|
-
}, [createVNode("div", {
|
|
136
|
-
"ref": scrollContainer,
|
|
137
|
-
"class": "sk-tab-view__tabs-wrapper"
|
|
138
|
-
}, [props.tabs?.map((item, index) => createVNode("div", {
|
|
139
|
-
"key": props.rowKey(item),
|
|
140
|
-
"class": [
|
|
141
|
-
"sk-tab-view__tab-item",
|
|
142
|
-
{ "sk-tab-view__tab-item--active": props.activeTab(item) },
|
|
143
|
-
`sk-tab-view__tab-item--${props.type}`
|
|
144
|
-
],
|
|
145
|
-
"onClick": () => props.onClickItem?.(item),
|
|
146
|
-
"onMouseup": (e) => props.onMouseUpItem?.(e, item, index),
|
|
147
|
-
"onContextmenu": (e) => {
|
|
148
|
-
e.preventDefault();
|
|
149
|
-
props.onContextMenuItem?.(e, item, index);
|
|
150
|
-
}
|
|
151
|
-
}, [slots?.default?.({
|
|
152
|
-
item,
|
|
153
|
-
index
|
|
154
|
-
})]))]), slots?.extra?.()]);
|
|
155
|
-
};
|
|
156
|
-
}, { props: [
|
|
157
|
-
"tabs",
|
|
158
|
-
"rowKey",
|
|
159
|
-
"activeTab",
|
|
160
|
-
"type",
|
|
161
|
-
"onClickItem",
|
|
162
|
-
"onMouseUpItem",
|
|
163
|
-
"onContextMenuItem"
|
|
164
|
-
] });
|
|
165
|
-
var tab_view_default = TabView;
|
|
166
|
-
|
|
167
|
-
//#endregion
|
|
168
|
-
export { getAppProvider as n, tab_view_default as t };
|