@iankibetsh/shframework 5.6.0 → 5.6.1

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
@@ -2150,7 +2150,7 @@ const _hoisted_2$i = {
2150
2150
  };
2151
2151
  const _hoisted_3$f = ["src"];
2152
2152
  const _hoisted_4$f = ["value"];
2153
- const _hoisted_5$c = ["disabled"];
2153
+ const _hoisted_5$d = ["disabled"];
2154
2154
 
2155
2155
  function render$4(_ctx, _cache, $props, $setup, $data, $options) {
2156
2156
  return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$q, [
@@ -2182,7 +2182,7 @@ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
2182
2182
  onInput: _cache[2] || (_cache[2] = (...args) => ($options.updateValue && $options.updateValue(...args))),
2183
2183
  placeholder: "712345678",
2184
2184
  "onUpdate:modelValue": _cache[3] || (_cache[3] = $event => (($data.input) = $event))
2185
- }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_5$c), [
2185
+ }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_5$d), [
2186
2186
  [vue.vModelText, $data.input]
2187
2187
  ])
2188
2188
  ]))
@@ -2198,7 +2198,7 @@ const _hoisted_1$p = {
2198
2198
  const _hoisted_2$h = ["id"];
2199
2199
  const _hoisted_3$e = { class: "sh-suggestions-holder" };
2200
2200
  const _hoisted_4$e = { class: "badge bg-secondary m-1 sh-selected-item" };
2201
- const _hoisted_5$b = ["onClick"];
2201
+ const _hoisted_5$c = ["onClick"];
2202
2202
  const _hoisted_6$9 = ["id"];
2203
2203
  const _hoisted_7$8 = ["id", "aria-labelledby"];
2204
2204
  const _hoisted_8$7 = ["onClick"];
@@ -2374,7 +2374,7 @@ return (_ctx, _cache) => {
2374
2374
  type: "button",
2375
2375
  class: "btn-close border-start border-1 ms-1",
2376
2376
  "aria-label": "Close"
2377
- }, null, 8 /* PROPS */, _hoisted_5$b)
2377
+ }, null, 8 /* PROPS */, _hoisted_5$c)
2378
2378
  ]))
2379
2379
  }), 256 /* UNKEYED_FRAGMENT */))
2380
2380
  ]),
@@ -2795,7 +2795,7 @@ const _hoisted_2$g = {
2795
2795
  };
2796
2796
  const _hoisted_3$d = { key: 0 };
2797
2797
  const _hoisted_4$d = { key: 1 };
2798
- const _hoisted_5$a = { class: "row" };
2798
+ const _hoisted_5$b = { class: "row" };
2799
2799
  const _hoisted_6$8 = { class: "fg-label control-label text-capitalize control-bel col-md-12 request-form-label mb-2" };
2800
2800
  const _hoisted_7$7 = { class: "col-md-12" };
2801
2801
  const _hoisted_8$6 = ["data-cy", "placeholder", "name", "onFocus", "onChange"];
@@ -2846,7 +2846,7 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
2846
2846
  }, null, 512 /* NEED_PATCH */), [
2847
2847
  [vue.vModelText, _ctx.form_elements['id']]
2848
2848
  ]),
