@iankibetsh/shframework 4.8.9 → 5.0.2

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.js CHANGED
@@ -4405,13 +4405,13 @@ const _hoisted_2$b = ["title"];
4405
4405
 
4406
4406
  var script$h = {
4407
4407
  __name: 'SingleAction',
4408
- props: ['action','record','actionClass'],
4409
- emits: ['actionSuccessful','actionFailed','actionCanceled'],
4410
- setup(__props, { emit: __emit }) {
4408
+ props: ['action','record','actionClass','emitAction'],
4409
+ setup(__props) {
4411
4410
 
4412
4411
  const props = __props;
4413
4412
 
4414
- const doEmitAction = __emit;
4413
+
4414
+
4415
4415
 
4416
4416
  const url = vue.ref(props.action.path || props.action.url || props.action.link);
4417
4417
 
@@ -4431,11 +4431,13 @@ vue.onMounted(()=>{
4431
4431
  });
4432
4432
 
4433
4433
 
4434
- const actionClicked = callBack=>{
4434
+
4435
+
4436
+ const doEmitAction = (callBack,item)=>{
4435
4437
  if(typeof callBack === 'function'){
4436
4438
  callBack(props.record);
4437
4439
  } else {
4438
- doEmitAction(callBack,props.record);
4440
+ props.emitAction(callBack,item);
4439
4441
  }
4440
4442
  };
4441
4443
 
@@ -4510,7 +4512,7 @@ return (_ctx, _cache) => {
4510
4512
  key: 3,
4511
4513
  title: __props.action.title,
4512
4514
  class: vue.normalizeClass(__props.action.class ? __props.action.class:'btn btn-default' + __props.actionClass),
4513
- onClick: _cache[6] || (_cache[6] = $event => (actionClicked(__props.action.emits)))
4515
+ onClick: _cache[6] || (_cache[6] = $event => (doEmitAction(__props.action.emits, __props.record)))
4514
4516
  }, [
4515
4517
  (__props.action.icon)
4516
4518
  ? (vue.openBlock(), vue.createElementBlock("span", {
@@ -4561,11 +4563,11 @@ const _hoisted_2$a = {
4561
4563
  "aria-expanded": "false"
4562
4564
  };
4563
4565
  const _hoisted_3$9 = {
4564
- key: 0,
4566
+ key: 1,
4565
4567
  class: "bi bi-three-dots"
4566
4568
  };
4567
4569
  const _hoisted_4$9 = {
4568
- key: 1,
4570
+ key: 2,
4569
4571
  class: "bi bi-three-dots-vertical"
4570
4572
  };
4571
4573
  const _hoisted_5$8 = { class: "dropdown-menu" };
@@ -4573,21 +4575,27 @@ const _hoisted_5$8 = { class: "dropdown-menu" };
4573
4575
 
4574
4576
  var script$g = {
4575
4577
  __name: 'TableActions',
4576
- props: ['actions','record'],
4578
+ props: ['actions','record','emitAction'],
4577
4579
  setup(__props) {
4578
4580
 
4579
4581
  const props = __props;
4580
4582
 
4581
4583
  const actionItems = props.actions.actions;
4582
4584
  const type = props.actions.type; // dropdown, button
4585
+ const icon = props.actions.icon;
4583
4586
 
4584
4587
  return (_ctx, _cache) => {
4585
4588
  return (vue.unref(type) && vue.unref(type).includes('dropdown'))
4586
4589
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$d, [
4587
4590
  vue.createElementVNode("strong", _hoisted_2$a, [
4588
- (vue.unref(type) === 'dropdown-horizontal')
4589
- ? (vue.openBlock(), vue.createElementBlock("i", _hoisted_3$9))
4590
- : (vue.openBlock(), vue.createElementBlock("i", _hoisted_4$9))
4591
+ (vue.unref(icon))
4592
+ ? (vue.openBlock(), vue.createElementBlock("span", {
4593
+ key: 0,
4594
+ class: vue.normalizeClass(vue.unref(icon))
4595
+ }, null, 2 /* CLASS */))
4596
+ : (vue.unref(type) === 'dropdown-horizontal')
4597
+ ? (vue.openBlock(), vue.createElementBlock("i", _hoisted_3$9))
4598
+ : (vue.openBlock(), vue.createElementBlock("i", _hoisted_4$9))
4591
4599
  ]),
4592
4600
  vue.createElementVNode("ul", _hoisted_5$8, [
4593
4601
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(actionItems), (act) => {
@@ -4596,10 +4604,11 @@ return (_ctx, _cache) => {
4596
4604
  }, [
4597
4605
  vue.createVNode(script$h, {
4598
4606
  "action-class": " dropdown-item",
4607
+ "emit-action": __props.emitAction,
4599
4608
  class: vue.normalizeClass(act.class),
4600
4609
  action: act,
4601
4610
  record: __props.record
4602
- }, null, 8 /* PROPS */, ["class", "action", "record"])
4611
+ }, null, 8 /* PROPS */, ["emit-action", "class", "action", "record"])
4603
4612
  ]))
4604
4613
  }), 128 /* KEYED_FRAGMENT */))
4605
4614
  ])
@@ -4607,9 +4616,10 @@ return (_ctx, _cache) => {
4607
4616
  : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(vue.unref(actionItems), (act) => {
4608
4617
  return (vue.openBlock(), vue.createBlock(script$h, {
4609
4618
  key: act.label,
4619
+ "emit-action": __props.emitAction,
4610
4620
  action: act,
4611
4621
  record: __props.record
4612
- }, null, 8 /* PROPS */, ["action", "record"]))
4622
+ }, null, 8 /* PROPS */, ["emit-action", "action", "record"]))
4613
4623
  }), 128 /* KEYED_FRAGMENT */))
4614
4624
  }
