vue-stack-tabs 0.1.15 → 0.1.17

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.
Files changed (38) hide show
  1. package/README.md +2 -2
  2. package/dist/favicon.svg +9 -9
  3. package/dist/src/lib/components/PageLoading.vue.d.ts +15 -0
  4. package/dist/src/lib/components/TabHeader/TabHeaderItem.vue.d.ts +1 -0
  5. package/dist/src/lib/hooks/useTabMitt.d.ts +16 -0
  6. package/dist/style.css +1 -1
  7. package/dist/vue-stack-tabs.es.js +2667 -2829
  8. package/dist/vue-stack-tabs.umd.js +9 -34
  9. package/package.json +2 -1
  10. package/src/lib/assets/style/overlayer.scss +46 -40
  11. package/src/lib/assets/style/transition.scss +40 -40
  12. package/src/lib/banner.ts +26 -51
  13. package/src/lib/components/PageLoading.vue +20 -0
  14. package/src/lib/components/TabHeader/TabHeaderItem.vue +20 -14
  15. package/src/lib/components/TabHeader/index.vue +8 -6
  16. package/src/lib/hooks/useStackTab.ts +10 -10
  17. package/src/lib/hooks/useTabLoading.ts +4 -20
  18. package/src/lib/hooks/useTabMitt.ts +30 -0
  19. package/src/lib/hooks/useTabRouter.ts +93 -93
  20. package/src/lib/hooks/useTabpanel.tsx +525 -516
  21. package/src/lib/index.ts +33 -32
  22. package/src/lib/model/TabModel.ts +178 -178
  23. package/dist/src/lib/components/OverlayLoading/Component.vue.d.ts +0 -100
  24. package/dist/src/lib/components/OverlayLoading/api.d.ts +0 -5
  25. package/dist/src/lib/components/OverlayLoading/helpers.d.ts +0 -7
  26. package/dist/src/lib/components/OverlayLoading/index.d.ts +0 -6
  27. package/dist/src/lib/components/OverlayLoading/loaders/bars.vue.d.ts +0 -39
  28. package/dist/src/lib/components/OverlayLoading/loaders/dots.vue.d.ts +0 -39
  29. package/dist/src/lib/components/OverlayLoading/loaders/index.d.ts +0 -96
  30. package/dist/src/lib/components/OverlayLoading/loaders/spinner.vue.d.ts +0 -39
  31. package/src/lib/components/OverlayLoading/Component.vue +0 -182
  32. package/src/lib/components/OverlayLoading/api.ts +0 -31
  33. package/src/lib/components/OverlayLoading/helpers.ts +0 -31
  34. package/src/lib/components/OverlayLoading/index.ts +0 -12
  35. package/src/lib/components/OverlayLoading/loaders/bars.vue +0 -79
  36. package/src/lib/components/OverlayLoading/loaders/dots.vue +0 -92
  37. package/src/lib/components/OverlayLoading/loaders/index.ts +0 -9
  38. package/src/lib/components/OverlayLoading/loaders/spinner.vue +0 -41