2849
- vue.createElementVNode("div", _hoisted_5$a, [
2849
+ vue.createElementVNode("div", _hoisted_5$b, [
2850
2850
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.fields, (field) => {
2851
2851
  return (vue.openBlock(), vue.createElementBlock("div", {
2852
2852
  class: vue.normalizeClass(["form-group", 'col-md-' + $options.getColumns()]),
@@ -3408,7 +3408,7 @@ const _hoisted_3$c = {
3408
3408
  class: "text-danger sh-required"
3409
3409
  };
3410
3410
  const _hoisted_4$c = ["innerHTML"];
3411
- const _hoisted_5$9 = {
3411
+ const _hoisted_5$a = {
3412
3412
  key: 2,
3413
3413
  class: "form-notch"
3414
3414
  };
@@ -3719,7 +3719,7 @@ return (_ctx, _cache) => {
3719
3719
  }, null, 10 /* CLASS, PROPS */, _hoisted_4$c))
3720
3720
  : vue.createCommentVNode("v-if", true),
3721
3721
  (vue.unref(isFloating))
3722
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$9, [...(_cache[1] || (_cache[1] = [
3722
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$a, [...(_cache[1] || (_cache[1] = [
3723
3723
  vue.createElementVNode("div", { class: "form-notch-leading" }, null, -1 /* CACHED */),
3724
3724
  vue.createElementVNode("div", { class: "form-notch-middle" }, null, -1 /* CACHED */),
3725
3725
  vue.createElementVNode("div", { class: "form-notch-trailing" }, null, -1 /* CACHED */)
@@ -3772,7 +3772,7 @@ const _hoisted_1$k = ["id", "data-bs-backdrop"];
3772
3772
  const _hoisted_2$e = { class: "modal-content" };
3773
3773
  const _hoisted_3$b = { class: "modal-header" };
3774
3774
  const _hoisted_4$b = { class: "modal-title flex-fill" };
3775
- const _hoisted_5$8 = { class: "modal-body" };
3775
+ const _hoisted_5$9 = { class: "modal-body" };
3776
3776
  const _hoisted_6$6 = { class: "section" };
3777
3777
 
3778
3778
 
@@ -3844,7 +3844,7 @@ return (_ctx, _cache) => {
3844
3844
  "aria-label": "Close"
3845
3845
  }, null, -1 /* CACHED */))
3846
3846
  ]),
3847
- vue.createElementVNode("div", _hoisted_5$8, [
3847
+ vue.createElementVNode("div", _hoisted_5$9, [
3848
3848
  vue.createElementVNode("div", _hoisted_6$6, [
3849
3849
  vue.renderSlot(_ctx.$slots, "default")
3850
3850
  ])
@@ -4079,7 +4079,7 @@ const _hoisted_4$a = {
4079
4079
  "data-bs-dismiss": "offcanvas",
4080
4080
  "aria-label": "Close"
4081
4081
  };
4082
- const _hoisted_5$7 = { class: "offcanvas-body" };
4082
+ const _hoisted_5$8 = { class: "offcanvas-body" };
4083
4083
 
4084
4084
  var script$l = {
4085
4085
  __name: 'ShCanvas',
@@ -4131,7 +4131,7 @@ return (_ctx, _cache) => {
4131
4131
  vue.createElementVNode("h5", _hoisted_3$a, vue.toDisplayString(__props.canvasTitle), 1 /* TEXT */),
4132
4132
  vue.createElementVNode("button", _hoisted_4$a, null, 512 /* NEED_PATCH */)
4133
4133
  ]),
4134
- vue.createElementVNode("div", _hoisted_5$7, [
4134
+ vue.createElementVNode("div", _hoisted_5$8, [
4135
4135
  vue.renderSlot(_ctx.$slots, "default")
4136
4136
  ])
4137
4137
  ], 10 /* CLASS, PROPS */, _hoisted_1$h))
@@ -4629,7 +4629,7 @@ const _hoisted_4$9 = {
4629
4629
  key: 2,
4630
4630
  class: "bi bi-three-dots-vertical"
4631
4631
  };
4632
- const _hoisted_5$6 = { class: "dropdown-menu" };
4632
+ const _hoisted_5$7 = { class: "dropdown-menu" };
4633
4633
 
4634
4634
 
4635
4635
  var script$g = {
@@ -4656,7 +4656,7 @@ return (_ctx, _cache) => {
4656
4656
  ? (vue.openBlock(), vue.createElementBlock("i", _hoisted_3$9))
4657
4657
  : (vue.openBlock(), vue.createElementBlock("i", _hoisted_4$9))
4658
4658
  ]),
4659
- vue.createElementVNode("ul", _hoisted_5$6, [
4659
+ vue.createElementVNode("ul", _hoisted_5$7, [
4660
4660
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(actionItems), (act) => {
4661
4661
  return (vue.openBlock(), vue.createElementBlock("li", {
4662
4662
  key: act.label
@@ -4701,7 +4701,7 @@ const _hoisted_3$8 = {
4701
4701
  "aria-expanded": "false"
4702
4702
  };
4703
4703
  const _hoisted_4$8 = ["innerHTML"];
4704
- const _hoisted_5$5 = {
4704
+ const _hoisted_5$6 = {
4705
4705
  class: "dropdown-menu sh-range-dropdown",
4706
4706
  "aria-labelledby": "dropdownMenuLink"
4707
4707
  };
@@ -4842,7 +4842,7 @@ return (_ctx, _cache) => {
4842
4842
  _cache[3] || (_cache[3] = vue.createTextVNode()),
4843
4843
  vue.createElementVNode("span", { innerHTML: rangeLabel.value }, null, 8 /* PROPS */, _hoisted_4$8)
4844
4844
  ]),
4845
- vue.createElementVNode("div", _hoisted_5$5, [
4845
+ vue.createElementVNode("div", _hoisted_5$6, [
4846
4846
  vue.createElementVNode("ul", _hoisted_6$5, [
4847
4847
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(dates.value, (date) => {
4848
4848
  return (vue.openBlock(), vue.createElementBlock("li", {
@@ -4977,7 +4977,7 @@ const _hoisted_1$c = { key: 0 };
4977
4977
  const _hoisted_2$9 = { class: "record_count_body mb-3" };
4978
4978
  const _hoisted_3$7 = ["value"];
4979
4979
  const _hoisted_4$7 = { class: "record_counts" };
4980
- const _hoisted_5$4 = {
4980
+ const _hoisted_5$5 = {
4981
4981
  key: 0,
4982
4982
  "aria-label": "Page navigation"
4983
4983
  };
@@ -5030,7 +5030,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
5030
5030
  vue.createElementVNode("span", _hoisted_4$7, " of " + vue.toDisplayString($props.pagination_data.record_count) + " items", 1 /* TEXT */)
5031
5031
  ]),
5032
5032
  ($props.pagination_data != null)
5033
- ? (vue.openBlock(), vue.createElementBlock("nav", _hoisted_5$4, [
5033
+ ? (vue.openBlock(), vue.createElementBlock("nav", _hoisted_5$5, [
5034
5034
  vue.createElementVNode("ul", _hoisted_6$4, [
5035
5035
  vue.createElementVNode("li", {
5036
5036
  class: vue.normalizeClass([$options.getActivePage === 1 ? 'disabled' : '' , "page-item"])
@@ -5109,7 +5109,7 @@ const _hoisted_4$6 = {
5109
5109
  key: 1,
5110
5110
  class: "row"
5111
5111
  };
5112
- const _hoisted_5$3 = { class: "col-12 mb-3 d-flex justify-content-between flex-column flex-md-row flex-lg-row" };
5112
+ const _hoisted_5$4 = { class: "col-12 mb-3 d-flex justify-content-between flex-column flex-md-row flex-lg-row" };
5113
5113
  const _hoisted_6$3 = ["placeholder"];
5114
5114
  const _hoisted_7$3 = {
5115
5115
  key: 0,
@@ -5596,7 +5596,7 @@ return (_ctx, _cache) => {
5596
5596
  : vue.createCommentVNode("v-if", true),
5597
5597
  (!__props.hideSearch)
5598
5598
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$6, [
5599
- vue.createElementVNode("div", _hoisted_5$3, [
5599
+ vue.createElementVNode("div", _hoisted_5$4, [
5600
5600
  vue.createElementVNode("div", {
5601
5601
  class: vue.normalizeClass(["sh-search-bar input-group", __props.hasRange ? 'me-2':''])
5602
5602
  }, [
@@ -6228,59 +6228,146 @@ const _hoisted_1$9 = {
6228
6228
  };
6229
6229
  const _hoisted_2$6 = ["onClick"];
6230
6230
  const _hoisted_3$4 = { class: "sh_tab_count" };
6231
- const _hoisted_4$4 = { class: "tab-content" };
6231
+ const _hoisted_4$4 = { class: "sh_tab_count" };
6232
+ const _hoisted_5$3 = { class: "tab-content" };
6233
+
6234
+ // const props = defineProps(['tabs', 'data', 'classes', 'currentTab', 'component', 'baseUrl', 'defaultComponent','addTabQuery'])
6232
6235
 
6233
6236
  var script$b = {
6234
6237
  __name: 'ShDynamicTabs',
6235
- props: ['tabs','data','classes','currentTab'],
6238
+ props: {
6239
+ tabs: {
6240
+ type: Array,
6241
+ required: true
6242
+ },
6243
+ data: {
6244
+ type: Object,
6245
+ default: () => ({})
6246
+ },
6247
+ classes: {
6248
+ type: String,
6249
+ default: ''
6250
+ },
6251
+ currentTab: {
6252
+ type: String,
6253
+ default: null
6254
+ },
6255
+ component: {
6256
+ type: Object,
6257
+ default: null
6258
+ },
6259
+ baseUrl: {
6260
+ type: String,
6261
+ default: null
6262
+ },
6263
+ defaultComponent: {
6264
+ type: Object,
6265
+ default: () => ({ template: '<div></div>' })
6266
+ },
6267
+ addTabQuery: {
6268
+ type: Boolean,
6269
+ default: false
6270
+ }
6271
+ },
6236
6272
  setup(__props) {
6237
6273
 
6238
6274
  const props = __props;
6239
- const tabs = props.tabs;
6275
+ const route = vueRouter.useRoute();
6276
+ const router = vueRouter.useRouter();
6277
+ const formattedTabs = vue.computed(() => {
6278
+ if (!props.tabs || props.tabs.length === 0) {
6279
+ return []
6280
+ }
6281
+ return props.tabs.map(tab => {
6282
+ if (typeof tab === 'string') {
6283
+ return {key: tab, label: tab.replace(/_/g, ' ')}
6284
+ }
6285
+ if (typeof tab === 'function') {
6286
+ return tab(props.data)
6287
+ }
6288
+ return tab
6289
+ })
6290
+ });
6291
+ const tabsBaseUrl = props.baseUrl ?? route.path;
6240
6292
  let currentTab = vue.shallowRef(null);
6241
6293
  const generatedId = vue.ref(null);
6242
6294
  vue.ref(null);
6243
- vue.onMounted(()=>{
6244
- generatedId.value = 'tab' + Math.random().toString(36).slice(2);
6245
- if(tabs.length > 0) {
6246
- if (props.currentTab) {
6247
- currentTab.value = tabs.find(tab=>tab.label === props.currentTab);
6248
- } else {
6249
- currentTab.value = tabs[0];
6250
- }
6295
+ vue.onMounted(() => {
6296
+ generatedId.value = 'tab' + Math.random().toString(36).slice(2);
6297
+ if (formattedTabs.value.length > 0) {
6298
+ if (props.currentTab) {
6299
+ currentTab.value = formattedTabs.value.find(tab => tab.label === props.currentTab);
6300
+ } else {
6301
+ currentTab.value = formattedTabs.value[0];
6302
+ }
6303
+ const tabParam = route.query.tab;
6304
+ if (tabParam) {
6305
+ const tabFromParam = formattedTabs.value.find(tab => getTabKey(tab) === tabParam);
6306
+ if (tabFromParam) {
6307
+ currentTab.value = tabFromParam;
6308
+ }
6309
+ } else if(currentTab.value && props.addTabQuery) {
6310
+ router.replace({path: tabsBaseUrl, query: {...route.query, tab: getTabKey(currentTab.value)}});
6311
+ }
6312
+
6251
6313
  }
6252
6314
  });
6253
6315
 
6254
- function setTab(tab){
6316
+ function setTab(tab) {
6255
6317
  currentTab.value = tab;
6256
6318
  }
6257
6319
 
6320
+ const getTabKey = (tab) => {
6321
+ return tab.key ?? tab.label.replace(/\s+/g, '_').toLowerCase()
6322
+ };
6323
+
6258
6324
  return (_ctx, _cache) => {
6325
+ const _component_router_link = vue.resolveComponent("router-link");
6326
+
6259
6327
  return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
6260
6328
  vue.createElementVNode("ul", {
6261
- class: vue.normalizeClass(["nav nav-tabs", vue.unref(shRepo).getShConfig('tabsClass','sh-tabs nav-tabs-bordered') + __props.classes]),
6329
+ class: vue.normalizeClass(["nav nav-tabs nav-tabs-bordered", vue.unref(shRepo).getShConfig('tabsClass','sh-tabs nav-tabs-bordered') + __props.classes]),
6262
6330
  role: "tablist"
6263
6331
  }, [
6264
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(tabs), (tab) => {
6332
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(formattedTabs.value, (tab) => {
6265
6333
  return (vue.openBlock(), vue.createElementBlock("li", _hoisted_1$9, [
6266
- vue.createElementVNode("button", {
6267
- onClick: $event => (setTab(tab)),
6268
- class: vue.normalizeClass(["nav-link", vue.unref(currentTab) === tab ? 'active':''])
6269
- }, [
6270
- vue.createTextVNode(vue.toDisplayString(tab.label) + " ", 1 /* TEXT */),
6271
- (tab.count || tab.tabCount)
6272
- ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
6273
- _cache[0] || (_cache[0] = vue.createElementVNode("i", { class: "d-none" }, null, -1 /* CACHED */)),
6274
- vue.createElementVNode("sup", _hoisted_3$4, vue.toDisplayString(tab.count ?? tab.tabCount), 1 /* TEXT */)
6275
- ], 64 /* STABLE_FRAGMENT */))
6276
- : vue.createCommentVNode("v-if", true)
6277
- ], 10 /* CLASS, PROPS */, _hoisted_2$6)
6334
+ (!__props.addTabQuery)
6335
+ ? (vue.openBlock(), vue.createElementBlock("button", {
6336
+ key: 0,
6337
+ onClick: $event => (setTab(tab)),
6338
+ class: vue.normalizeClass(["nav-link", vue.unref(currentTab) === tab ? 'active':''])
6339
+ }, [
6340
+ vue.createTextVNode(vue.toDisplayString(tab.label) + " ", 1 /* TEXT */),
6341
+ (tab.count || tab.tabCount)
6342
+ ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
6343
+ _cache[0] || (_cache[0] = vue.createElementVNode("i", { class: "d-none" }, null, -1 /* CACHED */)),
6344
+ vue.createElementVNode("sup", _hoisted_3$4, vue.toDisplayString(tab.count ?? tab.tabCount), 1 /* TEXT */)
6345
+ ], 64 /* STABLE_FRAGMENT */))
6346
+ : vue.createCommentVNode("v-if", true)
6347
+ ], 10 /* CLASS, PROPS */, _hoisted_2$6))
6348
+ : (vue.openBlock(), vue.createBlock(_component_router_link, {
6349
+ key: 1,
6350
+ to: `${vue.unref(tabsBaseUrl)}?tab=${getTabKey(tab)}`,
6351
+ onClick: $event => (setTab(tab)),
6352
+ class: vue.normalizeClass(["nav-link", vue.unref(currentTab) === tab ? 'active':''])
6353
+ }, {
6354
+ default: vue.withCtx(() => [
6355
+ vue.createTextVNode(vue.toDisplayString(tab.label) + " ", 1 /* TEXT */),
6356
+ (tab.count || tab.tabCount)
6357
+ ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
6358
+ _cache[1] || (_cache[1] = vue.createElementVNode("i", { class: "d-none" }, null, -1 /* CACHED */)),
6359
+ vue.createElementVNode("sup", _hoisted_4$4, vue.toDisplayString(tab.count ?? tab.tabCount), 1 /* TEXT */)
6360
+ ], 64 /* STABLE_FRAGMENT */))
6361
+ : vue.createCommentVNode("v-if", true)
6362
+ ]),
6363
+ _: 2 /* DYNAMIC */
6364
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["to", "onClick", "class"]))
6278
6365
  ]))
6279
6366
  }), 256 /* UNKEYED_FRAGMENT */))
6280
6367
  ], 2 /* CLASS */),
6281
- vue.createElementVNode("div", _hoisted_4$4, [
6368
+ vue.createElementVNode("div", _hoisted_5$3, [
6282
6369
  (vue.unref(currentTab))
6283
- ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(currentTab).component), vue.normalizeProps(vue.mergeProps({ key: 0 }, vue.unref(currentTab))), null, 16 /* FULL_PROPS */))
6370
+ ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(currentTab).component ?? __props.defaultComponent), vue.normalizeProps(vue.mergeProps({ key: 0 }, vue.unref(currentTab))), null, 16 /* FULL_PROPS */))
6284
6371
  : vue.createCommentVNode("v-if", true)
6285
6372
  ])
6286
6373
  ], 64 /* STABLE_FRAGMENT */))
package/dist/library.mjs CHANGED
@@ -2139,7 +2139,7 @@ const _hoisted_2$i = {
2139
2139
  };
2140
2140
  const _hoisted_3$f = ["src"];
2141
2141
  const _hoisted_4$f = ["value"];
2142
- const _hoisted_5$c = ["disabled"];
2142
+ const _hoisted_5$d = ["disabled"];
2143
2143
 
2144
2144
  function render$4(_ctx, _cache, $props, $setup, $data, $options) {
2145
2145
  return (openBlock(), createElementBlock("div", _hoisted_1$q, [
@@ -2171,7 +2171,7 @@ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
2171
2171
  onInput: _cache[2] || (_cache[2] = (...args) => ($options.updateValue && $options.updateValue(...args))),
2172
2172
  placeholder: "712345678",
2173
2173
  "onUpdate:modelValue": _cache[3] || (_cache[3] = $event => (($data.input) = $event))
2174
- }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_5$c), [
2174
+ }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_5$d), [
2175
2175
  [vModelText, $data.input]
2176
2176
  ])
2177
2177
  ]))
@@ -2187,7 +2187,7 @@ const _hoisted_1$p = {
2187
2187
  const _hoisted_2$h = ["id"];
2188
2188
  const _hoisted_3$e = { class: "sh-suggestions-holder" };
2189
2189
  const _hoisted_4$e = { class: "badge bg-secondary m-1 sh-selected-item" };
2190
- const _hoisted_5$b = ["onClick"];
2190
+ const _hoisted_5$c = ["onClick"];
2191
2191
  const _hoisted_6$9 = ["id"];
2192
2192
  const _hoisted_7$8 = ["id", "aria-labelledby"];
2193
2193
  const _hoisted_8$7 = ["onClick"];
@@ -2363,7 +2363,7 @@ return (_ctx, _cache) => {
2363
2363
  type: "button",
2364
2364
  class: "btn-close border-start border-1 ms-1",
2365
2365
  "aria-label": "Close"
2366
- }, null, 8 /* PROPS */, _hoisted_5$b)
2366
+ }, null, 8 /* PROPS */, _hoisted_5$c)
2367
2367
  ]))
2368
2368
  }), 256 /* UNKEYED_FRAGMENT */))
2369
2369
  ]),
@@ -2784,7 +2784,7 @@ const _hoisted_2$g = {
2784
2784
  };
2785
2785
  const _hoisted_3$d = { key: 0 };
2786
2786
  const _hoisted_4$d = { key: 1 };
2787
- const _hoisted_5$a = { class: "row" };
2787
+ const _hoisted_5$b = { class: "row" };
2788
2788
  const _hoisted_6$8 = { class: "fg-label control-label text-capitalize control-bel col-md-12 request-form-label mb-2" };
2789
2789
  const _hoisted_7$7 = { class: "col-md-12" };
2790
2790
  const _hoisted_8$6 = ["data-cy", "placeholder", "name", "onFocus", "onChange"];
@@ -2835,7 +2835,7 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
2835
2835
  }, null, 512 /* NEED_PATCH */), [
2836
2836
  [vModelText, _ctx.form_elements['id']]
2837
2837
  ]),
2838
- createElementVNode("div", _hoisted_5$a, [
2838
+ createElementVNode("div", _hoisted_5$b, [
2839
2839
  (openBlock(true), createElementBlock(Fragment, null, renderList($props.fields, (field) => {
2840
2840
  return (openBlock(), createElementBlock("div", {
2841
2841
  class: normalizeClass(["form-group", 'col-md-' + $options.getColumns()]),
@@ -3397,7 +3397,7 @@ const _hoisted_3$c = {
3397
3397
  class: "text-danger sh-required"
3398
3398
  };
3399
3399
  const _hoisted_4$c = ["innerHTML"];
3400
- const _hoisted_5$9 = {
3400
+ const _hoisted_5$a = {
3401
3401
  key: 2,
3402
3402
  class: "form-notch"
3403
3403
  };
@@ -3708,7 +3708,7 @@ return (_ctx, _cache) => {
3708
3708
  }, null, 10 /* CLASS, PROPS */, _hoisted_4$c))
3709
3709
  : createCommentVNode("v-if", true),
3710
3710
  (unref(isFloating))
3711
- ? (openBlock(), createElementBlock("div", _hoisted_5$9, [...(_cache[1] || (_cache[1] = [
3711
+ ? (openBlock(), createElementBlock("div", _hoisted_5$a, [...(_cache[1] || (_cache[1] = [
3712
3712
  createElementVNode("div", { class: "form-notch-leading" }, null, -1 /* CACHED */),
3713
3713
  createElementVNode("div", { class: "form-notch-middle" }, null, -1 /* CACHED */),
3714
3714
  createElementVNode("div", { class: "form-notch-trailing" }, null, -1 /* CACHED */)
@@ -3761,7 +3761,7 @@ const _hoisted_1$k = ["id", "data-bs-backdrop"];
3761
3761
  const _hoisted_2$e = { class: "modal-content" };
3762
3762
  const _hoisted_3$b = { class: "modal-header" };
3763
3763
  const _hoisted_4$b = { class: "modal-title flex-fill" };
3764
- const _hoisted_5$8 = { class: "modal-body" };
3764
+ const _hoisted_5$9 = { class: "modal-body" };
3765
3765
  const _hoisted_6$6 = { class: "section" };
3766
3766
 
3767
3767
 
@@ -3833,7 +3833,7 @@ return (_ctx, _cache) => {
3833
3833
  "aria-label": "Close"
3834
3834
  }, null, -1 /* CACHED */))
3835
3835
  ]),
3836
- createElementVNode("div", _hoisted_5$8, [
3836
+ createElementVNode("div", _hoisted_5$9, [
3837
3837
  createElementVNode("div", _hoisted_6$6, [
3838
3838
  renderSlot(_ctx.$slots, "default")
3839
3839
  ])
@@ -4068,7 +4068,7 @@ const _hoisted_4$a = {
4068
4068
  "data-bs-dismiss": "offcanvas",
4069
4069
  "aria-label": "Close"
4070
4070
  };
4071
- const _hoisted_5$7 = { class: "offcanvas-body" };
4071
+ const _hoisted_5$8 = { class: "offcanvas-body" };
4072
4072
 
4073
4073
  var script$l = {
4074
4074
  __name: 'ShCanvas',
@@ -4120,7 +4120,7 @@ return (_ctx, _cache) => {
4120
4120
  createElementVNode("h5", _hoisted_3$a, toDisplayString(__props.canvasTitle), 1 /* TEXT */),
4121
4121
  createElementVNode("button", _hoisted_4$a, null, 512 /* NEED_PATCH */)
4122
4122
  ]),
4123
- createElementVNode("div", _hoisted_5$7, [
4123
+ createElementVNode("div", _hoisted_5$8, [
4124
4124
  renderSlot(_ctx.$slots, "default")
4125
4125
  ])
4126
4126
  ], 10 /* CLASS, PROPS */, _hoisted_1$h))
@@ -4618,7 +4618,7 @@ const _hoisted_4$9 = {
4618
4618
  key: 2,
4619
4619
  class: "bi bi-three-dots-vertical"
4620
4620
  };
4621
- const _hoisted_5$6 = { class: "dropdown-menu" };
4621
+ const _hoisted_5$7 = { class: "dropdown-menu" };
4622
4622
 
4623
4623
 
4624
4624
  var script$g = {
@@ -4645,7 +4645,7 @@ return (_ctx, _cache) => {
4645
4645
  ? (openBlock(), createElementBlock("i", _hoisted_3$9))
4646
4646
  : (openBlock(), createElementBlock("i", _hoisted_4$9))
4647
4647
  ]),
4648
- createElementVNode("ul", _hoisted_5$6, [
4648
+ createElementVNode("ul", _hoisted_5$7, [
4649
4649
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(actionItems), (act) => {
4650
4650
  return (openBlock(), createElementBlock("li", {
4651
4651
  key: act.label
@@ -4690,7 +4690,7 @@ const _hoisted_3$8 = {
4690
4690
  "aria-expanded": "false"
4691
4691
  };
4692
4692
  const _hoisted_4$8 = ["innerHTML"];
4693
- const _hoisted_5$5 = {
4693
+ const _hoisted_5$6 = {
4694
4694
  class: "dropdown-menu sh-range-dropdown",
4695
4695
  "aria-labelledby": "dropdownMenuLink"
4696
4696
  };
@@ -4831,7 +4831,7 @@ return (_ctx, _cache) => {
4831
4831
  _cache[3] || (_cache[3] = createTextVNode()),
4832
4832
  createElementVNode("span", { innerHTML: rangeLabel.value }, null, 8 /* PROPS */, _hoisted_4$8)
4833
4833
  ]),
4834
- createElementVNode("div", _hoisted_5$5, [
4834
+ createElementVNode("div", _hoisted_5$6, [
4835
4835
  createElementVNode("ul", _hoisted_6$5, [
4836
4836
  (openBlock(true), createElementBlock(Fragment, null, renderList(dates.value, (date) => {
4837
4837
  return (openBlock(), createElementBlock("li", {
@@ -4966,7 +4966,7 @@ const _hoisted_1$c = { key: 0 };
4966
4966
  const _hoisted_2$9 = { class: "record_count_body mb-3" };
4967
4967
  const _hoisted_3$7 = ["value"];
4968
4968
  const _hoisted_4$7 = { class: "record_counts" };
4969
- const _hoisted_5$4 = {
4969
+ const _hoisted_5$5 = {
4970
4970
  key: 0,
4971
4971
  "aria-label": "Page navigation"
4972
4972
  };
@@ -5019,7 +5019,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
5019
5019
  createElementVNode("span", _hoisted_4$7, " of " + toDisplayString($props.pagination_data.record_count) + " items", 1 /* TEXT */)
5020
5020
  ]),
5021
5021
  ($props.pagination_data != null)
5022
- ? (openBlock(), createElementBlock("nav", _hoisted_5$4, [
5022
+ ? (openBlock(), createElementBlock("nav", _hoisted_5$5, [
5023
5023
  createElementVNode("ul", _hoisted_6$4, [
5024
5024
  createElementVNode("li", {
5025
5025
  class: normalizeClass([$options.getActivePage === 1 ? 'disabled' : '' , "page-item"])
@@ -5098,7 +5098,7 @@ const _hoisted_4$6 = {
5098
5098
  key: 1,
5099
5099
  class: "row"
5100
5100
  };
5101
- const _hoisted_5$3 = { class: "col-12 mb-3 d-flex justify-content-between flex-column flex-md-row flex-lg-row" };
5101
+ const _hoisted_5$4 = { class: "col-12 mb-3 d-flex justify-content-between flex-column flex-md-row flex-lg-row" };
5102
5102
  const _hoisted_6$3 = ["placeholder"];
5103
5103
  const _hoisted_7$3 = {
5104
5104
  key: 0,
@@ -5585,7 +5585,7 @@ return (_ctx, _cache) => {
5585
5585
  : createCommentVNode("v-if", true),
5586
5586
  (!__props.hideSearch)
5587
5587
  ? (openBlock(), createElementBlock("div", _hoisted_4$6, [
5588
- createElementVNode("div", _hoisted_5$3, [
5588
+ createElementVNode("div", _hoisted_5$4, [
5589
5589
  createElementVNode("div", {
5590
5590
  class: normalizeClass(["sh-search-bar input-group", __props.hasRange ? 'me-2':''])
5591
5591
  }, [
@@ -6217,59 +6217,146 @@ const _hoisted_1$9 = {
6217
6217
  };
6218
6218
  const _hoisted_2$6 = ["onClick"];
6219
6219
  const _hoisted_3$4 = { class: "sh_tab_count" };
6220
- const _hoisted_4$4 = { class: "tab-content" };
6220
+ const _hoisted_4$4 = { class: "sh_tab_count" };
6221
+ const _hoisted_5$3 = { class: "tab-content" };
6222
+
6223
+ // const props = defineProps(['tabs', 'data', 'classes', 'currentTab', 'component', 'baseUrl', 'defaultComponent','addTabQuery'])
6221
6224
 
6222
6225
  var script$b = {
6223
6226
  __name: 'ShDynamicTabs',
6224
- props: ['tabs','data','classes','currentTab'],
6227
+ props: {
6228
+ tabs: {
6229
+ type: Array,
6230
+ required: true
6231
+ },
6232
+ data: {
6233
+ type: Object,
6234
+ default: () => ({})
6235
+ },
6236
+ classes: {
6237
+ type: String,
6238
+ default: ''
6239
+ },
6240
+ currentTab: {
6241
+ type: String,
6242
+ default: null
6243
+ },
6244
+ component: {
6245
+ type: Object,
6246
+ default: null
6247
+ },
6248
+ baseUrl: {
6249
+ type: String,
6250
+ default: null
6251
+ },
6252
+ defaultComponent: {
6253
+ type: Object,
6254
+ default: () => ({ template: '<div></div>' })
6255
+ },
6256
+ addTabQuery: {
6257
+ type: Boolean,
6258
+ default: false
6259
+ }
6260
+ },
6225
6261
  setup(__props) {
6226
6262
 
6227
6263
  const props = __props;
6228
- const tabs = props.tabs;
6264
+ const route = useRoute();
6265
+ const router = useRouter();
6266
+ const formattedTabs = computed(() => {
6267
+ if (!props.tabs || props.tabs.length === 0) {
6268
+ return []
6269
+ }
6270
+ return props.tabs.map(tab => {
6271
+ if (typeof tab === 'string') {
6272
+ return {key: tab, label: tab.replace(/_/g, ' ')}
6273
+ }
6274
+ if (typeof tab === 'function') {
6275
+ return tab(props.data)
6276
+ }
6277
+ return tab
6278
+ })
6279
+ });
6280
+ const tabsBaseUrl = props.baseUrl ?? route.path;
6229
6281
  let currentTab = shallowRef(null);
6230
6282
  const generatedId = ref(null);
6231
6283
  ref(null);
6232
- onMounted(()=>{
6233
- generatedId.value = 'tab' + Math.random().toString(36).slice(2);
6234
- if(tabs.length > 0) {
6235
- if (props.currentTab) {
6236
- currentTab.value = tabs.find(tab=>tab.label === props.currentTab);
6237
- } else {
6238
- currentTab.value = tabs[0];
6239
- }
6284
+ onMounted(() => {
6285
+ generatedId.value = 'tab' + Math.random().toString(36).slice(2);
6286
+ if (formattedTabs.value.length > 0) {
6287
+ if (props.currentTab) {
6288
+ currentTab.value = formattedTabs.value.find(tab => tab.label === props.currentTab);
6289
+ } else {
6290
+ currentTab.value = formattedTabs.value[0];
6291
+ }
6292
+ const tabParam = route.query.tab;
6293
+ if (tabParam) {
6294
+ const tabFromParam = formattedTabs.value.find(tab => getTabKey(tab) === tabParam);
6295
+ if (tabFromParam) {
6296
+ currentTab.value = tabFromParam;
6297
+ }
6298
+ } else if(currentTab.value && props.addTabQuery) {
6299
+ router.replace({path: tabsBaseUrl, query: {...route.query, tab: getTabKey(currentTab.value)}});
6300
+ }
6301
+
6240
6302
  }
6241
6303
  });
6242
6304
 
6243
- function setTab(tab){
6305
+ function setTab(tab) {
6244
6306
  currentTab.value = tab;
6245
6307
  }
6246
6308
 
6309
+ const getTabKey = (tab) => {
6310
+ return tab.key ?? tab.label.replace(/\s+/g, '_').toLowerCase()
6311
+ };
6312
+
6247
6313
  return (_ctx, _cache) => {
6314
+ const _component_router_link = resolveComponent("router-link");
6315
+
6248
6316
  return (openBlock(), createElementBlock(Fragment, null, [
6249
6317
  createElementVNode("ul", {
6250
- class: normalizeClass(["nav nav-tabs", unref(shRepo).getShConfig('tabsClass','sh-tabs nav-tabs-bordered') + __props.classes]),
6318
+ class: normalizeClass(["nav nav-tabs nav-tabs-bordered", unref(shRepo).getShConfig('tabsClass','sh-tabs nav-tabs-bordered') + __props.classes]),
6251
6319
  role: "tablist"
6252
6320
  }, [
6253
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(tabs), (tab) => {
6321
+ (openBlock(true), createElementBlock(Fragment, null, renderList(formattedTabs.value, (tab) => {
6254
6322
  return (openBlock(), createElementBlock("li", _hoisted_1$9, [
6255
- createElementVNode("button", {
6256
- onClick: $event => (setTab(tab)),
6257
- class: normalizeClass(["nav-link", unref(currentTab) === tab ? 'active':''])
6258
- }, [
6259
- createTextVNode(toDisplayString(tab.label) + " ", 1 /* TEXT */),
6260
- (tab.count || tab.tabCount)
6261
- ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
6262
- _cache[0] || (_cache[0] = createElementVNode("i", { class: "d-none" }, null, -1 /* CACHED */)),
6263
- createElementVNode("sup", _hoisted_3$4, toDisplayString(tab.count ?? tab.tabCount), 1 /* TEXT */)
6264
- ], 64 /* STABLE_FRAGMENT */))
6265
- : createCommentVNode("v-if", true)
6266
- ], 10 /* CLASS, PROPS */, _hoisted_2$6)
6323
+ (!__props.addTabQuery)
6324
+ ? (openBlock(), createElementBlock("button", {
6325
+ key: 0,
6326
+ onClick: $event => (setTab(tab)),
6327
+ class: normalizeClass(["nav-link", unref(currentTab) === tab ? 'active':''])
6328
+ }, [
6329
+ createTextVNode(toDisplayString(tab.label) + " ", 1 /* TEXT */),
6330
+ (tab.count || tab.tabCount)
6331
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
6332
+ _cache[0] || (_cache[0] = createElementVNode("i", { class: "d-none" }, null, -1 /* CACHED */)),
6333
+ createElementVNode("sup", _hoisted_3$4, toDisplayString(tab.count ?? tab.tabCount), 1 /* TEXT */)
6334
+ ], 64 /* STABLE_FRAGMENT */))
6335
+ : createCommentVNode("v-if", true)
6336
+ ], 10 /* CLASS, PROPS */, _hoisted_2$6))
6337
+ : (openBlock(), createBlock(_component_router_link, {
6338
+ key: 1,
6339
+ to: `${unref(tabsBaseUrl)}?tab=${getTabKey(tab)}`,
6340
+ onClick: $event => (setTab(tab)),
6341
+ class: normalizeClass(["nav-link", unref(currentTab) === tab ? 'active':''])
6342
+ }, {
6343
+ default: withCtx(() => [
6344
+ createTextVNode(toDisplayString(tab.label) + " ", 1 /* TEXT */),
6345
+ (tab.count || tab.tabCount)
6346
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
6347
+ _cache[1] || (_cache[1] = createElementVNode("i", { class: "d-none" }, null, -1 /* CACHED */)),
6348
+ createElementVNode("sup", _hoisted_4$4, toDisplayString(tab.count ?? tab.tabCount), 1 /* TEXT */)
6349
+ ], 64 /* STABLE_FRAGMENT */))
6350
+ : createCommentVNode("v-if", true)
6351
+ ]),
6352
+ _: 2 /* DYNAMIC */
6353
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["to", "onClick", "class"]))
6267
6354
  ]))
6268
6355
  }), 256 /* UNKEYED_FRAGMENT */))
6269
6356
  ], 2 /* CLASS */),
6270
- createElementVNode("div", _hoisted_4$4, [
6357
+ createElementVNode("div", _hoisted_5$3, [
6271
6358
  (unref(currentTab))
6272
- ? (openBlock(), createBlock(resolveDynamicComponent(unref(currentTab).component), normalizeProps(mergeProps({ key: 0 }, unref(currentTab))), null, 16 /* FULL_PROPS */))
6359
+ ? (openBlock(), createBlock(resolveDynamicComponent(unref(currentTab).component ?? __props.defaultComponent), normalizeProps(mergeProps({ key: 0 }, unref(currentTab))), null, 16 /* FULL_PROPS */))
6273
6360
  : createCommentVNode("v-if", true)
6274
6361
  ])
6275
6362
  ], 64 /* STABLE_FRAGMENT */))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/shframework",
3
- "version": "5.6.0",
3
+ "version": "5.6.1",
4
4
  "description": "Vue library for handling laravel backend",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.mjs",