@iankibetsh/shframework 1.6.7 → 1.6.8

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.
Files changed (3) hide show
  1. package/dist/library.js +126 -103
  2. package/dist/library.mjs +126 -103
  3. package/package.json +1 -1
package/dist/library.js CHANGED
@@ -1945,7 +1945,7 @@ const _hoisted_2$d = {
1945
1945
  const _hoisted_3$c = ["src"];
1946
1946
  const _hoisted_4$c = ["value"];
1947
1947
 
1948
- function render$5(_ctx, _cache, $props, $setup, $data, $options) {
1948
+ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
1949
1949
  return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$n, [
1950
1950
  ($data.selectedCountry)
1951
1951
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$d, [
@@ -1980,7 +1980,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
1980
1980
  ]))
1981
1981
  }
1982
1982
 
1983
- script$s.render = render$5;
1983
+ script$s.render = render$4;
1984
1984
  script$s.__file = "src/lib/components/form-components/PhoneInput.vue";
1985
1985
 
1986
1986
  var script$r = {
@@ -2028,7 +2028,7 @@ const _hoisted_1$m = /*#__PURE__*/vue.createElementVNode("textarea", {
2028
2028
  "data-cy": "tinymce_editor"
2029
2029
  }, null, -1 /* HOISTED */);
2030
2030
 
2031
- function render$4(_ctx, _cache, $props, $setup, $data, $options) {
2031
+ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
2032
2032
  const _component_editor = vue.resolveComponent("editor");
2033
2033
 
2034
2034
  return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
@@ -2057,7 +2057,7 @@ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
2057
2057
  ], 64 /* STABLE_FRAGMENT */))
2058
2058
  }
2059
2059
 
2060
- script$r.render = render$4;
2060
+ script$r.render = render$3;
2061
2061
  script$r.__file = "src/lib/components/form-components/ShEditor.vue";
2062
2062
 
2063
2063
  const _hoisted_1$l = {
@@ -2609,7 +2609,7 @@ const _hoisted_24$1 = /*#__PURE__*/vue.createElementVNode("span", {
2609
2609
  "aria-hidden": "true"
2610
2610
  }, null, -1 /* HOISTED */);
2611
2611
 
2612
- function render$3(_ctx, _cache, $props, $setup, $data, $options) {
2612
+ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
2613
2613
  const _component_phone_input = vue.resolveComponent("phone-input");
2614
2614
  const _component_ShSuggest = vue.resolveComponent("ShSuggest");
2615
2615
  const _component_ShEditor = vue.resolveComponent("ShEditor");
@@ -2832,7 +2832,7 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
2832
2832
  ], 64 /* STABLE_FRAGMENT */))
2833
2833
  }
2834
2834
 
2835
- script$p.render = render$3;
2835
+ script$p.render = render$2;
2836
2836
  script$p.__file = "src/lib/components/ShForm.vue";
2837
2837
 
2838
2838
  var script$o = {
@@ -3798,7 +3798,7 @@ const _hoisted_22$1 = {
3798
3798
  class: "text-center"
3799
3799
  };
3800
3800
 
3801
- function render$2(_ctx, _cache, $props, $setup, $data, $options) {
3801
+ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3802
3802
  return ($props.paginationStyle !== 'loadMore')
3803
3803
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
3804
3804
  vue.createElementVNode("div", _hoisted_2$6, [
@@ -3872,7 +3872,7 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
3872
3872
  ]))
3873
3873
  }
3874
3874
 
3875
- script$c.render = render$2;
3875
+ script$c.render = render$1;
3876
3876
  script$c.__file = "src/lib/components/list_templates/Pagination.vue";
3877
3877
 