4615
4625
  }
@@ -5129,16 +5139,18 @@ const _hoisted_42 = ["innerHTML"];
5129
5139
  const _hoisted_43 = ["innerHTML"];
5130
5140
  const _hoisted_44 = ["innerHTML"];
5131
5141
  const _hoisted_45 = ["innerHTML"];
5132
- const _hoisted_46 = {
5142
+ const _hoisted_46 = ["innerHTML"];
5143
+ const _hoisted_47 = ["innerHTML"];
5144
+ const _hoisted_48 = {
5133
5145
  key: 0,
5134
5146
  style: {"white-space":"nowrap"}
5135
5147
  };
5136
- const _hoisted_47 = { key: 5 };
5137
- const _hoisted_48 = {
5148
+ const _hoisted_49 = { key: 5 };
5149
+ const _hoisted_50 = {
5138
5150
  key: 0,
5139
5151
  class: "text-center"
5140
5152
  };
5141
- const _hoisted_49 = /*#__PURE__*/vue.createElementVNode("div", { class: "text-center" }, [
5153
+ const _hoisted_51 = /*#__PURE__*/vue.createElementVNode("div", { class: "text-center" }, [
5142
5154
  /*#__PURE__*/vue.createElementVNode("div", {
5143
5155
  class: "spinner-border",
5144
5156
  role: "status"
@@ -5146,43 +5158,45 @@ const _hoisted_49 = /*#__PURE__*/vue.createElementVNode("div", { class: "text-ce
5146
5158
  /*#__PURE__*/vue.createElementVNode("span", { class: "visually-hidden" }, "Loading...")
5147
5159
  ])
5148
5160
  ], -1 /* HOISTED */);
5149
- const _hoisted_50 = [
5150
- _hoisted_49
5161
+ const _hoisted_52 = [
5162
+ _hoisted_51
5151
5163
  ];
5152
- const _hoisted_51 = { key: 1 };
5153
- const _hoisted_52 = {
5164
+ const _hoisted_53 = { key: 1 };
5165
+ const _hoisted_54 = {
5154
5166
  key: 2,
5155
5167
  class: "mobile-list-items"
5156
5168
  };
5157
- const _hoisted_53 = ["onClick"];
5158
- const _hoisted_54 = {
5169
+ const _hoisted_55 = ["onClick"];
5170
+ const _hoisted_56 = {
5159
5171
  key: 0,
5160
5172
  class: "mb-1 font-weight-bold text-capitalize profile-form-title"
5161
5173
  };
5162
- const _hoisted_55 = {
5174
+ const _hoisted_57 = {
5163
5175
  key: 1,
5164
5176
  class: "mb-1 font-weight-bold text-capitalize profile-form-title"
5165
5177
  };
5166
- const _hoisted_56 = {
5178
+ const _hoisted_58 = {
5167
5179
  key: 2,
5168
5180
  class: "mb-1 font-weight-bold text-capitalize profile-form-title"
5169
5181
  };
5170
- const _hoisted_57 = {
5182
+ const _hoisted_59 = {
5171
5183
  key: 3,
5172
5184
  class: "mb-1 font-weight-bold text-capitalize profile-form-title"
5173
5185
  };
5174
- const _hoisted_58 = { key: 1 };
5175
- const _hoisted_59 = {
5186
+ const _hoisted_60 = { key: 1 };
5187
+ const _hoisted_61 = {
5176
5188
  key: 2,
5177
5189
  class: "text-primary fw-bold"
5178
5190
  };
5179
- const _hoisted_60 = { key: 3 };
5180
- const _hoisted_61 = ["innerHTML"];
5181
- const _hoisted_62 = ["innerHTML"];
5191
+ const _hoisted_62 = { key: 3 };
5182
5192
  const _hoisted_63 = ["innerHTML"];
5183
5193
  const _hoisted_64 = ["innerHTML"];
5184
- const _hoisted_65 = /*#__PURE__*/vue.createElementVNode("hr", { class: "my-2" }, null, -1 /* HOISTED */);
5185
- const _hoisted_66 = { key: 0 };
5194
+ const _hoisted_65 = ["innerHTML"];
5195
+ const _hoisted_66 = ["innerHTML"];
5196
+ const _hoisted_67 = ["innerHTML"];
5197
+ const _hoisted_68 = ["innerHTML"];
5198
+ const _hoisted_69 = /*#__PURE__*/vue.createElementVNode("hr", { class: "my-2" }, null, -1 /* HOISTED */);
5199
+ const _hoisted_70 = { key: 0 };
5186
5200
 
5187
5201
  const __default__ = {
5188
5202
  name: 'sh-table',
@@ -5505,6 +5519,14 @@ const noRecordsComponent = vue.inject('noRecordsComponent', script$k);
5505
5519
 
5506
5520
  pinia.storeToRefs(useUserStore());
5507
5521
 
5522
+ const cleanColumn = col=>{
5523
+ // remove col.component
5524
+ const newCol = {...col};
5525
+ delete newCol.component;
5526
+ delete newCol.key;
5527
+ return newCol
5528
+ };
5529
+
5508
5530
 
5509
5531
  return (_ctx, _cache) => {
5510
5532
  const _component_router_link = vue.resolveComponent("router-link");
@@ -5709,28 +5731,40 @@ return (_ctx, _cache) => {
5709
5731
  key: 5,
5710
5732
  innerHTML: key(record, index)
5711
5733
  }, null, 8 /* PROPS */, _hoisted_43))
5712
- : (typeof key === 'object' && key.component)
5713
- ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(key.component), {
5734
+ : (typeof key === 'object' && key.callBack)
5735
+ ? (vue.openBlock(), vue.createElementBlock("span", {
5714
5736
  key: 6,
5715
- item: record
5716
- }, null, 8 /* PROPS */, ["item"]))
5717
- : (typeof key === 'object')
5737
+ innerHTML: key.callBack(record, index)
5738
+ }, null, 8 /* PROPS */, _hoisted_44))
5739
+ : (typeof key === 'object' && key.callback)
5718
5740
  ? (vue.openBlock(), vue.createElementBlock("span", {
5719
5741
  key: 7,
5720
- innerHTML: record[key.key ?? key.field]
5721
- }, null, 8 /* PROPS */, _hoisted_44))
5722
- : (vue.openBlock(), vue.createElementBlock("span", {
5723
- key: 8,
5724
- innerHTML: record[key[0]]
5742
+ innerHTML: key.callback(record, index)
5725
5743
  }, null, 8 /* PROPS */, _hoisted_45))
5744
+ : (typeof key === 'object' && key.component)
5745
+ ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(key.component), vue.mergeProps({
5746
+ key: 8,
5747
+ item: record,
5748
+ ref_for: true
5749
+ }, cleanColumn(key)), null, 16 /* FULL_PROPS */, ["item"]))
5750
+ : (typeof key === 'object')
5751
+ ? (vue.openBlock(), vue.createElementBlock("span", {
5752
+ key: 9,
5753
+ innerHTML: record[key.key ?? key.field]
5754
+ }, null, 8 /* PROPS */, _hoisted_46))
5755
+ : (vue.openBlock(), vue.createElementBlock("span", {
5756
+ key: 10,
5757
+ innerHTML: record[key[0]]
5758
+ }, null, 8 /* PROPS */, _hoisted_47))
5726
5759
  ]))
5727
5760
  }), 128 /* KEYED_FRAGMENT */)),
5728
5761
  (__props.actions)
5729
- ? (vue.openBlock(), vue.createElementBlock("td", _hoisted_46, [
5762
+ ? (vue.openBlock(), vue.createElementBlock("td", _hoisted_48, [
5730
5763
  vue.createVNode(script$g, {
5764
+ emitAction: _ctx.doEmitAction,
5731
5765
  actions: __props.actions,
5732
5766
  record: record
5733
- }, null, 8 /* PROPS */, ["actions", "record"])
5767
+ }, null, 8 /* PROPS */, ["emitAction", "actions", "record"])
5734
5768
  ]))
5735
5769
  : vue.createCommentVNode("v-if", true)
5736
5770
  ], 10 /* CLASS, PROPS */, _hoisted_38))
