@iankibetsh/shframework 1.0.8 → 1.0.9

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,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,19 +31,36 @@
63
31
  opacity: 0.5;
64
32
  }
65
33
 
66
- .sh-selected-item{
67
- line-height: unset!important;
34
+ .colored-toast.swal2-icon-success {
35
+ background-color: #a5dc86 !important;
68
36
  }
69
- .sh-suggestion-input{
70
- padding: 0.375rem 0.75rem;
37
+
38
+ .colored-toast.swal2-icon-error {
39
+ background-color: #f27474 !important;
71
40
  }
72
- .sh-suggest{
73
- margin-bottom: 1rem;
41
+
42
+ .colored-toast.swal2-icon-warning {
43
+ background-color: #f8bb86 !important;
74
44
  }
75
- .sh-suggest-control::after{
76
- margin-top: auto;
77
- margin-bottom: auto;
78
- margin-right: 0.255em;
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;
79
64
  }
80
65
 
81
66
  :root {
@@ -102,3 +87,18 @@
102
87
  .sh-forgot-link, .sh-register-link{
103
88
  cursor: pointer;
104
89
  }
90
+
91
+ .sh-selected-item{
92
+ line-height: unset!important;
93
+ }
94
+ .sh-suggestion-input{
95
+ padding: 0.375rem 0.75rem;
96
+ }
97
+ .sh-suggest{
98
+ margin-bottom: 1rem;
99
+ }
100
+ .sh-suggest-control::after{
101
+ margin-top: auto;
102
+ margin-bottom: auto;
103
+ margin-right: 0.255em;
104
+ }
package/dist/library.js CHANGED
@@ -8,6 +8,8 @@ var vue = require('vue');
8
8
  var NProgress = require('nprogress');
9
9
  var Editor = require('@tinymce/tinymce-vue');
10
10
  var Swal = require('sweetalert2');
11
+ var ShConfirmAction = require('@/lib/components/ShConfirmAction.vue');
12
+ var ShSilentAction = require('@/lib/components/ShSilentAction.vue');
11
13
  var pinia = require('pinia');
12
14
  var vueRouter = require('vue-router');
13
15
 
@@ -18,6 +20,8 @@ var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
18
20
  var NProgress__default = /*#__PURE__*/_interopDefaultLegacy(NProgress);
19
21
  var Editor__default = /*#__PURE__*/_interopDefaultLegacy(Editor);
20
22
  var Swal__default = /*#__PURE__*/_interopDefaultLegacy(Swal);
23
+ var ShConfirmAction__default = /*#__PURE__*/_interopDefaultLegacy(ShConfirmAction);
24
+ var ShSilentAction__default = /*#__PURE__*/_interopDefaultLegacy(ShSilentAction);
21
25
 
22
26
  function setItem (key, value) {
23
27
  let toStore = value;
@@ -3111,7 +3115,7 @@ var shRepo = {
3111
3115
 
3112
3116
  var script$7 = {
3113
3117
  name: 'sh-table',
3114
- props: ['endPoint', 'headers', 'pageCount', 'actions', 'hideCount', 'hideLoadMore', 'links', 'reload', 'hideSearch', 'sharedData', 'searchPlaceholder', 'event', 'displayMore', 'displayMoreBtnClass', 'moreDetailsColumns', 'moreDetailsFields', 'hasDownload', 'downloadFields', 'tableHover'],
3118
+ props: ['endPoint', 'headers', 'pageCount', 'actions', 'hideCount', 'hideLoadMore', 'links', 'reload', 'hideSearch', 'sharedData', 'searchPlaceholder', 'event', 'displayMore', 'displayMoreBtnClass', 'moreDetailsColumns', 'moreDetailsFields', 'hasDownload', 'downloadFields', 'tableHover', 'hideIds'],
3115
3119
  inject: ['channel'],
3116
3120
  data () {
3117
3121
  return {
@@ -3135,15 +3139,20 @@ var script$7 = {
3135
3139
  },
3136
3140
  mounted () {
3137
3141
  if (this.event) ;
3138
- if(this.actions && this.actions.actions){
3142
+ if (this.actions && this.actions.actions) {
3139
3143
  this.actions.actions.forEach(action => {
3140
- if(action.canvasComponent){
3144
+ if (action.canvasComponent) {
3141
3145
  this.hasCanvas = true;
3142
3146
  }
3143
3147
  });
3144
3148
  }
3145
3149
  },
3146
3150
  methods: {
3151
+ cleanCanvasProps: function (actions) {
3152
+ let replaced = actions;
3153
+ replaced.class = null;
3154
+ return replaced
3155
+ },
3147
3156
  newRecordAdded: function (ev) {
3148
3157
  const record = ev.log;
3149
3158
  if (record.user) {
@@ -3151,15 +3160,15 @@ var script$7 = {
3151
3160
  }
3152
3161
  this.records.unshift(record);
3153
3162
  },
3154
- canvasClosed: function(){
3163
+ canvasClosed: function () {
3155
3164
  this.selectedRecord = null;
3156
3165
  },
3157
3166
  rowSelected: function (row) {
3158
3167
  this.selectedRecord = null;
3159
- setTimeout(()=>{
3168
+ setTimeout(() => {
3160
3169
  this.selectedRecord = row;
3161
3170
  this.$emit('rowSelected', row);
3162
- },100);
3171
+ }, 100);
3163
3172
  },
3164
3173
  changeKey: function (key, value) {
3165
3174
  this[key] = value;
@@ -3184,12 +3193,16 @@ var script$7 = {
3184
3193
  replaceActionUrl: function (path, obj) {
3185
3194
  if (path) {
3186
3195
  var matches = path.match(/\{(.*?)\}/g);
3187
- matches.forEach(key => {
3188
- key = key.replace('{', '');
3189
- key = key.replace('}', '');
3190
- path = path.replace(`{${key}}`, obj[key]);
3191
- });
3192
- return path
3196
+ try {
3197
+ matches.forEach(key => {
3198
+ key = key.replace('{', '');
3199
+ key = key.replace('}', '');
3200
+ path = path.replace(`{${key}}`, obj[key]);
3201
+ });
3202
+ return path
3203
+ } catch (e) {
3204
+ return path
3205
+ }
3193
3206
  }
3194
3207
  return ''
3195
3208
  },
@@ -3266,7 +3279,9 @@ var script$7 = {
3266
3279
  });
3267
3280
  },
3268
3281
  reloadData: function (page, append) {
3269
- if (typeof page !== 'undefined') { this.page = page; }
3282
+ if (typeof page !== 'undefined') {
3283
+ this.page = page;
3284
+ }
3270
3285
  if (!append) {
3271
3286
  this.loading = 'loading';
3272
3287
  }
@@ -3315,6 +3330,12 @@ var script$7 = {
3315
3330
  }
3316
3331
  },
3317
3332
  watch: {
3333
+ hideIds: {
3334
+ handler(newValue) {
3335
+ this.records = this.records.filter(record => !newValue.includes(record.id) && record);
3336
+ },
3337
+ deep: true
3338
+ },
3318
3339
  reload () {
3319
3340
  this.reloadData();
3320
3341
  }
@@ -3323,6 +3344,8 @@ var script$7 = {
3323
3344
  this.reloadData();
3324
3345
  },
3325
3346
  components: {
3347
+ ShSilentAction: ShSilentAction__default["default"],
3348
+ ShConfirmAction: ShConfirmAction__default["default"],
3326
3349
  ShCanvas: script$9,
3327
3350
  pagination: script$8
3328
3351
  },
@@ -3499,6 +3522,8 @@ const _hoisted_64 = ["title", "onClick"];
3499
3522
 
3500
3523
  function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3501
3524
  const _component_router_link = vue.resolveComponent("router-link");
3525
+ const _component_sh_confirm_action = vue.resolveComponent("sh-confirm-action");
3526
+ const _component_sh_silent_action = vue.resolveComponent("sh-silent-action");
3502
3527
  const _component_pagination = vue.resolveComponent("pagination");
3503
3528
  const _component_sh_canvas = vue.resolveComponent("sh-canvas");
3504
3529
 
@@ -3681,28 +3706,17 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3681
3706
  ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
3682
3707
  (!act.validator || act.validator(record))
3683
3708
  ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
3684
- (act.canvasId)
3685
- ? (vue.openBlock(), vue.createElementBlock("a", {
3709
+ (act.type === 'confirmAction')
3710
+ ? (vue.openBlock(), vue.createBlock(_component_sh_confirm_action, {
3686
3711
  key: 0,
3687
- href: '#' + act.canvasId,
3688
- "data-bs-toggle": "offcanvas",
3689
- class: vue.normalizeClass(act.class)
3690
- }, [
3691
- (act.icon)
3692
- ? (vue.openBlock(), vue.createElementBlock("span", {
3693
- key: 0,
3694
- class: vue.normalizeClass(act.icon)
3695
- }, null, 2 /* CLASS */))
3696
- : vue.createCommentVNode("v-if", true),
3697
- vue.createTextVNode(" " + vue.toDisplayString(act.label), 1 /* TEXT */)
3698
- ], 10 /* CLASS, PROPS */, _hoisted_44))
3699
- : (act.emits)
3700
- ? (vue.openBlock(), vue.createElementBlock("button", {
3701
- key: 1,
3702
- title: act.title,
3703
- class: vue.normalizeClass(act.class ? act.class:'btn btn-default'),
3704
- onClick: $event => ($options.doEmitAction(act.emits,record))
3705
- }, [
3712
+ onActionSuccessful: $event => ($options.doEmitAction('actionSuccessful',record)),
3713
+ onActionFailed: $event => ($options.doEmitAction('actionFailed',record)),
3714
+ onActionCanceled: $event => ($options.doEmitAction('actionCanceled',record)),
3715
+ "loading-message": act.label,
3716
+ class: vue.normalizeClass(act.class),
3717
+ url: $options.replaceActionUrl(act.url,record)
3718
+ }, {
3719
+ default: vue.withCtx(() => [
3706
3720
  (act.icon)
3707
3721
  ? (vue.openBlock(), vue.createElementBlock("span", {
3708
3722
  key: 0,
@@ -3710,15 +3724,52 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3710
3724
  }, null, 2 /* CLASS */))
3711
3725
  : vue.createCommentVNode("v-if", true),
3712
3726
  vue.createTextVNode(" " + vue.toDisplayString(act.label), 1 /* TEXT */)
3713
- ], 10 /* CLASS, PROPS */, _hoisted_45))
3714
- : (!act.emits)
3715
- ? (vue.openBlock(), vue.createBlock(_component_router_link, {
3727
+ ]),
3728
+ _: 2 /* DYNAMIC */
3729
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["onActionSuccessful", "onActionFailed", "onActionCanceled", "loading-message", "class", "url"]))
3730
+ : (act.type === 'silentAction')
3731
+ ? (vue.openBlock(), vue.createBlock(_component_sh_silent_action, {
3732
+ key: 1,
3733
+ onActionSuccessful: $event => ($options.doEmitAction('actionSuccessful',record)),
3734
+ onActionFailed: $event => ($options.doEmitAction('actionFailed',record)),
3735
+ onActionCanceled: $event => ($options.doEmitAction('actionCanceled',record)),
3736
+ "loading-message": act.label,
3737
+ class: vue.normalizeClass(act.class),
3738
+ url: $options.replaceActionUrl(act.url,record)
3739
+ }, {
3740
+ default: vue.withCtx(() => [
3741
+ (act.icon)
3742
+ ? (vue.openBlock(), vue.createElementBlock("span", {
3743
+ key: 0,
3744
+ class: vue.normalizeClass(act.icon)
3745
+ }, null, 2 /* CLASS */))
3746
+ : vue.createCommentVNode("v-if", true),
3747
+ vue.createTextVNode(" " + vue.toDisplayString(act.label), 1 /* TEXT */)
3748
+ ]),
3749
+ _: 2 /* DYNAMIC */
3750
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["onActionSuccessful", "onActionFailed", "onActionCanceled", "loading-message", "class", "url"]))
3751
+ : (act.canvasId)
3752
+ ? (vue.openBlock(), vue.createElementBlock("a", {
3716
3753
  key: 2,
3717
- title: act.title,
3718
- to: $options.replaceActionUrl(act.path,record),
3754
+ href: '#' + act.canvasId,
3755
+ "data-bs-toggle": "offcanvas",
3719
3756
  class: vue.normalizeClass(act.class)
3720
- }, {
3721
- default: vue.withCtx(() => [
3757
+ }, [
3758
+ (act.icon)
3759
+ ? (vue.openBlock(), vue.createElementBlock("span", {
3760
+ key: 0,
3761
+ class: vue.normalizeClass(act.icon)
3762
+ }, null, 2 /* CLASS */))
3763
+ : vue.createCommentVNode("v-if", true),
3764
+ vue.createTextVNode(" " + vue.toDisplayString(act.label), 1 /* TEXT */)
3765
+ ], 10 /* CLASS, PROPS */, _hoisted_44))
3766
+ : (act.emits)
3767
+ ? (vue.openBlock(), vue.createElementBlock("button", {
3768
+ key: 3,
3769
+ title: act.title,
3770
+ class: vue.normalizeClass(act.class ? act.class:'btn btn-default'),
3771
+ onClick: $event => ($options.doEmitAction(act.emits,record))
3772
+ }, [
3722
3773
  (act.icon)
3723
3774
  ? (vue.openBlock(), vue.createElementBlock("span", {
3724
3775
  key: 0,
@@ -3726,10 +3777,26 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3726
3777
  }, null, 2 /* CLASS */))
3727
3778
  : vue.createCommentVNode("v-if", true),
3728
3779
  vue.createTextVNode(" " + vue.toDisplayString(act.label), 1 /* TEXT */)
3729
- ]),
3730
- _: 2 /* DYNAMIC */
3731
- }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["title", "to", "class"]))
3732
- : vue.createCommentVNode("v-if", true)
3780
+ ], 10 /* CLASS, PROPS */, _hoisted_45))
3781
+ : (!act.emits)
3782
+ ? (vue.openBlock(), vue.createBlock(_component_router_link, {
3783
+ key: 4,
3784
+ title: act.title,
3785
+ to: $options.replaceActionUrl(act.path,record),
3786
+ class: vue.normalizeClass(act.class)
3787
+ }, {
3788
+ default: vue.withCtx(() => [
3789
+ (act.icon)
3790
+ ? (vue.openBlock(), vue.createElementBlock("span", {
3791
+ key: 0,
3792
+ class: vue.normalizeClass(act.icon)
3793
+ }, null, 2 /* CLASS */))
3794
+ : vue.createCommentVNode("v-if", true),
3795
+ vue.createTextVNode(" " + vue.toDisplayString(act.label), 1 /* TEXT */)
3796
+ ]),
3797
+ _: 2 /* DYNAMIC */
3798
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["title", "to", "class"]))
3799
+ : vue.createCommentVNode("v-if", true)
3733
3800
  ], 64 /* STABLE_FRAGMENT */))
3734
3801
  : vue.createCommentVNode("v-if", true)
3735
3802
  ], 64 /* STABLE_FRAGMENT */))
@@ -3753,69 +3820,81 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3753
3820
  : ($data.loading === 'done')
3754
3821
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_51, [
3755
3822
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($data.records, (record, index) => {
3756
- return (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
3757
- key: record.id
3823
+ return (vue.openBlock(), vue.createElementBlock("div", {
3824
+ key: record.id,
3825
+ class: "single-mobile-req bg-light p-3",
3826
+ onClick: $event => ($options.rowSelected(record))
3758
3827
  }, [
3759
- vue.createElementVNode("h3", null, vue.toDisplayString(_ctx.mobile_view), 1 /* TEXT */),
3760
- vue.createElementVNode("div", {
3761
- class: "single-mobile-req bg-light p-3",
3762
- onClick: $event => ($options.rowSelected(record))
3763
- }, [
3764
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.headers, (key) => {
3765
- return (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
3766
- key: key[0]
3767
- }, [
3768
- (typeof key === 'string' )
3769
- ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_53, vue.toDisplayString(key.replace(/_/g, ' ')), 1 /* TEXT */))
3770
- : (typeof key === 'function')
3771
- ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_54, vue.toDisplayString(key(null).replace(/_/g, ' ')), 1 /* TEXT */))
3772
- : (vue.openBlock(), vue.createElementBlock("p", _hoisted_55, vue.toDisplayString(key[1].replace(/_/g, ' ')), 1 /* TEXT */)),
3773
- vue.createElementVNode("span", null, [
3774
- (typeof key === 'string' && $props.links && $props.links[key])
3775
- ? (vue.openBlock(), vue.createBlock(_component_router_link, {
3776
- key: 0,
3777
- to: $options.replaceLinkUrl($props.links[key],record),
3778
- class: vue.normalizeClass($options.getLinkClass($props.links[key])),
3779
- innerHTML: record[key]
3780
- }, null, 8 /* PROPS */, ["to", "class", "innerHTML"]))
3781
- : ($options.getFieldType(key) === 'numeric')
3782
- ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_56, vue.toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3783
- : ($options.getFieldType(key) === 'money')
3784
- ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_57, "KES " + vue.toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3785
- : (typeof key === 'string')
3828
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.headers, (key) => {
3829
+ return (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
3830
+ key: key[0]
3831
+ }, [
3832
+ (typeof key === 'string' )
3833
+ ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_53, vue.toDisplayString(key.replace(/_/g, ' ')), 1 /* TEXT */))
3834
+ : (typeof key === 'function')
3835
+ ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_54, vue.toDisplayString(key(null).replace(/_/g, ' ')), 1 /* TEXT */))
3836
+ : (vue.openBlock(), vue.createElementBlock("p", _hoisted_55, vue.toDisplayString(key[1].replace(/_/g, ' ')), 1 /* TEXT */)),
3837
+ vue.createElementVNode("span", null, [
3838
+ (typeof key === 'string' && $props.links && $props.links[key])
3839
+ ? (vue.openBlock(), vue.createBlock(_component_router_link, {
3840
+ key: 0,
3841
+ to: $options.replaceLinkUrl($props.links[key],record),
3842
+ class: vue.normalizeClass($options.getLinkClass($props.links[key])),
3843
+ innerHTML: record[key]
3844
+ }, null, 8 /* PROPS */, ["to", "class", "innerHTML"]))
3845
+ : ($options.getFieldType(key) === 'numeric')
3846
+ ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_56, vue.toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3847
+ : ($options.getFieldType(key) === 'money')
3848
+ ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_57, "KES " + vue.toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3849
+ : (typeof key === 'string')
3850
+ ? (vue.openBlock(), vue.createElementBlock("span", {
3851
+ key: 3,
3852
+ innerHTML: record[key]
3853
+ }, null, 8 /* PROPS */, _hoisted_58))
3854
+ : (typeof key === 'function')
3786
3855
  ? (vue.openBlock(), vue.createElementBlock("span", {
3787
- key: 3,
3788
- innerHTML: record[key]
3789
- }, null, 8 /* PROPS */, _hoisted_58))
3790
- : (typeof key === 'function')
3791
- ? (vue.openBlock(), vue.createElementBlock("span", {
3792
- key: 4,
3793
- innerHTML: key(record, index )
3794
- }, null, 8 /* PROPS */, _hoisted_59))
3795
- : (vue.openBlock(), vue.createElementBlock("span", {
3796
- key: 5,
3797
- innerHTML: record[key[0]]
3798
- }, null, 8 /* PROPS */, _hoisted_60))
3799
- ]),
3800
- _hoisted_61
3801
- ], 64 /* STABLE_FRAGMENT */))
3802
- }), 128 /* KEYED_FRAGMENT */)),
3803
- ($props.actions)
3804
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_62, [
3805
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.actions.actions, (act) => {
3806
- return (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
3807
- key: act.path
3808
- }, [
3809
- (!act.permission || $options.user.isAllowedTo(act.permission))
3810
- ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
3811
- (!act.validator || act.validator(record))
3812
- ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
3813
- (act.canvasId)
3814
- ? (vue.openBlock(), vue.createElementBlock("a", {
3815
- key: 0,
3816
- href: '#' + act.canvasId,
3817
- "data-bs-toggle": "offcanvas",
3818
- class: vue.normalizeClass(act.class)
3856
+ key: 4,
3857
+ innerHTML: key(record, index )
3858
+ }, null, 8 /* PROPS */, _hoisted_59))
3859
+ : (vue.openBlock(), vue.createElementBlock("span", {
3860
+ key: 5,
3861
+ innerHTML: record[key[0]]
3862
+ }, null, 8 /* PROPS */, _hoisted_60))
3863
+ ]),
3864
+ _hoisted_61
3865
+ ], 64 /* STABLE_FRAGMENT */))
3866
+ }), 128 /* KEYED_FRAGMENT */)),
3867
+ ($props.actions)
3868
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_62, [
3869
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.actions.actions, (act) => {
3870
+ return (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
3871
+ key: act.path
3872
+ }, [
3873
+ (!act.permission || $options.user.isAllowedTo(act.permission))
3874
+ ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
3875
+ (!act.validator || act.validator(record))
3876
+ ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
3877
+ (act.canvasId)
3878
+ ? (vue.openBlock(), vue.createElementBlock("a", {
3879
+ key: 0,
3880
+ href: '#' + act.canvasId,
3881
+ "data-bs-toggle": "offcanvas",
3882
+ class: vue.normalizeClass(act.class)
3883
+ }, [
3884
+ (act.icon)
3885
+ ? (vue.openBlock(), vue.createElementBlock("span", {
3886
+ key: 0,
3887
+ class: vue.normalizeClass(act.icon)
3888
+ }, null, 2 /* CLASS */))
3889
+ : vue.createCommentVNode("v-if", true),
3890
+ vue.createTextVNode(" " + vue.toDisplayString(act.label), 1 /* TEXT */)
3891
+ ], 10 /* CLASS, PROPS */, _hoisted_63))
3892
+ : (act.emits)
3893
+ ? (vue.openBlock(), vue.createElementBlock("button", {
3894
+ key: 1,
3895
+ title: act.title,
3896
+ class: vue.normalizeClass(act.class ? act.class:'btn btn-default'),
3897
+ onClick: $event => ($options.doEmitAction(act.emits,record))
3819
3898
  }, [
3820
3899
  (act.icon)
3821
3900
  ? (vue.openBlock(), vue.createElementBlock("span", {
@@ -3824,51 +3903,35 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3824
3903
  }, null, 2 /* CLASS */))
3825
3904
  : vue.createCommentVNode("v-if", true),
3826
3905
  vue.createTextVNode(" " + vue.toDisplayString(act.label), 1 /* TEXT */)
3827
- ], 10 /* CLASS, PROPS */, _hoisted_63))
3828
- : (act.emits)
3829
- ? (vue.openBlock(), vue.createElementBlock("button", {
3830
- key: 1,
3906
+ ], 10 /* CLASS, PROPS */, _hoisted_64))
3907
+ : (!act.emits)
3908
+ ? (vue.openBlock(), vue.createBlock(_component_router_link, {
3909
+ key: 2,
3831
3910
  title: act.title,
3832
- class: vue.normalizeClass(act.class ? act.class:'btn btn-default'),
3833
- onClick: $event => ($options.doEmitAction(act.emits,record))
3834
- }, [
3835
- (act.icon)
3836
- ? (vue.openBlock(), vue.createElementBlock("span", {
3837
- key: 0,
3838
- class: vue.normalizeClass(act.icon)
3839
- }, null, 2 /* CLASS */))
3840
- : vue.createCommentVNode("v-if", true),
3841
- vue.createTextVNode(" " + vue.toDisplayString(act.label), 1 /* TEXT */)
3842
- ], 10 /* CLASS, PROPS */, _hoisted_64))
3843
- : (!act.emits)
3844
- ? (vue.openBlock(), vue.createBlock(_component_router_link, {
3845
- key: 2,
3846
- title: act.title,
3847
- to: $options.replaceActionUrl(act.path,record),
3848
- class: vue.normalizeClass(act.class)
3849
- }, {
3850
- default: vue.withCtx(() => [
3851
- (act.icon)
3852
- ? (vue.openBlock(), vue.createElementBlock("span", {
3853
- key: 0,
3854
- class: vue.normalizeClass(act.icon)
3855
- }, null, 2 /* CLASS */))
3856
- : vue.createCommentVNode("v-if", true),
3857
- vue.createTextVNode(" " + vue.toDisplayString(act.label), 1 /* TEXT */)
3858
- ]),
3859
- _: 2 /* DYNAMIC */
3860
- }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["title", "to", "class"]))
3861
- : vue.createCommentVNode("v-if", true)
3862
- ], 64 /* STABLE_FRAGMENT */))
3863
- : vue.createCommentVNode("v-if", true)
3864
- ], 64 /* STABLE_FRAGMENT */))
3865
- : vue.createCommentVNode("v-if", true)
3866
- ], 64 /* STABLE_FRAGMENT */))
3867
- }), 128 /* KEYED_FRAGMENT */))
3868
- ]))
3869
- : vue.createCommentVNode("v-if", true)
3870
- ], 8 /* PROPS */, _hoisted_52)
3871
- ], 64 /* STABLE_FRAGMENT */))
3911
+ to: $options.replaceActionUrl(act.path,record),
3912
+ class: vue.normalizeClass(act.class)
3913
+ }, {
3914
+ default: vue.withCtx(() => [
3915
+ (act.icon)
3916
+ ? (vue.openBlock(), vue.createElementBlock("span", {
3917
+ key: 0,
3918
+ class: vue.normalizeClass(act.icon)
3919
+ }, null, 2 /* CLASS */))
3920
+ : vue.createCommentVNode("v-if", true),
3921
+ vue.createTextVNode(" " + vue.toDisplayString(act.label), 1 /* TEXT */)
3922
+ ]),
3923
+ _: 2 /* DYNAMIC */
3924
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["title", "to", "class"]))
3925
+ : vue.createCommentVNode("v-if", true)
3926
+ ], 64 /* STABLE_FRAGMENT */))
3927
+ : vue.createCommentVNode("v-if", true)
3928
+ ], 64 /* STABLE_FRAGMENT */))
3929
+ : vue.createCommentVNode("v-if", true)
3930
+ ], 64 /* STABLE_FRAGMENT */))
3931
+ }), 128 /* KEYED_FRAGMENT */))
3932
+ ]))
3933
+ : vue.createCommentVNode("v-if", true)
3934
+ ], 8 /* PROPS */, _hoisted_52))
3872
3935
  }), 128 /* KEYED_FRAGMENT */))
