@semi-kit/component 1.4.9 → 1.4.11
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/app-provider/index.d.ts +1 -1
- package/lib/{index-C-Oqap1P.d.ts → index-Bvg8aJV4.d.ts} +9 -9
- package/lib/index.d.ts +6 -6
- package/lib/index.js +2 -2
- package/lib/resolver.d.ts +9 -1
- package/lib/resolver.js +17 -1
- package/lib/tab-view/index.d.ts +40 -1
- package/lib/tab-view/index.js +1 -1
- package/lib/tab-view-DN-KFQWP.js +194 -0
- package/lib/wrapper/flex-col-wrapper/index.d.ts +6 -1
- package/lib/wrapper/flex-row-wrapper/index.d.ts +6 -1
- package/lib/wrapper/scroll-wrapper/index.d.ts +6 -1
- package/package.json +1 -1
- package/lib/index-BScreGz5.d.ts +0 -41
- 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/resolver-BVvgCCAW.d.ts +0 -10
- package/lib/resolver-DP3BDWck.js +0 -19
- package/lib/tab-view-BktgxoMW.js +0 -168
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _default } from "../index-
|
|
1
|
+
import { t as _default } from "../index-Bvg8aJV4.js";
|
|
2
2
|
export { _default as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vue9 from "vue";
|
|
2
2
|
import { Ref } from "vue";
|
|
3
3
|
|
|
4
4
|
//#region src/app-provider/type.d.ts
|
|
@@ -20,16 +20,16 @@ interface AppProviderContext {
|
|
|
20
20
|
}
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region src/app-provider/index.d.ts
|
|
23
|
-
declare const _default:
|
|
23
|
+
declare const _default: vue9.DefineComponent<vue9.ExtractPropTypes<{
|
|
24
24
|
readonly locale: StringConstructor;
|
|
25
|
-
readonly formRuleConfig:
|
|
26
|
-
readonly theme:
|
|
27
|
-
}>, () =>
|
|
25
|
+
readonly formRuleConfig: vue9.PropType<AppProviderFormRuleConfig>;
|
|
26
|
+
readonly theme: vue9.PropType<AppProviderTheme>;
|
|
27
|
+
}>, () => vue9.VNode<vue9.RendererNode, vue9.RendererElement, {
|
|
28
28
|
[key: string]: any;
|
|
29
|
-
}>[] | undefined, {}, {}, {},
|
|
29
|
+
}>[] | undefined, {}, {}, {}, vue9.ComponentOptionsMixin, vue9.ComponentOptionsMixin, {}, string, vue9.PublicProps, Readonly<vue9.ExtractPropTypes<{
|
|
30
30
|
readonly locale: StringConstructor;
|
|
31
|
-
readonly formRuleConfig:
|
|
32
|
-
readonly theme:
|
|
33
|
-
}>> & Readonly<{}>, {}, {}, {}, {}, string,
|
|
31
|
+
readonly formRuleConfig: vue9.PropType<AppProviderFormRuleConfig>;
|
|
32
|
+
readonly theme: vue9.PropType<AppProviderTheme>;
|
|
33
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, vue9.ComponentProvideOptions, true, {}, any>;
|
|
34
34
|
//#endregion
|
|
35
35
|
export { AppProviderContext as n, AppProviderFormRuleConfig as r, _default as t };
|
package/lib/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as AppProviderContext, r as AppProviderFormRuleConfig, t as _default } from "./index-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
1
|
+
import { n as AppProviderContext, r as AppProviderFormRuleConfig, t as _default } from "./index-Bvg8aJV4.js";
|
|
2
|
+
import _default$3 from "./wrapper/scroll-wrapper/index.js";
|
|
3
|
+
import _default$2 from "./wrapper/flex-row-wrapper/index.js";
|
|
4
|
+
import _default$1 from "./wrapper/flex-col-wrapper/index.js";
|
|
5
|
+
import { SemiComponentResolver } from "./resolver.js";
|
|
6
|
+
import TabView from "./tab-view/index.js";
|
|
7
7
|
|
|
8
8
|
//#region src/_utils/get-provider.d.ts
|
|
9
9
|
declare function getAppProvider(): AppProviderContext;
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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-DN-KFQWP.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";
|
|
5
5
|
import { t as flex_col_wrapper_default } from "./flex-col-wrapper-BYnCXcY5.js";
|
|
6
6
|
import { t as app_provider_default } from "./app-provider-BNtVdZn9.js";
|
|
7
|
-
import {
|
|
7
|
+
import { SemiComponentResolver } from "./resolver.js";
|
|
8
8
|
|
|
9
9
|
export { app_provider_default as AppProvider, flex_col_wrapper_default as FlexColWrapper, flex_row_wrapper_default as FlexRowWrapper, scroll_wrapper_default as ScrollWrapper, SemiComponentResolver, tab_view_default as TabView, getAppProvider };
|
package/lib/resolver.d.ts
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/resolver.d.ts
|
|
2
|
+
declare const SemiComponentResolver: () => {
|
|
3
|
+
type: "component";
|
|
4
|
+
resolve: (name: string) => {
|
|
5
|
+
name: string;
|
|
6
|
+
from: string;
|
|
7
|
+
} | undefined;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
2
10
|
export { SemiComponentResolver };
|
package/lib/resolver.js
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/resolver.ts
|
|
2
|
+
const SemiComponentResolver = () => {
|
|
3
|
+
return {
|
|
4
|
+
type: "component",
|
|
5
|
+
resolve: (name) => {
|
|
6
|
+
if ([
|
|
7
|
+
"ScrollWrapper",
|
|
8
|
+
"FlexRowWrapper",
|
|
9
|
+
"FlexColWrapper"
|
|
10
|
+
].includes(name)) return {
|
|
11
|
+
name,
|
|
12
|
+
from: "@semi-kit/component"
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
};
|
|
2
17
|
|
|
18
|
+
//#endregion
|
|
3
19
|
export { SemiComponentResolver };
|
package/lib/tab-view/index.d.ts
CHANGED
|
@@ -1,2 +1,41 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as vue23 from "vue";
|
|
2
|
+
import { VNode } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/tab-view/index.d.ts
|
|
5
|
+
type TabActionType = 'closeTab' | 'closeOtherTabs' | 'closeLeftTabs' | 'closeRightTabs';
|
|
6
|
+
interface PropsType<T> {
|
|
7
|
+
rowKey: (item: T) => string | number;
|
|
8
|
+
activeTab: (item: T) => boolean;
|
|
9
|
+
tabs: T[];
|
|
10
|
+
type?: 'chrome' | 'tab' | 'tag';
|
|
11
|
+
onClickItem?: (item: T) => void;
|
|
12
|
+
onMouseUpItem?: (e: MouseEvent, item: T, index: number) => void;
|
|
13
|
+
onDropdownSelect?: (key: TabActionType, index: number) => void;
|
|
14
|
+
onContextMenuItem?: (e: MouseEvent, item: T, index: number) => void;
|
|
15
|
+
}
|
|
16
|
+
interface SlotType<T> {
|
|
17
|
+
default?: (props: {
|
|
18
|
+
item: T;
|
|
19
|
+
index: number;
|
|
20
|
+
}) => VNode;
|
|
21
|
+
extra?: () => VNode;
|
|
22
|
+
}
|
|
23
|
+
declare const TabView: vue23.DefineSetupFnComponent<{
|
|
24
|
+
tabs: any;
|
|
25
|
+
rowKey: any;
|
|
26
|
+
activeTab: any;
|
|
27
|
+
type: any;
|
|
28
|
+
onClickItem: any;
|
|
29
|
+
onMouseUpItem: any;
|
|
30
|
+
onContextMenuItem: any;
|
|
31
|
+
}, {}, {}, {
|
|
32
|
+
tabs: any;
|
|
33
|
+
rowKey: any;
|
|
34
|
+
activeTab: any;
|
|
35
|
+
type: any;
|
|
36
|
+
onClickItem: any;
|
|
37
|
+
onMouseUpItem: any;
|
|
38
|
+
onContextMenuItem: any;
|
|
39
|
+
} & {}, vue23.PublicProps>;
|
|
40
|
+
//#endregion
|
|
2
41
|
export { PropsType, SlotType, TabActionType, TabView as default };
|
package/lib/tab-view/index.js
CHANGED
|
@@ -0,0 +1,194 @@
|
|
|
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([cB("tab-view", {
|
|
24
|
+
display: "flex",
|
|
25
|
+
gap: "4px",
|
|
26
|
+
height: "42px",
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
backgroundColor: "#fff"
|
|
29
|
+
}, [
|
|
30
|
+
cE("tabs-wrapper", {
|
|
31
|
+
display: "flex",
|
|
32
|
+
flex: 1,
|
|
33
|
+
height: "100%",
|
|
34
|
+
overflowX: "auto",
|
|
35
|
+
padding: "0 10px",
|
|
36
|
+
whiteSpace: "nowrap",
|
|
37
|
+
"&::-webkit-scrollbar": { display: "none" },
|
|
38
|
+
scrollbarWidth: "none"
|
|
39
|
+
}),
|
|
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
|
+
}),
|
|
49
|
+
cM("chrome", [cE("tab-item", [c("&:hover:not(.sk-tab-view__tab-item--active)::before", {
|
|
50
|
+
content: "\"\"",
|
|
51
|
+
position: "absolute",
|
|
52
|
+
left: "1px",
|
|
53
|
+
right: 0,
|
|
54
|
+
top: "50%",
|
|
55
|
+
height: "80%",
|
|
56
|
+
transform: "translateY(-50%)",
|
|
57
|
+
background: "rgba(0, 0, 0, 0.06)",
|
|
58
|
+
borderRadius: "var(--sk-tab-radius)"
|
|
59
|
+
}), cM("active", {
|
|
60
|
+
color: "var(--sk-tab-primary-color)",
|
|
61
|
+
"&::before": {
|
|
62
|
+
content: "\"\"",
|
|
63
|
+
position: "absolute",
|
|
64
|
+
left: 0,
|
|
65
|
+
right: 0,
|
|
66
|
+
bottom: 0,
|
|
67
|
+
height: "85%",
|
|
68
|
+
backgroundColor: "var(--sk-tab-secondary-color)",
|
|
69
|
+
borderRadius: "10px 10px 0 0"
|
|
70
|
+
},
|
|
71
|
+
"&::after": {
|
|
72
|
+
content: "\"\"",
|
|
73
|
+
position: "absolute",
|
|
74
|
+
bottom: 0,
|
|
75
|
+
left: "-14px",
|
|
76
|
+
right: "-14px",
|
|
77
|
+
height: "14px",
|
|
78
|
+
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"
|
|
79
|
+
}
|
|
80
|
+
})])]),
|
|
81
|
+
cM("tab", [cE("tab-item", {
|
|
82
|
+
padding: "0 4px",
|
|
83
|
+
marginRight: "10px",
|
|
84
|
+
transition: "border var(--duration) ease",
|
|
85
|
+
boxSizing: "border-box",
|
|
86
|
+
borderBottom: "2px solid transparent",
|
|
87
|
+
"&:hover": {
|
|
88
|
+
borderBottom: "2px solid var(--sk-tab-primary-color)",
|
|
89
|
+
color: "var(--sk-tab-primary-color)"
|
|
90
|
+
}
|
|
91
|
+
}, [cM("active", {
|
|
92
|
+
color: "var(--sk-tab-primary-color)",
|
|
93
|
+
borderBottom: "2px solid var(--sk-tab-primary-color)"
|
|
94
|
+
})])]),
|
|
95
|
+
cM("tag", [cE("tabs-wrapper", { alignItems: "center" }), cE("tab-item", {
|
|
96
|
+
height: "75%",
|
|
97
|
+
padding: 0
|
|
98
|
+
}, [c(".n-tag", {
|
|
99
|
+
height: "100%",
|
|
100
|
+
cursor: "pointer"
|
|
101
|
+
}), c("&:hover .n-tag", {
|
|
102
|
+
color: "var(--sk-tab-primary-color)",
|
|
103
|
+
backgroundColor: "var(--sk-tab-secondary-color)"
|
|
104
|
+
}, [c("button", { color: "var(--sk-tab-primary-color)" })])])])
|
|
105
|
+
])]);
|
|
106
|
+
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/tab-view/index.tsx
|
|
109
|
+
function _isSlot(s) {
|
|
110
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
111
|
+
}
|
|
112
|
+
const TabView = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
113
|
+
const router = useRouter();
|
|
114
|
+
useStyle("tab-view", styles_default);
|
|
115
|
+
const provider = getAppProvider();
|
|
116
|
+
const radiusPX = computed(() => `${provider.theme?.value?.radius}px`);
|
|
117
|
+
const scrollContainer = ref();
|
|
118
|
+
const syncScroll = () => {
|
|
119
|
+
nextTick(() => {
|
|
120
|
+
const container = scrollContainer.value;
|
|
121
|
+
const activeTab = container?.querySelector(".sk-tab-view__tab-item--active");
|
|
122
|
+
if (!container || !activeTab) return;
|
|
123
|
+
const containerRect = container.getBoundingClientRect();
|
|
124
|
+
const activeRect = activeTab.getBoundingClientRect();
|
|
125
|
+
const scrollLeft = container.scrollLeft;
|
|
126
|
+
const offset = activeRect.left + activeRect.width / 2 - (containerRect.left + containerRect.width / 2);
|
|
127
|
+
container.scrollTo({
|
|
128
|
+
left: scrollLeft + offset,
|
|
129
|
+
behavior: "smooth"
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
onMounted(syncScroll);
|
|
134
|
+
router.afterEach(syncScroll);
|
|
135
|
+
useEventListener(scrollContainer, "wheel", (e) => {
|
|
136
|
+
if (e.deltaY === 0) return;
|
|
137
|
+
e.preventDefault();
|
|
138
|
+
if (scrollContainer.value) scrollContainer.value.scrollLeft += e.deltaY;
|
|
139
|
+
});
|
|
140
|
+
return () => {
|
|
141
|
+
return createVNode("div", {
|
|
142
|
+
"class": ["sk-tab-view", props.type && `sk-tab-view--${props.type}`],
|
|
143
|
+
"style": {
|
|
144
|
+
"--sk-tab-radius": radiusPX.value,
|
|
145
|
+
"--sk-tab-primary-color": provider.theme?.value?.primaryColor,
|
|
146
|
+
"--sk-tab-secondary-color": provider.theme?.value?.secondaryColor
|
|
147
|
+
}
|
|
148
|
+
}, [createVNode("div", {
|
|
149
|
+
"ref": scrollContainer,
|
|
150
|
+
"class": "sk-tab-view__tabs-wrapper"
|
|
151
|
+
}, [props.tabs?.map((item, index) => {
|
|
152
|
+
const isActive = props.activeTab(item);
|
|
153
|
+
const content = slots?.default?.({
|
|
154
|
+
item,
|
|
155
|
+
index
|
|
156
|
+
});
|
|
157
|
+
if (props.type === "tag") return createVNode("div", {
|
|
158
|
+
"class": "sk-tab-view__tab-item",
|
|
159
|
+
"key": props.rowKey(item),
|
|
160
|
+
"onClick": () => props.onClickItem?.(item),
|
|
161
|
+
"onMouseup": (e) => props.onMouseUpItem?.(e, item, index),
|
|
162
|
+
"onContextmenu": (e) => {
|
|
163
|
+
e.preventDefault();
|
|
164
|
+
props.onContextMenuItem?.(e, item, index);
|
|
165
|
+
}
|
|
166
|
+
}, [createVNode(NTag, {
|
|
167
|
+
"type": isActive ? "primary" : "default",
|
|
168
|
+
"bordered": false
|
|
169
|
+
}, _isSlot(content) ? content : { default: () => [content] })]);
|
|
170
|
+
return createVNode("div", {
|
|
171
|
+
"key": props.rowKey(item),
|
|
172
|
+
"class": ["sk-tab-view__tab-item", { "sk-tab-view__tab-item--active": isActive }],
|
|
173
|
+
"onClick": () => props.onClickItem?.(item),
|
|
174
|
+
"onMouseup": (e) => props.onMouseUpItem?.(e, item, index),
|
|
175
|
+
"onContextmenu": (e) => {
|
|
176
|
+
e.preventDefault();
|
|
177
|
+
props.onContextMenuItem?.(e, item, index);
|
|
178
|
+
}
|
|
179
|
+
}, [content]);
|
|
180
|
+
})]), slots?.extra?.()]);
|
|
181
|
+
};
|
|
182
|
+
}, { props: [
|
|
183
|
+
"tabs",
|
|
184
|
+
"rowKey",
|
|
185
|
+
"activeTab",
|
|
186
|
+
"type",
|
|
187
|
+
"onClickItem",
|
|
188
|
+
"onMouseUpItem",
|
|
189
|
+
"onContextMenuItem"
|
|
190
|
+
] });
|
|
191
|
+
var tab_view_default = TabView;
|
|
192
|
+
|
|
193
|
+
//#endregion
|
|
194
|
+
export { getAppProvider as n, tab_view_default as t };
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as vue25 from "vue";
|
|
2
|
+
import * as vue_jsx_runtime1 from "vue/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/wrapper/flex-col-wrapper/index.d.ts
|
|
5
|
+
declare const _default: vue25.DefineComponent<{}, () => vue_jsx_runtime1.JSX.Element, {}, {}, {}, vue25.ComponentOptionsMixin, vue25.ComponentOptionsMixin, {}, string, vue25.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue25.ComponentProvideOptions, true, {}, any>;
|
|
6
|
+
//#endregion
|
|
2
7
|
export { _default as default };
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as vue4 from "vue";
|
|
2
|
+
import * as vue_jsx_runtime0 from "vue/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/wrapper/flex-row-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
|
|
2
7
|
export { _default as default };
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as vue0 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: vue0.DefineComponent<{}, () => vue_jsx_runtime0.JSX.Element, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue0.ComponentProvideOptions, true, {}, any>;
|
|
6
|
+
//#endregion
|
|
2
7
|
export { _default as default };
|
package/package.json
CHANGED
package/lib/index-BScreGz5.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import * as vue0 from "vue";
|
|
2
|
-
import { VNode } from "vue";
|
|
3
|
-
|
|
4
|
-
//#region src/tab-view/index.d.ts
|
|
5
|
-
type TabActionType = 'closeTab' | 'closeOtherTabs' | 'closeLeftTabs' | 'closeRightTabs';
|
|
6
|
-
interface PropsType<T> {
|
|
7
|
-
rowKey: (item: T) => string | number;
|
|
8
|
-
activeTab: (item: T) => boolean;
|
|
9
|
-
tabs: T[];
|
|
10
|
-
type?: 'chrome' | 'tab';
|
|
11
|
-
onClickItem?: (item: T) => void;
|
|
12
|
-
onMouseUpItem?: (e: MouseEvent, item: T, index: number) => void;
|
|
13
|
-
onDropdownSelect?: (key: TabActionType, index: number) => void;
|
|
14
|
-
onContextMenuItem?: (e: MouseEvent, item: T, index: number) => void;
|
|
15
|
-
}
|
|
16
|
-
interface SlotType<T> {
|
|
17
|
-
default?: (props: {
|
|
18
|
-
item: T;
|
|
19
|
-
index: number;
|
|
20
|
-
}) => VNode;
|
|
21
|
-
extra?: () => VNode;
|
|
22
|
-
}
|
|
23
|
-
declare const TabView: vue0.DefineSetupFnComponent<{
|
|
24
|
-
tabs: any;
|
|
25
|
-
rowKey: any;
|
|
26
|
-
activeTab: any;
|
|
27
|
-
type: any;
|
|
28
|
-
onClickItem: any;
|
|
29
|
-
onMouseUpItem: any;
|
|
30
|
-
onContextMenuItem: any;
|
|
31
|
-
}, {}, {}, {
|
|
32
|
-
tabs: any;
|
|
33
|
-
rowKey: any;
|
|
34
|
-
activeTab: any;
|
|
35
|
-
type: any;
|
|
36
|
-
onClickItem: any;
|
|
37
|
-
onMouseUpItem: any;
|
|
38
|
-
onContextMenuItem: any;
|
|
39
|
-
} & {}, vue0.PublicProps>;
|
|
40
|
-
//#endregion
|
|
41
|
-
export { TabView as i, SlotType as n, TabActionType as r, PropsType as t };
|
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/resolver-DP3BDWck.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
//#region src/resolver.ts
|
|
2
|
-
const SemiComponentResolver = () => {
|
|
3
|
-
return {
|
|
4
|
-
type: "component",
|
|
5
|
-
resolve: (name) => {
|
|
6
|
-
if ([
|
|
7
|
-
"ScrollWrapper",
|
|
8
|
-
"FlexRowWrapper",
|
|
9
|
-
"FlexColWrapper"
|
|
10
|
-
].includes(name)) return {
|
|
11
|
-
name,
|
|
12
|
-
from: "@semi-kit/component"
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { SemiComponentResolver 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 };
|