@iankibetsh/shframework 4.6.5 → 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.
@@ -1,4 +1,36 @@
1
1
 
2
+ .sh-phone{
3
+ display: flex;
4
+ width: 100%;
5
+ align-items: center;
6
+ padding: 0 0.25rem;
7
+ }
8
+ .phone-country{
9
+ width: 2rem;
10
+ border: none;
11
+ align-self: center;
12
+ outline: none !important;
13
+ padding: 0.4rem;
14
+ border-right: 1px solid #0003;
15
+ }
16
+ .phone-number{
17
+ width: calc(100% - 2.2rem);
18
+ border: none;
19
+ align-self: center;
20
+ outline: none;
21
+ margin-bottom: 0;
22
+ padding: 0.4rem;
23
+ }
24
+ .sh-phone img{
25
+ padding: 0.125rem;
26
+ width: 2rem;
27
+ height: 2rem;
28
+ }
29
+ .phone-number::placeholder{
30
+ font-weight: 300;
31
+ opacity: 0.5;
32
+ }
33
+
2
34
  .colored-toast.swal2-icon-success {
3
35
  background-color: #a5dc86 !important;
4
36
  }
@@ -63,38 +95,6 @@
63
95
  flex-grow: 1;
64
96
  }
65
97
 
66
- .sh-phone{
67
- display: flex;
68
- width: 100%;
69
- align-items: center;
70
- padding: 0 0.25rem;
71
- }
72
- .phone-country{
73
- width: 2rem;
74
- border: none;
75
- align-self: center;
76
- outline: none !important;
77
- padding: 0.4rem;
78
- border-right: 1px solid #0003;
79
- }
80
- .phone-number{
81
- width: calc(100% - 2.2rem);
82
- border: none;
83
- align-self: center;
84
- outline: none;
85
- margin-bottom: 0;
86
- padding: 0.4rem;
87
- }
88
- .sh-phone img{
89
- padding: 0.125rem;
90
- width: 2rem;
91
- height: 2rem;
92
- }
93
- .phone-number::placeholder{
94
- font-weight: 300;
95
- opacity: 0.5;
96
- }
97
-
98
98
  .sh-selected-item{
99
99
  line-height: unset!important;
100
100
  }
package/dist/library.js CHANGED
@@ -3863,6 +3863,7 @@ var script$l = {
3863
3863
  'country_code',
3864
3864
  'submitBtnClass',
3865
3865
  'fields',
3866
+ 'modalSize',
3866
3867
  'columns', 'placeholders', 'field_permissions', 'retainDataAfterSubmission',
3867
3868
  'currentData', 'actionLabel', 'fillSelects', 'phones', 'successCallback',
3868
3869
  'failedCallback', 'labels', 'editors',
@@ -3915,6 +3916,7 @@ return (_ctx, _cache) => {
3915
3916
  vue.renderSlot(_ctx.$slots, "default")
3916
3917
  ], 10 /* CLASS, PROPS */, _hoisted_1$i),
3917
3918
  vue.createVNode(script$n, {
3919
+ "modal-size": __props.modalSize,
3918
3920
  "modal-id": vue.unref(realModalId),
3919
3921
  "modal-title": __props.modalTitle
3920
3922
  }, {
@@ -3928,7 +3930,7 @@ return (_ctx, _cache) => {
3928
3930
  }, props), null, 16 /* FULL_PROPS */))
3929
3931
  ]),
3930
3932
  _: 1 /* STABLE */
3931
- }, 8 /* PROPS */, ["modal-id", "modal-title"])
3933
+ }, 8 /* PROPS */, ["modal-size", "modal-id", "modal-title"])
3932
3934
  ], 64 /* STABLE_FRAGMENT */))
3933
3935
  }
3934
3936
  }
@@ -4144,6 +4146,7 @@ const useUserStore = pinia.defineStore('user-store', {
4144
4146
  }
4145
4147
  return false
4146
4148
  };
4149
+ user.can = user.isAllowedTo;
4147
4150
  this.user = user;
4148
4151
  }).catch((reason) => {
4149
4152
  if (reason.response && reason.response.status) {
@@ -7188,8 +7191,22 @@ return (_ctx, _cache) => {
7188
7191
  script.__scopeId = "data-v-2911509a";
7189
7192
  script.__file = "src/lib/components/core/auth/ShAuth.vue";
7190
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
+
7191
7204
  const ShFrontend = {
7192
7205
  install: (app, options) => {
7206
+
7207
+ // add user-can directive
7208
+ app.directive('if-user-can', isAllowedTo);
7209
+
7193
7210
  if(options.sessionTimeout){
7194
7211
  app.provide('sessionTimeout',options.sessionTimeout);
7195
7212
  shStorage.setItem('sessionTimeout',options.sessionTimeout);
package/dist/library.mjs CHANGED
@@ -3851,6 +3851,7 @@ var script$l = {
3851
3851
  'country_code',
3852
3852
  'submitBtnClass',
3853
3853
  'fields',
3854
+ 'modalSize',
3854
3855
  'columns', 'placeholders', 'field_permissions', 'retainDataAfterSubmission',
3855
3856
  'currentData', 'actionLabel', 'fillSelects', 'phones', 'successCallback',
3856
3857
  'failedCallback', 'labels', 'editors',
@@ -3903,6 +3904,7 @@ return (_ctx, _cache) => {
3903
3904
  renderSlot(_ctx.$slots, "default")
3904
3905
  ], 10 /* CLASS, PROPS */, _hoisted_1$i),
3905
3906
  createVNode(script$n, {
3907
+ "modal-size": __props.modalSize,
3906
3908
  "modal-id": unref(realModalId),
3907
3909
  "modal-title": __props.modalTitle
3908
3910
  }, {
@@ -3916,7 +3918,7 @@ return (_ctx, _cache) => {
3916
3918
  }, props), null, 16 /* FULL_PROPS */))
3917
3919
  ]),
3918
3920
  _: 1 /* STABLE */
3919
- }, 8 /* PROPS */, ["modal-id", "modal-title"])
3921
+ }, 8 /* PROPS */, ["modal-size", "modal-id", "modal-title"])
3920
3922
  ], 64 /* STABLE_FRAGMENT */))
3921
3923
  }
3922
3924
  }
@@ -4132,6 +4134,7 @@ const useUserStore = defineStore('user-store', {
4132
4134
  }
4133
4135
  return false
4134
4136
  };
4137
+ user.can = user.isAllowedTo;
4135
4138
  this.user = user;
4136
4139
  }).catch((reason) => {
4137
4140
  if (reason.response && reason.response.status) {
@@ -7176,8 +7179,22 @@ return (_ctx, _cache) => {
7176
7179
  script.__scopeId = "data-v-2911509a";
7177
7180
  script.__file = "src/lib/components/core/auth/ShAuth.vue";
7178
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
+
7179
7192
  const ShFrontend = {
7180
7193
  install: (app, options) => {
7194
+
7195
+ // add user-can directive
7196
+ app.directive('if-user-can', isAllowedTo);
7197
+
7181
7198
  if(options.sessionTimeout){
7182
7199
  app.provide('sessionTimeout',options.sessionTimeout);
7183
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.5",
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",