vue-stack-tabs 0.1.0
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/LICENSE +201 -0
- package/README.md +3 -0
- package/dist/favicon.svg +10 -0
- package/dist/style.css +1 -0
- package/dist/vue-stack-tabs.es.js +6386 -0
- package/dist/vue-stack-tabs.umd.js +46 -0
- package/package.json +92 -0
- package/src/lib/StackTabs.vue +136 -0
- package/src/lib/assets/image/close.svg +6 -0
- package/src/lib/assets/image/close_all.svg +9 -0
- package/src/lib/assets/image/close_fill.svg +1 -0
- package/src/lib/assets/image/close_lefts.svg +1 -0
- package/src/lib/assets/image/close_other.svg +1 -0
- package/src/lib/assets/image/close_rights.svg +1 -0
- package/src/lib/assets/image/disable.svg +11 -0
- package/src/lib/assets/image/fullscreen.svg +1 -0
- package/src/lib/assets/image/left_arrow.svg +1 -0
- package/src/lib/assets/image/loading.svg +15 -0
- package/src/lib/assets/image/mask.svg +7 -0
- package/src/lib/assets/image/move.svg +6 -0
- package/src/lib/assets/image/reload.svg +3 -0
- package/src/lib/assets/image/reload_all.svg +6 -0
- package/src/lib/assets/image/reload_lefts.svg +15 -0
- package/src/lib/assets/image/reload_rights.svg +15 -0
- package/src/lib/assets/image/restore.svg +1 -0
- package/src/lib/assets/image/right_arrow.svg +1 -0
- package/src/lib/assets/image/scroll_pointer.svg +13 -0
- package/src/lib/assets/style/common/mixins.scss +45 -0
- package/src/lib/assets/style/common/var.scss +65 -0
- package/src/lib/assets/style/icon.scss +93 -0
- package/src/lib/assets/style/index.scss +3 -0
- package/src/lib/assets/style/stackTab.scss +395 -0
- package/src/lib/assets/style/transition.scss +40 -0
- package/src/lib/banner.ts +51 -0
- package/src/lib/components/ContextMenu/ContextMenuItem.vue +15 -0
- package/src/lib/components/ContextMenu/index.vue +128 -0
- package/src/lib/components/TabHeader/TabHeaderButton.vue +35 -0
- package/src/lib/components/TabHeader/TabHeaderItem.vue +63 -0
- package/src/lib/components/TabHeader/TabHeaderScroll.vue +240 -0
- package/src/lib/components/TabHeader/index.vue +134 -0
- package/src/lib/hooks/useContextMenu.ts +50 -0
- package/src/lib/hooks/useStackTab.ts +65 -0
- package/src/lib/hooks/useTabLoading.ts +48 -0
- package/src/lib/hooks/useTabRouter.ts +95 -0
- package/src/lib/hooks/useTabpanel.tsx +489 -0
- package/src/lib/i18n/index.ts +72 -0
- package/src/lib/i18n/lang/en.ts +15 -0
- package/src/lib/i18n/lang/zh-CN.ts +15 -0
- package/src/lib/iframe.vue +7 -0
- package/src/lib/index.ts +25 -0
- package/src/lib/model/TabModel.ts +182 -0
- package/src/lib/utils/TabIdHelper.ts +76 -0
- package/src/lib/utils/TabScrollHelper.ts +104 -0
- package/src/lib/utils/UriHelper.ts +22 -0
- package/types/banner.d.ts +2 -0
- package/types/hooks/useStackTab.d.ts +8 -0
- package/types/hooks/useTabLoading.d.ts +5 -0
- package/types/hooks/useTabRouter.d.ts +5 -0
- package/types/iframe.vue.d.ts +2 -0
- package/types/index.d.ts +10 -0
- package/types/model/TabModel.d.ts +114 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// Tab的滚动方式
|
|
2
|
+
export enum TabScrollMode {
|
|
3
|
+
// 使用滚轮
|
|
4
|
+
WHEEL = 'wheel',
|
|
5
|
+
// 使用按钮
|
|
6
|
+
BUTTON = 'button',
|
|
7
|
+
// 两者都可以
|
|
8
|
+
BOTH = 'both'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export enum EventType {
|
|
12
|
+
I18N_LOCALES = 'I18N_LOCALES',
|
|
13
|
+
PANEL_MAXIMUM = 'PANEL_MAXIMUM',
|
|
14
|
+
TAB_ACTIVE = 'TAB_ACTIVE',
|
|
15
|
+
TAB_CLOSE = 'TAB_CLOSE',
|
|
16
|
+
TAB_CLOSE_ALL = 'TAB_CLOSE_ALL',
|
|
17
|
+
TAB_CLOSE_RIGHT = 'TAB_CLOSE_RIGHT',
|
|
18
|
+
TAB_CLOSE_LEFT = 'TAB_CLOSE_LEFT',
|
|
19
|
+
TAB_REFRESH = 'TAB_REFRESH',
|
|
20
|
+
TAB_REFRESH_ALL = 'TAB_REFRESH_ALL'
|
|
21
|
+
}
|
|
22
|
+
// 拖拽数据接口
|
|
23
|
+
export interface DragData {
|
|
24
|
+
thumbLeft: number
|
|
25
|
+
startScrollLeft: number
|
|
26
|
+
startThumbLeft: number
|
|
27
|
+
startPageX: number
|
|
28
|
+
}
|
|
29
|
+
// 滑块数据接口
|
|
30
|
+
export interface ScrollData {
|
|
31
|
+
clientWidth: number
|
|
32
|
+
scrollWidth: number
|
|
33
|
+
scrollLeft: number
|
|
34
|
+
}
|
|
35
|
+
// 滚动条事件类型
|
|
36
|
+
export type ScrollEvents = {
|
|
37
|
+
ScrollUpdate: void
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Tab data for open
|
|
42
|
+
*/
|
|
43
|
+
export interface ITabData extends ITabBase {
|
|
44
|
+
// tab name
|
|
45
|
+
title: string
|
|
46
|
+
path: string
|
|
47
|
+
query?: Record<string, string>
|
|
48
|
+
}
|
|
49
|
+
export interface ITabBase {
|
|
50
|
+
id?: string
|
|
51
|
+
title: string
|
|
52
|
+
closable?: boolean
|
|
53
|
+
refreshable?: boolean
|
|
54
|
+
iframe?: boolean
|
|
55
|
+
}
|
|
56
|
+
export interface ITabItem extends ITabBase {
|
|
57
|
+
id: string
|
|
58
|
+
closable: boolean
|
|
59
|
+
refreshable: boolean
|
|
60
|
+
iframe: boolean
|
|
61
|
+
url?: string
|
|
62
|
+
active: boolean
|
|
63
|
+
pages: Stack<ITabPage>
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface ITabPage {
|
|
67
|
+
id: string
|
|
68
|
+
tabId: string
|
|
69
|
+
path: string
|
|
70
|
+
query?: Record<string, string>
|
|
71
|
+
}
|
|
72
|
+
export interface IContextMenu {
|
|
73
|
+
icon?: string
|
|
74
|
+
title: string
|
|
75
|
+
callback(id: string): void
|
|
76
|
+
disabled: (tabData: ITabBase) => boolean
|
|
77
|
+
}
|
|
78
|
+
export interface TabRouteLocationRaw {
|
|
79
|
+
path: string
|
|
80
|
+
query?: any
|
|
81
|
+
}
|
|
82
|
+
export interface PageRouteLocationRaw {
|
|
83
|
+
pId: string
|
|
84
|
+
path: string
|
|
85
|
+
query: any
|
|
86
|
+
}
|
|
87
|
+
export class Stack<T> {
|
|
88
|
+
// 存储的Map
|
|
89
|
+
private items: Map<number, T>
|
|
90
|
+
|
|
91
|
+
//
|
|
92
|
+
constructor() {
|
|
93
|
+
this.items = new Map()
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @description: 入栈
|
|
98
|
+
* @param {T} element 要入栈的元素
|
|
99
|
+
*/
|
|
100
|
+
push(element: T) {
|
|
101
|
+
this.items.set(this.items.size, element)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @description: 出栈
|
|
106
|
+
* @return {T} 返回出栈的元素
|
|
107
|
+
*/
|
|
108
|
+
pop(): T | undefined {
|
|
109
|
+
if (this.isEmpty()) {
|
|
110
|
+
return undefined
|
|
111
|
+
}
|
|
112
|
+
const result = this.items.get(this.items.size - 1)
|
|
113
|
+
this.items.delete(this.items.size - 1)
|
|
114
|
+
return result
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @description: 返回栈顶的元素
|
|
119
|
+
* @return {T}
|
|
120
|
+
*/
|
|
121
|
+
peek(): T | undefined {
|
|
122
|
+
if (this.isEmpty()) {
|
|
123
|
+
return undefined
|
|
124
|
+
}
|
|
125
|
+
return this.items.get(this.items.size - 1)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @description: 返回栈是否为空
|
|
130
|
+
* @return {Boolean}
|
|
131
|
+
*/
|
|
132
|
+
isEmpty(): boolean {
|
|
133
|
+
return this.items.size === 0
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @description: 返回栈里的元素个数
|
|
138
|
+
* @return {Number}
|
|
139
|
+
*/
|
|
140
|
+
size(): number {
|
|
141
|
+
return this.items.size
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @description: 清空栈
|
|
146
|
+
*/
|
|
147
|
+
clear() {
|
|
148
|
+
this.items.clear()
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
list() {
|
|
152
|
+
return Array.from(this.items.values())
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @description: 覆盖Object默认的toString
|
|
157
|
+
* @return {String}
|
|
158
|
+
*/
|
|
159
|
+
toString(): string {
|
|
160
|
+
if (this.isEmpty()) {
|
|
161
|
+
return ''
|
|
162
|
+
}
|
|
163
|
+
let result: string = ''
|
|
164
|
+
this.items.forEach((value, key) => {
|
|
165
|
+
result = `${result}${key === 0 ? '' : ', '}${value}`
|
|
166
|
+
})
|
|
167
|
+
return result
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// export { TabScrollMode, Stack, EventType }
|
|
171
|
+
// export type {
|
|
172
|
+
// ScrollData,
|
|
173
|
+
// ScrollEvents,
|
|
174
|
+
// DragData,
|
|
175
|
+
// ITabData,
|
|
176
|
+
// ITabItem,
|
|
177
|
+
// ITabPage,
|
|
178
|
+
// ITabBase,
|
|
179
|
+
// IContextMenu,
|
|
180
|
+
// TabRouteLocationRaw,
|
|
181
|
+
// PageRouteLocationRaw
|
|
182
|
+
// }
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// import { compressToEncodedURIComponent, decompressFromEncodedURIComponent } from 'lz-string'
|
|
2
|
+
// import { blake3 } from 'hash-wasm'
|
|
3
|
+
// import { compress, decompress } from 'brotli-compress'
|
|
4
|
+
// import { fromUint8Array } from 'js-base64'
|
|
5
|
+
// import { compress, decompress } from 'lzw-compressor'
|
|
6
|
+
import type { ITabBase } from '@/lib/model/TabModel'
|
|
7
|
+
import { compressToEncodedURIComponent, decompressFromEncodedURIComponent } from 'lz-string'
|
|
8
|
+
// import { v5 as uuidv5 } from 'uuid'
|
|
9
|
+
import Hex from 'hex-encoding'
|
|
10
|
+
import { blake3 } from '@noble/hashes/blake3'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* compress tab info to string
|
|
14
|
+
* format:
|
|
15
|
+
* {tab id}{current timestamp}{tab name}{tab closable}
|
|
16
|
+
* @param tabData
|
|
17
|
+
*/
|
|
18
|
+
export const encodeTabInfo = (tabData: ITabBase): string => {
|
|
19
|
+
// const info: ITabBase = {
|
|
20
|
+
// id: tabData.id,
|
|
21
|
+
// title: tabData.title,
|
|
22
|
+
// iframe: tabData.iframe,
|
|
23
|
+
// closable: tabData.closable,
|
|
24
|
+
// refreshable: tabData.refreshable
|
|
25
|
+
// }
|
|
26
|
+
const info = `${tabData.id}|${tabData.title}|${tabData.iframe ? 'Y' : 'N'}|${tabData.closable ? 'Y' : 'N'}|${tabData.refreshable ? 'Y' : 'N'}`
|
|
27
|
+
return compressToEncodedURIComponent(info)
|
|
28
|
+
// const compressed = await compress(new TextEncoder().encode(info))
|
|
29
|
+
// return fromUint8Array(compressed, true)
|
|
30
|
+
// return compressToEncodedURIComponent(
|
|
31
|
+
// `${tabData.id}|${tabData.title}|${tabData.iframe ? 'Y' : 'N'}|${tabData.closable ? 'Y' : 'N'}|${tabData.refreshable ? 'Y' : 'N'}`
|
|
32
|
+
// )
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const decodeTabInfo = (tab: string): ITabBase => {
|
|
36
|
+
// const decompressed = await decompress(toUint8Array(tab))
|
|
37
|
+
const tabString = decompressFromEncodedURIComponent(tab)
|
|
38
|
+
// const tabString = new TextDecoder().decode(decompressed)
|
|
39
|
+
// return JSON.parse(new TextDecoder().decode(decompressed))
|
|
40
|
+
// const tabString = decompressFromEncodedURIComponent(tab)
|
|
41
|
+
const tabValues: string[] = tabString.split('|')
|
|
42
|
+
return {
|
|
43
|
+
id: tabValues[0],
|
|
44
|
+
title: tabValues[1],
|
|
45
|
+
iframe: tabValues[2] === 'Y',
|
|
46
|
+
closable: tabValues[3] === 'Y',
|
|
47
|
+
refreshable: tabValues[4] === 'Y'
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const createPageId = (tabId: string, path: string, query: Object): string => {
|
|
52
|
+
const queryArray = []
|
|
53
|
+
console.log(query)
|
|
54
|
+
type ObjectKey = keyof typeof query
|
|
55
|
+
for (const key in query) {
|
|
56
|
+
if (!key.startsWith('__')) {
|
|
57
|
+
queryArray.push({
|
|
58
|
+
key,
|
|
59
|
+
value: query[key as ObjectKey]
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
queryArray.sort((a, b) => {
|
|
64
|
+
let result = 0
|
|
65
|
+
if (a.key > b.key) {
|
|
66
|
+
result = 1
|
|
67
|
+
} else if (a.key < b.key) {
|
|
68
|
+
result = -1
|
|
69
|
+
}
|
|
70
|
+
return result
|
|
71
|
+
})
|
|
72
|
+
const hash = blake3(`${tabId}|${path}|${JSON.stringify(queryArray)}`)
|
|
73
|
+
return Hex.encode(hash)
|
|
74
|
+
// return uuidv5(`${tabId}|${path}|${JSON.stringify(queryArray)}`, uuidv5.URL).replaceAll('-', '')
|
|
75
|
+
// return await blake3(`${tabId}|${path}|${JSON.stringify(queryArray)}`)
|
|
76
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 滚动到指定位置
|
|
3
|
+
* @export
|
|
4
|
+
* @param {Element} wrap 滚动区域
|
|
5
|
+
* @param {number} [left=0]
|
|
6
|
+
* @param {number} [top=0]
|
|
7
|
+
*/
|
|
8
|
+
export const _scrollTo = ({
|
|
9
|
+
wrap,
|
|
10
|
+
left = 0,
|
|
11
|
+
top = 0,
|
|
12
|
+
smooth = true
|
|
13
|
+
}: {
|
|
14
|
+
wrap: HTMLElement | null
|
|
15
|
+
left?: number
|
|
16
|
+
top?: number
|
|
17
|
+
smooth?: boolean
|
|
18
|
+
}) => {
|
|
19
|
+
if (!wrap) return
|
|
20
|
+
|
|
21
|
+
if (wrap.scrollTo) {
|
|
22
|
+
wrap.scrollTo({
|
|
23
|
+
left,
|
|
24
|
+
top,
|
|
25
|
+
behavior: smooth ? 'smooth' : 'auto'
|
|
26
|
+
})
|
|
27
|
+
} else {
|
|
28
|
+
wrap.scrollLeft = left
|
|
29
|
+
wrap.scrollTop = top
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 指定元素滚动到可视区域
|
|
35
|
+
* @export
|
|
36
|
+
* @param {Element} el 目标元素
|
|
37
|
+
* @param {Element} wrap 滚动区域
|
|
38
|
+
* @param {String} block 垂直方向的对齐,可选:'start', 'center', 'end', 或 'nearest'
|
|
39
|
+
* @param {String} inline 水平方向的对齐,可选值同上
|
|
40
|
+
*/
|
|
41
|
+
export function _scrollIntoView({
|
|
42
|
+
el,
|
|
43
|
+
wrap,
|
|
44
|
+
block = 'start',
|
|
45
|
+
inline = 'nearest'
|
|
46
|
+
}: {
|
|
47
|
+
el: HTMLElement
|
|
48
|
+
wrap: any
|
|
49
|
+
block?: any
|
|
50
|
+
inline?: any
|
|
51
|
+
}) {
|
|
52
|
+
if (!el || !wrap) return
|
|
53
|
+
|
|
54
|
+
if (el.scrollIntoView) {
|
|
55
|
+
el.scrollIntoView({ behavior: 'smooth', block, inline })
|
|
56
|
+
} else {
|
|
57
|
+
const { offsetLeft, offsetTop } = el
|
|
58
|
+
let left, top
|
|
59
|
+
|
|
60
|
+
if (block === 'center') {
|
|
61
|
+
top = offsetTop + (el.clientHeight - wrap.clientHeight) / 2
|
|
62
|
+
} else {
|
|
63
|
+
top = offsetTop
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (inline === 'center') {
|
|
67
|
+
left = offsetLeft + (el.clientWidth - wrap.clientWidth) / 2
|
|
68
|
+
} else {
|
|
69
|
+
left = offsetLeft
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
_scrollTo({ wrap, left, top })
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// 获取滚动条宽度
|
|
77
|
+
export const getScrollbarWidth = (function () {
|
|
78
|
+
let width: number | null = null
|
|
79
|
+
|
|
80
|
+
return function () {
|
|
81
|
+
if (width !== null) return width
|
|
82
|
+
|
|
83
|
+
const div = document.createElement('div')
|
|
84
|
+
|
|
85
|
+
div.style.cssText = 'width: 100px; height: 100px;overflow-y: scroll'
|
|
86
|
+
document.body.appendChild(div)
|
|
87
|
+
width = div.offsetWidth - div.clientWidth
|
|
88
|
+
div.parentElement?.removeChild(div)
|
|
89
|
+
|
|
90
|
+
return width
|
|
91
|
+
}
|
|
92
|
+
})()
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* 获取最大z-index
|
|
96
|
+
* @returns 最大z-index的值
|
|
97
|
+
*/
|
|
98
|
+
export const getMaxZIndex = (key = '.stack-tab__container *'): number => {
|
|
99
|
+
const allZIndex = Array.from(document.querySelectorAll(key)).map(
|
|
100
|
+
(e) => +window.getComputedStyle(e).zIndex || 0
|
|
101
|
+
)
|
|
102
|
+
// 特殊处理,不高于90000的才行
|
|
103
|
+
return allZIndex.length ? Math.max(...allZIndex.filter((item) => item < 90000)) + 1 : 1
|
|
104
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const uriDecode = (uri: string) => {
|
|
2
|
+
const uris = uri.split('?')
|
|
3
|
+
if (uris.length <= 1) {
|
|
4
|
+
return {
|
|
5
|
+
path: uris[0],
|
|
6
|
+
query: {}
|
|
7
|
+
}
|
|
8
|
+
} else {
|
|
9
|
+
const arr = uris[1].split('&')
|
|
10
|
+
const query: Record<string, string> = {}
|
|
11
|
+
for (const item of arr) {
|
|
12
|
+
const kv = item.split('=')
|
|
13
|
+
if (kv[1] !== null && kv[1] !== undefined && kv[1] !== '') {
|
|
14
|
+
query[kv[0]] = kv[1]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
path: uris[0],
|
|
19
|
+
query
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import IFrame from './iframe.vue';
|
|
2
|
+
import useTabLoading from './hooks/useTabLoading';
|
|
3
|
+
import useTabRouter from './hooks/useTabRouter';
|
|
4
|
+
import useStackTab from './hooks/useStackTab';
|
|
5
|
+
export { IFrame, useTabLoading, useTabRouter, useStackTab };
|
|
6
|
+
export * from './model/TabModel';
|
|
7
|
+
declare const _default: {
|
|
8
|
+
install(app: App): void;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export declare enum TabScrollMode {
|
|
2
|
+
WHEEL = "wheel",
|
|
3
|
+
BUTTON = "button",
|
|
4
|
+
BOTH = "both"
|
|
5
|
+
}
|
|
6
|
+
export declare enum EventType {
|
|
7
|
+
I18N_LOCALES = "I18N_LOCALES",
|
|
8
|
+
PANEL_MAXIMUM = "PANEL_MAXIMUM",
|
|
9
|
+
TAB_ACTIVE = "TAB_ACTIVE",
|
|
10
|
+
TAB_CLOSE = "TAB_CLOSE",
|
|
11
|
+
TAB_CLOSE_ALL = "TAB_CLOSE_ALL",
|
|
12
|
+
TAB_CLOSE_RIGHT = "TAB_CLOSE_RIGHT",
|
|
13
|
+
TAB_CLOSE_LEFT = "TAB_CLOSE_LEFT",
|
|
14
|
+
TAB_REFRESH = "TAB_REFRESH",
|
|
15
|
+
TAB_REFRESH_ALL = "TAB_REFRESH_ALL"
|
|
16
|
+
}
|
|
17
|
+
export interface DragData {
|
|
18
|
+
thumbLeft: number;
|
|
19
|
+
startScrollLeft: number;
|
|
20
|
+
startThumbLeft: number;
|
|
21
|
+
startPageX: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ScrollData {
|
|
24
|
+
clientWidth: number;
|
|
25
|
+
scrollWidth: number;
|
|
26
|
+
scrollLeft: number;
|
|
27
|
+
}
|
|
28
|
+
export type ScrollEvents = {
|
|
29
|
+
ScrollUpdate: void;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Tab data for open
|
|
33
|
+
*/
|
|
34
|
+
export interface ITabData extends ITabBase {
|
|
35
|
+
title: string;
|
|
36
|
+
path: string;
|
|
37
|
+
query?: Record<string, string>;
|
|
38
|
+
}
|
|
39
|
+
export interface ITabBase {
|
|
40
|
+
id?: string;
|
|
41
|
+
title: string;
|
|
42
|
+
closable?: boolean;
|
|
43
|
+
refreshable?: boolean;
|
|
44
|
+
iframe?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface ITabItem extends ITabBase {
|
|
47
|
+
id: string;
|
|
48
|
+
closable: boolean;
|
|
49
|
+
refreshable: boolean;
|
|
50
|
+
iframe: boolean;
|
|
51
|
+
url?: string;
|
|
52
|
+
active: boolean;
|
|
53
|
+
pages: Stack<ITabPage>;
|
|
54
|
+
}
|
|
55
|
+
export interface ITabPage {
|
|
56
|
+
id: string;
|
|
57
|
+
tabId: string;
|
|
58
|
+
path: string;
|
|
59
|
+
query?: Record<string, string>;
|
|
60
|
+
}
|
|
61
|
+
export interface IContextMenu {
|
|
62
|
+
icon?: string;
|
|
63
|
+
title: string;
|
|
64
|
+
callback(id: string): void;
|
|
65
|
+
disabled: (tabData: ITabBase) => boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface TabRouteLocationRaw {
|
|
68
|
+
path: string;
|
|
69
|
+
query?: any;
|
|
70
|
+
}
|
|
71
|
+
export interface PageRouteLocationRaw {
|
|
72
|
+
pId: string;
|
|
73
|
+
path: string;
|
|
74
|
+
query: any;
|
|
75
|
+
}
|
|
76
|
+
export declare class Stack<T> {
|
|
77
|
+
private items;
|
|
78
|
+
constructor();
|
|
79
|
+
/**
|
|
80
|
+
* @description: 入栈
|
|
81
|
+
* @param {T} element 要入栈的元素
|
|
82
|
+
*/
|
|
83
|
+
push(element: T): void;
|
|
84
|
+
/**
|
|
85
|
+
* @description: 出栈
|
|
86
|
+
* @return {T} 返回出栈的元素
|
|
87
|
+
*/
|
|
88
|
+
pop(): T | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* @description: 返回栈顶的元素
|
|
91
|
+
* @return {T}
|
|
92
|
+
*/
|
|
93
|
+
peek(): T | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* @description: 返回栈是否为空
|
|
96
|
+
* @return {Boolean}
|
|
97
|
+
*/
|
|
98
|
+
isEmpty(): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* @description: 返回栈里的元素个数
|
|
101
|
+
* @return {Number}
|
|
102
|
+
*/
|
|
103
|
+
size(): number;
|
|
104
|
+
/**
|
|
105
|
+
* @description: 清空栈
|
|
106
|
+
*/
|
|
107
|
+
clear(): void;
|
|
108
|
+
list(): T[];
|
|
109
|
+
/**
|
|
110
|
+
* @description: 覆盖Object默认的toString
|
|
111
|
+
* @return {String}
|
|
112
|
+
*/
|
|
113
|
+
toString(): string;
|
|
114
|
+
}
|