@veritree/ui 0.25.0-0 → 0.26.0-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/package.json
CHANGED
|
@@ -19,6 +19,10 @@ export default {
|
|
|
19
19
|
name: 'VTTabGroup',
|
|
20
20
|
|
|
21
21
|
props: {
|
|
22
|
+
activeIndex: {
|
|
23
|
+
type: Number,
|
|
24
|
+
default: null,
|
|
25
|
+
},
|
|
22
26
|
vertical: {
|
|
23
27
|
type: Boolean,
|
|
24
28
|
default: false,
|
|
@@ -28,20 +32,72 @@ export default {
|
|
|
28
32
|
provide() {
|
|
29
33
|
return {
|
|
30
34
|
apiTabs: () => {
|
|
35
|
+
/**
|
|
36
|
+
* Registers a tab.
|
|
37
|
+
* This function adds a tab to the list of tabs managed by the provider.
|
|
38
|
+
* If there is an active index set, it checks if the newly registered tab matches the active index,
|
|
39
|
+
* and if so, selects the tab.
|
|
40
|
+
* If no active index is set, it selects the tab if its index is 0.
|
|
41
|
+
* @param {VueComponent} tab - The tab to register.
|
|
42
|
+
* @returns {void}
|
|
43
|
+
*/
|
|
31
44
|
const registerTab = (tab) => {
|
|
32
45
|
_register(this.tabs, tab);
|
|
33
|
-
|
|
46
|
+
|
|
47
|
+
if (this.activeIndex) {
|
|
48
|
+
if (tab.index === this.activeIndex) {
|
|
49
|
+
tab.select();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (tab.index === 0) {
|
|
56
|
+
tab.select();
|
|
57
|
+
}
|
|
34
58
|
};
|
|
35
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Registers a tab panel.
|
|
62
|
+
* This function adds a tab panel to the list of tab panels managed by the provider.
|
|
63
|
+
* If there is an active index set, it checks if the newly registered tab panel matches the active index,
|
|
64
|
+
* and if so, shows the tab panel.
|
|
65
|
+
* If no active index is set, it shows the tab panel if its index is 0.
|
|
66
|
+
* @param {VueComponent} tabPanel - The tab panel to register.
|
|
67
|
+
* @returns {void}
|
|
68
|
+
*/
|
|
36
69
|
const registerTabPanel = (tabPanel) => {
|
|
37
70
|
_register(this.tabPanels, tabPanel);
|
|
38
|
-
|
|
71
|
+
|
|
72
|
+
if (this.activeIndex) {
|
|
73
|
+
if (tabPanel.index === this.activeIndex) {
|
|
74
|
+
tabPanel.show();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (tabPanel.index === 0) {
|
|
81
|
+
tabPanel.show();
|
|
82
|
+
}
|
|
39
83
|
};
|
|
40
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Unregisters a tab.
|
|
87
|
+
* This function removes a tab from the list of tabs managed by the provider.
|
|
88
|
+
* @param {string} id - The ID of the tab to unregister.
|
|
89
|
+
* @returns {void}
|
|
90
|
+
*/
|
|
41
91
|
const unregisterTab = (id) => {
|
|
42
92
|
_unregister(this.tabs, id);
|
|
43
93
|
};
|
|
44
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Unregisters a tab panel.
|
|
97
|
+
* This function removes a tab panel from the list of tab panels managed by the provider.
|
|
98
|
+
* @param {string} id - The ID of the tab panel to unregister.
|
|
99
|
+
* @returns {void}
|
|
100
|
+
*/
|
|
45
101
|
const unregisterTabPanel = (id) => {
|
|
46
102
|
_unregister(this.tabPanels, id);
|
|
47
103
|
};
|