3878
3878
  const _hoisted_1$a = /*#__PURE__*/vue.createElementVNode("span", {
@@ -4481,7 +4481,7 @@ const _hoisted_63 = { key: 0 };
4481
4481
  const _hoisted_64 = ["href"];
4482
4482
  const _hoisted_65 = ["title", "onClick"];
4483
4483
 
4484
- function render$1(_ctx, _cache, $props, $setup, $data, $options) {
4484
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
4485
4485
  const _component_router_link = vue.resolveComponent("router-link");
4486
4486
  const _component_sh_confirm_action = vue.resolveComponent("sh-confirm-action");
4487
4487
  const _component_sh_silent_action = vue.resolveComponent("sh-silent-action");
@@ -4582,11 +4582,13 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
4582
4582
  class: "text-capitalize",
4583
4583
  onClick: $event => ($options.changeKey('order_by',title(null)))
4584
4584
  }, vue.toDisplayString(title(null).replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_23))
4585
- : (vue.openBlock(), vue.createElementBlock("a", {
4586
- key: 2,
4587
- class: "text-capitalize",
4588
- onClick: $event => ($options.changeKey('order_by',title[0]))
4589
- }, vue.toDisplayString(title[1].replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_24))
4585
+ : (typeof title !== 'undefined')
4586
+ ? (vue.openBlock(), vue.createElementBlock("a", {
4587
+ key: 2,
4588
+ class: "text-capitalize",
4589
+ onClick: $event => ($options.changeKey('order_by',title))
4590
+ }, vue.toDisplayString(title.replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_24))
4591
+ : vue.createCommentVNode("v-if", true)
4590
4592
  ]))
4591
4593
  }), 128 /* KEYED_FRAGMENT */)),
4592
4594
  ($props.actions)
@@ -4624,9 +4626,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
4624
4626
  onClick: $event => ($options.rowSelected(record))
