@iankibetsh/shframework 4.1.4 → 4.1.6
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/dist/library.mjs.css +32 -32
- package/dist/library.js +105 -103
- package/dist/library.mjs +105 -103
- package/package.json +1 -1
|
@@ -1,36 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
.colored-toast.swal2-icon-success {
|
|
3
|
-
background-color: #a5dc86 !important;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.colored-toast.swal2-icon-error {
|
|
7
|
-
background-color: #f27474 !important;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.colored-toast.swal2-icon-warning {
|
|
11
|
-
background-color: #f8bb86 !important;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.colored-toast.swal2-icon-info {
|
|
15
|
-
background-color: #3fc3ee !important;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.colored-toast.swal2-icon-question {
|
|
19
|
-
background-color: #87adbd !important;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.colored-toast .swal2-title {
|
|
23
|
-
color: white;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.colored-toast .swal2-close {
|
|
27
|
-
color: white;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.colored-toast .swal2-html-container {
|
|
31
|
-
color: white;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
2
|
.sh-phone{
|
|
35
3
|
display: flex;
|
|
36
4
|
width: 100%;
|
|
@@ -63,6 +31,38 @@
|
|
|
63
31
|
opacity: 0.5;
|
|
64
32
|
}
|
|
65
33
|
|
|
34
|
+
.colored-toast.swal2-icon-success {
|
|
35
|
+
background-color: #a5dc86 !important;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.colored-toast.swal2-icon-error {
|
|
39
|
+
background-color: #f27474 !important;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.colored-toast.swal2-icon-warning {
|
|
43
|
+
background-color: #f8bb86 !important;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.colored-toast.swal2-icon-info {
|
|
47
|
+
background-color: #3fc3ee !important;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.colored-toast.swal2-icon-question {
|
|
51
|
+
background-color: #87adbd !important;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.colored-toast .swal2-title {
|
|
55
|
+
color: white;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.colored-toast .swal2-close {
|
|
59
|
+
color: white;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.colored-toast .swal2-html-container {
|
|
63
|
+
color: white;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
66
|
.sh-selected-item{
|
|
67
67
|
line-height: unset!important;
|
|
68
68
|
}
|
package/dist/library.js
CHANGED
|
@@ -9,8 +9,8 @@ var bootstrap = require('bootstrap');
|
|
|
9
9
|
var NProgress = require('nprogress');
|
|
10
10
|
var vue = require('vue');
|
|
11
11
|
var _ = require('lodash');
|
|
12
|
-
var vueRouter = require('vue-router');
|
|
13
12
|
var pinia = require('pinia');
|
|
13
|
+
var vueRouter = require('vue-router');
|
|
14
14
|
|
|
15
15
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
16
|
|
|
@@ -3754,6 +3754,102 @@ script$g.render = render$1;
|
|
|
3754
3754
|
script$g.__scopeId = "data-v-55cf77fb";
|
|
3755
3755
|
script$g.__file = "src/lib/components/others/NoRecords.vue";
|
|
3756
3756
|
|
|
3757
|
+
const useUserStore = pinia.defineStore('user-store', {
|
|
3758
|
+
state: () => ({
|
|
3759
|
+
user: null,
|
|
3760
|
+
role: null,
|
|
3761
|
+
permissions: null,
|
|
3762
|
+
menus: [],
|
|
3763
|
+
loggedOut: false
|
|
3764
|
+
}),
|
|
3765
|
+
actions: {
|
|
3766
|
+
setUser (){
|
|
3767
|
+
let user = null;
|
|
3768
|
+
try {
|
|
3769
|
+
user = ShStorage.getItem('user') ? ShStorage.getItem('user') : null;
|
|
3770
|
+
} catch (error) {
|
|
3771
|
+
user= null;
|
|
3772
|
+
}
|
|
3773
|
+
if (user) {
|
|
3774
|
+
user.isAllowedTo = function (slug) {
|
|
3775
|
+
if (this.permissions) {
|
|
3776
|
+
let permissions = [];
|
|
3777
|
+
if (typeof this.permissions === 'string') {
|
|
3778
|
+
permissions = this.permissions;
|
|
3779
|
+
} else {
|
|
3780
|
+
permissions = this.permissions;
|
|
3781
|
+
}
|
|
3782
|
+
return permissions.includes(slug)
|
|
3783
|
+
}
|
|
3784
|
+
return false
|
|
3785
|
+
};
|
|
3786
|
+
}
|
|
3787
|
+
this.user = user;
|
|
3788
|
+
shApis.doGet('auth/user').then(res => {
|
|
3789
|
+
let user = res.data.user;
|
|
3790
|
+
if (typeof(user) === 'undefined') {
|
|
3791
|
+
user = res.data;
|
|
3792
|
+
}
|
|
3793
|
+
ShStorage.setItem('user',user);
|
|
3794
|
+
user.signOut = this.signOut;
|
|
3795
|
+
user.logout = this.signOut;
|
|
3796
|
+
user.logOut = this.signOut;
|
|
3797
|
+
user.isAllowedTo = function (slug) {
|
|
3798
|
+
if(!slug){
|
|
3799
|
+
return true
|
|
3800
|
+
}
|
|
3801
|
+
if (this.permissions) {
|
|
3802
|
+
let permissions = [];
|
|
3803
|
+
if (typeof this.permissions === 'string') {
|
|
3804
|
+
permissions = this.permissions;
|
|
3805
|
+
} else {
|
|
3806
|
+
permissions = this.permissions;
|
|
3807
|
+
}
|
|
3808
|
+
return permissions.includes(slug)
|
|
3809
|
+
}
|
|
3810
|
+
return false
|
|
3811
|
+
};
|
|
3812
|
+
this.user = user;
|
|
3813
|
+
}).catch((reason) => {
|
|
3814
|
+
if (reason.response && reason.response.status) {
|
|
3815
|
+
if(reason.response.status === 401) {
|
|
3816
|
+
ShStorage.setItem('user',null);
|
|
3817
|
+
this.user = null;
|
|
3818
|
+
}
|
|
3819
|
+
this.loggedOut = true;
|
|
3820
|
+
}
|
|
3821
|
+
});
|
|
3822
|
+
if (this.user) {
|
|
3823
|
+
if (typeof this.user.permissions === 'string') {
|
|
3824
|
+
this.permissions = this.user.permissions;
|
|
3825
|
+
} else {
|
|
3826
|
+
this.permissions = this.user.permissions;
|
|
3827
|
+
}
|
|
3828
|
+
}
|
|
3829
|
+
const timeNow = moment__default["default"]().toISOString();
|
|
3830
|
+
ShStorage.setItem('session_start',timeNow);
|
|
3831
|
+
},
|
|
3832
|
+
signOut () {
|
|
3833
|
+
shRepo.signOutUser();
|
|
3834
|
+
},
|
|
3835
|
+
logOut () {
|
|
3836
|
+
this.signOut();
|
|
3837
|
+
},
|
|
3838
|
+
getUser () {
|
|
3839
|
+
this.setUser();
|
|
3840
|
+
},
|
|
3841
|
+
setAccessToken (accessToken) {
|
|
3842
|
+
ShStorage.setItem('access_token', accessToken);
|
|
3843
|
+
this.setUser();
|
|
3844
|
+
}
|
|
3845
|
+
},
|
|
3846
|
+
getters: {
|
|
3847
|
+
userId (state) {
|
|
3848
|
+
return state.user === null ? null:state.user.id
|
|
3849
|
+
}
|
|
3850
|
+
}
|
|
3851
|
+
});
|
|
3852
|
+
|
|
3757
3853
|
var script$f = {
|
|
3758
3854
|
name: 'Pagination',
|
|
3759
3855
|
props: ['pagination_data', 'loadMore', 'hideCount', 'hideLoadMore', 'paginationStyle'],
|
|
@@ -4403,7 +4499,7 @@ const _hoisted_19 = [
|
|
|
4403
4499
|
];
|
|
4404
4500
|
const _hoisted_20 = {
|
|
4405
4501
|
key: 1,
|
|
4406
|
-
class: "alert alert-danger"
|
|
4502
|
+
class: "alert alert-danger error-loading"
|
|
4407
4503
|
};
|
|
4408
4504
|
const _hoisted_21 = /*#__PURE__*/vue.createElementVNode("i", { class: "bi-info-circle" }, null, -1 /* HOISTED */);
|
|
4409
4505
|
const _hoisted_22 = { class: "sh-thead" };
|
|
@@ -4815,6 +4911,8 @@ var script$b = /*#__PURE__*/Object.assign(__default__, {
|
|
|
4815
4911
|
|
|
4816
4912
|
const noRecordsComponent = vue.inject('noRecordsComponent', script$g);
|
|
4817
4913
|
|
|
4914
|
+
const {user} = pinia.storeToRefs(useUserStore());
|
|
4915
|
+
|
|
4818
4916
|
return (_ctx, _cache) => {
|
|
4819
4917
|
const _component_router_link = vue.resolveComponent("router-link");
|
|
4820
4918
|
|
|
@@ -4897,14 +4995,14 @@ return (_ctx, _cache) => {
|
|
|
4897
4995
|
], 64 /* STABLE_FRAGMENT */))
|
|
4898
4996
|
: (_ctx.hasRecordsSlot)
|
|
4899
4997
|
? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
|
|
4900
|
-
(_ctx.loading === 'loading')
|
|
4998
|
+
(_ctx.loading === 'loading' && !__props.cacheKey)
|
|
4901
4999
|
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_17$1, _hoisted_19))
|
|
4902
|
-
: (_ctx.loading === 'error')
|
|
5000
|
+
: (_ctx.loading === 'error' && !__props.cacheKey)
|
|
4903
5001
|
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_20, [
|
|
4904
5002
|
vue.createElementVNode("span", null, vue.toDisplayString(_ctx.loading_error), 1 /* TEXT */)
|
|
4905
5003
|
]))
|
|
4906
5004
|
: vue.createCommentVNode("v-if", true),
|
|
4907
|
-
(_ctx.loading === 'done')
|
|
5005
|
+
(_ctx.loading === 'done' || __props.cacheKey)
|
|
4908
5006
|
? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
|
|
4909
5007
|
(_ctx.records.length === 0)
|
|
4910
5008
|
? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(noRecordsComponent)), { key: 0 }, {
|
|
@@ -5021,7 +5119,7 @@ return (_ctx, _cache) => {
|
|
|
5021
5119
|
return (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
|
|
5022
5120
|
key: act.path
|
|
5023
5121
|
}, [
|
|
5024
|
-
(!act.permission ||
|
|
5122
|
+
(!act.permission || vue.unref(user).isAllowedTo(act.permission))
|
|
5025
5123
|
? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
5026
5124
|
(!act.validator || act.validator(record))
|
|
5027
5125
|
? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
@@ -5191,7 +5289,7 @@ return (_ctx, _cache) => {
|
|
|
5191
5289
|
return (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
|
|
5192
5290
|
key: act.path
|
|
5193
5291
|
}, [
|
|
5194
|
-
(!act.permission ||
|
|
5292
|
+
(!act.permission || vue.unref(user).isAllowedTo(act.permission))
|
|
5195
5293
|
? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
5196
5294
|
(!act.validator || act.validator(record))
|
|
5197
5295
|
? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
@@ -5576,102 +5674,6 @@ return (_ctx, _cache) => {
|
|
|
5576
5674
|
|
|
5577
5675
|
script$7.__file = "src/lib/components/ShCanvasBtn.vue";
|
|
5578
5676
|
|
|
5579
|
-
const useUserStore = pinia.defineStore('user-store', {
|
|
5580
|
-
state: () => ({
|
|
5581
|
-
user: null,
|
|
5582
|
-
role: null,
|
|
5583
|
-
permissions: null,
|
|
5584
|
-
menus: [],
|
|
5585
|
-
loggedOut: false
|
|
5586
|
-
}),
|
|
5587
|
-
actions: {
|
|
5588
|
-
setUser (){
|
|
5589
|
-
let user = null;
|
|
5590
|
-
try {
|
|
5591
|
-
user = ShStorage.getItem('user') ? ShStorage.getItem('user') : null;
|
|
5592
|
-
} catch (error) {
|
|
5593
|
-
user= null;
|
|
5594
|
-
}
|
|
5595
|
-
if (user) {
|
|
5596
|
-
user.isAllowedTo = function (slug) {
|
|
5597
|
-
if (this.permissions) {
|
|
5598
|
-
let permissions = [];
|
|
5599
|
-
if (typeof this.permissions === 'string') {
|
|
5600
|
-
permissions = this.permissions;
|
|
5601
|
-
} else {
|
|
5602
|
-
permissions = this.permissions;
|
|
5603
|
-
}
|
|
5604
|
-
return permissions.includes(slug)
|
|
5605
|
-
}
|
|
5606
|
-
return false
|
|
5607
|
-
};
|
|
5608
|
-
}
|
|
5609
|
-
this.user = user;
|
|
5610
|
-
shApis.doGet('auth/user').then(res => {
|
|
5611
|
-
let user = res.data.user;
|
|
5612
|
-
if (typeof(user) === 'undefined') {
|
|
5613
|
-
user = res.data;
|
|
5614
|
-
}
|
|
5615
|
-
ShStorage.setItem('user',user);
|
|
5616
|
-
user.signOut = this.signOut;
|
|
5617
|
-
user.logout = this.signOut;
|
|
5618
|
-
user.logOut = this.signOut;
|
|
5619
|
-
user.isAllowedTo = function (slug) {
|
|
5620
|
-
if(!slug){
|
|
5621
|
-
return true
|
|
5622
|
-
}
|
|
5623
|
-
if (this.permissions) {
|
|
5624
|
-
let permissions = [];
|
|
5625
|
-
if (typeof this.permissions === 'string') {
|
|
5626
|
-
permissions = this.permissions;
|
|
5627
|
-
} else {
|
|
5628
|
-
permissions = this.permissions;
|
|
5629
|
-
}
|
|
5630
|
-
return permissions.includes(slug)
|
|
5631
|
-
}
|
|
5632
|
-
return false
|
|
5633
|
-
};
|
|
5634
|
-
this.user = user;
|
|
5635
|
-
}).catch((reason) => {
|
|
5636
|
-
if (reason.response && reason.response.status) {
|
|
5637
|
-
if(reason.response.status === 401) {
|
|
5638
|
-
ShStorage.setItem('user',null);
|
|
5639
|
-
this.user = null;
|
|
5640
|
-
}
|
|
5641
|
-
this.loggedOut = true;
|
|
5642
|
-
}
|
|
5643
|
-
});
|
|
5644
|
-
if (this.user) {
|
|
5645
|
-
if (typeof this.user.permissions === 'string') {
|
|
5646
|
-
this.permissions = this.user.permissions;
|
|
5647
|
-
} else {
|
|
5648
|
-
this.permissions = this.user.permissions;
|
|
5649
|
-
}
|
|
5650
|
-
}
|
|
5651
|
-
const timeNow = moment__default["default"]().toISOString();
|
|
5652
|
-
ShStorage.setItem('session_start',timeNow);
|
|
5653
|
-
},
|
|
5654
|
-
signOut () {
|
|
5655
|
-
shRepo.signOutUser();
|
|
5656
|
-
},
|
|
5657
|
-
logOut () {
|
|
5658
|
-
this.signOut();
|
|
5659
|
-
},
|
|
5660
|
-
getUser () {
|
|
5661
|
-
this.setUser();
|
|
5662
|
-
},
|
|
5663
|
-
setAccessToken (accessToken) {
|
|
5664
|
-
ShStorage.setItem('access_token', accessToken);
|
|
5665
|
-
this.setUser();
|
|
5666
|
-
}
|
|
5667
|
-
},
|
|
5668
|
-
getters: {
|
|
5669
|
-
userId (state) {
|
|
5670
|
-
return state.user === null ? null:state.user.id
|
|
5671
|
-
}
|
|
5672
|
-
}
|
|
5673
|
-
});
|
|
5674
|
-
|
|
5675
5677
|
const _withScopeId$1 = n => (vue.pushScopeId("data-v-0d4fa0ac"),n=n(),vue.popScopeId(),n);
|
|
5676
5678
|
const _hoisted_1$4 = { class: "row permissions-main d-flex" };
|
|
5677
5679
|
const _hoisted_2$3 = {
|
package/dist/library.mjs
CHANGED
|
@@ -5,8 +5,8 @@ import { Modal, Offcanvas } from 'bootstrap';
|
|
|
5
5
|
import NProgress from 'nprogress';
|
|
6
6
|
import { openBlock, createElementBlock, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, withDirectives, Fragment, renderList, vModelSelect, vModelText, ref, onMounted, unref, normalizeClass, resolveComponent, createBlock, resolveDynamicComponent, watch, inject, mergeProps, normalizeStyle, renderSlot, createVNode, normalizeProps, guardReactiveProps, withCtx, createStaticVNode, vModelCheckbox, shallowRef, pushScopeId, popScopeId, markRaw, computed, isRef } from 'vue';
|
|
7
7
|
import _ from 'lodash';
|
|
8
|
-
import { useRoute, useRouter } from 'vue-router';
|
|
9
8
|
import { defineStore, storeToRefs } from 'pinia';
|
|
9
|
+
import { useRoute, useRouter } from 'vue-router';
|
|
10
10
|
|
|
11
11
|
function setItem (key, value) {
|
|
12
12
|
let toStore = value;
|
|
@@ -3742,6 +3742,102 @@ script$g.render = render$1;
|
|
|
3742
3742
|
script$g.__scopeId = "data-v-55cf77fb";
|
|
3743
3743
|
script$g.__file = "src/lib/components/others/NoRecords.vue";
|
|
3744
3744
|
|
|
3745
|
+
const useUserStore = defineStore('user-store', {
|
|
3746
|
+
state: () => ({
|
|
3747
|
+
user: null,
|
|
3748
|
+
role: null,
|
|
3749
|
+
permissions: null,
|
|
3750
|
+
menus: [],
|
|
3751
|
+
loggedOut: false
|
|
3752
|
+
}),
|
|
3753
|
+
actions: {
|
|
3754
|
+
setUser (){
|
|
3755
|
+
let user = null;
|
|
3756
|
+
try {
|
|
3757
|
+
user = ShStorage.getItem('user') ? ShStorage.getItem('user') : null;
|
|
3758
|
+
} catch (error) {
|
|
3759
|
+
user= null;
|
|
3760
|
+
}
|
|
3761
|
+
if (user) {
|
|
3762
|
+
user.isAllowedTo = function (slug) {
|
|
3763
|
+
if (this.permissions) {
|
|
3764
|
+
let permissions = [];
|
|
3765
|
+
if (typeof this.permissions === 'string') {
|
|
3766
|
+
permissions = this.permissions;
|
|
3767
|
+
} else {
|
|
3768
|
+
permissions = this.permissions;
|
|
3769
|
+
}
|
|
3770
|
+
return permissions.includes(slug)
|
|
3771
|
+
}
|
|
3772
|
+
return false
|
|
3773
|
+
};
|
|
3774
|
+
}
|
|
3775
|
+
this.user = user;
|
|
3776
|
+
shApis.doGet('auth/user').then(res => {
|
|
3777
|
+
let user = res.data.user;
|
|
3778
|
+
if (typeof(user) === 'undefined') {
|
|
3779
|
+
user = res.data;
|
|
3780
|
+
}
|
|
3781
|
+
ShStorage.setItem('user',user);
|
|
3782
|
+
user.signOut = this.signOut;
|
|
3783
|
+
user.logout = this.signOut;
|
|
3784
|
+
user.logOut = this.signOut;
|
|
3785
|
+
user.isAllowedTo = function (slug) {
|
|
3786
|
+
if(!slug){
|
|
3787
|
+
return true
|
|
3788
|
+
}
|
|
3789
|
+
if (this.permissions) {
|
|
3790
|
+
let permissions = [];
|
|
3791
|
+
if (typeof this.permissions === 'string') {
|
|
3792
|
+
permissions = this.permissions;
|
|
3793
|
+
} else {
|
|
3794
|
+
permissions = this.permissions;
|
|
3795
|
+
}
|
|
3796
|
+
return permissions.includes(slug)
|
|
3797
|
+
}
|
|
3798
|
+
return false
|
|
3799
|
+
};
|
|
3800
|
+
this.user = user;
|
|
3801
|
+
}).catch((reason) => {
|
|
3802
|
+
if (reason.response && reason.response.status) {
|
|
3803
|
+
if(reason.response.status === 401) {
|
|
3804
|
+
ShStorage.setItem('user',null);
|
|
3805
|
+
this.user = null;
|
|
3806
|
+
}
|
|
3807
|
+
this.loggedOut = true;
|
|
3808
|
+
}
|
|
3809
|
+
});
|
|
3810
|
+
if (this.user) {
|
|
3811
|
+
if (typeof this.user.permissions === 'string') {
|
|
3812
|
+
this.permissions = this.user.permissions;
|
|
3813
|
+
} else {
|
|
3814
|
+
this.permissions = this.user.permissions;
|
|
3815
|
+
}
|
|
3816
|
+
}
|
|
3817
|
+
const timeNow = moment().toISOString();
|
|
3818
|
+
ShStorage.setItem('session_start',timeNow);
|
|
3819
|
+
},
|
|
3820
|
+
signOut () {
|
|
3821
|
+
shRepo.signOutUser();
|
|
3822
|
+
},
|
|
3823
|
+
logOut () {
|
|
3824
|
+
this.signOut();
|
|
3825
|
+
},
|
|
3826
|
+
getUser () {
|
|
3827
|
+
this.setUser();
|
|
3828
|
+
},
|
|
3829
|
+
setAccessToken (accessToken) {
|
|
3830
|
+
ShStorage.setItem('access_token', accessToken);
|
|
3831
|
+
this.setUser();
|
|
3832
|
+
}
|
|
3833
|
+
},
|
|
3834
|
+
getters: {
|
|
3835
|
+
userId (state) {
|
|
3836
|
+
return state.user === null ? null:state.user.id
|
|
3837
|
+
}
|
|
3838
|
+
}
|
|
3839
|
+
});
|
|
3840
|
+
|
|
3745
3841
|
var script$f = {
|
|
3746
3842
|
name: 'Pagination',
|
|
3747
3843
|
props: ['pagination_data', 'loadMore', 'hideCount', 'hideLoadMore', 'paginationStyle'],
|
|
@@ -4391,7 +4487,7 @@ const _hoisted_19 = [
|
|
|
4391
4487
|
];
|
|
4392
4488
|
const _hoisted_20 = {
|
|
4393
4489
|
key: 1,
|
|
4394
|
-
class: "alert alert-danger"
|
|
4490
|
+
class: "alert alert-danger error-loading"
|
|
4395
4491
|
};
|
|
4396
4492
|
const _hoisted_21 = /*#__PURE__*/createElementVNode("i", { class: "bi-info-circle" }, null, -1 /* HOISTED */);
|
|
4397
4493
|
const _hoisted_22 = { class: "sh-thead" };
|
|
@@ -4803,6 +4899,8 @@ var script$b = /*#__PURE__*/Object.assign(__default__, {
|
|
|
4803
4899
|
|
|
4804
4900
|
const noRecordsComponent = inject('noRecordsComponent', script$g);
|
|
4805
4901
|
|
|
4902
|
+
const {user} = storeToRefs(useUserStore());
|
|
4903
|
+
|
|
4806
4904
|
return (_ctx, _cache) => {
|
|
4807
4905
|
const _component_router_link = resolveComponent("router-link");
|
|
4808
4906
|
|
|
@@ -4885,14 +4983,14 @@ return (_ctx, _cache) => {
|
|
|
4885
4983
|
], 64 /* STABLE_FRAGMENT */))
|
|
4886
4984
|
: (_ctx.hasRecordsSlot)
|
|
4887
4985
|
? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
|
|
4888
|
-
(_ctx.loading === 'loading')
|
|
4986
|
+
(_ctx.loading === 'loading' && !__props.cacheKey)
|
|
4889
4987
|
? (openBlock(), createElementBlock("div", _hoisted_17$1, _hoisted_19))
|
|
4890
|
-
: (_ctx.loading === 'error')
|
|
4988
|
+
: (_ctx.loading === 'error' && !__props.cacheKey)
|
|
4891
4989
|
? (openBlock(), createElementBlock("div", _hoisted_20, [
|
|
4892
4990
|
createElementVNode("span", null, toDisplayString(_ctx.loading_error), 1 /* TEXT */)
|
|
4893
4991
|
]))
|
|
4894
4992
|
: createCommentVNode("v-if", true),
|
|
4895
|
-
(_ctx.loading === 'done')
|
|
4993
|
+
(_ctx.loading === 'done' || __props.cacheKey)
|
|
4896
4994
|
? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
4897
4995
|
(_ctx.records.length === 0)
|
|
4898
4996
|
? (openBlock(), createBlock(resolveDynamicComponent(unref(noRecordsComponent)), { key: 0 }, {
|
|
@@ -5009,7 +5107,7 @@ return (_ctx, _cache) => {
|
|
|
5009
5107
|
return (openBlock(), createElementBlock(Fragment, {
|
|
5010
5108
|
key: act.path
|
|
5011
5109
|
}, [
|
|
5012
|
-
(!act.permission ||
|
|
5110
|
+
(!act.permission || unref(user).isAllowedTo(act.permission))
|
|
5013
5111
|
? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
5014
5112
|
(!act.validator || act.validator(record))
|
|
5015
5113
|
? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
@@ -5179,7 +5277,7 @@ return (_ctx, _cache) => {
|
|
|
5179
5277
|
return (openBlock(), createElementBlock(Fragment, {
|
|
5180
5278
|
key: act.path
|
|
5181
5279
|
}, [
|
|
5182
|
-
(!act.permission ||
|
|
5280
|
+
(!act.permission || unref(user).isAllowedTo(act.permission))
|
|
5183
5281
|
? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
5184
5282
|
(!act.validator || act.validator(record))
|
|
5185
5283
|
? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
@@ -5564,102 +5662,6 @@ return (_ctx, _cache) => {
|
|
|
5564
5662
|
|
|
5565
5663
|
script$7.__file = "src/lib/components/ShCanvasBtn.vue";
|
|
5566
5664
|
|
|
5567
|
-
const useUserStore = defineStore('user-store', {
|
|
5568
|
-
state: () => ({
|
|
5569
|
-
user: null,
|
|
5570
|
-
role: null,
|
|
5571
|
-
permissions: null,
|
|
5572
|
-
menus: [],
|
|
5573
|
-
loggedOut: false
|
|
5574
|
-
}),
|
|
5575
|
-
actions: {
|
|
5576
|
-
setUser (){
|
|
5577
|
-
let user = null;
|
|
5578
|
-
try {
|
|
5579
|
-
user = ShStorage.getItem('user') ? ShStorage.getItem('user') : null;
|
|
5580
|
-
} catch (error) {
|
|
5581
|
-
user= null;
|
|
5582
|
-
}
|
|
5583
|
-
if (user) {
|
|
5584
|
-
user.isAllowedTo = function (slug) {
|
|
5585
|
-
if (this.permissions) {
|
|
5586
|
-
let permissions = [];
|
|
5587
|
-
if (typeof this.permissions === 'string') {
|
|
5588
|
-
permissions = this.permissions;
|
|
5589
|
-
} else {
|
|
5590
|
-
permissions = this.permissions;
|
|
5591
|
-
}
|
|
5592
|
-
return permissions.includes(slug)
|
|
5593
|
-
}
|
|
5594
|
-
return false
|
|
5595
|
-
};
|
|
5596
|
-
}
|
|
5597
|
-
this.user = user;
|
|
5598
|
-
shApis.doGet('auth/user').then(res => {
|
|
5599
|
-
let user = res.data.user;
|
|
5600
|
-
if (typeof(user) === 'undefined') {
|
|
5601
|
-
user = res.data;
|
|
5602
|
-
}
|
|
5603
|
-
ShStorage.setItem('user',user);
|
|
5604
|
-
user.signOut = this.signOut;
|
|
5605
|
-
user.logout = this.signOut;
|
|
5606
|
-
user.logOut = this.signOut;
|
|
5607
|
-
user.isAllowedTo = function (slug) {
|
|
5608
|
-
if(!slug){
|
|
5609
|
-
return true
|
|
5610
|
-
}
|
|
5611
|
-
if (this.permissions) {
|
|
5612
|
-
let permissions = [];
|
|
5613
|
-
if (typeof this.permissions === 'string') {
|
|
5614
|
-
permissions = this.permissions;
|
|
5615
|
-
} else {
|
|
5616
|
-
permissions = this.permissions;
|
|
5617
|
-
}
|
|
5618
|
-
return permissions.includes(slug)
|
|
5619
|
-
}
|
|
5620
|
-
return false
|
|
5621
|
-
};
|
|
5622
|
-
this.user = user;
|
|
5623
|
-
}).catch((reason) => {
|
|
5624
|
-
if (reason.response && reason.response.status) {
|
|
5625
|
-
if(reason.response.status === 401) {
|
|
5626
|
-
ShStorage.setItem('user',null);
|
|
5627
|
-
this.user = null;
|
|
5628
|
-
}
|
|
5629
|
-
this.loggedOut = true;
|
|
5630
|
-
}
|
|
5631
|
-
});
|
|
5632
|
-
if (this.user) {
|
|
5633
|
-
if (typeof this.user.permissions === 'string') {
|
|
5634
|
-
this.permissions = this.user.permissions;
|
|
5635
|
-
} else {
|
|
5636
|
-
this.permissions = this.user.permissions;
|
|
5637
|
-
}
|
|
5638
|
-
}
|
|
5639
|
-
const timeNow = moment().toISOString();
|
|
5640
|
-
ShStorage.setItem('session_start',timeNow);
|
|
5641
|
-
},
|
|
5642
|
-
signOut () {
|
|
5643
|
-
shRepo.signOutUser();
|
|
5644
|
-
},
|
|
5645
|
-
logOut () {
|
|
5646
|
-
this.signOut();
|
|
5647
|
-
},
|
|
5648
|
-
getUser () {
|
|
5649
|
-
this.setUser();
|
|
5650
|
-
},
|
|
5651
|
-
setAccessToken (accessToken) {
|
|
5652
|
-
ShStorage.setItem('access_token', accessToken);
|
|
5653
|
-
this.setUser();
|
|
5654
|
-
}
|
|
5655
|
-
},
|
|
5656
|
-
getters: {
|
|
5657
|
-
userId (state) {
|
|
5658
|
-
return state.user === null ? null:state.user.id
|
|
5659
|
-
}
|
|
5660
|
-
}
|
|
5661
|
-
});
|
|
5662
|
-
|
|
5663
5665
|
const _withScopeId$1 = n => (pushScopeId("data-v-0d4fa0ac"),n=n(),popScopeId(),n);
|
|
5664
5666
|
const _hoisted_1$4 = { class: "row permissions-main d-flex" };
|
|
5665
5667
|
const _hoisted_2$3 = {
|