@@ -5738,15 +5772,15 @@ return (_ctx, _cache) => {
5738
5772
  : vue.createCommentVNode("v-if", true)
5739
5773
  ])
5740
5774
  ], 2 /* CLASS */))
5741
- : (vue.openBlock(), vue.createElementBlock("div", _hoisted_47, [
5775
+ : (vue.openBlock(), vue.createElementBlock("div", _hoisted_49, [
5742
5776
  (_ctx.loading === 'loading')
5743
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_48, [..._hoisted_50]))
5777
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_50, [..._hoisted_52]))
5744
5778
  : (_ctx.loading === 'error')
5745
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_51, [
5779
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_53, [
5746
5780
  vue.createElementVNode("span", null, vue.toDisplayString(_ctx.loading_error), 1 /* TEXT */)
5747
5781
  ]))
5748
5782
  : (_ctx.loading === 'done')
5749
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_52, [
5783
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_54, [
5750
5784
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.records, (record, index) => {
5751
5785
  return (vue.openBlock(), vue.createElementBlock("div", {
5752
5786
  key: record.id,
@@ -5758,12 +5792,12 @@ return (_ctx, _cache) => {
5758
5792
  key: key[0]
5759
5793
  }, [
5760
5794
  (typeof key === 'string' )
5761
- ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_54, vue.toDisplayString(key.replace(/_/g, ' ')), 1 /* TEXT */))
5795
+ ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_56, vue.toDisplayString(key.replace(/_/g, ' ')), 1 /* TEXT */))
5762
5796
  : (typeof key === 'function')
5763
- ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_55, vue.toDisplayString(key(null).replace(/_/g, ' ')), 1 /* TEXT */))
5797
+ ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_57, vue.toDisplayString(key(null).replace(/_/g, ' ')), 1 /* TEXT */))
5764
5798
  : (typeof key === 'object')