4625
4627
  }, [
4626
4628
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.headers, (key) => {
4627
- return (vue.openBlock(), vue.createElementBlock("td", {
4628
- key: key[0]
4629
- }, [
4629
+ return (vue.openBlock(), vue.createElementBlock("td", { key: key }, [
4630
4630
  (typeof key === 'string' && $props.links && $props.links[key])
4631
4631
  ? (vue.openBlock(), vue.createBlock(_component_router_link, {
4632
4632
  key: 0,
@@ -4940,108 +4940,128 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
4940
4940
  ]))
4941
4941
  }
4942
4942
 
4943
- script$9.render = render$1;
4943
+ script$9.render = render;
4944
4944
  script$9.__file = "src/lib/components/ShTable.vue";
4945
4945
 
4946
4946
  var script$8 = {
4947
- name: 'ShTabs',
4948
- props: ['tabs', 'baseUrl', 'sharedData', 'tabCounts', 'responsive','classOne','classTwo','classes'],
4949
- data () {
4950
- return {
4951
- currentTab: '',
4952
- generatedId: null,
4953
- isResponsive: typeof this.responsive !== 'undefined'
4954
- }
4947
+ __name: 'ShTabs',
4948
+ props: {
4949
+ tabs: {
4950
+ type: Array,
4951
+ required: true
4955
4952
  },
4956
- watch: {
4957
- refreshStatus: function (state) {
4958
- if (state === 0) {
4959
- if (this.tabCounts) {
4960
- this.setTabCounts(this.tabCounts);
4961
- }
4962
- }
4963
- },
4964
- tabCounts: function () {
4965
- this.resetTabCounts();
4966
- }
4953
+ baseUrl: {
4954
+ type: String,
4955
+ required: true
4967
4956
  },
4968
- computed: {
4969
- refreshStatus () {
4970
- }
4957
+ sharedData: {
4958
+ type: Object
4971
4959
  },
4972
- mounted () {
4973
- this.generatedId = 'tab' + Math.random().toString(36).slice(2);
4974
- this.resetTabCounts();
4975
- this.setTab(this.tabs[0]);
4960
+ tabCounts: {
4961
+ type: Object
4976
4962
  },
4977
- methods: {
4978
- setTab: function (tab) {
4979
- if (tab) {
4980
- this.currentTab = tab.replace(/_/g, ' ');
4981
- }
4982
- },
4983
- setTabCounts: function (tabCounts) {
4984
- if (typeof tabCounts === 'object') {
4985
- this.setCounts(tabCounts);
4986
- } else {
4987
- shApis.doGet(tabCounts).then(res => {
4988
- this.setCounts(res.data);
4989
- });
4990
- }
4991
- },
4992
- resetTabCounts: function () {
4993
- const arr = this.$route.fullPath.split('/');
4994
- if (!this.tabExistsInUrl()) {
4995
- this.$router.push(this.$route.fullPath + '/tab/' + this.tabs[0]);
4996
- } else {
4997
- this.currentTab = arr[arr.length - 1];
4998
- }
4999
- if (this.tabCounts) {
5000
- this.setTabCounts(this.tabCounts);
4963
+ responsive: {
4964
+ type: Object
4965
+ },
4966
+ classes: {
4967
+ type: String
4968
+ },
4969
+ classOne: {
4970
+ type: String
4971
+ },
4972
+ classTwo: {
4973
+ type: String
4974
+ }
4975
+ },
4976
+ setup(__props) {
4977
+
4978
+ const props = __props;
4979
+
4980
+
4981
+ const route = vueRouter.useRoute();
4982
+ const router = vueRouter.useRouter();
4983
+ const currentTab = vue.ref('');
4984
+ const path = vue.ref(route.path);
4985
+
4986
+ vue.onMounted(()=>{
4987
+ resetTabCounts();
4988
+ setTab(props.tabs[0]);
4989
+ });
4990
+
4991
+ vue.watch(()=>props.tabCounts, () => {
4992
+ resetTabCounts();
4993
+ });
4994
+
4995
+ vue.watch(()=>route.path,(newPath)=>{
4996
+ path.value = newPath;
4997
+ });
4998
+
4999
+ const setTab = (tab) => {
5000
+ if (tab) {
5001
+ currentTab.value = tab.replace(/_/g, ' ');
5002
+ }
5003
+ };
5004
+ const setTabCounts = (tabCounts) => {
5005
+ if (typeof tabCounts === 'object') {
5006
+ setCounts(tabCounts);
5007
+ } else {
5008
+ shApis.doGet(tabCounts).then(res => {
5009
+ setCounts(res.data);
5010
+ });
5011
+ }
5012
+ };
5013
+ const resetTabCounts = () => {
5014
+ const arr = route.fullPath.split('/');
5015
+ if (!tabExistsInUrl()) {
5016
+ router.push(route.fullPath + '/tab/' + props.tabs[0]);
5017
+ } else {
5018
+ currentTab.value = arr[arr.length - 1];
5019
+ }
5020
+ if (props.tabCounts) {
5021
+ setTabCounts(props.tabCounts);
5022
+ }
5023
+ };
5024
+ const tabExistsInUrl = () => {
5025
+ let exists = false;
5026
+ props.tabs.forEach(tab => {
5027
+ if (route.fullPath.includes(`/${tab}`)) {
5028
+ exists = true;
5029
+ }
5030
+ });
5031
+ return exists
5032
+ };
5033
+ const setCounts = (res) => {
5034
+ Object.keys(res).forEach(key => {
5035
+ let elem = document.getElementsByClassName('sh_tab_' + key);
5036
+ if (elem) {
5037
+ let txt = elem.innerHTML;
5038
+ txt = txt.split('<i class="d-none"></i>')[0];
5039
+ if (parseInt(res[key]) > 0) {
5040
+ elem.innerHTML = txt + '<i class="d-none"></i><sup class="sh_tab_count">' + res[key] + '</sup>';
5001
5041
  }
5002
- },
5003
- tabExistsInUrl: function () {
5004
- let exists = false;
5005
- this.tabs.forEach(tab => {
5006
- if (this.$route.fullPath.includes(tab)) {
5007
- exists = true;
5008
- }
5009
- });
5010
- return exists
5011
- },
5012
- setCounts: function (res) {
5013
- Object.keys(res).forEach(key => {
5014
- let elem = document.getElementsByClassName('sh_tab_' + key);
5015
- if (elem) {
5016
- let txt = elem.innerHTML;
5017
- txt = txt.split('<i class="d-none"></i>')[0];
5018
- if (parseInt(res[key]) > 0) {
5019
- elem.innerHTML = txt + '<i class="d-none"></i><sup class="sh_tab_count">' + res[key] + '</sup>';
5020
- }
5021
- }
5022
- });
5023
5042
  }
5024
- }
5043
+ });
5025
5044
  };
5026
5045
 
5027
- function render(_ctx, _cache, $props, $setup, $data, $options) {
5046
+ return (_ctx, _cache) => {
5028
5047
  const _component_router_link = vue.resolveComponent("router-link");
5029
5048
  const _component_router_view = vue.resolveComponent("router-view");
5030
5049
 
5031
5050
  return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
5051
+ vue.createElementVNode("h3", null, vue.toDisplayString(path.value), 1 /* TEXT */),
5032
5052
  vue.createElementVNode("ul", {
5033
- class: vue.normalizeClass(["nav nav-tabs sh-tabs", $props.classes])
5053
+ class: vue.normalizeClass(["nav nav-tabs sh-tabs", __props.classes])
5034
5054
  }, [
5035
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.tabs, (tab) => {
5055
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.tabs, (tab) => {
5036
5056
  return (vue.openBlock(), vue.createElementBlock("li", {
5037
5057
  class: "nav-item",
5038
5058
  key: tab
5039
5059
  }, [
5040
5060
  vue.createVNode(_component_router_link, {
5041
- onClick: $event => ($options.setTab(tab)),
5061
+ onClick: $event => (setTab(tab)),
5042
5062
  "active-class": 'active',
5043
5063
  class: vue.normalizeClass(["nav-link text-capitalize", 'sh_tab_' + tab]),
5044
- to: $props.baseUrl+'/tab/'+tab,
5064
+ to: __props.baseUrl+'/tab/'+tab,
5045
5065
  role: "tab"
5046
5066
  }, {
5047
5067
  default: vue.withCtx(() => [
@@ -5053,18 +5073,21 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
5053
5073
  }), 128 /* KEYED_FRAGMENT */))
5054
5074
  ], 2 /* CLASS */),
5055
5075
  vue.createElementVNode("div", {
5056
- class: vue.normalizeClass(["tab-content", $props.classTwo])
5076
+ class: vue.normalizeClass(["tab-content", __props.classTwo])
5057
5077
  }, [
5058
- vue.createVNode(_component_router_view, {
5059
- currentTab: $data.currentTab,
5060
- sharedData: $props.sharedData,
5061
- tabCounts: $props.tabCounts
5062
- }, null, 8 /* PROPS */, ["currentTab", "sharedData", "tabCounts"])
5078
+ (vue.openBlock(), vue.createBlock(_component_router_view, {
5079
+ currentTab: currentTab.value,
5080
+ key: path.value,
5081
+ sharedData: __props.sharedData,
5082
+ tabCounts: __props.tabCounts
5083
+ }, null, 8 /* PROPS */, ["currentTab", "sharedData", "tabCounts"]))
5063
5084
  ], 2 /* CLASS */)
5064
5085
  ], 64 /* STABLE_FRAGMENT */))
5065
5086
  }
5087
+ }
5088
+
5089
+ };
5066
5090
 
5067
- script$8.render = render;
5068
5091
  script$8.__file = "src/lib/components/ShTabs.vue";
5069
5092
 
5070
5093
  const _hoisted_1$7 = {
@@ -5581,7 +5604,7 @@ const initPopup = ()=>{
5581
5604
  });
5582
5605
  }
5583
5606
  };
5584
- const goBack = ()=> route.matched.length > 1 && router.back();
5607
+ const goBack = ()=> route.matched.length > 1 && router.push(route.matched[route.matched.length-2].path);
5585
5608
 
5586
5609
  return (_ctx, _cache) => {
5587
5610
  return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
package/dist/library.mjs CHANGED
@@ -1932,7 +1932,7 @@ const _hoisted_2$d = {
1932
1932
  const _hoisted_3$c = ["src"];
1933
1933
  const _hoisted_4$c = ["value"];
1934
1934
 
1935
- function render$5(_ctx, _cache, $props, $setup, $data, $options) {
1935
+ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
1936
1936
  return (openBlock(), createElementBlock("div", _hoisted_1$n, [
1937
1937
  ($data.selectedCountry)
1938
1938
  ? (openBlock(), createElementBlock("div", _hoisted_2$d, [
@@ -1967,7 +1967,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
1967
1967
  ]))
1968
1968
  }
1969
1969
 
1970
- script$s.render = render$5;
1970
+ script$s.render = render$4;
1971
1971
  script$s.__file = "src/lib/components/form-components/PhoneInput.vue";
1972
1972
 
1973
1973
  var script$r = {
@@ -2015,7 +2015,7 @@ const _hoisted_1$m = /*#__PURE__*/createElementVNode("textarea", {
2015
2015
  "data-cy": "tinymce_editor"
2016
2016
  }, null, -1 /* HOISTED */);
2017
2017
 
2018
- function render$4(_ctx, _cache, $props, $setup, $data, $options) {
2018
+ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
2019
2019
  const _component_editor = resolveComponent("editor");
2020
2020
 
2021
2021
  return (openBlock(), createElementBlock(Fragment, null, [
@@ -2044,7 +2044,7 @@ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
2044
2044
  ], 64 /* STABLE_FRAGMENT */))
2045
2045
  }
2046
2046
 
2047
- script$r.render = render$4;
2047
+ script$r.render = render$3;
2048
2048
  script$r.__file = "src/lib/components/form-components/ShEditor.vue";
2049
2049
 
2050
2050
  const _hoisted_1$l = {
@@ -2596,7 +2596,7 @@ const _hoisted_24$1 = /*#__PURE__*/createElementVNode("span", {
2596
2596
  "aria-hidden": "true"
2597
2597
  }, null, -1 /* HOISTED */);
2598
2598
 
2599
- function render$3(_ctx, _cache, $props, $setup, $data, $options) {
2599
+ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
2600
2600
  const _component_phone_input = resolveComponent("phone-input");
2601
2601
  const _component_ShSuggest = resolveComponent("ShSuggest");
2602
2602
  const _component_ShEditor = resolveComponent("ShEditor");
@@ -2819,7 +2819,7 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
2819
2819
  ], 64 /* STABLE_FRAGMENT */))
2820
2820
  }
2821
2821
 
2822
- script$p.render = render$3;
2822
+ script$p.render = render$2;
2823
2823
  script$p.__file = "src/lib/components/ShForm.vue";
2824
2824
 
2825
2825
  var script$o = {
@@ -3785,7 +3785,7 @@ const _hoisted_22$1 = {
3785
3785
  class: "text-center"
3786
3786
  };
3787
3787
 
3788
- function render$2(_ctx, _cache, $props, $setup, $data, $options) {
3788
+ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
3789
3789
  return ($props.paginationStyle !== 'loadMore')
3790
3790
  ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
3791
3791
  createElementVNode("div", _hoisted_2$6, [
@@ -3859,7 +3859,7 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
3859
3859
  ]))
3860
3860
  }
3861
3861
 
3862
- script$c.render = render$2;
3862
+ script$c.render = render$1;
3863
3863
  script$c.__file = "src/lib/components/list_templates/Pagination.vue";
3864
3864
 
3865
3865
  const _hoisted_1$a = /*#__PURE__*/createElementVNode("span", {
@@ -4468,7 +4468,7 @@ const _hoisted_63 = { key: 0 };
4468
4468
  const _hoisted_64 = ["href"];
4469
4469
  const _hoisted_65 = ["title", "onClick"];
4470
4470
 
4471
- function render$1(_ctx, _cache, $props, $setup, $data, $options) {
4471
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
4472
4472
  const _component_router_link = resolveComponent("router-link");
4473
4473
  const _component_sh_confirm_action = resolveComponent("sh-confirm-action");
4474
4474
  const _component_sh_silent_action = resolveComponent("sh-silent-action");
@@ -4569,11 +4569,13 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
4569
4569
  class: "text-capitalize",
4570
4570
  onClick: $event => ($options.changeKey('order_by',title(null)))
4571
4571
  }, toDisplayString(title(null).replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_23))
4572
- : (openBlock(), createElementBlock("a", {
4573
- key: 2,
4574
- class: "text-capitalize",
4575
- onClick: $event => ($options.changeKey('order_by',title[0]))
4576
- }, toDisplayString(title[1].replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_24))
4572
+ : (typeof title !== 'undefined')
4573
+ ? (openBlock(), createElementBlock("a", {
4574
+ key: 2,
4575
+ class: "text-capitalize",
4576
+ onClick: $event => ($options.changeKey('order_by',title))
4577
+ }, toDisplayString(title.replace(/_/g, ' ')), 9 /* TEXT, PROPS */, _hoisted_24))
4578
+ : createCommentVNode("v-if", true)
4577
4579
  ]))
4578
4580
  }), 128 /* KEYED_FRAGMENT */)),
4579
4581
  ($props.actions)
@@ -4611,9 +4613,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
4611
4613
  onClick: $event => ($options.rowSelected(record))
4612
4614
  }, [
4613
4615
  (openBlock(true), createElementBlock(Fragment, null, renderList($props.headers, (key) => {
4614
- return (openBlock(), createElementBlock("td", {
4615
- key: key[0]
4616
- }, [
4616
+ return (openBlock(), createElementBlock("td", { key: key }, [
4617
4617
  (typeof key === 'string' && $props.links && $props.links[key])
4618
4618
  ? (openBlock(), createBlock(_component_router_link, {
4619
4619
  key: 0,
@@ -4927,108 +4927,128 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
4927
4927
  ]))
4928
4928
  }
4929
4929
 
4930
- script$9.render = render$1;
4930
+ script$9.render = render;
4931
4931
  script$9.__file = "src/lib/components/ShTable.vue";
4932
4932
 
4933
4933
  var script$8 = {
4934
- name: 'ShTabs',
4935
- props: ['tabs', 'baseUrl', 'sharedData', 'tabCounts', 'responsive','classOne','classTwo','classes'],
4936
- data () {
4937
- return {
4938
- currentTab: '',
4939
- generatedId: null,
4940
- isResponsive: typeof this.responsive !== 'undefined'
4941
- }
4934
+ __name: 'ShTabs',
4935
+ props: {
4936
+ tabs: {
4937
+ type: Array,
4938
+ required: true
4942
4939
  },
4943
- watch: {
4944
- refreshStatus: function (state) {
4945
- if (state === 0) {
4946
- if (this.tabCounts) {
4947
- this.setTabCounts(this.tabCounts);
4948
- }
4949
- }
4950
- },
4951
- tabCounts: function () {
4952
- this.resetTabCounts();
4953
- }
4940
+ baseUrl: {
4941
+ type: String,
4942
+ required: true
4954
4943
  },
4955
- computed: {
4956
- refreshStatus () {
4957
- }
4944
+ sharedData: {
4945
+ type: Object
4958
4946
  },
4959
- mounted () {
4960
- this.generatedId = 'tab' + Math.random().toString(36).slice(2);
4961
- this.resetTabCounts();
4962
- this.setTab(this.tabs[0]);
4947
+ tabCounts: {
4948
+ type: Object
4963
4949
  },
4964
- methods: {
4965
- setTab: function (tab) {
4966
- if (tab) {
4967
- this.currentTab = tab.replace(/_/g, ' ');
4968
- }
4969
- },
4970
- setTabCounts: function (tabCounts) {
4971
- if (typeof tabCounts === 'object') {
4972
- this.setCounts(tabCounts);
4973
- } else {
4974
- shApis.doGet(tabCounts).then(res => {
4975
- this.setCounts(res.data);
4976
- });
4977
- }
4978
- },
4979
- resetTabCounts: function () {
4980
- const arr = this.$route.fullPath.split('/');
4981
- if (!this.tabExistsInUrl()) {
4982
- this.$router.push(this.$route.fullPath + '/tab/' + this.tabs[0]);
4983
- } else {
4984
- this.currentTab = arr[arr.length - 1];
4985
- }
4986
- if (this.tabCounts) {
4987
- this.setTabCounts(this.tabCounts);
4950
+ responsive: {
4951
+ type: Object
4952
+ },
4953
+ classes: {
4954
+ type: String
4955
+ },
4956
+ classOne: {
4957
+ type: String
4958
+ },
4959
+ classTwo: {
4960
+ type: String
4961
+ }
4962
+ },
4963
+ setup(__props) {
4964
+
4965
+ const props = __props;
4966
+
4967
+
4968
+ const route = useRoute();
4969
+ const router = useRouter();
4970
+ const currentTab = ref('');
4971
+ const path = ref(route.path);
4972
+
4973
+ onMounted(()=>{
4974
+ resetTabCounts();
4975
+ setTab(props.tabs[0]);
4976
+ });
4977
+
4978
+ watch(()=>props.tabCounts, () => {
4979
+ resetTabCounts();
4980
+ });
4981
+
4982
+ watch(()=>route.path,(newPath)=>{
4983
+ path.value = newPath;
4984
+ });
4985
+
4986
+ const setTab = (tab) => {
4987
+ if (tab) {
4988
+ currentTab.value = tab.replace(/_/g, ' ');
4989
+ }
4990
+ };
4991
+ const setTabCounts = (tabCounts) => {
4992
+ if (typeof tabCounts === 'object') {
4993
+ setCounts(tabCounts);
4994
+ } else {
4995
+ shApis.doGet(tabCounts).then(res => {
4996
+ setCounts(res.data);
4997
+ });
4998
+ }
4999
+ };
5000
+ const resetTabCounts = () => {
5001
+ const arr = route.fullPath.split('/');
5002
+ if (!tabExistsInUrl()) {
5003
+ router.push(route.fullPath + '/tab/' + props.tabs[0]);
5004
+ } else {
5005
+ currentTab.value = arr[arr.length - 1];
5006
+ }
5007
+ if (props.tabCounts) {
5008
+ setTabCounts(props.tabCounts);
5009
+ }
5010
+ };
5011
+ const tabExistsInUrl = () => {
5012
+ let exists = false;
5013
+ props.tabs.forEach(tab => {
5014
+ if (route.fullPath.includes(`/${tab}`)) {
5015
+ exists = true;
5016
+ }
5017
+ });
5018
+ return exists
5019
+ };
5020
+ const setCounts = (res) => {
5021
+ Object.keys(res).forEach(key => {
5022
+ let elem = document.getElementsByClassName('sh_tab_' + key);
5023
+ if (elem) {
5024
+ let txt = elem.innerHTML;
5025
+ txt = txt.split('<i class="d-none"></i>')[0];
5026
+ if (parseInt(res[key]) > 0) {
5027
+ elem.innerHTML = txt + '<i class="d-none"></i><sup class="sh_tab_count">' + res[key] + '</sup>';
4988
5028
  }
4989
- },
4990
- tabExistsInUrl: function () {
4991
- let exists = false;
4992
- this.tabs.forEach(tab => {
4993
- if (this.$route.fullPath.includes(tab)) {
4994
- exists = true;
4995
- }
4996
- });
4997
- return exists
4998
- },
4999
- setCounts: function (res) {
5000
- Object.keys(res).forEach(key => {
5001
- let elem = document.getElementsByClassName('sh_tab_' + key);
5002
- if (elem) {
5003
- let txt = elem.innerHTML;
5004
- txt = txt.split('<i class="d-none"></i>')[0];
5005
- if (parseInt(res[key]) > 0) {
5006
- elem.innerHTML = txt + '<i class="d-none"></i><sup class="sh_tab_count">' + res[key] + '</sup>';
5007
- }
5008
- }
5009
- });
5010
5029
  }
5011
- }
5030
+ });
5012
5031
  };
5013
5032
 
5014
- function render(_ctx, _cache, $props, $setup, $data, $options) {
5033
+ return (_ctx, _cache) => {
5015
5034
  const _component_router_link = resolveComponent("router-link");
5016
5035
  const _component_router_view = resolveComponent("router-view");
5017
5036
 
5018
5037
  return (openBlock(), createElementBlock(Fragment, null, [
5038
+ createElementVNode("h3", null, toDisplayString(path.value), 1 /* TEXT */),
5019
5039
  createElementVNode("ul", {
5020
- class: normalizeClass(["nav nav-tabs sh-tabs", $props.classes])
5040
+ class: normalizeClass(["nav nav-tabs sh-tabs", __props.classes])
5021
5041
  }, [
5022
- (openBlock(true), createElementBlock(Fragment, null, renderList($props.tabs, (tab) => {
5042
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.tabs, (tab) => {
5023
5043
  return (openBlock(), createElementBlock("li", {
5024
5044
  class: "nav-item",
5025
5045
  key: tab
5026
5046
  }, [
5027
5047
  createVNode(_component_router_link, {
5028
- onClick: $event => ($options.setTab(tab)),
5048
+ onClick: $event => (setTab(tab)),
5029
5049
  "active-class": 'active',
5030
5050
  class: normalizeClass(["nav-link text-capitalize", 'sh_tab_' + tab]),
5031
- to: $props.baseUrl+'/tab/'+tab,
5051
+ to: __props.baseUrl+'/tab/'+tab,
5032
5052
  role: "tab"
5033
5053
  }, {
5034
5054
  default: withCtx(() => [
@@ -5040,18 +5060,21 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
5040
5060
  }), 128 /* KEYED_FRAGMENT */))
5041
5061
  ], 2 /* CLASS */),
5042
5062
  createElementVNode("div", {
5043
- class: normalizeClass(["tab-content", $props.classTwo])
5063
+ class: normalizeClass(["tab-content", __props.classTwo])
5044
5064
  }, [
5045
- createVNode(_component_router_view, {
5046
- currentTab: $data.currentTab,
5047
- sharedData: $props.sharedData,
5048
- tabCounts: $props.tabCounts
5049
- }, null, 8 /* PROPS */, ["currentTab", "sharedData", "tabCounts"])
5065
+ (openBlock(), createBlock(_component_router_view, {
5066
+ currentTab: currentTab.value,
5067
+ key: path.value,
5068
+ sharedData: __props.sharedData,
5069
+ tabCounts: __props.tabCounts
5070
+ }, null, 8 /* PROPS */, ["currentTab", "sharedData", "tabCounts"]))
5050
5071
  ], 2 /* CLASS */)
5051
5072
  ], 64 /* STABLE_FRAGMENT */))
5052
5073
  }
5074
+ }
5075
+
5076
+ };
5053
5077
 
5054
- script$8.render = render;
5055
5078
  script$8.__file = "src/lib/components/ShTabs.vue";
5056
5079
 
5057
5080
  const _hoisted_1$7 = {
@@ -5568,7 +5591,7 @@ const initPopup = ()=>{
5568
5591
  });
5569
5592
  }
5570
5593
  };
5571
- const goBack = ()=> route.matched.length > 1 && router.back();
5594
+ const goBack = ()=> route.matched.length > 1 && router.push(route.matched[route.matched.length-2].path);
5572
5595
 
5573
5596
  return (_ctx, _cache) => {
5574
5597
  return (openBlock(), createElementBlock(Fragment, null, [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/shframework",
3
- "version": "1.6.7",
3
+ "version": "1.6.8",
4
4
  "description": "Vue library for handling laravel backend",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.mjs",