@iankibetsh/shframework 1.1.5 → 1.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.
@@ -63,21 +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
- }
75
- .sh-suggest-control::after{
76
- margin-top: auto;
77
- margin-bottom: auto;
78
- margin-right: 0.255em;
79
- }
80
-
81
66
  :root {
82
67
  --ck-z-default: 10555 !important;
83
68
  --ck-z-modal: calc(var(--ck-z-default) + 999) !important;
@@ -99,6 +84,21 @@
99
84
  }
100
85
  }
101
86
 
87
+ .sh-selected-item{
88
+ line-height: unset!important;
89
+ }
90
+ .sh-suggestion-input{
91
+ padding: 0.375rem 0.75rem;
92
+ }
93
+ .sh-suggest{
94
+ margin-bottom: 1rem;
95
+ }
96
+ .sh-suggest-control::after{
97
+ margin-top: auto;
98
+ margin-bottom: auto;
99
+ margin-right: 0.255em;
100
+ }
101
+
102
102
  .sh-forgot-link, .sh-register-link{
103
103
  cursor: pointer;
104
104
  }
package/dist/library.js CHANGED
@@ -2198,7 +2198,8 @@ var script$d = {
2198
2198
  'files',
2199
2199
  'phones',
2200
2200
  'numbers',
2201
- 'customComponent'
2201
+ 'customComponent',
2202
+ 'successMessage'
2202
2203
  ],