5765
- ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_56, vue.toDisplayString(key.label ?? key.key.replace(/_/g, ' ')), 1 /* TEXT */))
5766
- : (vue.openBlock(), vue.createElementBlock("p", _hoisted_57, vue.toDisplayString(key[1].replace(/_/g, ' ')), 1 /* TEXT */)),
5799
+ ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_58, vue.toDisplayString(key.label ?? key.key.replace(/_/g, ' ')), 1 /* TEXT */))
5800
+ : (vue.openBlock(), vue.createElementBlock("p", _hoisted_59, vue.toDisplayString(key[1].replace(/_/g, ' ')), 1 /* TEXT */)),
5767
5801
  vue.createElementVNode("span", null, [
5768
5802
  (typeof key === 'string' && __props.links && __props.links[key])
5769
5803
  ? (vue.openBlock(), vue.createBlock(_component_router_link, {
@@ -5773,48 +5807,60 @@ return (_ctx, _cache) => {
5773
5807
  innerHTML: record[key]
5774
5808
  }, null, 8 /* PROPS */, ["to", "class", "innerHTML"]))
5775
5809
  : (_ctx.getFieldType(key) === 'numeric')
5776
- ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_58, vue.toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
5810
+ ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_60, vue.toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
5777
5811
  : (_ctx.getFieldType(key) === 'money')
5778
- ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_59, "KES " + vue.toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
5812
+ ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_61, "KES " + vue.toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
5779
5813
  : (_ctx.getFieldType(key) === 'date')
5780
- ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_60, vue.toDisplayString(_ctx.formatDate(record[key])), 1 /* TEXT */))
5814
+ ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_62, vue.toDisplayString(_ctx.formatDate(record[key])), 1 /* TEXT */))
5781
5815
  : (typeof key === 'string')
5782
5816
  ? (vue.openBlock(), vue.createElementBlock("span", {
5783
5817
  key: 4,
5784
5818
  innerHTML: record[key]
5785
- }, null, 8 /* PROPS */, _hoisted_61))
5786
- : (typeof key === 'object' && key.component)
5787
- ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(key.component), {
5819
+ }, null, 8 /* PROPS */, _hoisted_63))
5820
+ : (typeof key === 'object' && key.callBack)
5821
+ ? (vue.openBlock(), vue.createElementBlock("span", {
5788
5822
  key: 5,
5789
- item: record
5790
- }, null, 8 /* PROPS */, ["item"]))
5791
- : (typeof key === 'object')
5823
+ innerHTML: key.callBack(record, index)
5824
+ }, null, 8 /* PROPS */, _hoisted_64))
5825
+ : (typeof key === 'object' && key.callback)
5792
5826
  ? (vue.openBlock(), vue.createElementBlock("span", {
5793
5827
  key: 6,
5794
- innerHTML: record[key.key ?? key.field]
5795
- }, null, 8 /* PROPS */, _hoisted_62))
5796
- : (typeof key === 'function')
5797
- ? (vue.openBlock(), vue.createElementBlock("span", {
5828
+ innerHTML: key.callback(record, index)
5829
+ }, null, 8 /* PROPS */, _hoisted_65))
5830
+ : (typeof key === 'object' && key.component)
5831
+ ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(key.component), vue.mergeProps({
5798
5832
  key: 7,
5799
- innerHTML: key(record, index )
5800
- }, null, 8 /* PROPS */, _hoisted_63))
5801
- : (vue.openBlock(), vue.createElementBlock("span", {
5802
- key: 8,
5803
- innerHTML: record[key[0]]
5804
- }, null, 8 /* PROPS */, _hoisted_64))
5833
+ item: record,
5834
+ ref_for: true
5835
+ }, cleanColumn(key)), null, 16 /* FULL_PROPS */, ["item"]))
5836
+ : (typeof key === 'object')
5837
+ ? (vue.openBlock(), vue.createElementBlock("span", {
5838
+ key: 8,
5839
+ innerHTML: record[key.key ?? key.field]
5840
+ }, null, 8 /* PROPS */, _hoisted_66))
5841
+ : (typeof key === 'function')
5842
+ ? (vue.openBlock(), vue.createElementBlock("span", {
5843
+ key: 9,
5844
+ innerHTML: key(record, index )
5845
+ }, null, 8 /* PROPS */, _hoisted_67))
5846
+ : (vue.openBlock(), vue.createElementBlock("span", {
5847
+ key: 10,
5848
+ innerHTML: record[key[0]]
5849
+ }, null, 8 /* PROPS */, _hoisted_68))
5805
5850
  ]),
5806
- _hoisted_65
5851
+ _hoisted_69
5807
5852
  ], 64 /* STABLE_FRAGMENT */))
5808
5853
  }), 128 /* KEYED_FRAGMENT */)),
5809
5854
  (__props.actions)
5810
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_66, [
5855
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_70, [
5811
5856
  vue.createVNode(script$g, {
5857
+ emitAction: _ctx.doEmitAction,
5812
5858
  actions: __props.actions,
5813
5859
  record: record
5814
- }, null, 8 /* PROPS */, ["actions", "record"])
5860
+ }, null, 8 /* PROPS */, ["emitAction", "actions", "record"])
5815
5861
  ]))
5816
5862
  : vue.createCommentVNode("v-if", true)
5817
- ], 8 /* PROPS */, _hoisted_53))
5863
+ ], 8 /* PROPS */, _hoisted_55))
5818
5864
  }), 128 /* KEYED_FRAGMENT */))
5819
5865
  ]))
5820
5866
  : vue.createCommentVNode("v-if", true)
package/dist/library.mjs CHANGED
@@ -4393,13 +4393,13 @@ const _hoisted_2$b = ["title"];
4393
4393
 
