vue-stack-tabs 0.1.36 → 0.1.37
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/README.md +2 -2
- package/dist/src/lib/StackTabs.vue.d.ts +140 -13
- package/dist/src/lib/components/ContextMenu/ContextMenuItem.vue.d.ts +3 -3
- package/dist/src/lib/components/ContextMenu/index.vue.d.ts +13 -12
- package/dist/src/lib/components/PageLoading.vue.d.ts +3 -3
- package/dist/src/lib/components/TabHeader/TabHeaderButton.vue.d.ts +11 -11
- package/dist/src/lib/components/TabHeader/TabHeaderItem.vue.d.ts +4 -4
- package/dist/src/lib/components/TabHeader/TabHeaderScroll.vue.d.ts +11 -11
- package/dist/src/lib/components/TabHeader/index.vue.d.ts +15 -14
- package/dist/src/lib/hooks/useContextMenu.d.ts +3 -2
- package/dist/src/lib/hooks/useStackTab.d.ts +4 -2
- package/dist/src/lib/hooks/useTabMitt.d.ts +3 -2
- package/dist/src/lib/hooks/useTabRouter.d.ts +2 -1
- package/dist/src/lib/hooks/useTabpanel.d.ts +7 -6
- package/dist/src/lib/i18n/index.d.ts +1 -1
- package/dist/src/lib/iframe.vue.d.ts +1 -1
- package/dist/src/lib/index.d.ts +8 -8
- package/dist/src/lib/utils/TabIdHelper.d.ts +2 -1
- package/dist/src/lib/utils/TabScrollHelper.d.ts +3 -3
- package/dist/style.css +1 -1
- package/dist/vue-stack-tabs.es.js +1340 -1493
- package/dist/vue-stack-tabs.umd.js +2 -3
- package/package.json +47 -50
- package/src/lib/StackTabs.vue +14 -3
- package/src/lib/assets/style/transition.scss +22 -0
- package/src/lib/hooks/useStackTab.ts +9 -5
- package/src/lib/hooks/useTabRouter.ts +4 -0
- package/src/lib/hooks/useTabpanel.tsx +2 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useRouter } from 'vue-router'
|
|
2
2
|
import useTabpanel from '../hooks/useTabpanel'
|
|
3
|
-
import { throttle } from '
|
|
3
|
+
import { throttle } from 'throttle-debounce'
|
|
4
4
|
import type { ITabData } from '../model/TabModel'
|
|
5
5
|
import { defu } from 'defu'
|
|
6
6
|
|
|
7
7
|
import { encodeTabInfo } from '../utils/TabIdHelper'
|
|
8
8
|
import { uriDecode } from '../utils/UriHelper'
|
|
9
|
-
import { ulid } from '
|
|
9
|
+
import { ulid } from 'ulid'
|
|
10
10
|
import { MittType, useEmitter } from './useTabMitt'
|
|
11
11
|
import { nextTick } from 'vue'
|
|
12
12
|
|
|
@@ -20,13 +20,17 @@ export default () => {
|
|
|
20
20
|
* @param tab
|
|
21
21
|
* @param to
|
|
22
22
|
*/
|
|
23
|
-
const openNewTab = throttle((tab: ITabData, renew = false) => {
|
|
23
|
+
const openNewTab = throttle(500, (tab: ITabData, renew = false) => {
|
|
24
24
|
return new Promise((resolve, reject) => {
|
|
25
25
|
if (!pageShown.value) {
|
|
26
26
|
reject()
|
|
27
27
|
return
|
|
28
28
|
}
|
|
29
|
-
const tabInfo = defu(tab, {
|
|
29
|
+
const tabInfo = defu(tab, {
|
|
30
|
+
refreshable: true,
|
|
31
|
+
closable: true,
|
|
32
|
+
iframe: false
|
|
33
|
+
})
|
|
30
34
|
if (tabInfo.id && renew && hasTab(tabInfo.id!)) {
|
|
31
35
|
renewTab(tab)
|
|
32
36
|
const currentTab = getTab(tab.id!)
|
|
@@ -80,7 +84,7 @@ export default () => {
|
|
|
80
84
|
resolve(tabInfo.id)
|
|
81
85
|
// }
|
|
82
86
|
})
|
|
83
|
-
}
|
|
87
|
+
})
|
|
84
88
|
const toPage = (tab: ITabData, tabInfo: any) => {
|
|
85
89
|
const __tab = encodeTabInfo(tabInfo)
|
|
86
90
|
let query = defu(
|
|
@@ -6,12 +6,14 @@ import { type RouteLocationPathRaw, useRoute, useRouter } from 'vue-router'
|
|
|
6
6
|
|
|
7
7
|
import useTabpanel from '@/lib/hooks/useTabpanel'
|
|
8
8
|
import { uriDecode } from '@/lib/utils/UriHelper'
|
|
9
|
+
import { useEmitter } from '@/lib/hooks/useTabMitt'
|
|
9
10
|
export default () => {
|
|
10
11
|
const { attrs, props } = getCurrentInstance() as ComponentInternalInstance
|
|
11
12
|
const { pageShown, getTab, markDeletableCache, removeComponent, getComponent, addPageScroller } =
|
|
12
13
|
useTabpanel()
|
|
13
14
|
const route = useRoute()
|
|
14
15
|
const router = useRouter()
|
|
16
|
+
const emitter = useEmitter()
|
|
15
17
|
let currentId = ''
|
|
16
18
|
// const currentPageId = ''
|
|
17
19
|
let currentTab = ''
|
|
@@ -31,6 +33,7 @@ export default () => {
|
|
|
31
33
|
},
|
|
32
34
|
to.query
|
|
33
35
|
)
|
|
36
|
+
emitter.emit('FORWARD')
|
|
34
37
|
router.push({
|
|
35
38
|
path: to.path,
|
|
36
39
|
query
|
|
@@ -85,6 +88,7 @@ export default () => {
|
|
|
85
88
|
const sourceComponent = component.components.DynamicComponent
|
|
86
89
|
sourceComponent.props = defu(query, sourceComponent.props)
|
|
87
90
|
}
|
|
91
|
+
emitter.emit('BACKWARD')
|
|
88
92
|
router.push({
|
|
89
93
|
path: pageRoute!.path,
|
|
90
94
|
query: pageRoute!.query
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import type { DefineComponent, VNode } from 'vue'
|
|
13
13
|
import { useRouter } from 'vue-router'
|
|
14
14
|
import type { RouteLocationNormalizedLoaded } from 'vue-router'
|
|
15
|
-
import { ulid } from '
|
|
15
|
+
import { ulid } from 'ulid'
|
|
16
16
|
import { encodeTabInfo, createPageId, decodeTabInfo } from '../utils/TabIdHelper'
|
|
17
17
|
import { defu } from 'defu'
|
|
18
18
|
import { Stack } from '../model/TabModel'
|
|
@@ -588,6 +588,7 @@ export default () => {
|
|
|
588
588
|
*/
|
|
589
589
|
const active = (id: string, route = true) => {
|
|
590
590
|
// return new Promise((resolve)=>{
|
|
591
|
+
emitter.emit('FORWARD')
|
|
591
592
|
for (let i = tabs.value.length - 1; i >= 0; i--) {
|
|
592
593
|
const tab = tabs.value[i] as ITabItem
|
|
593
594
|
if (tab.id === id) {
|