@iankibetsh/shframework 5.6.6 → 5.6.8

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 CHANGED
@@ -4813,7 +4813,7 @@ const dates = vue.ref([
4813
4813
  },
4814
4814
  {
4815
4815
  label: 'All Time',
4816
- value: [luxon.DateTime.fromObject({ year: 2021 }).startOf('year'), luxon.DateTime.now().endOf('day')]
4816
+ value: [luxon.DateTime.fromObject({ year: 2018 }).startOf('year'), luxon.DateTime.now().endOf('day')]
4817
4817
  }
4818
4818
  ]);
4819
4819
  const setDate = (date, label) => {
@@ -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.map(tab => {
6299
+ return props.tabs.filter(tab => {
6300
+ let newTab = tab;
6295
6301
  if (typeof tab === 'string') {
6296
- return {key: tab, label: tab.replace(/_/g, ' ')}
6302
+ newTab = {key: tab, label: tab.replace(/_/g, ' ')};
6297
6303
  }
6298
6304
  if (typeof tab === 'function') {
6299
- return tab(props.data)
6305
+ newTab = tab(props.data);
6300
6306
  }
6301
- return tab
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
@@ -4802,7 +4802,7 @@ const dates = ref([
4802
4802
  },
4803
4803
  {
4804
4804
  label: 'All Time',
4805
- value: [DateTime.fromObject({ year: 2021 }).startOf('year'), DateTime.now().endOf('day')]
4805
+ value: [DateTime.fromObject({ year: 2018 }).startOf('year'), DateTime.now().endOf('day')]
4806
4806
  }
4807
4807
  ]);
4808
4808
  const setDate = (date, label) => {
@@ -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.map(tab => {
6288
+ return props.tabs.filter(tab => {
6289
+ let newTab = tab;
6284
6290
  if (typeof tab === 'string') {
6285
- return {key: tab, label: tab.replace(/_/g, ' ')}
6291
+ newTab = {key: tab, label: tab.replace(/_/g, ' ')};
6286
6292
  }
6287
6293
  if (typeof tab === 'function') {
6288
- return tab(props.data)
6294
+ newTab = tab(props.data);
6289
6295
  }
6290
- return tab
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/shframework",
3
- "version": "5.6.6",
3
+ "version": "5.6.8",
4
4
  "description": "Vue library for handling laravel backend",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.mjs",