@iankibetsh/shframework 1.0.8 → 1.1.0

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.mjs CHANGED
@@ -3097,9 +3097,160 @@ var shRepo = {
3097
3097
  formatDate
3098
3098
  };
3099
3099
 
3100
+ const _hoisted_1$6 = /*#__PURE__*/createElementVNode("span", {
3101
+ class: "spinner-border spinner-border-sm me-1",
3102
+ role: "status",
3103
+ "aria-hidden": "true"
3104
+ }, null, -1 /* HOISTED */);
3105
+
3106
+
3100
3107
  var script$7 = {
3108
+ __name: 'ShConfirmAction',
3109
+ props: {
3110
+ data: Object,
3111
+ title: String,
3112
+ message: String,
3113
+ url: {
3114
+ type: String,
3115
+ required: true
3116
+ },
3117
+ loadingMessage: {
3118
+ type: String,
3119
+ default: 'Processing'
3120
+ }
3121
+ },
3122
+ emits: ['actionSuccessful', 'actionFailed','actionCanceled'],
3123
+ setup(__props, { emit }) {
3124
+
3125
+ const props = __props;
3126
+
3127
+
3128
+ const processing = ref(false);
3129
+
3130
+
3131
+ function runAction () {
3132
+ processing.value = true;
3133
+ shRepo.runPlainRequest(props.url, props.message, props.title, props.data).then(res => {
3134
+ if(res.isConfirmed){
3135
+ const value = res.value;
3136
+ if(value.status){
3137
+ emit('actionSuccessful', res);
3138
+ processing.value = false;
3139
+ } else {
3140
+ emit('actionFailed', value);
3141
+ processing.value = false;
3142
+ }
3143
+ } else {
3144
+ emit('actionCanceled');
3145
+ processing.value = false;
3146
+ }
3147
+ }).catch(ex => {
3148
+ emit('actionFailed', ex);
3149
+ processing.value = false;
3150
+ });
3151
+ }
3152
+
3153
+ return (_ctx, _cache) => {
3154
+ return (openBlock(), createElementBlock("a", {
3155
+ class: normalizeClass(processing.value ? 'disabled':''),
3156
+ onClick: runAction
3157
+ }, [
3158
+ (processing.value)
3159
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3160
+ _hoisted_1$6,
3161
+ createElementVNode("span", null, toDisplayString(__props.loadingMessage), 1 /* TEXT */)
3162
+ ], 64 /* STABLE_FRAGMENT */))
3163
+ : createCommentVNode("v-if", true),
3164
+ (!processing.value)
3165
+ ? renderSlot(_ctx.$slots, "default", { key: 1 })
3166
+ : createCommentVNode("v-if", true)
3167
+ ], 2 /* CLASS */))
3168
+ }
3169
+ }
3170
+
3171
+ };
3172
+
3173
+ script$7.__file = "src/lib/components/ShConfirmAction.vue";
3174
+
3175
+ const _hoisted_1$5 = /*#__PURE__*/createElementVNode("span", {
3176
+ class: "spinner-border spinner-border-sm me-1",
3177
+ role: "status",
3178
+ "aria-hidden": "true"
3179
+ }, null, -1 /* HOISTED */);
3180
+
3181
+ var script$6 = {
3182
+ __name: 'ShSilentAction',
3183
+ props: {
3184
+ data: Object,
3185
+ loadingMessage: {
3186
+ type: String,
3187
+ default: 'Processing'
3188
+ },
3189
+ method: {
3190
+ type: String,
3191
+ default: 'POST'
3192
+ },
3193
+ url: {
3194
+ type: String,
3195
+ required: true
3196
+ }
3197
+ },
3198
+ emits: ['actionSuccessful','actionFailed'],
3199
+ setup(__props, { emit }) {
3200
+
3201
+ const props = __props;
3202
+
3203
+
3204
+ const processing = ref(false);
3205
+
3206
+
3207
+ function runAction(){
3208
+ processing.value = true;
3209
+ if(props.method === 'POST'){
3210
+ shApis.doPost(props.url,props.data).then(res=>{
3211
+ emit('actionSuccessful',res);
3212
+ processing.value = false;
3213
+ }).catch(reason=>{
3214
+ emit('actionFailed', reason);
3215
+ processing.value = false;
3216
+ });
3217
+ }
3218
+ if(props.method === 'GET'){
3219
+ shApis.doGet(props.url,props.data).then(res=>{
3220
+ emit('actionSuccessful',res);
3221
+ processing.value = false;
3222
+ }).catch(reason=>{
3223
+ emit('actionFailed', reason);
3224
+ processing.value = false;
3225
+ });
3226
+ }
3227
+ }
3228
+
3229
+ return (_ctx, _cache) => {
3230
+ return (openBlock(), createElementBlock("a", {
3231
+ class: normalizeClass(processing.value ? 'disabled':''),
3232
+ onClick: runAction
3233
+ }, [
3234
+ (processing.value)
3235
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3236
+ _hoisted_1$5,
3237
+ createElementVNode("span", null, toDisplayString(__props.loadingMessage), 1 /* TEXT */)
3238
+ ], 64 /* STABLE_FRAGMENT */))
3239
+ : createCommentVNode("v-if", true),
3240
+ (!processing.value)
3241
+ ? renderSlot(_ctx.$slots, "default", { key: 1 })
3242
+ : createCommentVNode("v-if", true)
3243
+ ], 2 /* CLASS */))
3244
+ }
3245
+ }
3246
+
3247
+ };
3248
+
3249
+ script$6.__file = "src/lib/components/ShSilentAction.vue";
3250
+
3251
+ var script$5 = {
3101
3252
  name: 'sh-table',
3102
- props: ['endPoint', 'headers', 'pageCount', 'actions', 'hideCount', 'hideLoadMore', 'links', 'reload', 'hideSearch', 'sharedData', 'searchPlaceholder', 'event', 'displayMore', 'displayMoreBtnClass', 'moreDetailsColumns', 'moreDetailsFields', 'hasDownload', 'downloadFields', 'tableHover'],
3253
+ props: ['endPoint', 'headers', 'pageCount', 'actions', 'hideCount', 'hideLoadMore', 'links', 'reload', 'hideSearch', 'sharedData', 'searchPlaceholder', 'event', 'displayMore', 'displayMoreBtnClass', 'moreDetailsColumns', 'moreDetailsFields', 'hasDownload', 'downloadFields', 'tableHover', 'hideIds'],
3103
3254
  inject: ['channel'],
3104
3255
  data () {
3105
3256
  return {
@@ -3123,15 +3274,20 @@ var script$7 = {
3123
3274
  },
3124
3275
  mounted () {
3125
3276
  if (this.event) ;
3126
- if(this.actions && this.actions.actions){
3277
+ if (this.actions && this.actions.actions) {
3127
3278
  this.actions.actions.forEach(action => {
3128
- if(action.canvasComponent){
3279
+ if (action.canvasComponent) {
3129
3280
  this.hasCanvas = true;
3130
3281
  }
3131
3282
  });
3132
3283
  }
3133
3284
  },
3134
3285
  methods: {
3286
+ cleanCanvasProps: function (actions) {
3287
+ let replaced = actions;
3288
+ replaced.class = null;
3289
+ return replaced
3290
+ },
3135
3291
  newRecordAdded: function (ev) {
3136
3292
  const record = ev.log;
3137
3293
  if (record.user) {
@@ -3139,15 +3295,15 @@ var script$7 = {
3139
3295
  }
3140
3296
  this.records.unshift(record);
3141
3297
  },
3142
- canvasClosed: function(){
3298
+ canvasClosed: function () {
3143
3299
  this.selectedRecord = null;
3144
3300
  },
3145
3301
  rowSelected: function (row) {
3146
3302
  this.selectedRecord = null;
3147
- setTimeout(()=>{
3303
+ setTimeout(() => {
3148
3304
  this.selectedRecord = row;
3149
3305
  this.$emit('rowSelected', row);
3150
- },100);
3306
+ }, 100);
3151
3307
  },
3152
3308
  changeKey: function (key, value) {
3153
3309
  this[key] = value;
@@ -3172,12 +3328,16 @@ var script$7 = {
3172
3328
  replaceActionUrl: function (path, obj) {
3173
3329
  if (path) {
3174
3330
  var matches = path.match(/\{(.*?)\}/g);
3175
- matches.forEach(key => {
3176
- key = key.replace('{', '');
3177
- key = key.replace('}', '');
3178
- path = path.replace(`{${key}}`, obj[key]);
3179
- });
3180
- return path
3331
+ try {
3332
+ matches.forEach(key => {
3333
+ key = key.replace('{', '');
3334
+ key = key.replace('}', '');
3335
+ path = path.replace(`{${key}}`, obj[key]);
3336
+ });
3337
+ return path
3338
+ } catch (e) {
3339
+ return path
3340
+ }
3181
3341
  }
3182
3342
  return ''
3183
3343
  },
@@ -3254,7 +3414,9 @@ var script$7 = {
3254
3414
  });
3255
3415
  },
3256
3416
  reloadData: function (page, append) {
3257
- if (typeof page !== 'undefined') { this.page = page; }
3417
+ if (typeof page !== 'undefined') {
3418
+ this.page = page;
3419
+ }
3258
3420
  if (!append) {
3259
3421
  this.loading = 'loading';
3260
3422
  }
@@ -3303,6 +3465,12 @@ var script$7 = {
3303
3465
  }
3304
3466
  },
3305
3467
  watch: {
3468
+ hideIds: {
3469
+ handler(newValue) {
3470
+ this.records = this.records.filter(record => !newValue.includes(record.id) && record);
3471
+ },
3472
+ deep: true
3473
+ },
3306
3474
  reload () {
3307
3475
  this.reloadData();
3308
3476
  }
@@ -3311,6 +3479,8 @@ var script$7 = {
3311
3479
  this.reloadData();
3312
3480
  },
3313
3481
  components: {
3482
+ ShSilentAction: script$6,
3483
+ ShConfirmAction: script$7,
3314
3484
  ShCanvas: script$9,
3315
3485
  pagination: script$8
3316
3486
  },
@@ -3330,7 +3500,7 @@ var script$7 = {
3330
3500
  }
3331
3501
  };
3332
3502
 
3333
- const _hoisted_1$6 = { class: "auto-table mt-2" };
3503
+ const _hoisted_1$4 = { class: "auto-table mt-2" };
3334
3504
  const _hoisted_2$4 = {
3335
3505
  key: 0,
3336
3506
  class: "col-md-4 mb-2"
@@ -3487,10 +3657,12 @@ const _hoisted_64 = ["title", "onClick"];
3487
3657
 
3488
3658
  function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3489
3659
  const _component_router_link = resolveComponent("router-link");
3660
+ const _component_sh_confirm_action = resolveComponent("sh-confirm-action");
3661
+ const _component_sh_silent_action = resolveComponent("sh-silent-action");
3490
3662
  const _component_pagination = resolveComponent("pagination");
3491
3663
  const _component_sh_canvas = resolveComponent("sh-canvas");
3492
3664
 
3493
- return (openBlock(), createElementBlock("div", _hoisted_1$6, [
3665
+ return (openBlock(), createElementBlock("div", _hoisted_1$4, [
3494
3666
  ($props.hasDownload)
3495
3667
  ? (openBlock(), createElementBlock("div", _hoisted_2$4, [
3496
3668
  createElementVNode("button", {
@@ -3669,28 +3841,17 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3669
3841
  ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3670
3842
  (!act.validator || act.validator(record))
3671
3843
  ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3672
- (act.canvasId)
3673
- ? (openBlock(), createElementBlock("a", {
3844
+ (act.type === 'confirmAction')
3845
+ ? (openBlock(), createBlock(_component_sh_confirm_action, {
3674
3846
  key: 0,
3675
- href: '#' + act.canvasId,
3676
- "data-bs-toggle": "offcanvas",
3677
- class: normalizeClass(act.class)
3678
- }, [
3679
- (act.icon)
3680
- ? (openBlock(), createElementBlock("span", {
3681
- key: 0,
3682
- class: normalizeClass(act.icon)
3683
- }, null, 2 /* CLASS */))
3684
- : createCommentVNode("v-if", true),
3685
- createTextVNode(" " + toDisplayString(act.label), 1 /* TEXT */)
3686
- ], 10 /* CLASS, PROPS */, _hoisted_44))
3687
- : (act.emits)
3688
- ? (openBlock(), createElementBlock("button", {
3689
- key: 1,
3690
- title: act.title,
3691
- class: normalizeClass(act.class ? act.class:'btn btn-default'),
3692
- onClick: $event => ($options.doEmitAction(act.emits,record))
3693
- }, [
3847
+ onActionSuccessful: $event => ($options.doEmitAction('actionSuccessful',record)),
3848
+ onActionFailed: $event => ($options.doEmitAction('actionFailed',record)),
3849
+ onActionCanceled: $event => ($options.doEmitAction('actionCanceled',record)),
3850
+ "loading-message": act.label,
3851
+ class: normalizeClass(act.class),
3852
+ url: $options.replaceActionUrl(act.url,record)
3853
+ }, {
3854
+ default: withCtx(() => [
3694
3855
  (act.icon)
3695
3856
  ? (openBlock(), createElementBlock("span", {
3696
3857
  key: 0,
@@ -3698,15 +3859,52 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3698
3859
  }, null, 2 /* CLASS */))
3699
3860
  : createCommentVNode("v-if", true),
3700
3861
  createTextVNode(" " + toDisplayString(act.label), 1 /* TEXT */)
3701
- ], 10 /* CLASS, PROPS */, _hoisted_45))
3702
- : (!act.emits)
3703
- ? (openBlock(), createBlock(_component_router_link, {
3862
+ ]),
3863
+ _: 2 /* DYNAMIC */
3864
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["onActionSuccessful", "onActionFailed", "onActionCanceled", "loading-message", "class", "url"]))
3865
+ : (act.type === 'silentAction')
3866
+ ? (openBlock(), createBlock(_component_sh_silent_action, {
3867
+ key: 1,
3868
+ onActionSuccessful: $event => ($options.doEmitAction('actionSuccessful',record)),
3869
+ onActionFailed: $event => ($options.doEmitAction('actionFailed',record)),
3870
+ onActionCanceled: $event => ($options.doEmitAction('actionCanceled',record)),
3871
+ "loading-message": act.label,
3872
+ class: normalizeClass(act.class),
3873
+ url: $options.replaceActionUrl(act.url,record)
3874
+ }, {
3875
+ default: withCtx(() => [
3876
+ (act.icon)
3877
+ ? (openBlock(), createElementBlock("span", {
3878
+ key: 0,
3879
+ class: normalizeClass(act.icon)
3880
+ }, null, 2 /* CLASS */))
3881
+ : createCommentVNode("v-if", true),
3882
+ createTextVNode(" " + toDisplayString(act.label), 1 /* TEXT */)
3883
+ ]),
3884
+ _: 2 /* DYNAMIC */
3885
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["onActionSuccessful", "onActionFailed", "onActionCanceled", "loading-message", "class", "url"]))
3886
+ : (act.canvasId)
3887
+ ? (openBlock(), createElementBlock("a", {
3704
3888
  key: 2,
3705
- title: act.title,
3706
- to: $options.replaceActionUrl(act.path,record),
3889
+ href: '#' + act.canvasId,
3890
+ "data-bs-toggle": "offcanvas",
3707
3891
  class: normalizeClass(act.class)
3708
- }, {
3709
- default: withCtx(() => [
3892
+ }, [
3893
+ (act.icon)
3894
+ ? (openBlock(), createElementBlock("span", {
3895
+ key: 0,
3896
+ class: normalizeClass(act.icon)
3897
+ }, null, 2 /* CLASS */))
3898
+ : createCommentVNode("v-if", true),
3899
+ createTextVNode(" " + toDisplayString(act.label), 1 /* TEXT */)
3900
+ ], 10 /* CLASS, PROPS */, _hoisted_44))
3901
+ : (act.emits)
3902
+ ? (openBlock(), createElementBlock("button", {
3903
+ key: 3,
3904
+ title: act.title,
3905
+ class: normalizeClass(act.class ? act.class:'btn btn-default'),
3906
+ onClick: $event => ($options.doEmitAction(act.emits,record))
3907
+ }, [
3710
3908
  (act.icon)
3711
3909
  ? (openBlock(), createElementBlock("span", {
3712
3910
  key: 0,
@@ -3714,10 +3912,26 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3714
3912
  }, null, 2 /* CLASS */))
3715
3913
  : createCommentVNode("v-if", true),
3716
3914
  createTextVNode(" " + toDisplayString(act.label), 1 /* TEXT */)
3717
- ]),
3718
- _: 2 /* DYNAMIC */
3719
- }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["title", "to", "class"]))
3720
- : createCommentVNode("v-if", true)
3915
+ ], 10 /* CLASS, PROPS */, _hoisted_45))
3916
+ : (!act.emits)
3917
+ ? (openBlock(), createBlock(_component_router_link, {
3918
+ key: 4,
3919
+ title: act.title,
3920
+ to: $options.replaceActionUrl(act.path,record),
3921
+ class: normalizeClass(act.class)
3922
+ }, {
3923
+ default: withCtx(() => [
3924
+ (act.icon)
3925
+ ? (openBlock(), createElementBlock("span", {
3926
+ key: 0,
3927
+ class: normalizeClass(act.icon)
3928
+ }, null, 2 /* CLASS */))
3929
+ : createCommentVNode("v-if", true),
3930
+ createTextVNode(" " + toDisplayString(act.label), 1 /* TEXT */)
3931
+ ]),
3932
+ _: 2 /* DYNAMIC */
3933
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["title", "to", "class"]))
3934
+ : createCommentVNode("v-if", true)
3721
3935
  ], 64 /* STABLE_FRAGMENT */))
3722
3936
  : createCommentVNode("v-if", true)
3723
3937
  ], 64 /* STABLE_FRAGMENT */))
@@ -3741,69 +3955,81 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3741
3955
  : ($data.loading === 'done')
3742
3956
  ? (openBlock(), createElementBlock("div", _hoisted_51, [
3743
3957
  (openBlock(true), createElementBlock(Fragment, null, renderList($data.records, (record, index) => {
3744
- return (openBlock(), createElementBlock(Fragment, {
3745
- key: record.id
3958
+ return (openBlock(), createElementBlock("div", {
3959
+ key: record.id,
3960
+ class: "single-mobile-req bg-light p-3",
3961
+ onClick: $event => ($options.rowSelected(record))
3746
3962
  }, [
3747
- createElementVNode("h3", null, toDisplayString(_ctx.mobile_view), 1 /* TEXT */),
3748
- createElementVNode("div", {
3749
- class: "single-mobile-req bg-light p-3",
3750
- onClick: $event => ($options.rowSelected(record))
3751
- }, [
3752
- (openBlock(true), createElementBlock(Fragment, null, renderList($props.headers, (key) => {
3753
- return (openBlock(), createElementBlock(Fragment, {
3754
- key: key[0]
3755
- }, [
3756
- (typeof key === 'string' )
3757
- ? (openBlock(), createElementBlock("p", _hoisted_53, toDisplayString(key.replace(/_/g, ' ')), 1 /* TEXT */))
3758
- : (typeof key === 'function')
3759
- ? (openBlock(), createElementBlock("p", _hoisted_54, toDisplayString(key(null).replace(/_/g, ' ')), 1 /* TEXT */))
3760
- : (openBlock(), createElementBlock("p", _hoisted_55, toDisplayString(key[1].replace(/_/g, ' ')), 1 /* TEXT */)),
3761
- createElementVNode("span", null, [
3762
- (typeof key === 'string' && $props.links && $props.links[key])
3763
- ? (openBlock(), createBlock(_component_router_link, {
3764
- key: 0,
3765
- to: $options.replaceLinkUrl($props.links[key],record),
3766
- class: normalizeClass($options.getLinkClass($props.links[key])),
3767
- innerHTML: record[key]
3768
- }, null, 8 /* PROPS */, ["to", "class", "innerHTML"]))
3769
- : ($options.getFieldType(key) === 'numeric')
3770
- ? (openBlock(), createElementBlock("span", _hoisted_56, toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3771
- : ($options.getFieldType(key) === 'money')
3772
- ? (openBlock(), createElementBlock("span", _hoisted_57, "KES " + toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3773
- : (typeof key === 'string')
3963
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.headers, (key) => {
3964
+ return (openBlock(), createElementBlock(Fragment, {
3965
+ key: key[0]
3966
+ }, [
3967
+ (typeof key === 'string' )
3968
+ ? (openBlock(), createElementBlock("p", _hoisted_53, toDisplayString(key.replace(/_/g, ' ')), 1 /* TEXT */))
3969
+ : (typeof key === 'function')
3970
+ ? (openBlock(), createElementBlock("p", _hoisted_54, toDisplayString(key(null).replace(/_/g, ' ')), 1 /* TEXT */))
3971
+ : (openBlock(), createElementBlock("p", _hoisted_55, toDisplayString(key[1].replace(/_/g, ' ')), 1 /* TEXT */)),
3972
+ createElementVNode("span", null, [
3973
+ (typeof key === 'string' && $props.links && $props.links[key])
3974
+ ? (openBlock(), createBlock(_component_router_link, {
3975
+ key: 0,
3976
+ to: $options.replaceLinkUrl($props.links[key],record),
3977
+ class: normalizeClass($options.getLinkClass($props.links[key])),
3978
+ innerHTML: record[key]
3979
+ }, null, 8 /* PROPS */, ["to", "class", "innerHTML"]))
3980
+ : ($options.getFieldType(key) === 'numeric')
3981
+ ? (openBlock(), createElementBlock("span", _hoisted_56, toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3982
+ : ($options.getFieldType(key) === 'money')
3983
+ ? (openBlock(), createElementBlock("span", _hoisted_57, "KES " + toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3984
+ : (typeof key === 'string')
3985
+ ? (openBlock(), createElementBlock("span", {
3986
+ key: 3,
3987
+ innerHTML: record[key]
3988
+ }, null, 8 /* PROPS */, _hoisted_58))
3989
+ : (typeof key === 'function')
3774
3990
  ? (openBlock(), createElementBlock("span", {
3775
- key: 3,
3776
- innerHTML: record[key]
3777
- }, null, 8 /* PROPS */, _hoisted_58))
3778
- : (typeof key === 'function')
3779
- ? (openBlock(), createElementBlock("span", {
3780
- key: 4,
3781
- innerHTML: key(record, index )
3782
- }, null, 8 /* PROPS */, _hoisted_59))
3783
- : (openBlock(), createElementBlock("span", {
3784
- key: 5,
3785
- innerHTML: record[key[0]]
3786
- }, null, 8 /* PROPS */, _hoisted_60))
3787
- ]),
3788
- _hoisted_61
3789
- ], 64 /* STABLE_FRAGMENT */))
3790
- }), 128 /* KEYED_FRAGMENT */)),
3791
- ($props.actions)
3792
- ? (openBlock(), createElementBlock("div", _hoisted_62, [
3793
- (openBlock(true), createElementBlock(Fragment, null, renderList($props.actions.actions, (act) => {
3794
- return (openBlock(), createElementBlock(Fragment, {
3795
- key: act.path
3796
- }, [
3797
- (!act.permission || $options.user.isAllowedTo(act.permission))
3798
- ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3799
- (!act.validator || act.validator(record))
3800
- ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3801
- (act.canvasId)
3802
- ? (openBlock(), createElementBlock("a", {
3803
- key: 0,
3804
- href: '#' + act.canvasId,
3805
- "data-bs-toggle": "offcanvas",
3806
- class: normalizeClass(act.class)
3991
+ key: 4,
3992
+ innerHTML: key(record, index )
3993
+ }, null, 8 /* PROPS */, _hoisted_59))
3994
+ : (openBlock(), createElementBlock("span", {
3995
+ key: 5,
3996
+ innerHTML: record[key[0]]
3997
+ }, null, 8 /* PROPS */, _hoisted_60))
3998
+ ]),
3999
+ _hoisted_61
4000
+ ], 64 /* STABLE_FRAGMENT */))
4001
+ }), 128 /* KEYED_FRAGMENT */)),
4002
+ ($props.actions)
4003
+ ? (openBlock(), createElementBlock("div", _hoisted_62, [
4004
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.actions.actions, (act) => {
4005
+ return (openBlock(), createElementBlock(Fragment, {
4006
+ key: act.path
4007
+ }, [
4008
+ (!act.permission || $options.user.isAllowedTo(act.permission))
4009
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
4010
+ (!act.validator || act.validator(record))
4011
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
4012
+ (act.canvasId)
4013
+ ? (openBlock(), createElementBlock("a", {
4014
+ key: 0,
4015
+ href: '#' + act.canvasId,
4016
+ "data-bs-toggle": "offcanvas",
4017
+ class: normalizeClass(act.class)
4018
+ }, [
4019
+ (act.icon)
4020
+ ? (openBlock(), createElementBlock("span", {
4021
+ key: 0,
4022
+ class: normalizeClass(act.icon)
4023
+ }, null, 2 /* CLASS */))
4024
+ : createCommentVNode("v-if", true),
4025
+ createTextVNode(" " + toDisplayString(act.label), 1 /* TEXT */)
4026
+ ], 10 /* CLASS, PROPS */, _hoisted_63))
4027
+ : (act.emits)
4028
+ ? (openBlock(), createElementBlock("button", {
4029
+ key: 1,
4030
+ title: act.title,
4031
+ class: normalizeClass(act.class ? act.class:'btn btn-default'),
4032
+ onClick: $event => ($options.doEmitAction(act.emits,record))
3807
4033
  }, [
3808
4034
  (act.icon)
3809
4035
  ? (openBlock(), createElementBlock("span", {
@@ -3812,51 +4038,35 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3812
4038
  }, null, 2 /* CLASS */))
3813
4039
  : createCommentVNode("v-if", true),
3814
4040
  createTextVNode(" " + toDisplayString(act.label), 1 /* TEXT */)
3815
- ], 10 /* CLASS, PROPS */, _hoisted_63))
3816
- : (act.emits)
3817
- ? (openBlock(), createElementBlock("button", {
3818
- key: 1,
4041
+ ], 10 /* CLASS, PROPS */, _hoisted_64))
4042
+ : (!act.emits)
4043
+ ? (openBlock(), createBlock(_component_router_link, {
4044
+ key: 2,
3819
4045
  title: act.title,
3820
- class: normalizeClass(act.class ? act.class:'btn btn-default'),
3821
- onClick: $event => ($options.doEmitAction(act.emits,record))
3822
- }, [
3823
- (act.icon)
3824
- ? (openBlock(), createElementBlock("span", {
3825
- key: 0,
3826
- class: normalizeClass(act.icon)
3827
- }, null, 2 /* CLASS */))
3828
- : createCommentVNode("v-if", true),
3829
- createTextVNode(" " + toDisplayString(act.label), 1 /* TEXT */)
3830
- ], 10 /* CLASS, PROPS */, _hoisted_64))
3831
- : (!act.emits)
3832
- ? (openBlock(), createBlock(_component_router_link, {
3833
- key: 2,
3834
- title: act.title,
3835
- to: $options.replaceActionUrl(act.path,record),
3836
- class: normalizeClass(act.class)
3837
- }, {
3838
- default: withCtx(() => [
3839
- (act.icon)
3840
- ? (openBlock(), createElementBlock("span", {
3841
- key: 0,
3842
- class: normalizeClass(act.icon)
3843
- }, null, 2 /* CLASS */))
3844
- : createCommentVNode("v-if", true),
3845
- createTextVNode(" " + toDisplayString(act.label), 1 /* TEXT */)
3846
- ]),
3847
- _: 2 /* DYNAMIC */
3848
- }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["title", "to", "class"]))
3849
- : createCommentVNode("v-if", true)
3850
- ], 64 /* STABLE_FRAGMENT */))
3851
- : createCommentVNode("v-if", true)
3852
- ], 64 /* STABLE_FRAGMENT */))
3853
- : createCommentVNode("v-if", true)
3854
- ], 64 /* STABLE_FRAGMENT */))
3855
- }), 128 /* KEYED_FRAGMENT */))
3856
- ]))
3857
- : createCommentVNode("v-if", true)
3858
- ], 8 /* PROPS */, _hoisted_52)
3859
- ], 64 /* STABLE_FRAGMENT */))
4046
+ to: $options.replaceActionUrl(act.path,record),
4047
+ class: normalizeClass(act.class)
4048
+ }, {
4049
+ default: withCtx(() => [
4050
+ (act.icon)
4051
+ ? (openBlock(), createElementBlock("span", {
4052
+ key: 0,
4053
+ class: normalizeClass(act.icon)
4054
+ }, null, 2 /* CLASS */))
4055
+ : createCommentVNode("v-if", true),
4056
+ createTextVNode(" " + toDisplayString(act.label), 1 /* TEXT */)
4057
+ ]),
4058
+ _: 2 /* DYNAMIC */
4059
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["title", "to", "class"]))
4060
+ : createCommentVNode("v-if", true)
4061
+ ], 64 /* STABLE_FRAGMENT */))
4062
+ : createCommentVNode("v-if", true)
4063
+ ], 64 /* STABLE_FRAGMENT */))
4064
+ : createCommentVNode("v-if", true)
4065
+ ], 64 /* STABLE_FRAGMENT */))
4066
+ }), 128 /* KEYED_FRAGMENT */))
4067
+ ]))
4068
+ : createCommentVNode("v-if", true)
4069
+ ], 8 /* PROPS */, _hoisted_52))
3860
4070
  }), 128 /* KEYED_FRAGMENT */))
3861
4071
  ]))
3862
4072
  : createCommentVNode("v-if", true)
@@ -3888,7 +4098,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3888
4098
  }, {
3889
4099
  default: withCtx(() => [
3890
4100
  ($data.selectedRecord)
3891
- ? (openBlock(), createBlock(resolveDynamicComponent(action.canvasComponent), mergeProps({ key: 0 }, action, { record: $data.selectedRecord }), null, 16 /* FULL_PROPS */, ["record"]))
4101
+ ? (openBlock(), createBlock(resolveDynamicComponent(action.canvasComponent), mergeProps({ key: 0 }, $options.cleanCanvasProps(action), { record: $data.selectedRecord }), null, 16 /* FULL_PROPS */, ["record"]))
3892
4102
  : createCommentVNode("v-if", true)
3893
4103
  ]),
3894
4104
  _: 2 /* DYNAMIC */
@@ -3900,10 +4110,10 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3900
4110
  ]))
3901
4111
  }
3902
4112
 
3903
- script$7.render = render$1;
3904
- script$7.__file = "src/lib/components/ShTable.vue";
4113
+ script$5.render = render$1;
4114
+ script$5.__file = "src/lib/components/ShTable.vue";
3905
4115
 
3906
- var script$6 = {
4116
+ var script$4 = {
3907
4117
  name: 'ShTabs',
3908
4118
  props: ['tabs', 'baseUrl', 'sharedData', 'tabCounts', 'responsive','classOne','classTwo','classes'],
3909
4119
  data () {
@@ -4024,10 +4234,10 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
4024
4234
  ], 64 /* STABLE_FRAGMENT */))
4025
4235
  }
