@iankibetsh/shframework 5.6.6 → 5.6.7
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/library.js +26 -4
- package/dist/library.mjs +26 -4
- package/package.json +1 -1
package/dist/library.js
CHANGED
|
@@ -6280,25 +6280,47 @@ var script$b = {
|
|
|
6280
6280
|
addTabQuery: {
|
|
6281
6281
|
type: Boolean,
|
|
6282
6282
|
default: false
|
|
6283
|
+
},
|
|
6284
|
+
tabCounts: {
|
|
6285
|
+
type: Object,
|
|
6286
|
+
default: () => ({})
|
|
6283
6287
|
}
|
|
6284
6288
|
},
|
|
6285
6289
|
setup(__props) {
|
|
6286
6290
|
|
|
6287
6291
|
const props = __props;
|
|
6292
|
+
const {user} = pinia.storeToRefs(useUserStore());
|
|
6288
6293
|
const route = vueRouter.useRoute();
|
|
6289
6294
|
const router = vueRouter.useRouter();
|
|
6290
6295
|
const formattedTabs = vue.computed(() => {
|
|
6291
6296
|
if (!props.tabs || props.tabs.length === 0) {
|
|
6292
6297
|
return []
|
|
6293
6298
|
}
|
|
6294
|
-
return props.tabs.
|
|
6299
|
+
return props.tabs.filter(tab => {
|
|
6300
|
+
let newTab = tab;
|
|
6295
6301
|
if (typeof tab === 'string') {
|
|
6296
|
-
|
|
6302
|
+
newTab = {key: tab, label: tab.replace(/_/g, ' ')};
|
|
6297
6303
|
}
|
|
6298
6304
|
if (typeof tab === 'function') {
|
|
6299
|
-
|
|
6305
|
+
newTab = tab(props.data);
|
|
6300
6306
|
}
|
|
6301
|
-
|
|
6307
|
+
if(newTab.validator){
|
|
6308
|
+
if(!newTab.validator()){
|
|
6309
|
+
return false
|
|
6310
|
+
}
|
|
6311
|
+
}
|
|
6312
|
+
if(newTab.permission){
|
|
6313
|
+
if(!user.value || !user.value.isAllowedTo(newTab.permission)){
|
|
6314
|
+
return false
|
|
6315
|
+
}
|
|
6316
|
+
}
|
|
6317
|
+
console.log(newTab);
|
|
6318
|
+
// check if there are tabCounts for this tab
|
|
6319
|
+
// const tabKey = getTabKey(newTab)
|
|
6320
|
+
// if (!newTab.count && props.tabCounts && props.tabCounts[tabKey] !== undefined) {
|
|
6321
|
+
// newTab.count = props.tabCounts[tabKey]
|
|
6322
|
+
// }
|
|
6323
|
+
return newTab
|
|
6302
6324
|
})
|
|
6303
6325
|
});
|
|
6304
6326
|
const tabsBaseUrl = props.baseUrl ?? route.path;
|
package/dist/library.mjs
CHANGED
|
@@ -6269,25 +6269,47 @@ var script$b = {
|
|
|
6269
6269
|
addTabQuery: {
|
|
6270
6270
|
type: Boolean,
|
|
6271
6271
|
default: false
|
|
6272
|
+
},
|
|
6273
|
+
tabCounts: {
|
|
6274
|
+
type: Object,
|
|
6275
|
+
default: () => ({})
|
|
6272
6276
|
}
|
|
6273
6277
|
},
|
|
6274
6278
|
setup(__props) {
|
|
6275
6279
|
|
|
6276
6280
|
const props = __props;
|
|
6281
|
+
const {user} = storeToRefs(useUserStore());
|
|
6277
6282
|
const route = useRoute();
|
|
6278
6283
|
const router = useRouter();
|
|
6279
6284
|
const formattedTabs = computed(() => {
|
|
6280
6285
|
if (!props.tabs || props.tabs.length === 0) {
|
|
6281
6286
|
return []
|
|
6282
6287
|
}
|
|
6283
|
-
return props.tabs.
|
|
6288
|
+
return props.tabs.filter(tab => {
|
|
6289
|
+
let newTab = tab;
|
|
6284
6290
|
if (typeof tab === 'string') {
|
|
6285
|
-
|
|
6291
|
+
newTab = {key: tab, label: tab.replace(/_/g, ' ')};
|
|
6286
6292
|
}
|
|
6287
6293
|
if (typeof tab === 'function') {
|
|
6288
|
-
|
|
6294
|
+
newTab = tab(props.data);
|
|
6289
6295
|
}
|
|
6290
|
-
|
|
6296
|
+
if(newTab.validator){
|
|
6297
|
+
if(!newTab.validator()){
|
|
6298
|
+
return false
|
|
6299
|
+
}
|
|
6300
|
+
}
|
|
6301
|
+
if(newTab.permission){
|
|
6302
|
+
if(!user.value || !user.value.isAllowedTo(newTab.permission)){
|
|
6303
|
+
return false
|
|
6304
|
+
}
|
|
6305
|
+
}
|
|
6306
|
+
console.log(newTab);
|
|
6307
|
+
// check if there are tabCounts for this tab
|
|
6308
|
+
// const tabKey = getTabKey(newTab)
|
|
6309
|
+
// if (!newTab.count && props.tabCounts && props.tabCounts[tabKey] !== undefined) {
|
|
6310
|
+
// newTab.count = props.tabCounts[tabKey]
|
|
6311
|
+
// }
|
|
6312
|
+
return newTab
|
|
6291
6313
|
})
|
|
6292
6314
|
});
|
|
6293
6315
|
const tabsBaseUrl = props.baseUrl ?? route.path;
|