2203
2204
  data: function () {
2204
2205
  return {
@@ -2387,6 +2388,11 @@ var script$d = {
2387
2388
  Object.keys(this.form_files).forEach(key => {
2388
2389
  this.form_errors[key] = null;
2389
2390
  });
2391
+ this.$emit('formSubmitted',res.data);
2392
+ this.$emit('success',res.data);
2393
+ if(this.successMessage){
2394
+ shRepo.showToast(this.successMessage);
2395
+ }
2390
2396
  if (this.successCallback) {
2391
2397
  if (typeof this.successCallback === 'function') {
2392
2398
  this.successCallback(res.data);
@@ -2900,8 +2906,9 @@ var script$a = {
2900
2906
  'files',
2901
2907
  'phones',
2902
2908
  'numbers',
2903
- 'customComponent','modalTitle','class'],
2904
- setup(__props) {
2909
+ 'customComponent','modalTitle','class','successMessage'],
2910
+ emits: ['success'],
2911
+ setup(__props, { emit }) {
2905
2912
 
2906
2913
  const props = __props;
2907
2914
 
@@ -2910,7 +2917,9 @@ const props = __props;
2910
2917
  vue.ref(props);
2911
2918
  let btnClass=props.class;
2912
2919
  const modalId = 'rand' + (Math.random() + 1).toString(36).substring(2);
2913
-
2920
+ const success = (res)=>{
2921
+ emit('success',res);
2922
+ };
2914
2923
 
2915
2924
  return (_ctx, _cache) => {
2916
2925
  return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
@@ -2926,7 +2935,7 @@ return (_ctx, _cache) => {
2926
2935
  "modal-title": __props.modalTitle
2927
2936
  }, {
2928
2937
  default: vue.withCtx(() => [
2929
- vue.createVNode(script$d, vue.normalizeProps(vue.guardReactiveProps(props)), null, 16 /* FULL_PROPS */)
2938
+ vue.createVNode(script$d, vue.mergeProps({ onSuccess: success }, props), null, 16 /* FULL_PROPS */)
2930
2939
  ]),
2931
2940
  _: 1 /* STABLE */
2932
2941
  }, 8 /* PROPS */, ["modal-title"])
@@ -3161,7 +3170,7 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
3161
3170
  : vue.createCommentVNode("v-if", true)
3162
3171
  ]))
3163
3172
  : (vue.openBlock(), vue.createElementBlock("div", _hoisted_16$1, [
3164
- (this.pagination_data.loading === 1 && $props.loadMore)
3173
+ (this.pagination_data.loading === 1 && $props.loadMore && $props.hideLoadMore)
3165
3174
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_17$1, _hoisted_19$1))
3166
3175
  : vue.createCommentVNode("v-if", true),
3167
3176
  (!$props.hideCount)
@@ -3203,36 +3212,56 @@ var script$7 = {
3203
3212
  loadingMessage: {
3204
3213
  type: String,
3205
3214
  default: 'Processing'
3215
+ },
3216
+ successMessage: {
3217
+ type: String,
3218
+ default: 'Action Successful'
3219
+ },
3220
+ failMessage: {
3221
+ type: String,
3222
+ default: 'Action failed'
3206
3223
  }
3207
3224
  },
3208
- emits: ['actionSuccessful', 'actionFailed','actionCanceled'],
3225
+ emits: ['actionSuccessful', 'actionFailed','success','actionCanceled'],
3209
3226
  setup(__props, { emit }) {
3210
3227
 
3211
3228
  const props = __props;
3212
3229
 
3213
3230
 
3231
+
3214
3232
  const processing = vue.ref(false);
3215
3233
 
3234
+ const actionSuccessful = (res)=>{
3235
+ processing.value = false;
3236
+ res.actionType = 'silentAction';
3237
+ emit('actionSuccessful',res);
3238
+ emit('success',res);
3239
+ shRepo.showToast(res.message ?? props.successMessage);
3240
+ };
3216
3241
 
3242
+ const actionFailed = reason =>{
3243
+ console.log(reason);
3244
+ processing.value = false;
3245
+ reason.actionType = 'silentAction';
3246
+ emit('actionFailed', reason);
3247
+ shRepo.showToast(reason.value.error.message ?? props.failMessage,'error');
3248
+ };
3217
3249
  function runAction () {
3218
3250
  processing.value = true;
3219
3251
  shRepo.runPlainRequest(props.url, props.message, props.title, props.data).then(res => {
3220
3252
  if(res.isConfirmed){
3221
3253
  const value = res.value;
3222
- if(value.status){
3223
- emit('actionSuccessful', res);
3224
- processing.value = false;
3254
+ if(value.success){
3255
+ actionSuccessful(res.value.response);
3225
3256
  } else {
3226
- emit('actionFailed', value);
3227
- processing.value = false;
3257
+ actionFailed(res);
3228
3258
  }
3229
3259
  } else {
3230
3260
  emit('actionCanceled');
3231
3261
  processing.value = false;
3232
3262
  }
3233
3263
  }).catch(ex => {
3234
- emit('actionFailed', ex);
3235
- processing.value = false;
3264
+ actionFailed(ex);
3236
3265
  });
3237
3266
  }
3238
3267
 
@@ -3272,6 +3301,14 @@ var script$6 = {
3272
3301
  type: String,
3273
3302
  default: 'Processing'
3274
3303
  },
3304
+ successMessage: {
3305
+ type: String,
3306
+ default: 'Action Successful'
3307
+ },
3308
+ failMessage: {
3309
+ type: String,
3310
+ default: 'Action failed'
3311
+ },
3275
3312
  method: {
3276
3313
  type: String,
3277
3314
  default: 'POST'
@@ -3281,7 +3318,7 @@ var script$6 = {
3281
3318
  required: true
3282
3319
  }
3283
3320
  },
3284
- emits: ['actionSuccessful','actionFailed'],
3321
+ emits: ['actionSuccessful','actionFailed','success'],
3285
3322
  setup(__props, { emit }) {
3286
3323
 
3287
3324
  const props = __props;
@@ -3289,25 +3326,37 @@ const props = __props;
3289
3326
 
3290
3327
  const processing = vue.ref(false);
3291
3328
 
3329
+ const actionSuccessful = (res)=>{
3330
+ processing.value = false;
3331
+ res.actionType = 'silentAction';
3332
+ console.log(res.data,props.successMessage);
3333
+ emit('actionSuccessful',res);
3334
+ emit('success',res);
3335
+ shRepo.showToast(res.data.message ?? props.successMessage);
3336
+ };
3292
3337
 
3338
+ const actionFailed = reason =>{
3339
+ processing.value = false;
3340
+ console.log(reason);
3341
+ shRepo.showToast('Failed');
3342
+ reason.actionType = 'silentAction';
3343
+ emit('actionFailed', reason);
3344
+ shRepo.showToast(reason.message ?? props.failMessage,'error');
3345
+ };
3293
3346
  function runAction(){
3294
3347
  processing.value = true;
3295
3348
  if(props.method === 'POST'){
3296
3349
  shApis.doPost(props.url,props.data).then(res=>{
3297
- emit('actionSuccessful',res);
3298
- processing.value = false;
3350
+ actionSuccessful(res);
3299
3351
  }).catch(reason=>{
3300
- emit('actionFailed', reason);
3301
- processing.value = false;
3352
+ actionFailed(reason);
3302
3353
  });
3303
3354
  }
3304
3355
  if(props.method === 'GET'){
3305
3356
  shApis.doGet(props.url,props.data).then(res=>{
3306
- emit('actionSuccessful',res);
3307
- processing.value = false;
3357
+ actionSuccessful(res);
3308
3358
  }).catch(reason=>{
3309
- emit('actionFailed', reason);
3310
- processing.value = false;
3359
+ actionFailed(reason);
3311
3360
  });
3312
3361
  }
3313
3362
  }
@@ -3969,7 +4018,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3969
4018
  ]),
3970
4019
  _: 2 /* DYNAMIC */
3971
4020
  }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["onActionSuccessful", "onActionFailed", "onActionCanceled", "loading-message", "class", "url"]))
3972
- : (act.canvasId)
4021
+ : (act.canvasId || act.type === 'offcanvas')
3973
4022
  ? (vue.openBlock(), vue.createElementBlock("a", {
3974
4023
  key: 2,
3975
4024
  href: '#' + act.canvasId,
@@ -4420,6 +4469,9 @@ const useUserStore = pinia.defineStore('user-store', {
4420
4469
  }
4421
4470
  ShStorage.setItem('user',user);
4422
4471
  user.isAllowedTo = function (slug) {
4472
+ if(!slug){
4473
+ return true
4474
+ }
4423
4475
  if (this.permissions) {
4424
4476
  let permissions = [];
4425
4477
  if (typeof this.permissions === 'string') {
@@ -4599,6 +4651,7 @@ let getModule = vue.computed(()=>{
4599
4651
 
4600
4652
  function moduleAdded () {
4601
4653
  shRepo.showToast('module added successfully', 'success');
4654
+ userStore.setUser();
4602
4655
  reload.value++;
4603
4656
  }
4604
4657
  function showModule (module) {
@@ -4657,6 +4710,7 @@ function submitPermissions() {
4657
4710
  shApis.doPost('admin/departments/department/permissions/' + getModule.value.id, data)
4658
4711
  .then(res => {
4659
4712
  reload.value++;
4713
+ userStore.setUser();
4660
4714
  shRepo.showToast('Permissions updated', 'success');
4661
4715
  });
4662
4716
  }
package/dist/library.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import Axios from 'axios';
2
2
  import moment from 'moment';
3
3
  import Swal from 'sweetalert2';
4
- import { inject, openBlock, createElementBlock, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, withDirectives, Fragment, renderList, vModelSelect, vModelText, resolveComponent, withModifiers, createVNode, ref, onMounted, unref, normalizeClass, createBlock, resolveDynamicComponent, renderSlot, normalizeProps, guardReactiveProps, withCtx, createStaticVNode, mergeProps, shallowRef, computed, isRef, vModelCheckbox, watch, pushScopeId, popScopeId } from 'vue';
4
+ import { inject, openBlock, createElementBlock, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, withDirectives, Fragment, renderList, vModelSelect, vModelText, resolveComponent, withModifiers, createVNode, ref, onMounted, unref, normalizeClass, createBlock, resolveDynamicComponent, renderSlot, normalizeProps, guardReactiveProps, withCtx, mergeProps, createStaticVNode, shallowRef, computed, isRef, vModelCheckbox, watch, pushScopeId, popScopeId } from 'vue';
5
5
  import NProgress from 'nprogress';
6
6
  import Editor from '@tinymce/tinymce-vue';
7
7
  import { defineStore, storeToRefs } from 'pinia';
@@ -2186,7 +2186,8 @@ var script$d = {
2186
2186
  'files',
2187
2187
  'phones',
2188
2188
  'numbers',
2189
- 'customComponent'
2189
+ 'customComponent',
2190
+ 'successMessage'
2190
2191
  ],
2191
2192
  data: function () {
2192
2193
  return {
@@ -2375,6 +2376,11 @@ var script$d = {
2375
2376
  Object.keys(this.form_files).forEach(key => {
2376
2377
  this.form_errors[key] = null;
2377
2378
  });
2379
+ this.$emit('formSubmitted',res.data);
2380
+ this.$emit('success',res.data);
2381
+ if(this.successMessage){
2382
+ shRepo.showToast(this.successMessage);
2383
+ }
2378
2384
  if (this.successCallback) {
2379
2385
  if (typeof this.successCallback === 'function') {
2380
2386
  this.successCallback(res.data);
@@ -2888,8 +2894,9 @@ var script$a = {
2888
2894
  'files',
2889
2895
  'phones',
2890
2896
  'numbers',
2891
- 'customComponent','modalTitle','class'],
2892
- setup(__props) {
2897
+ 'customComponent','modalTitle','class','successMessage'],
2898
+ emits: ['success'],
2899
+ setup(__props, { emit }) {
2893
2900
 
2894
2901
  const props = __props;
2895
2902
 
@@ -2898,7 +2905,9 @@ const props = __props;
2898
2905
  ref(props);
2899
2906
  let btnClass=props.class;
2900
2907
  const modalId = 'rand' + (Math.random() + 1).toString(36).substring(2);
2901
-
2908
+ const success = (res)=>{
2909
+ emit('success',res);
2910
+ };
2902
2911
 
2903
2912
  return (_ctx, _cache) => {
2904
2913
  return (openBlock(), createElementBlock(Fragment, null, [
@@ -2914,7 +2923,7 @@ return (_ctx, _cache) => {
2914
2923
  "modal-title": __props.modalTitle
2915
2924
  }, {
2916
2925
  default: withCtx(() => [
2917
- createVNode(script$d, normalizeProps(guardReactiveProps(props)), null, 16 /* FULL_PROPS */)
2926
+ createVNode(script$d, mergeProps({ onSuccess: success }, props), null, 16 /* FULL_PROPS */)
2918
2927
  ]),
2919
2928
  _: 1 /* STABLE */
2920
2929
  }, 8 /* PROPS */, ["modal-title"])
@@ -3149,7 +3158,7 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
3149
3158
  : createCommentVNode("v-if", true)
3150
3159
  ]))
3151
3160
  : (openBlock(), createElementBlock("div", _hoisted_16$1, [
3152
- (this.pagination_data.loading === 1 && $props.loadMore)
3161
+ (this.pagination_data.loading === 1 && $props.loadMore && $props.hideLoadMore)
3153
3162
  ? (openBlock(), createElementBlock("div", _hoisted_17$1, _hoisted_19$1))
3154
3163
  : createCommentVNode("v-if", true),
3155
3164
  (!$props.hideCount)
@@ -3191,36 +3200,56 @@ var script$7 = {
3191
3200
  loadingMessage: {
3192
3201
  type: String,
3193
3202
  default: 'Processing'
3203
+ },
3204
+ successMessage: {
3205
+ type: String,
3206
+ default: 'Action Successful'
3207
+ },
3208
+ failMessage: {
3209
+ type: String,
3210
+ default: 'Action failed'
3194
3211
  }
3195
3212
  },
3196
- emits: ['actionSuccessful', 'actionFailed','actionCanceled'],
3213
+ emits: ['actionSuccessful', 'actionFailed','success','actionCanceled'],
3197
3214
  setup(__props, { emit }) {
3198
3215
 
3199
3216
  const props = __props;
3200
3217
 
3201
3218
 
3219
+
3202
3220
  const processing = ref(false);
3203
3221
 
3222
+ const actionSuccessful = (res)=>{
3223
+ processing.value = false;
3224
+ res.actionType = 'silentAction';
3225
+ emit('actionSuccessful',res);
3226
+ emit('success',res);
3227
+ shRepo.showToast(res.message ?? props.successMessage);
3228
+ };
3204
3229
 
3230
+ const actionFailed = reason =>{
3231
+ console.log(reason);
3232
+ processing.value = false;
3233
+ reason.actionType = 'silentAction';
3234
+ emit('actionFailed', reason);
3235
+ shRepo.showToast(reason.value.error.message ?? props.failMessage,'error');
3236
+ };
3205
3237
  function runAction () {
3206
3238
  processing.value = true;
3207
3239
  shRepo.runPlainRequest(props.url, props.message, props.title, props.data).then(res => {
3208
3240
  if(res.isConfirmed){
3209
3241
  const value = res.value;
3210
- if(value.status){
3211
- emit('actionSuccessful', res);
3212
- processing.value = false;
3242
+ if(value.success){
3243
+ actionSuccessful(res.value.response);
3213
3244
  } else {
3214
- emit('actionFailed', value);
3215
- processing.value = false;
3245
+ actionFailed(res);
3216
3246
  }
3217
3247
  } else {
3218
3248
  emit('actionCanceled');
3219
3249
  processing.value = false;
3220
3250
  }
3221
3251
  }).catch(ex => {
3222
- emit('actionFailed', ex);
3223
- processing.value = false;
3252
+ actionFailed(ex);
3224
3253
  });
3225
3254
  }
3226
3255
 
@@ -3260,6 +3289,14 @@ var script$6 = {
3260
3289
  type: String,
3261
3290
  default: 'Processing'
3262
3291
  },
3292
+ successMessage: {
3293
+ type: String,
3294
+ default: 'Action Successful'
3295
+ },
3296
+ failMessage: {
3297
+ type: String,
3298
+ default: 'Action failed'
3299
+ },
3263
3300
  method: {
3264
3301
  type: String,
3265
3302
  default: 'POST'
@@ -3269,7 +3306,7 @@ var script$6 = {
3269
3306
  required: true
3270
3307
  }
3271
3308
  },
3272
- emits: ['actionSuccessful','actionFailed'],
3309
+ emits: ['actionSuccessful','actionFailed','success'],
3273
3310
  setup(__props, { emit }) {
3274
3311
 
3275
3312
  const props = __props;
@@ -3277,25 +3314,37 @@ const props = __props;
3277
3314
 
3278
3315
  const processing = ref(false);
3279
3316
 
3317
+ const actionSuccessful = (res)=>{
3318
+ processing.value = false;
3319
+ res.actionType = 'silentAction';
3320
+ console.log(res.data,props.successMessage);
3321
+ emit('actionSuccessful',res);
3322
+ emit('success',res);
3323
+ shRepo.showToast(res.data.message ?? props.successMessage);
3324
+ };
3280
3325
 
3326
+ const actionFailed = reason =>{
3327
+ processing.value = false;
3328
+ console.log(reason);
3329
+ shRepo.showToast('Failed');
3330
+ reason.actionType = 'silentAction';
3331
+ emit('actionFailed', reason);
3332
+ shRepo.showToast(reason.message ?? props.failMessage,'error');
3333
+ };
3281
3334
  function runAction(){
3282
3335
  processing.value = true;
3283
3336
  if(props.method === 'POST'){
3284
3337
  shApis.doPost(props.url,props.data).then(res=>{
3285
- emit('actionSuccessful',res);
3286
- processing.value = false;
3338
+ actionSuccessful(res);
3287
3339
  }).catch(reason=>{
3288
- emit('actionFailed', reason);
3289
- processing.value = false;
3340
+ actionFailed(reason);
3290
3341
  });
3291
3342
  }
3292
3343
  if(props.method === 'GET'){
3293
3344
  shApis.doGet(props.url,props.data).then(res=>{
3294
- emit('actionSuccessful',res);
3295
- processing.value = false;
3345
+ actionSuccessful(res);
3296
3346
  }).catch(reason=>{
3297
- emit('actionFailed', reason);
3298
- processing.value = false;
3347
+ actionFailed(reason);
3299
3348
  });
3300
3349
  }
3301
3350
  }
@@ -3957,7 +4006,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3957
4006
  ]),
3958
4007
  _: 2 /* DYNAMIC */
3959
4008
  }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["onActionSuccessful", "onActionFailed", "onActionCanceled", "loading-message", "class", "url"]))
3960
- : (act.canvasId)
4009
+ : (act.canvasId || act.type === 'offcanvas')
3961
4010
  ? (openBlock(), createElementBlock("a", {
3962
4011
  key: 2,
3963
4012
  href: '#' + act.canvasId,
@@ -4408,6 +4457,9 @@ const useUserStore = defineStore('user-store', {
4408
4457
  }
4409
4458
  ShStorage.setItem('user',user);
4410
4459
  user.isAllowedTo = function (slug) {
4460
+ if(!slug){
4461
+ return true
4462
+ }
4411
4463
  if (this.permissions) {
4412
4464
  let permissions = [];
4413
4465
  if (typeof this.permissions === 'string') {
@@ -4587,6 +4639,7 @@ let getModule = computed(()=>{
4587
4639
 
4588
4640
  function moduleAdded () {
4589
4641
  shRepo.showToast('module added successfully', 'success');
4642
+ userStore.setUser();
4590
4643
  reload.value++;
4591
4644
  }
4592
4645
  function showModule (module) {
@@ -4645,6 +4698,7 @@ function submitPermissions() {
4645
4698
  shApis.doPost('admin/departments/department/permissions/' + getModule.value.id, data)
4646
4699
  .then(res => {
4647
4700
  reload.value++;
4701
+ userStore.setUser();
4648
4702
  shRepo.showToast('Permissions updated', 'success');
4649
4703
  });
4650
4704
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/shframework",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "Vue library for handling laravel backend",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.mjs",