@iankibetsh/shframework 4.6.6 → 4.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.
@@ -63,22 +63,6 @@
63
63
  color: white;
64
64
  }
65
65
 
66
- .sh-selected-item{
67
- line-height: unset!important;
68
- }
69
- .sh-suggestion-input{
70
- padding: 0.375rem 0.75rem;
71
- }
72
- .sh-suggest{
73
- margin-bottom: 1rem;
74
- padding: 0rem 0rem;
75
- }
76
- .sh-suggest-control::after{
77
- margin-top: auto;
78
- margin-bottom: auto;
79
- margin-right: 0.255em;
80
- }
81
-
82
66
  .permissions-main {
83
67
  background: #edeff2;
84
68
  }
@@ -111,6 +95,22 @@
111
95
  flex-grow: 1;
112
96
  }
113
97
 
98
+ .sh-selected-item{
99
+ line-height: unset!important;
100
+ }
101
+ .sh-suggestion-input{
102
+ padding: 0.375rem 0.75rem;
103
+ }
104
+ .sh-suggest{
105
+ margin-bottom: 1rem;
106
+ padding: 0rem 0rem;
107
+ }
108
+ .sh-suggest-control::after{
109
+ margin-top: auto;
110
+ margin-bottom: auto;
111
+ margin-right: 0.255em;
112
+ }
113
+
114
114
  .callout{
115
115
  --bs-link-color-rgb: 110,168,254;
116
116
  --bs-code-color: #e685b5;
package/dist/library.js CHANGED
@@ -4146,6 +4146,7 @@ const useUserStore = pinia.defineStore('user-store', {
4146
4146
  }
4147
4147
  return false
4148
4148
  };
4149
+ user.can = user.isAllowedTo;
4149
4150
  this.user = user;
4150
4151
  }).catch((reason) => {
4151
4152
  if (reason.response && reason.response.status) {
@@ -7190,8 +7191,22 @@ return (_ctx, _cache) => {
7190
7191
  script.__scopeId = "data-v-2911509a";
7191
7192
  script.__file = "src/lib/components/core/auth/ShAuth.vue";
7192
7193
 
7194
+ var isAllowedTo = {
7195
+ mounted(el, binding) {
7196
+ const {user} = pinia.storeToRefs(useUserStore());
7197
+ if(!user.value.isAllowedTo(binding.value)){
7198
+ // delete element
7199
+ el.remove();
7200
+ }
7201
+ }
7202
+ };
7203
+
7193
7204
  const ShFrontend = {
7194
7205
  install: (app, options) => {
7206
+
7207
+ // add user-can directive
7208
+ app.directive('if-user-can', isAllowedTo);
7209
+
7195
7210
  if(options.sessionTimeout){
7196
7211
  app.provide('sessionTimeout',options.sessionTimeout);
7197
7212
  shStorage.setItem('sessionTimeout',options.sessionTimeout);
package/dist/library.mjs CHANGED
@@ -4134,6 +4134,7 @@ const useUserStore = defineStore('user-store', {
4134
4134
  }
4135
4135
  return false
4136
4136
  };
4137
+ user.can = user.isAllowedTo;
4137
4138
  this.user = user;
4138
4139
  }).catch((reason) => {
4139
4140
  if (reason.response && reason.response.status) {
@@ -7178,8 +7179,22 @@ return (_ctx, _cache) => {
7178
7179
  script.__scopeId = "data-v-2911509a";
7179
7180
  script.__file = "src/lib/components/core/auth/ShAuth.vue";
7180
7181
 
7182
+ var isAllowedTo = {
7183
+ mounted(el, binding) {
7184
+ const {user} = storeToRefs(useUserStore());
7185
+ if(!user.value.isAllowedTo(binding.value)){
7186
+ // delete element
7187
+ el.remove();
7188
+ }
7189
+ }
7190
+ };
7191
+
7181
7192
  const ShFrontend = {
7182
7193
  install: (app, options) => {
7194
+
7195
+ // add user-can directive
7196
+ app.directive('if-user-can', isAllowedTo);
7197
+
7183
7198
  if(options.sessionTimeout){
7184
7199
  app.provide('sessionTimeout',options.sessionTimeout);
7185
7200
  shStorage.setItem('sessionTimeout',options.sessionTimeout);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/shframework",
3
- "version": "4.6.6",
3
+ "version": "4.6.7",
4
4
  "description": "Vue library for handling laravel backend",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.mjs",