4394
4394
  var script$h = {
4395
4395
  __name: 'SingleAction',
4396
- props: ['action','record','actionClass'],
4397
- emits: ['actionSuccessful','actionFailed','actionCanceled'],
4398
- setup(__props, { emit: __emit }) {
4396
+ props: ['action','record','actionClass','emitAction'],
4397
+ setup(__props) {
4399
4398
 
4400
4399
  const props = __props;
4401
4400
 
4402
- const doEmitAction = __emit;
4401
+
4402
+
4403
4403
 
4404
4404
  const url = ref(props.action.path || props.action.url || props.action.link);
4405
4405
 
@@ -4419,11 +4419,13 @@ onMounted(()=>{
4419
4419
  });
4420
4420
 
4421
4421
 
4422
- const actionClicked = callBack=>{
4422
+
4423
+
4424
+ const doEmitAction = (callBack,item)=>{
4423
4425
  if(typeof callBack === 'function'){
4424
4426
  callBack(props.record);
4425
4427
  } else {
4426
- doEmitAction(callBack,props.record);
4428
+ props.emitAction(callBack,item);
4427
4429
  }
4428
4430
  };
4429
4431
 
@@ -4498,7 +4500,7 @@ return (_ctx, _cache) => {
4498
4500
  key: 3,
4499
4501
  title: __props.action.title,
4500
4502
  class: normalizeClass(__props.action.class ? __props.action.class:'btn btn-default' + __props.actionClass),
4501
- onClick: _cache[6] || (_cache[6] = $event => (actionClicked(__props.action.emits)))
4503
+ onClick: _cache[6] || (_cache[6] = $event => (doEmitAction(__props.action.emits, __props.record)))
4502
4504
  }, [
4503
4505
  (__props.action.icon)
4504
4506
  ? (openBlock(), createElementBlock("span", {
@@ -4549,11 +4551,11 @@ const _hoisted_2$a = {
4549
4551
  "aria-expanded": "false"
4550
4552
  };
4551
4553
  const _hoisted_3$9 = {
4552
- key: 0,
4554
+ key: 1,
4553
4555
  class: "bi bi-three-dots"
4554
4556
  };
4555
4557
  const _hoisted_4$9 = {
4556
- key: 1,
4558
+ key: 2,
4557
4559
  class: "bi bi-three-dots-vertical"
4558
4560
  };
4559
4561
  const _hoisted_5$8 = { class: "dropdown-menu" };
@@ -4561,21 +4563,27 @@ const _hoisted_5$8 = { class: "dropdown-menu" };
4561
4563
 
4562
4564
  var script$g = {
4563
4565
  __name: 'TableActions',
4564
- props: ['actions','record'],
4566
+ props: ['actions','record','emitAction'],
4565
4567
  setup(__props) {
4566
4568
 
4567
4569
  const props = __props;
4568
4570
 
4569
4571
  const actionItems = props.actions.actions;
4570
4572
  const type = props.actions.type; // dropdown, button
4573
+ const icon = props.actions.icon;
4571
4574
 
4572
4575
  return (_ctx, _cache) => {
4573
4576
  return (unref(type) && unref(type).includes('dropdown'))
4574
4577
  ? (openBlock(), createElementBlock("div", _hoisted_1$d, [
4575
4578
  createElementVNode("strong", _hoisted_2$a, [
4576
- (unref(type) === 'dropdown-horizontal')
4577
- ? (openBlock(), createElementBlock("i", _hoisted_3$9))
4578
- : (openBlock(), createElementBlock("i", _hoisted_4$9))
4579
+ (unref(icon))
4580
+ ? (openBlock(), createElementBlock("span", {
4581
+ key: 0,
4582
+ class: normalizeClass(unref(icon))
4583
+ }, null, 2 /* CLASS */))
4584
+ : (unref(type) === 'dropdown-horizontal')
4585
+ ? (openBlock(), createElementBlock("i", _hoisted_3$9))
4586
+ : (openBlock(), createElementBlock("i", _hoisted_4$9))
4579
4587
  ]),
4580
4588
  createElementVNode("ul", _hoisted_5$8, [
4581
4589
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(actionItems), (act) => {
@@ -4584,10 +4592,11 @@ return (_ctx, _cache) => {
4584
4592
  }, [
4585
4593
  createVNode(script$h, {
4586
4594
  "action-class": " dropdown-item",
4595
+ "emit-action": __props.emitAction,
4587
4596
  class: normalizeClass(act.class),
4588
4597
  action: act,
4589
4598
  record: __props.record
4590
- }, null, 8 /* PROPS */, ["class", "action", "record"])
4599
+ }, null, 8 /* PROPS */, ["emit-action", "class", "action", "record"])
4591
4600
  ]))
4592
4601
  }), 128 /* KEYED_FRAGMENT */))
4593
4602
  ])
@@ -4595,9 +4604,10 @@ return (_ctx, _cache) => {
4595
4604
  : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(actionItems), (act) => {
4596
4605
  return (openBlock(), createBlock(script$h, {
4597
4606
  key: act.label,
4607
+ "emit-action": __props.emitAction,
4598
4608
  action: act,
4599
4609
  record: __props.record
4600
- }, null, 8 /* PROPS */, ["action", "record"]))
4610
+ }, null, 8 /* PROPS */, ["emit-action", "action", "record"]))
4601
4611
  }), 128 /* KEYED_FRAGMENT */))
4602
4612
  }
4603
4613
  }
@@ -5117,16 +5127,18 @@ const _hoisted_42 = ["innerHTML"];
5117
5127
  const _hoisted_43 = ["innerHTML"];
5118
5128
  const _hoisted_44 = ["innerHTML"];
