jky-component-lib 0.0.72 → 0.0.75
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/dist/es/components.d.ts +0 -1
- package/dist/es/components.js +1 -4
- package/dist/es/index.js +0 -15
- package/dist/es/menu/Menu.vue.js +42 -40
- package/dist/es/menu/MenuItem.vue.js +43 -41
- package/dist/es/package.json.js +1 -1
- package/dist/es/page-layout/PageLayout.vue.d.ts +1 -1
- package/dist/es/page-layout/PageLayout.vue.js +47 -60
- package/dist/es/style.css +0 -56
- package/dist/es/styles.css +1 -1
- package/dist/lib/components.d.ts +0 -1
- package/dist/lib/components.js +1 -4
- package/dist/lib/index.js +0 -15
- package/dist/lib/menu/Menu.vue.js +42 -40
- package/dist/lib/menu/MenuItem.vue.js +42 -40
- package/dist/lib/package.json.js +1 -1
- package/dist/lib/page-layout/PageLayout.vue.d.ts +1 -1
- package/dist/lib/page-layout/PageLayout.vue.js +46 -59
- package/dist/lib/style.css +0 -56
- package/dist/lib/styles.css +1 -1
- package/package.json +1 -1
- package/dist/es/tabs/TabContent.vue.d.ts +0 -16
- package/dist/es/tabs/TabContent.vue.js +0 -65
- package/dist/es/tabs/TabContent.vue3.js +0 -5
- package/dist/es/tabs/Tabs.vue.d.ts +0 -46
- package/dist/es/tabs/Tabs.vue.js +0 -311
- package/dist/es/tabs/Tabs.vue3.js +0 -5
- package/dist/es/tabs/index.d.ts +0 -9
- package/dist/es/tabs/index.js +0 -8
- package/dist/es/tabs/routeListener.d.ts +0 -19
- package/dist/es/tabs/routeListener.js +0 -26
- package/dist/es/tabs/style.css +0 -29
- package/dist/es/tabs/useTabs.d.ts +0 -27
- package/dist/es/tabs/useTabs.js +0 -59
- package/dist/es/tabs/useTabsStore.d.ts +0 -53
- package/dist/es/tabs/useTabsStore.js +0 -208
- package/dist/lib/tabs/TabContent.vue.d.ts +0 -16
- package/dist/lib/tabs/TabContent.vue.js +0 -65
- package/dist/lib/tabs/TabContent.vue3.js +0 -5
- package/dist/lib/tabs/Tabs.vue.d.ts +0 -46
- package/dist/lib/tabs/Tabs.vue.js +0 -311
- package/dist/lib/tabs/Tabs.vue3.js +0 -5
- package/dist/lib/tabs/index.d.ts +0 -9
- package/dist/lib/tabs/index.js +0 -8
- package/dist/lib/tabs/routeListener.d.ts +0 -19
- package/dist/lib/tabs/routeListener.js +0 -26
- package/dist/lib/tabs/style.css +0 -29
- package/dist/lib/tabs/useTabs.d.ts +0 -27
- package/dist/lib/tabs/useTabs.js +0 -59
- package/dist/lib/tabs/useTabsStore.d.ts +0 -53
- package/dist/lib/tabs/useTabsStore.js +0 -208
package/dist/es/tabs/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { RouteLocationNormalized } from 'vue-router';
|
|
2
|
-
/**
|
|
3
|
-
* 触发路由变化事件
|
|
4
|
-
*
|
|
5
|
-
* @param route - 路由信息
|
|
6
|
-
*/
|
|
7
|
-
export declare function emitRouteChange(route: RouteLocationNormalized): void;
|
|
8
|
-
/**
|
|
9
|
-
* 监听路由变化
|
|
10
|
-
*
|
|
11
|
-
* @param callback - 回调函数
|
|
12
|
-
* @param immediate - 是否立即执行
|
|
13
|
-
* @returns 取消监听函数
|
|
14
|
-
*/
|
|
15
|
-
export declare function onRouteChange(callback: (route: RouteLocationNormalized) => void, immediate?: boolean): () => void;
|
|
16
|
-
/**
|
|
17
|
-
* 清除所有监听
|
|
18
|
-
*/
|
|
19
|
-
export declare function clearRouteListeners(): void;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import mitt from "mitt";
|
|
2
|
-
const emitter = mitt();
|
|
3
|
-
let lastRoute = null;
|
|
4
|
-
function emitRouteChange(route) {
|
|
5
|
-
lastRoute = route;
|
|
6
|
-
emitter.emit("routeChange", { route });
|
|
7
|
-
}
|
|
8
|
-
function onRouteChange(callback, immediate = true) {
|
|
9
|
-
emitter.on("routeChange", ({ route }) => {
|
|
10
|
-
callback(route);
|
|
11
|
-
});
|
|
12
|
-
if (immediate && lastRoute) {
|
|
13
|
-
callback(lastRoute);
|
|
14
|
-
}
|
|
15
|
-
return () => {
|
|
16
|
-
emitter.off("routeChange");
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
function clearRouteListeners() {
|
|
20
|
-
emitter.all.clear();
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
clearRouteListeners,
|
|
24
|
-
emitRouteChange,
|
|
25
|
-
onRouteChange
|
|
26
|
-
};
|
package/dist/es/tabs/style.css
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/* Tabs 组件样式 */
|
|
2
|
-
.jky-tabs {
|
|
3
|
-
--jky-tabs-color: var(--el-text-color-regular);
|
|
4
|
-
--jky-tabs-active-color: var(--el-color-primary);
|
|
5
|
-
--jky-tabs-height: 40px;
|
|
6
|
-
--jky-tabs-font-size: 14px;
|
|
7
|
-
.el-tabs__item {
|
|
8
|
-
color: var(--jky-tabs-color);
|
|
9
|
-
font-size: var(--jky-tabs-font-size);
|
|
10
|
-
height: var(--jky-tabs-height);
|
|
11
|
-
line-height: var(--jky-tabs-height);
|
|
12
|
-
&.is-active {
|
|
13
|
-
color: var(--jky-tabs-active-color);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
.el-tabs__active-bar {
|
|
17
|
-
background-color: var(--jky-tabs-active-color);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
/* 路由模式下的特殊样式 */
|
|
21
|
-
.jky-tabs--route {
|
|
22
|
-
.el-tabs__item {
|
|
23
|
-
&.is-closable:hover {
|
|
24
|
-
.el-tabs__item__close {
|
|
25
|
-
opacity: 1;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ComputedRef } from 'vue';
|
|
2
|
-
import { TabItem, TabsStore } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Tabs Hook 返回类型
|
|
5
|
-
*/
|
|
6
|
-
interface UseTabsReturn {
|
|
7
|
-
activeTab: ComputedRef<string>;
|
|
8
|
-
tabList: ComputedRef<TabItem[]>;
|
|
9
|
-
cacheTabs: ComputedRef<string[]>;
|
|
10
|
-
getCurrentTab: () => TabItem | undefined;
|
|
11
|
-
addTab: (tab: TabItem) => void;
|
|
12
|
-
closeTab: (name?: string) => void;
|
|
13
|
-
closeLeft: (name?: string) => void;
|
|
14
|
-
closeRight: (name?: string) => void;
|
|
15
|
-
closeOther: (name?: string) => void;
|
|
16
|
-
closeAll: () => void;
|
|
17
|
-
refresh: (name?: string) => void;
|
|
18
|
-
setTitle: (title: string, name?: string) => void;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Tabs Hook
|
|
22
|
-
*
|
|
23
|
-
* @param store - 可选的 store 实例
|
|
24
|
-
* @returns Tabs 操作 API
|
|
25
|
-
*/
|
|
26
|
-
export declare function useTabs(store?: TabsStore): UseTabsReturn;
|
|
27
|
-
export {};
|
package/dist/es/tabs/useTabs.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { computed } from "vue";
|
|
2
|
-
import { useTabsStore } from "./useTabsStore.js";
|
|
3
|
-
function useTabs(store) {
|
|
4
|
-
const tabsStore = store || useTabsStore();
|
|
5
|
-
function getCurrentTab() {
|
|
6
|
-
return tabsStore.tabList.find(
|
|
7
|
-
(t) => t.name === tabsStore.activeTab
|
|
8
|
-
);
|
|
9
|
-
}
|
|
10
|
-
function addTab(tab) {
|
|
11
|
-
tabsStore.addTab(tab);
|
|
12
|
-
}
|
|
13
|
-
function closeTab(name) {
|
|
14
|
-
const tabName = name || tabsStore.activeTab;
|
|
15
|
-
tabsStore.removeTab(tabName);
|
|
16
|
-
}
|
|
17
|
-
function closeLeft(name) {
|
|
18
|
-
const tabName = name || tabsStore.activeTab;
|
|
19
|
-
tabsStore.closeLeft(tabName);
|
|
20
|
-
}
|
|
21
|
-
function closeRight(name) {
|
|
22
|
-
const tabName = name || tabsStore.activeTab;
|
|
23
|
-
tabsStore.closeRight(tabName);
|
|
24
|
-
}
|
|
25
|
-
function closeOther(name) {
|
|
26
|
-
const tabName = name || tabsStore.activeTab;
|
|
27
|
-
tabsStore.closeOther(tabName);
|
|
28
|
-
}
|
|
29
|
-
function closeAll() {
|
|
30
|
-
tabsStore.closeAll();
|
|
31
|
-
}
|
|
32
|
-
function refresh(name) {
|
|
33
|
-
const tabName = name || tabsStore.activeTab;
|
|
34
|
-
tabsStore.refresh(tabName);
|
|
35
|
-
}
|
|
36
|
-
function setTitle(title, name) {
|
|
37
|
-
const tabName = name || tabsStore.activeTab;
|
|
38
|
-
tabsStore.updateTab(tabName, { label: title });
|
|
39
|
-
}
|
|
40
|
-
return {
|
|
41
|
-
// 状态
|
|
42
|
-
activeTab: computed(() => tabsStore.activeTab),
|
|
43
|
-
tabList: computed(() => tabsStore.getTabList()),
|
|
44
|
-
cacheTabs: computed(() => tabsStore.getCacheTabs()),
|
|
45
|
-
// 方法
|
|
46
|
-
getCurrentTab,
|
|
47
|
-
addTab,
|
|
48
|
-
closeTab,
|
|
49
|
-
closeLeft,
|
|
50
|
-
closeRight,
|
|
51
|
-
closeOther,
|
|
52
|
-
closeAll,
|
|
53
|
-
refresh,
|
|
54
|
-
setTitle
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
export {
|
|
58
|
-
useTabs
|
|
59
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { TabItem } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Tabs Store 返回类型
|
|
4
|
-
* 注意:Pinia 会自动解包 Ref,所以这里使用 UnwrapRef
|
|
5
|
-
*/
|
|
6
|
-
export interface TabsStoreReturn {
|
|
7
|
-
tabList: TabItem[];
|
|
8
|
-
activeTab: string;
|
|
9
|
-
cacheTabs: string[];
|
|
10
|
-
closedTabs: string[];
|
|
11
|
-
addTab: (tab: TabItem) => void;
|
|
12
|
-
updateTab: (name: string, tab: Partial<TabItem>) => void;
|
|
13
|
-
removeTab: (name: string) => void;
|
|
14
|
-
setActiveTab: (name: string) => void;
|
|
15
|
-
addCache: (name: string) => void;
|
|
16
|
-
removeCache: (name: string) => void;
|
|
17
|
-
bulkRemove: (names: string[]) => void;
|
|
18
|
-
closeLeft: (name: string) => void;
|
|
19
|
-
closeRight: (name: string) => void;
|
|
20
|
-
closeOther: (name: string) => void;
|
|
21
|
-
closeAll: () => void;
|
|
22
|
-
refresh: (name: string) => void;
|
|
23
|
-
getTabList: () => TabItem[];
|
|
24
|
-
getCacheTabs: () => string[];
|
|
25
|
-
isClosed: (name: string) => boolean;
|
|
26
|
-
isCached: (name: string) => boolean;
|
|
27
|
-
reset: () => void;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Tabs Store
|
|
31
|
-
* 使用 Pinia 管理标签页状态和缓存
|
|
32
|
-
*
|
|
33
|
-
* @param persist - 是否启用持久化(默认 false)
|
|
34
|
-
* @param persistKey - 持久化 key(可选,默认 'jky-tabs-state')
|
|
35
|
-
*/
|
|
36
|
-
export declare function createTabsStore(persist?: boolean, persistKey?: string): TabsStoreReturn;
|
|
37
|
-
/**
|
|
38
|
-
* 获取或创建 Tabs Store
|
|
39
|
-
*
|
|
40
|
-
* @param persist - 是否启用持久化(默认 false)
|
|
41
|
-
* @param persistKey - 持久化 key(可选)
|
|
42
|
-
*/
|
|
43
|
-
export declare function useTabsStore(persist?: boolean, persistKey?: string): TabsStoreReturn;
|
|
44
|
-
/**
|
|
45
|
-
* 重置 Store
|
|
46
|
-
*/
|
|
47
|
-
export declare function resetTabsStore(): void;
|
|
48
|
-
/**
|
|
49
|
-
* 在应用中提供持久化 key
|
|
50
|
-
*/
|
|
51
|
-
export declare function provideTabsPersistKey(key: string): {
|
|
52
|
-
key: string;
|
|
53
|
-
};
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
|
-
import { defineStore } from "pinia";
|
|
18
|
-
import { ref, shallowRef, computed, inject } from "vue";
|
|
19
|
-
const PERSIST_KEY_SYMBOL = Symbol("jky-tabs-persist-key");
|
|
20
|
-
const DEFAULT_PERSIST_KEY = "jky-tabs-state";
|
|
21
|
-
function getPersistConfig(persist, persistKey) {
|
|
22
|
-
const injectedPersistKey = inject(PERSIST_KEY_SYMBOL, void 0);
|
|
23
|
-
const finalPersistKey = injectedPersistKey || persistKey || DEFAULT_PERSIST_KEY;
|
|
24
|
-
return {
|
|
25
|
-
enabled: persist !== void 0 ? persist : false,
|
|
26
|
-
key: finalPersistKey
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function loadFromStorage(key) {
|
|
30
|
-
try {
|
|
31
|
-
const stored = localStorage.getItem(key);
|
|
32
|
-
if (stored) {
|
|
33
|
-
return JSON.parse(stored);
|
|
34
|
-
}
|
|
35
|
-
} catch (error) {
|
|
36
|
-
console.warn("Failed to load tabs from storage:", error);
|
|
37
|
-
}
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
function saveToStorage(key, data) {
|
|
41
|
-
try {
|
|
42
|
-
localStorage.setItem(key, JSON.stringify(data));
|
|
43
|
-
} catch (error) {
|
|
44
|
-
console.warn("Failed to save tabs to storage:", error);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function createTabsStore(persist, persistKey) {
|
|
48
|
-
const persistConfig = getPersistConfig(persist, persistKey);
|
|
49
|
-
const initialData = persistConfig.enabled ? loadFromStorage(persistConfig.key) : null;
|
|
50
|
-
const store = defineStore("jky-tabs", () => {
|
|
51
|
-
const tabList = ref((initialData == null ? void 0 : initialData.tabList) || []);
|
|
52
|
-
const activeTab = ref((initialData == null ? void 0 : initialData.activeTab) || "");
|
|
53
|
-
const cacheTabs = shallowRef((initialData == null ? void 0 : initialData.cacheTabs) || []);
|
|
54
|
-
const closedTabs = shallowRef((initialData == null ? void 0 : initialData.closedTabs) || []);
|
|
55
|
-
const cacheSet = computed(() => new Set(cacheTabs.value));
|
|
56
|
-
const closedSet = computed(() => new Set(closedTabs.value));
|
|
57
|
-
function persistState() {
|
|
58
|
-
if (!persistConfig.enabled)
|
|
59
|
-
return;
|
|
60
|
-
saveToStorage(persistConfig.key, {
|
|
61
|
-
tabList: tabList.value,
|
|
62
|
-
activeTab: activeTab.value,
|
|
63
|
-
cacheTabs: cacheTabs.value,
|
|
64
|
-
closedTabs: closedTabs.value
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
function addTab(tab) {
|
|
68
|
-
const index = tabList.value.findIndex((t) => t.name === tab.name);
|
|
69
|
-
if (index !== -1) {
|
|
70
|
-
tabList.value[index] = __spreadValues(__spreadValues({}, tabList.value[index]), tab);
|
|
71
|
-
} else {
|
|
72
|
-
tabList.value.push(tab);
|
|
73
|
-
}
|
|
74
|
-
persistState();
|
|
75
|
-
}
|
|
76
|
-
function updateTab(name, tab) {
|
|
77
|
-
const index = tabList.value.findIndex((t) => t.name === name);
|
|
78
|
-
if (index !== -1) {
|
|
79
|
-
tabList.value[index] = __spreadValues(__spreadValues({}, tabList.value[index]), tab);
|
|
80
|
-
persistState();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function removeTab(name) {
|
|
84
|
-
const index = tabList.value.findIndex((t) => t.name === name);
|
|
85
|
-
if (index !== -1) {
|
|
86
|
-
tabList.value.splice(index, 1);
|
|
87
|
-
removeCache(name);
|
|
88
|
-
if (activeTab.value === name && tabList.value.length > 0) {
|
|
89
|
-
const nextTab = tabList.value[index] || tabList.value[index - 1];
|
|
90
|
-
if (nextTab) {
|
|
91
|
-
activeTab.value = nextTab.name;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
persistState();
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
function setActiveTab(name) {
|
|
98
|
-
activeTab.value = name;
|
|
99
|
-
persistState();
|
|
100
|
-
}
|
|
101
|
-
function addCache(name) {
|
|
102
|
-
if (!cacheSet.value.has(name)) {
|
|
103
|
-
cacheTabs.value = [...cacheTabs.value, name];
|
|
104
|
-
persistState();
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
function removeCache(name) {
|
|
108
|
-
cacheTabs.value = cacheTabs.value.filter((t) => t !== name);
|
|
109
|
-
persistState();
|
|
110
|
-
}
|
|
111
|
-
function bulkRemove(names) {
|
|
112
|
-
tabList.value = tabList.value.filter((tab) => !names.includes(tab.name));
|
|
113
|
-
names.forEach((name) => removeCache(name));
|
|
114
|
-
persistState();
|
|
115
|
-
}
|
|
116
|
-
function closeLeft(name) {
|
|
117
|
-
const index = tabList.value.findIndex((t) => t.name === name);
|
|
118
|
-
if (index > 0) {
|
|
119
|
-
const leftTabs = tabList.value.slice(0, index);
|
|
120
|
-
const removableTabs = leftTabs.filter((tab) => !tab.affix);
|
|
121
|
-
bulkRemove(removableTabs.map((tab) => tab.name));
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
function closeRight(name) {
|
|
125
|
-
const index = tabList.value.findIndex((t) => t.name === name);
|
|
126
|
-
if (index >= 0 && index < tabList.value.length - 1) {
|
|
127
|
-
const rightTabs = tabList.value.slice(index + 1);
|
|
128
|
-
const removableTabs = rightTabs.filter((tab) => !tab.affix);
|
|
129
|
-
bulkRemove(removableTabs.map((tab) => tab.name));
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
function closeOther(name) {
|
|
133
|
-
const removableTabs = tabList.value.filter(
|
|
134
|
-
(tab) => tab.name !== name && !tab.affix
|
|
135
|
-
);
|
|
136
|
-
bulkRemove(removableTabs.map((tab) => tab.name));
|
|
137
|
-
}
|
|
138
|
-
function closeAll() {
|
|
139
|
-
const removableTabs = tabList.value.filter((tab) => !tab.affix);
|
|
140
|
-
bulkRemove(removableTabs.map((tab) => tab.name));
|
|
141
|
-
}
|
|
142
|
-
function refresh(name) {
|
|
143
|
-
removeCache(name);
|
|
144
|
-
setTimeout(() => {
|
|
145
|
-
addCache(name);
|
|
146
|
-
}, 0);
|
|
147
|
-
}
|
|
148
|
-
function getTabList() {
|
|
149
|
-
return [...tabList.value];
|
|
150
|
-
}
|
|
151
|
-
function getCacheTabs() {
|
|
152
|
-
return [...cacheTabs.value];
|
|
153
|
-
}
|
|
154
|
-
function isClosed(name) {
|
|
155
|
-
return closedSet.value.has(name);
|
|
156
|
-
}
|
|
157
|
-
function isCached(name) {
|
|
158
|
-
return cacheSet.value.has(name);
|
|
159
|
-
}
|
|
160
|
-
function reset() {
|
|
161
|
-
tabList.value = [];
|
|
162
|
-
activeTab.value = "";
|
|
163
|
-
cacheTabs.value = [];
|
|
164
|
-
closedTabs.value = [];
|
|
165
|
-
persistState();
|
|
166
|
-
}
|
|
167
|
-
return {
|
|
168
|
-
tabList,
|
|
169
|
-
activeTab,
|
|
170
|
-
cacheTabs,
|
|
171
|
-
closedTabs,
|
|
172
|
-
addTab,
|
|
173
|
-
updateTab,
|
|
174
|
-
removeTab,
|
|
175
|
-
setActiveTab,
|
|
176
|
-
addCache,
|
|
177
|
-
removeCache,
|
|
178
|
-
bulkRemove,
|
|
179
|
-
closeLeft,
|
|
180
|
-
closeRight,
|
|
181
|
-
closeOther,
|
|
182
|
-
closeAll,
|
|
183
|
-
refresh,
|
|
184
|
-
getTabList,
|
|
185
|
-
getCacheTabs,
|
|
186
|
-
isClosed,
|
|
187
|
-
isCached,
|
|
188
|
-
reset
|
|
189
|
-
};
|
|
190
|
-
});
|
|
191
|
-
return store();
|
|
192
|
-
}
|
|
193
|
-
const storeInstances = /* @__PURE__ */ new Map();
|
|
194
|
-
function useTabsStore(persist, persistKey) {
|
|
195
|
-
const key = persistKey || DEFAULT_PERSIST_KEY;
|
|
196
|
-
if (!storeInstances.has(key)) {
|
|
197
|
-
storeInstances.set(key, () => createTabsStore(persist, persistKey));
|
|
198
|
-
}
|
|
199
|
-
return storeInstances.get(key)();
|
|
200
|
-
}
|
|
201
|
-
function resetTabsStore() {
|
|
202
|
-
storeInstances.clear();
|
|
203
|
-
}
|
|
204
|
-
export {
|
|
205
|
-
createTabsStore,
|
|
206
|
-
resetTabsStore,
|
|
207
|
-
useTabsStore
|
|
208
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { TabContentProps } from './types';
|
|
2
|
-
declare const _default: import('vue').DefineComponent<TabContentProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
3
|
-
contextMenu: (data: {
|
|
4
|
-
tab: import('./types').TabItem;
|
|
5
|
-
event: MouseEvent;
|
|
6
|
-
}) => any;
|
|
7
|
-
}, string, import('vue').PublicProps, Readonly<TabContentProps> & Readonly<{
|
|
8
|
-
onContextMenu?: ((data: {
|
|
9
|
-
tab: import('./types').TabItem;
|
|
10
|
-
event: MouseEvent;
|
|
11
|
-
}) => any) | undefined;
|
|
12
|
-
}>, {
|
|
13
|
-
showIcon: boolean;
|
|
14
|
-
showContextMenu: boolean;
|
|
15
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
16
|
-
export default _default;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
22
|
-
const vue = require("vue");
|
|
23
|
-
const _hoisted_1 = { class: "jky-tab-content__title" };
|
|
24
|
-
const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValues({}, {
|
|
25
|
-
name: "JkyTabContent"
|
|
26
|
-
}), {
|
|
27
|
-
__name: "TabContent",
|
|
28
|
-
props: {
|
|
29
|
-
tab: {},
|
|
30
|
-
showIcon: { type: Boolean, default: true },
|
|
31
|
-
showContextMenu: { type: Boolean, default: false }
|
|
32
|
-
},
|
|
33
|
-
emits: ["contextMenu"],
|
|
34
|
-
setup(__props, { emit: __emit }) {
|
|
35
|
-
const props = __props;
|
|
36
|
-
const emit = __emit;
|
|
37
|
-
const title = vue.computed(() => {
|
|
38
|
-
var _a, _b;
|
|
39
|
-
return props.tab.label || ((_b = (_a = props.tab.route) == null ? void 0 : _a.meta) == null ? void 0 : _b.title) || "";
|
|
40
|
-
});
|
|
41
|
-
const icon = vue.computed(() => {
|
|
42
|
-
var _a, _b;
|
|
43
|
-
return props.tab.icon || ((_b = (_a = props.tab.route) == null ? void 0 : _a.meta) == null ? void 0 : _b.icon);
|
|
44
|
-
});
|
|
45
|
-
function handleContextMenu(e) {
|
|
46
|
-
if (props.showContextMenu) {
|
|
47
|
-
e.preventDefault();
|
|
48
|
-
emit("contextMenu", { tab: props.tab, event: e });
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return (_ctx, _cache) => {
|
|
52
|
-
return vue.openBlock(), vue.createElementBlock("div", {
|
|
53
|
-
class: "jky-tab-content flex items-center gap-1",
|
|
54
|
-
onContextmenu: handleContextMenu
|
|
55
|
-
}, [
|
|
56
|
-
props.showIcon && icon.value ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
57
|
-
key: 0,
|
|
58
|
-
class: vue.normalizeClass(["jky-tab-content__icon text-sm", [icon.value]])
|
|
59
|
-
}, null, 2)) : vue.createCommentVNode("", true),
|
|
60
|
-
vue.createElementVNode("span", _hoisted_1, vue.toDisplayString(title.value), 1)
|
|
61
|
-
], 32);
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
}));
|
|
65
|
-
exports.default = _sfc_main;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const TabContent_vue_vue_type_script_setup_true_lang = require("./TabContent.vue.js");
|
|
4
|
-
;/* empty css */
|
|
5
|
-
exports.default = TabContent_vue_vue_type_script_setup_true_lang.default;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { TabItem, TabsProps } from './types';
|
|
2
|
-
declare function __VLS_template(): {
|
|
3
|
-
attrs: Partial<{}>;
|
|
4
|
-
slots: {
|
|
5
|
-
default?(_: {}): any;
|
|
6
|
-
};
|
|
7
|
-
refs: {};
|
|
8
|
-
rootEl: any;
|
|
9
|
-
};
|
|
10
|
-
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
11
|
-
declare const __VLS_component: import('vue').DefineComponent<TabsProps, {
|
|
12
|
-
closeTab: (tabName: string) => void;
|
|
13
|
-
closeOthers: (tabName: string) => void;
|
|
14
|
-
closeAll: () => void;
|
|
15
|
-
refreshTab: (tabName: string) => void;
|
|
16
|
-
getCachedTabs: () => string[];
|
|
17
|
-
getTabList: () => TabItem[];
|
|
18
|
-
getActiveTab: () => string;
|
|
19
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
20
|
-
"update:modelValue": (value: string) => any;
|
|
21
|
-
routeChange: (route: any) => any;
|
|
22
|
-
tabClick: (tab: any) => any;
|
|
23
|
-
tabRemove: (tabName: string) => any;
|
|
24
|
-
edit: (tabName: string | undefined, action: "add" | "remove") => any;
|
|
25
|
-
tabClose: (tabName: string) => any;
|
|
26
|
-
}, string, import('vue').PublicProps, Readonly<TabsProps> & Readonly<{
|
|
27
|
-
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
28
|
-
onRouteChange?: ((route: any) => any) | undefined;
|
|
29
|
-
onTabClick?: ((tab: any) => any) | undefined;
|
|
30
|
-
onTabRemove?: ((tabName: string) => any) | undefined;
|
|
31
|
-
onEdit?: ((tabName: string | undefined, action: "add" | "remove") => any) | undefined;
|
|
32
|
-
onTabClose?: ((tabName: string) => any) | undefined;
|
|
33
|
-
}>, {
|
|
34
|
-
mode: import('./types').TabsMode;
|
|
35
|
-
cachable: boolean;
|
|
36
|
-
maxCacheSize: number;
|
|
37
|
-
tabStyle: import('./types').TabStyleOptions;
|
|
38
|
-
tabs: TabItem[];
|
|
39
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
40
|
-
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
41
|
-
export default _default;
|
|
42
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
43
|
-
new (): {
|
|
44
|
-
$slots: S;
|
|
45
|
-
};
|
|
46
|
-
};
|