4026
4236
 
4027
- script$6.render = render;
4028
- script$6.__file = "src/lib/components/ShTabs.vue";
4237
+ script$4.render = render;
4238
+ script$4.__file = "src/lib/components/ShTabs.vue";
4029
4239
 
4030
- const _hoisted_1$5 = {
4240
+ const _hoisted_1$3 = {
4031
4241
  class: "nav nav-tabs",
4032
4242
  role: "tablist"
4033
4243
  };
@@ -4038,7 +4248,7 @@ const _hoisted_2$3 = {
4038
4248
  const _hoisted_3$3 = ["onClick"];
4039
4249
  const _hoisted_4$3 = { class: "tab-content" };
4040
4250
 
4041
- var script$5 = {
4251
+ var script$3 = {
4042
4252
  __name: 'ShDynamicTabs',
4043
4253
  props: ['tabs','data'],
4044
4254
  setup(__props) {
@@ -4063,7 +4273,7 @@ function setTab(tab){
4063
4273
 
4064
4274
  return (_ctx, _cache) => {
4065
4275
  return (openBlock(), createElementBlock(Fragment, null, [
4066
- createElementVNode("ul", _hoisted_1$5, [
4276
+ createElementVNode("ul", _hoisted_1$3, [
4067
4277
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(tabs), (tab) => {
4068
4278
  return (openBlock(), createElementBlock("li", _hoisted_2$3, [
4069
4279
  createElementVNode("button", {
@@ -4084,158 +4294,7 @@ return (_ctx, _cache) => {
4084
4294
 
4085
4295
  };
4086
4296
 
4087
- script$5.__file = "src/lib/components/ShDynamicTabs.vue";
4088
-
4089
- const _hoisted_1$4 = /*#__PURE__*/createElementVNode("span", {
4090
- class: "spinner-border spinner-border-sm me-1",
4091
- role: "status",
4092
- "aria-hidden": "true"
4093
- }, null, -1 /* HOISTED */);
4094
-
4095
- var script$4 = {
4096
- __name: 'ShSilentAction',
4097
- props: {
4098
- data: Object,
4099
- loadingMessage: {
4100
- type: String,
4101
- default: 'Processing'
4102
- },
4103
- method: {
4104
- type: String,
4105
- default: 'POST'
4106
- },
4107
- url: {
4108
- type: String,
4109
- required: true
4110
- }
4111
- },
4112
- emits: ['actionSuccessful','actionFailed'],
4113
- setup(__props, { emit }) {
4114
-
4115
- const props = __props;
4116
-
4117
-
4118
- const processing = ref(false);
4119
-
4120
-
4121
- function runAction(){
4122
- processing.value = true;
4123
- if(props.method === 'POST'){
4124
- shApis.doPost(props.url,props.data).then(res=>{
4125
- emit('actionSuccessful',res);
4126
- processing.value = false;
4127
- }).catch(reason=>{
4128
- emit('actionFailed', reason);
4129
- processing.value = false;
4130
- });
4131
- }
4132
- if(props.method === 'GET'){
4133
- shApis.doGet(props.url,props.data).then(res=>{
4134
- emit('actionSuccessful',res);
4135
- processing.value = false;
4136
- }).catch(reason=>{
4137
- emit('actionFailed', reason);
4138
- processing.value = false;
4139
- });
4140
- }
4141
- }
4142
-
4143
- return (_ctx, _cache) => {
4144
- return (openBlock(), createElementBlock("a", {
4145
- class: normalizeClass(processing.value ? 'disabled':''),
4146
- onClick: runAction
4147
- }, [
4148
- (processing.value)
4149
- ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
4150
- _hoisted_1$4,
4151
- createElementVNode("span", null, toDisplayString(__props.loadingMessage), 1 /* TEXT */)
4152
- ], 64 /* STABLE_FRAGMENT */))
4153
- : createCommentVNode("v-if", true),
4154
- (!processing.value)
4155
- ? renderSlot(_ctx.$slots, "default", { key: 1 })
4156
- : createCommentVNode("v-if", true)
4157
- ], 2 /* CLASS */))
4158
- }
4159
- }
4160
-
4161
- };
4162
-
4163
- script$4.__file = "src/lib/components/ShSilentAction.vue";
4164
-
4165
- const _hoisted_1$3 = /*#__PURE__*/createElementVNode("span", {
4166
- class: "spinner-border spinner-border-sm me-1",
4167
- role: "status",
4168
- "aria-hidden": "true"
4169
- }, null, -1 /* HOISTED */);
4170
-
4171
-
4172
- var script$3 = {
4173
- __name: 'ShConfirmAction',
4174
- props: {
4175
- data: Object,
4176
- title: String,
4177
- message: String,
4178
- url: {
4179
- type: String,
4180
- required: true
4181
- },
4182
- loadingMessage: {
4183
- type: String,
4184
- default: 'Processing'
4185
- }
4186
- },
4187
- emits: ['actionSuccessful', 'actionFailed','actionCanceled'],
4188
- setup(__props, { emit }) {
4189
-
4190
- const props = __props;
4191
-
4192
-
4193
- const processing = ref(false);
4194
-
4195
-
4196
- function runAction () {
4197
- processing.value = true;
4198
- shRepo.runPlainRequest(props.url, props.message, props.title, props.data).then(res => {
4199
- if(res.isConfirmed){
4200
- const value = res.value;
4201
- if(value.status){
4202
- emit('actionSuccessful', res);
4203
- processing.value = false;
4204
- } else {
4205
- emit('actionFailed', value);
4206
- processing.value = false;
4207
- }
4208
- } else {
4209
- emit('actionCanceled');
4210
- processing.value = false;
4211
- }
4212
- }).catch(ex => {
4213
- emit('actionFailed', ex);
4214
- processing.value = false;
4215
- });
4216
- }
4217
-
4218
- return (_ctx, _cache) => {
4219
- return (openBlock(), createElementBlock("a", {
4220
- class: normalizeClass(processing.value ? 'disabled':''),
4221
- onClick: runAction
4222
- }, [
4223
- (processing.value)
4224
- ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
4225
- _hoisted_1$3,
4226
- createElementVNode("span", null, toDisplayString(__props.loadingMessage), 1 /* TEXT */)
4227
- ], 64 /* STABLE_FRAGMENT */))
4228
- : createCommentVNode("v-if", true),
4229
- (!processing.value)
4230
- ? renderSlot(_ctx.$slots, "default", { key: 1 })
4231
- : createCommentVNode("v-if", true)
4232
- ], 2 /* CLASS */))
4233
- }
4234
- }
4235
-
4236
- };
4237
-
4238
- script$3.__file = "src/lib/components/ShConfirmAction.vue";
4297
+ script$3.__file = "src/lib/components/ShDynamicTabs.vue";
4239
4298
 
4240
4299
  const useUserStore = defineStore('user-store', {
4241
4300
  state: () => ({
@@ -4363,7 +4422,7 @@ return (_ctx, _cache) => {
4363
4422
  _hoisted_5$2,
4364
4423
  createTextVNode(" ADD DEPARTMENT")
4365
4424
  ], 512 /* NEED_PATCH */),
4366
- createVNode(script$7, {
4425
+ createVNode(script$5, {
4367
4426
  headers: ['id','name','description', 'created_at'],
4368
4427
  "end-point": "admin/departments/list",
4369
4428
  actions: {
@@ -4514,7 +4573,7 @@ return (_ctx, _cache) => {
4514
4573
  createElementVNode("div", _hoisted_2$1, [
4515
4574
  _hoisted_3$1,
4516
4575
  createElementVNode("h5", null, "Department #" + toDisplayString(unref(department).id) + " - " + toDisplayString(unref(department).name) + " Allowed Modules", 1 /* TEXT */),
4517
- createVNode(script$7, {
4576
+ createVNode(script$5, {
4518
4577
  actions: {
4519
4578
  label: 'Actions',
4520
4579
  actions: [
@@ -4765,4 +4824,4 @@ const ShFrontend = {
4765
4824
  }
4766
4825
  };
4767
4826
 
4768
- export { script$9 as ShCanvas, script$3 as ShConfirmAction, script$c as ShDropDownForm, script$5 as ShDynamicTabs, script$d as ShForm, ShFrontend, script$b as ShModal, script$a as ShModalForm, script$g as ShPhone, script$4 as ShSilentAction, script$7 as ShTable, script$6 as ShTabs, shApis, shRepo, ShStorage as shStorage, useUserStore };
4827
+ export { script$9 as ShCanvas, script$7 as ShConfirmAction, script$c as ShDropDownForm, script$3 as ShDynamicTabs, script$d as ShForm, ShFrontend, script$b as ShModal, script$a as ShModalForm, script$g as ShPhone, script$6 as ShSilentAction, script$5 as ShTable, script$4 as ShTabs, shApis, shRepo, ShStorage as shStorage, useUserStore };