5119
5129
  const _hoisted_45 = ["innerHTML"];
5120
- const _hoisted_46 = {
5130
+ const _hoisted_46 = ["innerHTML"];
5131
+ const _hoisted_47 = ["innerHTML"];
5132
+ const _hoisted_48 = {
5121
5133
  key: 0,
5122
5134
  style: {"white-space":"nowrap"}
5123
5135
  };
5124
- const _hoisted_47 = { key: 5 };
5125
- const _hoisted_48 = {
5136
+ const _hoisted_49 = { key: 5 };
5137
+ const _hoisted_50 = {
5126
5138
  key: 0,
5127
5139
  class: "text-center"
5128
5140
  };
5129
- const _hoisted_49 = /*#__PURE__*/createElementVNode("div", { class: "text-center" }, [
5141
+ const _hoisted_51 = /*#__PURE__*/createElementVNode("div", { class: "text-center" }, [
5130
5142
  /*#__PURE__*/createElementVNode("div", {
5131
5143
  class: "spinner-border",
5132
5144
  role: "status"
@@ -5134,43 +5146,45 @@ const _hoisted_49 = /*#__PURE__*/createElementVNode("div", { class: "text-center
5134
5146
  /*#__PURE__*/createElementVNode("span", { class: "visually-hidden" }, "Loading...")
5135
5147
  ])
5136
5148
  ], -1 /* HOISTED */);
5137
- const _hoisted_50 = [
5138
- _hoisted_49
5149
+ const _hoisted_52 = [
5150
+ _hoisted_51
5139
5151
  ];
5140
- const _hoisted_51 = { key: 1 };
5141
- const _hoisted_52 = {
5152
+ const _hoisted_53 = { key: 1 };
5153
+ const _hoisted_54 = {
5142
5154
  key: 2,
5143
5155
  class: "mobile-list-items"
5144
5156
  };
5145
- const _hoisted_53 = ["onClick"];
5146
- const _hoisted_54 = {
5157
+ const _hoisted_55 = ["onClick"];
5158
+ const _hoisted_56 = {
5147
5159
  key: 0,
5148
5160
  class: "mb-1 font-weight-bold text-capitalize profile-form-title"
5149
5161
  };
5150
- const _hoisted_55 = {
5162
+ const _hoisted_57 = {
5151
5163
  key: 1,
5152
5164
  class: "mb-1 font-weight-bold text-capitalize profile-form-title"
5153
5165
  };
5154
- const _hoisted_56 = {
5166
+ const _hoisted_58 = {
5155
5167
  key: 2,
5156
5168
  class: "mb-1 font-weight-bold text-capitalize profile-form-title"
5157
5169
  };
5158
- const _hoisted_57 = {
5170
+ const _hoisted_59 = {
5159
5171
  key: 3,
5160
5172
  class: "mb-1 font-weight-bold text-capitalize profile-form-title"
5161
5173
  };
5162
- const _hoisted_58 = { key: 1 };
5163
- const _hoisted_59 = {
5174
+ const _hoisted_60 = { key: 1 };
5175
+ const _hoisted_61 = {
5164
5176
  key: 2,
5165
5177
  class: "text-primary fw-bold"
5166
5178
  };
5167
- const _hoisted_60 = { key: 3 };
5168
- const _hoisted_61 = ["innerHTML"];
5169
- const _hoisted_62 = ["innerHTML"];
5179
+ const _hoisted_62 = { key: 3 };
5170
5180
  const _hoisted_63 = ["innerHTML"];
5171
5181
  const _hoisted_64 = ["innerHTML"];
5172
- const _hoisted_65 = /*#__PURE__*/createElementVNode("hr", { class: "my-2" }, null, -1 /* HOISTED */);
5173
- const _hoisted_66 = { key: 0 };
5182
+ const _hoisted_65 = ["innerHTML"];
5183
+ const _hoisted_66 = ["innerHTML"];
5184
+ const _hoisted_67 = ["innerHTML"];
5185
+ const _hoisted_68 = ["innerHTML"];
5186
+ const _hoisted_69 = /*#__PURE__*/createElementVNode("hr", { class: "my-2" }, null, -1 /* HOISTED */);
5187
+ const _hoisted_70 = { key: 0 };
5174
5188
 
5175
5189
  const __default__ = {
5176
5190
  name: 'sh-table',
@@ -5493,6 +5507,14 @@ const noRecordsComponent = inject('noRecordsComponent', script$k);
5493
5507
 
5494
5508
  storeToRefs(useUserStore());
5495
5509
 
5510
+ const cleanColumn = col=>{
5511
+ // remove col.component
5512
+ const newCol = {...col};
5513
+ delete newCol.component;
5514
+ delete newCol.key;
5515
+ return newCol
5516
+ };
5517
+
5496
5518
 
5497
5519
  return (_ctx, _cache) => {
5498
5520
  const _component_router_link = resolveComponent("router-link");
@@ -5697,28 +5719,40 @@ return (_ctx, _cache) => {
5697
5719
  key: 5,
5698
5720
  innerHTML: key(record, index)
5699
5721
  }, null, 8 /* PROPS */, _hoisted_43))
5700
- : (typeof key === 'object' && key.component)
5701
- ? (openBlock(), createBlock(resolveDynamicComponent(key.component), {
5722
+ : (typeof key === 'object' && key.callBack)
5723
+ ? (openBlock(), createElementBlock("span", {
5702
5724
  key: 6,
5703
- item: record
5704
- }, null, 8 /* PROPS */, ["item"]))
5705
- : (typeof key === 'object')
5725
+ innerHTML: key.callBack(record, index)
5726
+ }, null, 8 /* PROPS */, _hoisted_44))
5727
+ : (typeof key === 'object' && key.callback)
5706
5728
  ? (openBlock(), createElementBlock("span", {
5707
5729
  key: 7,
5708
- innerHTML: record[key.key ?? key.field]
5709
- }, null, 8 /* PROPS */, _hoisted_44))
5710
- : (openBlock(), createElementBlock("span", {
5711
- key: 8,
5712
- innerHTML: record[key[0]]
5730
+ innerHTML: key.callback(record, index)
5713
5731
  }, null, 8 /* PROPS */, _hoisted_45))
5732
+ : (typeof key === 'object' && key.component)
5733
+ ? (openBlock(), createBlock(resolveDynamicComponent(key.component), mergeProps({
5734
+ key: 8,
5735
+ item: record,
5736
+ ref_for: true
5737
+ }, cleanColumn(key)), null, 16 /* FULL_PROPS */, ["item"]))
5738
+ : (typeof key === 'object')
5739
+ ? (openBlock(), createElementBlock("span", {
5740
+ key: 9,
5741
+ innerHTML: record[key.key ?? key.field]
5742
+ }, null, 8 /* PROPS */, _hoisted_46))
5743
+ : (openBlock(), createElementBlock("span", {
5744
+ key: 10,
5745
+ innerHTML: record[key[0]]
5746
+ }, null, 8 /* PROPS */, _hoisted_47))
5714
5747
  ]))
5715
5748
  }), 128 /* KEYED_FRAGMENT */)),
5716
5749
  (__props.actions)
5717
- ? (openBlock(), createElementBlock("td", _hoisted_46, [
5750
+ ? (openBlock(), createElementBlock("td", _hoisted_48, [
5718
5751
  createVNode(script$g, {
5752
+ emitAction: _ctx.doEmitAction,
5719
5753
  actions: __props.actions,
5720
5754
  record: record
5721
- }, null, 8 /* PROPS */, ["actions", "record"])
5755
+ }, null, 8 /* PROPS */, ["emitAction", "actions", "record"])
5722
5756
  ]))
5723
5757
  : createCommentVNode("v-if", true)
5724
5758
  ], 10 /* CLASS, PROPS */, _hoisted_38))
@@ -5726,15 +5760,15 @@ return (_ctx, _cache) => {
5726
5760
  : createCommentVNode("v-if", true)
5727
5761
  ])
5728
5762
  ], 2 /* CLASS */))