package/src/lib/index.ts CHANGED
@@ -1,32 +1,33 @@
1
- import type { App } from 'vue'
2
- import { createI18n } from 'vue-i18n'
3
- import StackTab from './StackTabs.vue'
4
- import tabVersion from './banner'
5
- import IFrame from './iframe.vue'
6
- import useTabLoading from './hooks/useTabLoading'
7
- import useTabRouter from './hooks/useTabRouter'
8
- import useStackTab from './hooks/useStackTab'
9
- import TabHeaderButton from '@/lib/components/TabHeader/TabHeaderButton.vue'
10
- import './assets/style/index.scss'
11
-
12
- const i18n = createI18n({
13
- legacy: false,
14
- locale: 'zh-CN',
15
- fallbackLocale: 'en-US'
16
- })
17
-
18
- export * from './model/TabModel'
19
- // Cutsom type
20
- declare module '@vue/runtime-core' {
21
- export interface GlobalComponents {
22
- VueStackTabs: typeof StackTab
23
- }
24
- }
25
-
26
- export { IFrame, useTabLoading, useTabRouter, useStackTab, TabHeaderButton, StackTab }
27
- export default {
28
- install(Vue: App): void {
29
- tabVersion(import.meta.env.PACKAGE_VERSION)
30
- Vue.component('VueStackTabs', StackTab).use(i18n)
31
- }
32
- }
1
+ import type { App } from 'vue'
2
+ import { createI18n } from 'vue-i18n'
3
+ import StackTab from './StackTabs.vue'
4
+ import tabVersion from './banner'
5
+ import IFrame from './iframe.vue'
6
+ import useTabLoading from './hooks/useTabLoading'
7
+ import useTabRouter from './hooks/useTabRouter'
8
+ import useStackTab from './hooks/useStackTab'
9
+ import TabHeaderButton from '@/lib/components/TabHeader/TabHeaderButton.vue'
10
+ import useTabMitt from '@/lib/hooks/useTabMitt'
11
+ import './assets/style/index.scss'
12
+
13
+ const i18n = createI18n({
14
+ legacy: false,
15
+ locale: 'zh-CN',
16
+ fallbackLocale: 'en-US'
17
+ })
18
+
19
+ export * from './model/TabModel'
20
+ // Cutsom type
21
+ declare module '@vue/runtime-core' {
22
+ export interface GlobalComponents {
23
+ VueStackTabs: typeof StackTab
24
+ }
25
+ }
26
+
27
+ export { IFrame, useTabLoading, useTabRouter, useStackTab, TabHeaderButton, StackTab }
28
+ export default {
29
+ install(Vue: App): void {
30
+ tabVersion(import.meta.env.PACKAGE_VERSION)
31
+ Vue.component('VueStackTabs', StackTab).use(useTabMitt).use(i18n)
32
+ }
33
+ }
@@ -1,178 +1,178 @@
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(items?:T[]) {
93
- this.items = new Map()
94
- if(items) {
95
- for (const item of items) {
96
- this.push(item)
97
- }
98
- }
99
- }
100
-
101
- /**
102
- * @description: 入栈
103
- * @param {T} element 要入栈的元素
104
- */
105
- push(element: T) {
106
- this.items.set(this.items.size, element)
107
- }
108
-
109
- /**
110
- * @description: 出栈
111
- * @return {T} 返回出栈的元素
112
- */
113
- pop(): T | undefined {
114
- if (this.isEmpty()) {
115
- return undefined
116
- }
117
- const result = this.items.get(this.items.size - 1)
118
- this.items.delete(this.items.size - 1)
119
- return result
120
- }
121
-
122
- /**
123
- * @description: 返回栈顶的元素
124
- * @return {T}
125
- */
126
- peek(): T | undefined {
127
- if (this.isEmpty()) {
128
- return undefined
129
- }
130
- return this.items.get(this.items.size - 1)
131
- }
132
-
133
- /**
134
- * @description: 返回栈是否为空
135
- * @return {Boolean}
136
- */
137
- isEmpty(): boolean {
138
- return this.items.size === 0
139
- }
140
-
141
- /**
142
- * @description: 返回栈里的元素个数
143
- * @return {Number}
144
- */
145
- size(): number {
146
- return this.items.size
147
- }
148
-
149
- /**
150
- * @description: 清空栈
151
- */
152
- clear() {
153
- this.items.clear()
154
- }
155
-
156
- list() {
157
- return Array.from(this.items.values())
158
- }
159
-
160
- /**
161
- * @description: 覆盖Object默认的toString
162
- * @return {String}
163
- */
164
- toString(): string {
165
- if (this.isEmpty()) {
166
- return ''
167
- }
168
- let result: string = ''
169
- this.items.forEach((value, key) => {
170
- result = `${result}${key === 0 ? '' : ', '}${value}`
171
- })
172
- return result
173
- }
174
- toJSON() {
175
- // return Object.fromEntries(this.items)
176
- return Array.from(this.items.values())
177
- }
178
- }
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(items?:T[]) {
93
+ this.items = new Map()
94
+ if(items) {
95
+ for (const item of items) {
96
+ this.push(item)
97
+ }
98
+ }
99
+ }
100
+
101
+ /**
102
+ * @description: 入栈
103
+ * @param {T} element 要入栈的元素
104
+ */
105
+ push(element: T) {
106
+ this.items.set(this.items.size, element)
107
+ }
108
+
109
+ /**
110
+ * @description: 出栈
111
+ * @return {T} 返回出栈的元素
112
+ */
113
+ pop(): T | undefined {
114
+ if (this.isEmpty()) {
115
+ return undefined
116
+ }
117
+ const result = this.items.get(this.items.size - 1)
118
+ this.items.delete(this.items.size - 1)
119
+ return result
120
+ }
121
+
122
+ /**
123
+ * @description: 返回栈顶的元素
124
+ * @return {T}
125
+ */
126
+ peek(): T | undefined {
127
+ if (this.isEmpty()) {
128
+ return undefined
129
+ }
130
+ return this.items.get(this.items.size - 1)
131
+ }
132
+
133
+ /**
134
+ * @description: 返回栈是否为空
135
+ * @return {Boolean}
136
+ */
137
+ isEmpty(): boolean {
138
+ return this.items.size === 0
139
+ }
140
+
141
+ /**
142
+ * @description: 返回栈里的元素个数
143
+ * @return {Number}
144
+ */
145
+ size(): number {
146
+ return this.items.size
147
+ }
148
+
149
+ /**
150
+ * @description: 清空栈
151
+ */
152
+ clear() {
153
+ this.items.clear()
154
+ }
155
+
156
+ list() {
157
+ return Array.from(this.items.values())
158
+ }
159
+
160
+ /**
161
+ * @description: 覆盖Object默认的toString
162
+ * @return {String}
163
+ */
164
+ toString(): string {
165
+ if (this.isEmpty()) {
166
+ return ''
167
+ }
168
+ let result: string = ''
169
+ this.items.forEach((value, key) => {
170
+ result = `${result}${key === 0 ? '' : ', '}${value}`
171
+ })
172
+ return result
173
+ }
174
+ toJSON() {
175
+ // return Object.fromEntries(this.items)
176
+ return Array.from(this.items.values())
177
+ }
178
+ }
@@ -1,100 +0,0 @@
1
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
- active: boolean;
3
- programmatic: boolean;
4
- container: Object | Function | HTMLElement;
5
- isFullPage: boolean;
6
- enforceFocus?: boolean | undefined;
7
- lockScroll: boolean;
8
- transition: string;
9
- /**
10
- * Allow user to hide the loader
11
- */
12
- canCancel: boolean;
13
- /**
14
- * Do something on cancel
15
- */
16
- onCancel: Function;
17
- color: string;
18
- backgroundColor: string;
19
- opacity: number;
20
- width: number;
21
- height: number;
22
- zIndex: number;
23
- loader: string;
24
- }>, {
25
- isFullPage: boolean;
26
- enforceFocus: boolean;
27
- transition: string;
28
- onCancel: () => void;
29
- loader: string;
30
- }>, {
31
- hide: () => void;
32
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
33
- hide: (...args: any[]) => void;
34
- "update:active": (...args: any[]) => void;
35
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
36
- active: boolean;
37
- programmatic: boolean;
38
- container: Object | Function | HTMLElement;
39
- isFullPage: boolean;
40
- enforceFocus?: boolean | undefined;
41
- lockScroll: boolean;
42
- transition: string;
43
- /**
44
- * Allow user to hide the loader
45
- */
46
- canCancel: boolean;
47
- /**
48
- * Do something on cancel
49
- */
50
- onCancel: Function;
51
- color: string;
52
- backgroundColor: string;
53
- opacity: number;
54
- width: number;
55
- height: number;
56
- zIndex: number;
57
- loader: string;
58
- }>, {
59
- isFullPage: boolean;
60
- enforceFocus: boolean;
61
- transition: string;
62
- onCancel: () => void;
63
- loader: string;
64
- }>>> & {
65
- onHide?: ((...args: any[]) => any) | undefined;
66
- "onUpdate:active"?: ((...args: any[]) => any) | undefined;
67
- }, {
68
- transition: string;
69
- onCancel: Function;
70
- isFullPage: boolean;
71
- enforceFocus: boolean;
72
- loader: string;
73
- }, {}>, {
74
- before?(_: {}): any;
75
- default?(_: {}): any;
76
- after?(_: {}): any;
77
- }>;
78
- export default _default;
79
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
80
- type __VLS_TypePropsToRuntimeProps<T> = {
81
- [K in keyof T]-?: {} extends Pick<T, K> ? {
82
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
83
- } : {
84
- type: import('vue').PropType<T[K]>;
85
- required: true;
86
- };
87
- };
88
- type __VLS_WithDefaults<P, D> = {
89
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
90
- default: D[K];
91
- }> : P[K];
92
- };
93
- type __VLS_Prettify<T> = {
94
- [K in keyof T]: T[K];
95
- } & {};
96
- type __VLS_WithTemplateSlots<T, S> = T & {
97
- new (): {
98
- $slots: S;
99
- };
100
- };
@@ -1,5 +0,0 @@
1
- export declare const useLoading: (globalProps?: {}, globalSlots?: {}) => {
2
- show(props?: {}, slots?: {}): {
3
- hide: any;
4
- };
5
- };
@@ -1,7 +0,0 @@
1
- export declare const removeElement: (el: HTMLElement) => void;
2
- export declare function createComponent(component: any, props: any, parentContainer: HTMLElement, slots?: {}): import("vue").ComponentInternalInstance | null;
3
- export declare const hasWindow: () => boolean;
4
- export declare const MayBeHTMLElement: ObjectConstructor | {
5
- new (): HTMLElement;
6
- prototype: HTMLElement;
7
- };
@@ -1,6 +0,0 @@
1
- import { useLoading } from './api';
2
- import Component from './Component.vue';
3
- import type { App } from 'vue';
4
- declare const LoadingPlugin: (app: App, props?: {}, slots?: {}) => void;
5
- export default Component;
6
- export { useLoading, LoadingPlugin, Component };
@@ -1,39 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
- color?: string | undefined;
3
- height?: number | undefined;
4
- width?: number | undefined;
5
- }>, {
6
- color: string;
7
- height: number;
8
- width: number;
9
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
10
- color?: string | undefined;
11
- height?: number | undefined;
12
- width?: number | undefined;
13
- }>, {
14
- color: string;
15
- height: number;
16
- width: number;
17
- }>>>, {
18
- width: number;
19
- height: number;
20
- color: string;
21
- }, {}>;
22
- export default _default;
23
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
24
- type __VLS_TypePropsToRuntimeProps<T> = {
25
- [K in keyof T]-?: {} extends Pick<T, K> ? {
26
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
27
- } : {
28
- type: import('vue').PropType<T[K]>;
29
- required: true;
30
- };
31
- };
32
- type __VLS_WithDefaults<P, D> = {
33
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
34
- default: D[K];
35
- }> : P[K];
36
- };
37
- type __VLS_Prettify<T> = {
38
- [K in keyof T]: T[K];
39
- } & {};
@@ -1,39 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
- color?: string | undefined;
3
- height?: number | undefined;
4
- width?: number | undefined;
5
- }>, {
6
- color: string;
7
- height: number;
8
- width: number;
9
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
10
- color?: string | undefined;
11
- height?: number | undefined;
12
- width?: number | undefined;
13
- }>, {
14
- color: string;
15
- height: number;
16
- width: number;
17
- }>>>, {
18
- width: number;
19
- height: number;
20
- color: string;
21
- }, {}>;
22
- export default _default;
23
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
24
- type __VLS_TypePropsToRuntimeProps<T> = {
25
- [K in keyof T]-?: {} extends Pick<T, K> ? {
26
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
27
- } : {
28
- type: import('vue').PropType<T[K]>;
29
- required: true;
30
- };
31
- };
32
- type __VLS_WithDefaults<P, D> = {
33
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
34
- default: D[K];
35
- }> : P[K];
36
- };
37
- type __VLS_Prettify<T> = {
38
- [K in keyof T]: T[K];
39
- } & {};