3873
3936
  ]))
3874
3937
  : vue.createCommentVNode("v-if", true)
@@ -3900,7 +3963,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3900
3963
  }, {
3901
3964
  default: vue.withCtx(() => [
3902
3965
  ($data.selectedRecord)
3903
- ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(action.canvasComponent), vue.mergeProps({ key: 0 }, action, { record: $data.selectedRecord }), null, 16 /* FULL_PROPS */, ["record"]))
3966
+ ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(action.canvasComponent), vue.mergeProps({ key: 0 }, $options.cleanCanvasProps(action), { record: $data.selectedRecord }), null, 16 /* FULL_PROPS */, ["record"]))
3904
3967
  : vue.createCommentVNode("v-if", true)
3905
3968
  ]),
3906
3969
  _: 2 /* DYNAMIC */
package/dist/library.mjs CHANGED
@@ -4,6 +4,8 @@ import { inject, openBlock, createElementBlock, createElementVNode, createTextVN
4
4
  import NProgress from 'nprogress';
5
5
  import Editor from '@tinymce/tinymce-vue';
6
6
  import Swal from 'sweetalert2';
7
+ import ShConfirmAction from '@/lib/components/ShConfirmAction.vue';
8
+ import ShSilentAction from '@/lib/components/ShSilentAction.vue';
7
9
  import { defineStore, storeToRefs } from 'pinia';
8
10
  import { useRoute, useRouter } from 'vue-router';
9
11
 
@@ -3099,7 +3101,7 @@ var shRepo = {
3099
3101
 
3100
3102
  var script$7 = {
3101
3103
  name: 'sh-table',
3102
- props: ['endPoint', 'headers', 'pageCount', 'actions', 'hideCount', 'hideLoadMore', 'links', 'reload', 'hideSearch', 'sharedData', 'searchPlaceholder', 'event', 'displayMore', 'displayMoreBtnClass', 'moreDetailsColumns', 'moreDetailsFields', 'hasDownload', 'downloadFields', 'tableHover'],
3104
+ props: ['endPoint', 'headers', 'pageCount', 'actions', 'hideCount', 'hideLoadMore', 'links', 'reload', 'hideSearch', 'sharedData', 'searchPlaceholder', 'event', 'displayMore', 'displayMoreBtnClass', 'moreDetailsColumns', 'moreDetailsFields', 'hasDownload', 'downloadFields', 'tableHover', 'hideIds'],
3103
3105
  inject: ['channel'],
3104
3106
  data () {
3105
3107
  return {
@@ -3123,15 +3125,20 @@ var script$7 = {
3123
3125
  },
3124
3126
  mounted () {
3125
3127
  if (this.event) ;
3126
- if(this.actions && this.actions.actions){
3128
+ if (this.actions && this.actions.actions) {
3127
3129
  this.actions.actions.forEach(action => {
3128
- if(action.canvasComponent){
3130
+ if (action.canvasComponent) {
3129
3131
  this.hasCanvas = true;
3130
3132
  }
3131
3133
  });
3132
3134
  }
3133
3135
  },
3134
3136
  methods: {
3137
+ cleanCanvasProps: function (actions) {
3138
+ let replaced = actions;
3139
+ replaced.class = null;
3140
+ return replaced
3141
+ },
3135
3142
  newRecordAdded: function (ev) {
3136
3143
  const record = ev.log;
3137
3144
  if (record.user) {
@@ -3139,15 +3146,15 @@ var script$7 = {
3139
3146
  }
3140
3147
  this.records.unshift(record);
3141
3148
  },
3142
- canvasClosed: function(){
3149
+ canvasClosed: function () {
3143
3150
  this.selectedRecord = null;
3144
3151
  },
3145
3152
  rowSelected: function (row) {
3146
3153
  this.selectedRecord = null;
3147
- setTimeout(()=>{
3154
+ setTimeout(() => {
3148
3155
  this.selectedRecord = row;
3149
3156
  this.$emit('rowSelected', row);
3150
- },100);
3157
+ }, 100);
3151
3158
  },
3152
3159
  changeKey: function (key, value) {
3153
3160
  this[key] = value;
@@ -3172,12 +3179,16 @@ var script$7 = {
3172
3179
  replaceActionUrl: function (path, obj) {
3173
3180
  if (path) {
3174
3181
  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
3182
+ try {
3183
+ matches.forEach(key => {
3184
+ key = key.replace('{', '');
3185
+ key = key.replace('}', '');
3186
+ path = path.replace(`{${key}}`, obj[key]);
3187
+ });
3188
+ return path
3189
+ } catch (e) {
3190
+ return path
3191
+ }
3181
3192
  }
3182
3193
  return ''
3183
3194
  },
@@ -3254,7 +3265,9 @@ var script$7 = {
3254
3265
  });
3255
3266
  },
3256
3267
  reloadData: function (page, append) {
3257
- if (typeof page !== 'undefined') { this.page = page; }
3268
+ if (typeof page !== 'undefined') {
3269
+ this.page = page;
3270
+ }
3258
3271
  if (!append) {
3259
3272
  this.loading = 'loading';
3260
3273
  }
@@ -3303,6 +3316,12 @@ var script$7 = {
3303
3316
  }
3304
3317
  },
3305
3318
  watch: {
3319
+ hideIds: {
3320
+ handler(newValue) {
3321
+ this.records = this.records.filter(record => !newValue.includes(record.id) && record);
3322
+ },
3323
+ deep: true
3324
+ },
3306
3325
  reload () {
3307
3326
  this.reloadData();
3308
3327
  }
@@ -3311,6 +3330,8 @@ var script$7 = {
3311
3330
  this.reloadData();
3312
3331
  },
3313
3332
  components: {
3333
+ ShSilentAction,
3334
+ ShConfirmAction,
3314
3335
  ShCanvas: script$9,
3315
3336
  pagination: script$8
3316
3337
  },
@@ -3487,6 +3508,8 @@ const _hoisted_64 = ["title", "onClick"];
3487
3508
 
3488
3509
  function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3489
3510
  const _component_router_link = resolveComponent("router-link");
3511
+ const _component_sh_confirm_action = resolveComponent("sh-confirm-action");
3512
+ const _component_sh_silent_action = resolveComponent("sh-silent-action");
3490
3513
  const _component_pagination = resolveComponent("pagination");
3491
3514
  const _component_sh_canvas = resolveComponent("sh-canvas");
3492
3515
 
@@ -3669,28 +3692,17 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3669
3692
  ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3670
3693
  (!act.validator || act.validator(record))
3671
3694
  ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3672
- (act.canvasId)
3673
- ? (openBlock(), createElementBlock("a", {
3695
+ (act.type === 'confirmAction')
3696
+ ? (openBlock(), createBlock(_component_sh_confirm_action, {
3674
3697
  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
- }, [
3698
+ onActionSuccessful: $event => ($options.doEmitAction('actionSuccessful',record)),
3699
+ onActionFailed: $event => ($options.doEmitAction('actionFailed',record)),
3700
+ onActionCanceled: $event => ($options.doEmitAction('actionCanceled',record)),
3701
+ "loading-message": act.label,
3702
+ class: normalizeClass(act.class),
3703
+ url: $options.replaceActionUrl(act.url,record)
3704
+ }, {
3705
+ default: withCtx(() => [
3694
3706
  (act.icon)
3695
3707
  ? (openBlock(), createElementBlock("span", {
3696
3708
  key: 0,
@@ -3698,15 +3710,52 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3698
3710
  }, null, 2 /* CLASS */))
3699
3711
  : createCommentVNode("v-if", true),
3700
3712
  createTextVNode(" " + toDisplayString(act.label), 1 /* TEXT */)
3701
- ], 10 /* CLASS, PROPS */, _hoisted_45))
3702
- : (!act.emits)
3703
- ? (openBlock(), createBlock(_component_router_link, {
3713
+ ]),
3714
+ _: 2 /* DYNAMIC */
3715
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["onActionSuccessful", "onActionFailed", "onActionCanceled", "loading-message", "class", "url"]))
3716
+ : (act.type === 'silentAction')
3717
+ ? (openBlock(), createBlock(_component_sh_silent_action, {
3718
+ key: 1,
3719
+ onActionSuccessful: $event => ($options.doEmitAction('actionSuccessful',record)),
3720
+ onActionFailed: $event => ($options.doEmitAction('actionFailed',record)),
3721
+ onActionCanceled: $event => ($options.doEmitAction('actionCanceled',record)),
3722
+ "loading-message": act.label,
3723
+ class: normalizeClass(act.class),
3724
+ url: $options.replaceActionUrl(act.url,record)
3725
+ }, {
3726
+ default: withCtx(() => [
3727
+ (act.icon)
3728
+ ? (openBlock(), createElementBlock("span", {
3729
+ key: 0,
3730
+ class: normalizeClass(act.icon)
3731
+ }, null, 2 /* CLASS */))
3732
+ : createCommentVNode("v-if", true),
3733
+ createTextVNode(" " + toDisplayString(act.label), 1 /* TEXT */)
3734
+ ]),
3735
+ _: 2 /* DYNAMIC */
3736
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["onActionSuccessful", "onActionFailed", "onActionCanceled", "loading-message", "class", "url"]))
3737
+ : (act.canvasId)
3738
+ ? (openBlock(), createElementBlock("a", {
3704
3739
  key: 2,
3705
- title: act.title,
3706
- to: $options.replaceActionUrl(act.path,record),
3740
+ href: '#' + act.canvasId,
3741
+ "data-bs-toggle": "offcanvas",
3707
3742
  class: normalizeClass(act.class)
3708
- }, {
3709
- default: withCtx(() => [
3743
+ }, [
3744
+ (act.icon)
3745
+ ? (openBlock(), createElementBlock("span", {
3746
+ key: 0,
3747
+ class: normalizeClass(act.icon)
3748
+ }, null, 2 /* CLASS */))
3749
+ : createCommentVNode("v-if", true),
3750
+ createTextVNode(" " + toDisplayString(act.label), 1 /* TEXT */)
3751
+ ], 10 /* CLASS, PROPS */, _hoisted_44))
3752
+ : (act.emits)
3753
+ ? (openBlock(), createElementBlock("button", {
3754
+ key: 3,
3755
+ title: act.title,
3756
+ class: normalizeClass(act.class ? act.class:'btn btn-default'),
3757
+ onClick: $event => ($options.doEmitAction(act.emits,record))
3758
+ }, [
3710
3759
  (act.icon)
3711
3760
  ? (openBlock(), createElementBlock("span", {
3712
3761
  key: 0,
@@ -3714,10 +3763,26 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3714
3763
  }, null, 2 /* CLASS */))
3715
3764
  : createCommentVNode("v-if", true),
3716
3765
  createTextVNode(" " + toDisplayString(act.label), 1 /* TEXT */)
3717
- ]),
3718
- _: 2 /* DYNAMIC */
3719
- }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["title", "to", "class"]))
3720
- : createCommentVNode("v-if", true)
3766
+ ], 10 /* CLASS, PROPS */, _hoisted_45))
3767
+ : (!act.emits)
3768
+ ? (openBlock(), createBlock(_component_router_link, {
3769
+ key: 4,
3770
+ title: act.title,
3771
+ to: $options.replaceActionUrl(act.path,record),
3772
+ class: normalizeClass(act.class)
3773
+ }, {
3774
+ default: withCtx(() => [
3775
+ (act.icon)
3776
+ ? (openBlock(), createElementBlock("span", {
3777
+ key: 0,
3778
+ class: normalizeClass(act.icon)
3779
+ }, null, 2 /* CLASS */))
3780
+ : createCommentVNode("v-if", true),
3781
+ createTextVNode(" " + toDisplayString(act.label), 1 /* TEXT */)
3782
+ ]),
3783
+ _: 2 /* DYNAMIC */
3784
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["title", "to", "class"]))
3785
+ : createCommentVNode("v-if", true)
3721
3786
  ], 64 /* STABLE_FRAGMENT */))
3722
3787
  : createCommentVNode("v-if", true)
3723
3788
  ], 64 /* STABLE_FRAGMENT */))
@@ -3741,69 +3806,81 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3741
3806
  : ($data.loading === 'done')
3742
3807
  ? (openBlock(), createElementBlock("div", _hoisted_51, [
3743
3808
  (openBlock(true), createElementBlock(Fragment, null, renderList($data.records, (record, index) => {
3744
- return (openBlock(), createElementBlock(Fragment, {
3745
- key: record.id
3809
+ return (openBlock(), createElementBlock("div", {
3810
+ key: record.id,
3811
+ class: "single-mobile-req bg-light p-3",
3812
+ onClick: $event => ($options.rowSelected(record))
3746
3813
  }, [
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')
3814
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.headers, (key) => {
3815
+ return (openBlock(), createElementBlock(Fragment, {
3816
+ key: key[0]
3817
+ }, [
3818
+ (typeof key === 'string' )
3819
+ ? (openBlock(), createElementBlock("p", _hoisted_53, toDisplayString(key.replace(/_/g, ' ')), 1 /* TEXT */))
3820
+ : (typeof key === 'function')
3821
+ ? (openBlock(), createElementBlock("p", _hoisted_54, toDisplayString(key(null).replace(/_/g, ' ')), 1 /* TEXT */))
3822
+ : (openBlock(), createElementBlock("p", _hoisted_55, toDisplayString(key[1].replace(/_/g, ' ')), 1 /* TEXT */)),
3823
+ createElementVNode("span", null, [
3824
+ (typeof key === 'string' && $props.links && $props.links[key])
3825
+ ? (openBlock(), createBlock(_component_router_link, {
3826
+ key: 0,
3827
+ to: $options.replaceLinkUrl($props.links[key],record),
3828
+ class: normalizeClass($options.getLinkClass($props.links[key])),
3829
+ innerHTML: record[key]
3830
+ }, null, 8 /* PROPS */, ["to", "class", "innerHTML"]))
3831
+ : ($options.getFieldType(key) === 'numeric')
3832
+ ? (openBlock(), createElementBlock("span", _hoisted_56, toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3833
+ : ($options.getFieldType(key) === 'money')
3834
+ ? (openBlock(), createElementBlock("span", _hoisted_57, "KES " + toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
3835
+ : (typeof key === 'string')
3836
+ ? (openBlock(), createElementBlock("span", {
3837
+ key: 3,
3838
+ innerHTML: record[key]
3839
+ }, null, 8 /* PROPS */, _hoisted_58))
3840
+ : (typeof key === 'function')
3774
3841
  ? (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)
3842
+ key: 4,
3843
+ innerHTML: key(record, index )
3844
+ }, null, 8 /* PROPS */, _hoisted_59))
3845
+ : (openBlock(), createElementBlock("span", {
3846
+ key: 5,
3847
+ innerHTML: record[key[0]]
3848
+ }, null, 8 /* PROPS */, _hoisted_60))
3849
+ ]),
3850
+ _hoisted_61
3851
+ ], 64 /* STABLE_FRAGMENT */))
3852
+ }), 128 /* KEYED_FRAGMENT */)),
3853
+ ($props.actions)
3854
+ ? (openBlock(), createElementBlock("div", _hoisted_62, [
3855
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.actions.actions, (act) => {
3856
+ return (openBlock(), createElementBlock(Fragment, {
3857
+ key: act.path
3858
+ }, [
3859
+ (!act.permission || $options.user.isAllowedTo(act.permission))
3860
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3861
+ (!act.validator || act.validator(record))
3862
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3863
+ (act.canvasId)
3864
+ ? (openBlock(), createElementBlock("a", {
3865
+ key: 0,
3866
+ href: '#' + act.canvasId,
3867
+ "data-bs-toggle": "offcanvas",
3868
+ class: normalizeClass(act.class)
3869
+ }, [
3870
+ (act.icon)
3871
+ ? (openBlock(), createElementBlock("span", {
3872
+ key: 0,
3873
+ class: normalizeClass(act.icon)
3874
+ }, null, 2 /* CLASS */))
3875
+ : createCommentVNode("v-if", true),
3876
+ createTextVNode(" " + toDisplayString(act.label), 1 /* TEXT */)
3877
+ ], 10 /* CLASS, PROPS */, _hoisted_63))
3878
+ : (act.emits)
3879
+ ? (openBlock(), createElementBlock("button", {
3880
+ key: 1,
3881
+ title: act.title,
3882
+ class: normalizeClass(act.class ? act.class:'btn btn-default'),
3883
+ onClick: $event => ($options.doEmitAction(act.emits,record))
3807
3884
  }, [
3808
3885
  (act.icon)
3809
3886
  ? (openBlock(), createElementBlock("span", {
@@ -3812,51 +3889,35 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3812
3889
  }, null, 2 /* CLASS */))
3813
3890
  : createCommentVNode("v-if", true),
3814
3891
  createTextVNode(" " + toDisplayString(act.label), 1 /* TEXT */)
3815
- ], 10 /* CLASS, PROPS */, _hoisted_63))
3816
- : (act.emits)
3817
- ? (openBlock(), createElementBlock("button", {
3818
- key: 1,
3892
+ ], 10 /* CLASS, PROPS */, _hoisted_64))
3893
+ : (!act.emits)
3894
+ ? (openBlock(), createBlock(_component_router_link, {
3895
+ key: 2,
3819
3896
  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 */))
3897
+ to: $options.replaceActionUrl(act.path,record),
3898
+ class: normalizeClass(act.class)
3899
+ }, {
3900
+ default: withCtx(() => [
3901
+ (act.icon)
3902
+ ? (openBlock(), createElementBlock("span", {
3903
+ key: 0,
3904
+ class: normalizeClass(act.icon)
3905
+ }, null, 2 /* CLASS */))
3906
+ : createCommentVNode("v-if", true),
3907
+ createTextVNode(" " + toDisplayString(act.label), 1 /* TEXT */)
3908
+ ]),
3909
+ _: 2 /* DYNAMIC */
3910
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["title", "to", "class"]))
3911
+ : createCommentVNode("v-if", true)
3912
+ ], 64 /* STABLE_FRAGMENT */))
3913
+ : createCommentVNode("v-if", true)
3914
+ ], 64 /* STABLE_FRAGMENT */))
3915
+ : createCommentVNode("v-if", true)
3916
+ ], 64 /* STABLE_FRAGMENT */))
3917
+ }), 128 /* KEYED_FRAGMENT */))
3918
+ ]))
3919
+ : createCommentVNode("v-if", true)
3920
+ ], 8 /* PROPS */, _hoisted_52))
3860
3921
  }), 128 /* KEYED_FRAGMENT */))
3861
3922
  ]))
3862
3923
  : createCommentVNode("v-if", true)
@@ -3888,7 +3949,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3888
3949
  }, {
3889
3950
  default: withCtx(() => [
3890
3951
  ($data.selectedRecord)
3891
- ? (openBlock(), createBlock(resolveDynamicComponent(action.canvasComponent), mergeProps({ key: 0 }, action, { record: $data.selectedRecord }), null, 16 /* FULL_PROPS */, ["record"]))
3952
+ ? (openBlock(), createBlock(resolveDynamicComponent(action.canvasComponent), mergeProps({ key: 0 }, $options.cleanCanvasProps(action), { record: $data.selectedRecord }), null, 16 /* FULL_PROPS */, ["record"]))
3892
3953
  : createCommentVNode("v-if", true)
3893
3954
  ]),
3894
3955
  _: 2 /* DYNAMIC */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/shframework",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Vue library for handling laravel backend",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.mjs",