5729
- : (openBlock(), createElementBlock("div", _hoisted_47, [
5763
+ : (openBlock(), createElementBlock("div", _hoisted_49, [
5730
5764
  (_ctx.loading === 'loading')
5731
- ? (openBlock(), createElementBlock("div", _hoisted_48, [..._hoisted_50]))
5765
+ ? (openBlock(), createElementBlock("div", _hoisted_50, [..._hoisted_52]))
5732
5766
  : (_ctx.loading === 'error')
5733
- ? (openBlock(), createElementBlock("div", _hoisted_51, [
5767
+ ? (openBlock(), createElementBlock("div", _hoisted_53, [
5734
5768
  createElementVNode("span", null, toDisplayString(_ctx.loading_error), 1 /* TEXT */)
5735
5769
  ]))
5736
5770
  : (_ctx.loading === 'done')
5737
- ? (openBlock(), createElementBlock("div", _hoisted_52, [
5771
+ ? (openBlock(), createElementBlock("div", _hoisted_54, [
5738
5772
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.records, (record, index) => {
5739
5773
  return (openBlock(), createElementBlock("div", {
5740
5774
  key: record.id,
@@ -5746,12 +5780,12 @@ return (_ctx, _cache) => {
5746
5780
  key: key[0]
5747
5781
  }, [
5748
5782
  (typeof key === 'string' )
5749
- ? (openBlock(), createElementBlock("p", _hoisted_54, toDisplayString(key.replace(/_/g, ' ')), 1 /* TEXT */))
5783
+ ? (openBlock(), createElementBlock("p", _hoisted_56, toDisplayString(key.replace(/_/g, ' ')), 1 /* TEXT */))
5750
5784
  : (typeof key === 'function')
5751
- ? (openBlock(), createElementBlock("p", _hoisted_55, toDisplayString(key(null).replace(/_/g, ' ')), 1 /* TEXT */))
5785
+ ? (openBlock(), createElementBlock("p", _hoisted_57, toDisplayString(key(null).replace(/_/g, ' ')), 1 /* TEXT */))
5752
5786
  : (typeof key === 'object')
5753
- ? (openBlock(), createElementBlock("p", _hoisted_56, toDisplayString(key.label ?? key.key.replace(/_/g, ' ')), 1 /* TEXT */))
5754
- : (openBlock(), createElementBlock("p", _hoisted_57, toDisplayString(key[1].replace(/_/g, ' ')), 1 /* TEXT */)),
5787
+ ? (openBlock(), createElementBlock("p", _hoisted_58, toDisplayString(key.label ?? key.key.replace(/_/g, ' ')), 1 /* TEXT */))
5788
+ : (openBlock(), createElementBlock("p", _hoisted_59, toDisplayString(key[1].replace(/_/g, ' ')), 1 /* TEXT */)),
5755
5789
  createElementVNode("span", null, [
5756
5790
  (typeof key === 'string' && __props.links && __props.links[key])
5757
5791
  ? (openBlock(), createBlock(_component_router_link, {
@@ -5761,48 +5795,60 @@ return (_ctx, _cache) => {
5761
5795
  innerHTML: record[key]
5762
5796
  }, null, 8 /* PROPS */, ["to", "class", "innerHTML"]))
5763
5797
  : (_ctx.getFieldType(key) === 'numeric')
5764
- ? (openBlock(), createElementBlock("span", _hoisted_58, toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
5798
+ ? (openBlock(), createElementBlock("span", _hoisted_60, toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
5765
5799
  : (_ctx.getFieldType(key) === 'money')
5766
- ? (openBlock(), createElementBlock("span", _hoisted_59, "KES " + toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
5800
+ ? (openBlock(), createElementBlock("span", _hoisted_61, "KES " + toDisplayString(Intl.NumberFormat().format(record[key])), 1 /* TEXT */))
5767
5801
  : (_ctx.getFieldType(key) === 'date')
5768
- ? (openBlock(), createElementBlock("span", _hoisted_60, toDisplayString(_ctx.formatDate(record[key])), 1 /* TEXT */))
5802
+ ? (openBlock(), createElementBlock("span", _hoisted_62, toDisplayString(_ctx.formatDate(record[key])), 1 /* TEXT */))
5769
5803
  : (typeof key === 'string')
5770
5804
  ? (openBlock(), createElementBlock("span", {
5771
5805
  key: 4,
5772
5806
  innerHTML: record[key]
5773
- }, null, 8 /* PROPS */, _hoisted_61))
5774
- : (typeof key === 'object' && key.component)
5775
- ? (openBlock(), createBlock(resolveDynamicComponent(key.component), {
5807
+ }, null, 8 /* PROPS */, _hoisted_63))
5808
+ : (typeof key === 'object' && key.callBack)
5809
+ ? (openBlock(), createElementBlock("span", {
5776
5810
  key: 5,
5777
- item: record
5778
- }, null, 8 /* PROPS */, ["item"]))
5779
- : (typeof key === 'object')
5811
+ innerHTML: key.callBack(record, index)
5812
+ }, null, 8 /* PROPS */, _hoisted_64))
5813
+ : (typeof key === 'object' && key.callback)
5780
5814
  ? (openBlock(), createElementBlock("span", {
5781
5815
  key: 6,
5782
- innerHTML: record[key.key ?? key.field]
5783
- }, null, 8 /* PROPS */, _hoisted_62))
5784
- : (typeof key === 'function')
5785
- ? (openBlock(), createElementBlock("span", {
5816
+ innerHTML: key.callback(record, index)
5817
+ }, null, 8 /* PROPS */, _hoisted_65))
5818
+ : (typeof key === 'object' && key.component)
5819
+ ? (openBlock(), createBlock(resolveDynamicComponent(key.component), mergeProps({
5786
5820
  key: 7,
5787
- innerHTML: key(record, index )
5788
- }, null, 8 /* PROPS */, _hoisted_63))
5789
- : (openBlock(), createElementBlock("span", {
5790
- key: 8,
5791
- innerHTML: record[key[0]]
5792
- }, null, 8 /* PROPS */, _hoisted_64))
5821
+ item: record,
5822
+ ref_for: true
5823
+ }, cleanColumn(key)), null, 16 /* FULL_PROPS */, ["item"]))
5824
+ : (typeof key === 'object')
5825
+ ? (openBlock(), createElementBlock("span", {
5826
+ key: 8,
5827
+ innerHTML: record[key.key ?? key.field]
5828
+ }, null, 8 /* PROPS */, _hoisted_66))
5829
+ : (typeof key === 'function')
5830
+ ? (openBlock(), createElementBlock("span", {
5831
+ key: 9,
5832
+ innerHTML: key(record, index )
5833
+ }, null, 8 /* PROPS */, _hoisted_67))
5834
+ : (openBlock(), createElementBlock("span", {
5835
+ key: 10,
5836
+ innerHTML: record[key[0]]
5837
+ }, null, 8 /* PROPS */, _hoisted_68))
5793
5838
  ]),
5794
- _hoisted_65
5839
+ _hoisted_69
5795
5840
  ], 64 /* STABLE_FRAGMENT */))
5796
5841
  }), 128 /* KEYED_FRAGMENT */)),
5797
5842
  (__props.actions)
5798
- ? (openBlock(), createElementBlock("div", _hoisted_66, [
5843
+ ? (openBlock(), createElementBlock("div", _hoisted_70, [
5799
5844
  createVNode(script$g, {
5845
+ emitAction: _ctx.doEmitAction,
5800
5846
  actions: __props.actions,
5801
5847
  record: record
5802
- }, null, 8 /* PROPS */, ["actions", "record"])
5848
+ }, null, 8 /* PROPS */, ["emitAction", "actions", "record"])
5803
5849
  ]))
5804
5850
  : createCommentVNode("v-if", true)
5805
- ], 8 /* PROPS */, _hoisted_53))
5851
+ ], 8 /* PROPS */, _hoisted_55))
5806
5852
  }), 128 /* KEYED_FRAGMENT */))
5807
5853
  ]))
5808
5854
  : createCommentVNode("v-if", true)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/shframework",
3
- "version": "4.8.9",
3
+ "version": "5.0.2",
4
4
  "description": "Vue library for handling laravel backend",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.mjs",