@iankibetsh/shframework 5.8.8 → 5.9.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/README.md CHANGED
@@ -66,15 +66,17 @@ The flagship component for generating complex forms from simple configurations.
66
66
  - **Auto-Detection**: Infers input types from field names (email, phone, date, etc.).
67
67
  - **Multi-Step Support**: Break long forms into logical steps with progress indicators.
68
68
  - **Validation**: Seamlessly handles and displays Laravel validation errors (422).
69
- - **GraphQL Support**: Integrate with GraphQL mutations via the `gqlMutation` prop.
70
- - **Checkbox Support**: Easily handle boolean or multiple-choice fields with `type: 'checkbox'`.
71
69
  - **Modern Reactivity**: Built using Vue 3.4's `defineModel` for clean, conflict-free two-way binding.
72
70
 
73
71
  ```html
74
72
  <sh-auto-form
75
- :fields="['name', 'email', 'password', 'gender']"
76
- :required="['name', 'email']"
77
- action="auth/register"
73
+ :fields="[
74
+ { field: 'name', label: 'Name', required: true },
75
+ { field: 'email', type: 'email', label: 'Email', required: true },
76
+ { field: 'password', type: 'password', label: 'Password' },
77
+ { field: 'gender', type: 'select', label: 'Gender' }
78
+ ]"
79
+ :action="getActionUrl('register')"
78
80
  :successCallback="onRegistered"
79
81
  />
80
82
  ```
@@ -91,8 +93,11 @@ A convenience component that wraps a trigger button, a Bootstrap modal, and an `
91
93
  <sh-modal-form
92
94
  modal-id="addTaskModal"
93
95
  modal-title="Create New Task"
94
- :fields="['title', 'description']"
95
- action="tasks/store"
96
+ :fields="[
97
+ { field: 'title', label: 'Task Title', required: true },
98
+ { field: 'description', type: 'textarea', label: 'Description' }
99
+ ]"
100
+ :action="getActionUrl('storeTask')"
96
101
  >
97
102
  Add Task
98
103
  </sh-modal-form>
@@ -1,4 +1,36 @@
1
1
 
2
+ .sh-phone{
3
+ display: flex;
4
+ width: 100%;
5
+ align-items: center;
6
+ padding: 0 0.25rem;
7
+ }
8
+ .phone-country{
9
+ width: 2rem;
10
+ border: none;
11
+ align-self: center;
12
+ outline: none !important;
13
+ padding: 0.4rem;
14
+ border-right: 1px solid #0003;
15
+ }
16
+ .phone-number{
17
+ width: calc(100% - 2.2rem);
18
+ border: none;
19
+ align-self: center;
20
+ outline: none;
21
+ margin-bottom: 0;
22
+ padding: 0.4rem;
23
+ }
24
+ .sh-phone img{
25
+ padding: 0.125rem;
26
+ width: 2rem;
27
+ height: 2rem;
28
+ }
29
+ .phone-number::placeholder{
30
+ font-weight: 300;
31
+ opacity: 0.5;
32
+ }
33
+
2
34
  /* Step Container */
3
35
  .sh-form-steps-container {
4
36
  margin-bottom: 2.5rem;
@@ -260,38 +292,6 @@
260
292
  }
261
293
  }
262
294
 
263
- .sh-phone{
264
- display: flex;
265
- width: 100%;
266
- align-items: center;
267
- padding: 0 0.25rem;
268
- }
269
- .phone-country{
270
- width: 2rem;
271
- border: none;
272
- align-self: center;
273
- outline: none !important;
274
- padding: 0.4rem;
275
- border-right: 1px solid #0003;
276
- }
277
- .phone-number{
278
- width: calc(100% - 2.2rem);
279
- border: none;
280
- align-self: center;
281
- outline: none;
282
- margin-bottom: 0;
283
- padding: 0.4rem;
284
- }
285
- .sh-phone img{
286
- padding: 0.125rem;
287
- width: 2rem;
288
- height: 2rem;
289
- }
290
- .phone-number::placeholder{
291
- font-weight: 300;
292
- opacity: 0.5;
293
- }
294
-
295
295
  .colored-toast.swal2-icon-success {
296
296
  background-color: #a5dc86 !important;
297
297
  }
@@ -384,6 +384,11 @@
384
384
  margin-right: 0.255em;
385
385
  }
386
386
 
387
+ .sh-checkbox-group {
388
+ display: flex;
389
+ flex-wrap: wrap;
390
+ }
391
+
387
392
  .callout{
388
393
  --bs-link-color-rgb: 110,168,254;
389
394
  --bs-code-color: #e685b5;
@@ -400,11 +405,6 @@
400
405
  --bd-callout-border: var(--bs-info-border-subtle);
401
406
  }
402
407
 
403
- .sh-checkbox-group {
404
- display: flex;
405
- flex-wrap: wrap;
406
- }
407
-
408
408
  .sh-forgot-link, .sh-register-link{
409
409
  cursor: pointer;
410
410
  }
package/dist/library.js CHANGED
@@ -619,7 +619,6 @@ const updateSession = () =>{
619
619
  shStorage.setItem('last_activity', timeNow);
620
620
  };
621
621
 
622
- const graphQlEndpoint = 'sh-ql';
623
622
  // eslint-disable-next-line no-undef
624
623
  let axios;
625
624
 
@@ -729,28 +728,14 @@ function doPatch(endPoint, data, extraConfig) {
729
728
 
730
729
  }
731
730
 
732
- function graphQlQuery(query) {
733
- const data = {
734
- query
735
- };
736
- return doGet(graphQlEndpoint, data)
737
- }
738
731
 
739
- function graphQlMutate(mutation) {
740
- const data = {
741
- query: `mutation ${mutation}`
742
- };
743
- return doPost(graphQlEndpoint, data)
744
- }
745
732
 
746
733
  var shApis = {
747
734
  doGet,
748
735
  doPost,
749
- graphQlQuery,
750
736
  doDelete,
751
737
  doPut,
752
- doPatch,
753
- graphQlMutate
738
+ doPatch
754
739
  };
755
740
 
756
741
  const countries = [
@@ -3730,10 +3715,6 @@ var script$q = {
3730
3715
  type: Array,
3731
3716
  required: false
3732
3717
  },
3733
- gqlMutation: {
3734
- type: String,
3735
- required: false
3736
- },
3737
3718
  required: {
3738
3719
  type: Array,
3739
3720
  required: false
@@ -3946,34 +3927,16 @@ const submitForm = async (e) => {
3946
3927
 
3947
3928
  emit('preSubmit', data);
3948
3929
 
3949
- // Handle GraphQL mutation
3950
- if (props.gqlMutation) {
3951
- const selectFields = Object.keys(data);
3952
- let args = selectFields
3953
- .filter(key => data[key])
3954
- .map(key => `${key}: "${data[key]}"`)
3955
- .join(', ');
3956
-
3957
- if (args) {
3958
- args = `(${args})`;
3959
- }
3930
+ // Handle REST API
3931
+ const method = props.method === 'put'
3932
+ ? shApis.doPut
3933
+ : props.method === 'delete'
3934
+ ? shApis.doDelete
3935
+ : shApis.doPost;
3960
3936
 
3961
- const mutation = `{\n${props.gqlMutation}${args} {\n${selectFields.join('\n')}\n}\n}`;
3962
- shApis.graphQlMutate(mutation)
3963
- .then(handleSuccessRequest)
3964
- .catch(handleFailedRequest);
3965
- } else {
3966
- // Handle REST API
3967
- const method = props.method === 'put'
3968
- ? shApis.doPut
3969
- : props.method === 'delete'
3970
- ? shApis.doDelete
3971
- : shApis.doPost;
3972
-
3973
- method(props.action, data)
3974
- .then(handleSuccessRequest)
3975
- .catch(handleFailedRequest);
3976
- }
3937
+ method(props.action, data)
3938
+ .then(handleSuccessRequest)
3939
+ .catch(handleFailedRequest);
3977
3940
 
3978
3941
  return false
3979
3942
  };
@@ -5612,22 +5575,26 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
5612
5575
  return ($props.paginationStyle !== 'loadMore')
5613
5576
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
5614
5577
  vue.createElementVNode("div", _hoisted_2$9, [
5615
- _cache[5] || (_cache[5] = vue.createElementVNode("span", { class: "per_page_show" }, "Showing", -1 /* CACHED */)),
5616
- _cache[6] || (_cache[6] = vue.createTextVNode("  ", -1 /* CACHED */)),
5617
- vue.withDirectives(vue.createElementVNode("select", {
5618
- class: "select_per_page",
5619
- onChange: _cache[0] || (_cache[0] = (...args) => ($options.changePerPage && $options.changePerPage(...args))),
5620
- "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => (($data.per_page) = $event))
5621
- }, [
5622
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($data.pageOptions, (option) => {
5623
- return (vue.openBlock(), vue.createElementBlock("option", { value: option }, vue.toDisplayString(option), 9 /* TEXT, PROPS */, _hoisted_3$7))
5624
- }), 256 /* UNKEYED_FRAGMENT */))
5625
- ], 544 /* NEED_HYDRATION, NEED_PATCH */), [
5626
- [vue.vModelSelect, $data.per_page]
5627
- ]),
5628
- vue.createElementVNode("span", _hoisted_4$7, " of " + vue.toDisplayString($props.pagination_data.record_count) + " items", 1 /* TEXT */)
5578
+ ($props.pagination_data.end > 1)
5579
+ ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
5580
+ _cache[5] || (_cache[5] = vue.createElementVNode("span", { class: "per_page_show" }, "Showing", -1 /* CACHED */)),
5581
+ _cache[6] || (_cache[6] = vue.createTextVNode("  ", -1 /* CACHED */)),
5582
+ vue.withDirectives(vue.createElementVNode("select", {
5583
+ class: "select_per_page",
5584
+ onChange: _cache[0] || (_cache[0] = (...args) => ($options.changePerPage && $options.changePerPage(...args))),
5585
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => (($data.per_page) = $event))
5586
+ }, [
5587
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($data.pageOptions, (option) => {
5588
+ return (vue.openBlock(), vue.createElementBlock("option", { value: option }, vue.toDisplayString(option), 9 /* TEXT, PROPS */, _hoisted_3$7))
5589
+ }), 256 /* UNKEYED_FRAGMENT */))
5590
+ ], 544 /* NEED_HYDRATION, NEED_PATCH */), [
5591
+ [vue.vModelSelect, $data.per_page]
5592
+ ])
5593
+ ], 64 /* STABLE_FRAGMENT */))
5594
+ : vue.createCommentVNode("v-if", true),
5595
+ vue.createElementVNode("span", _hoisted_4$7, " Showing " + vue.toDisplayString($props.pagination_data.record_count) + " items", 1 /* TEXT */)
5629
5596
  ]),
5630
- ($props.pagination_data != null)
5597
+ ($props.pagination_data != null && $props.pagination_data.end > 1)
5631
5598
  ? (vue.openBlock(), vue.createElementBlock("nav", _hoisted_5$5, [
5632
5599
  vue.createElementVNode("ul", _hoisted_6$4, [
5633
5600
  vue.createElementVNode("li", {
@@ -6418,7 +6385,7 @@ return (_ctx, _cache) => {
6418
6385
  ], 8 /* PROPS */, _hoisted_3$6)
6419
6386
  ]))
6420
6387
  : vue.createCommentVNode("v-if", true),
6421
- (!__props.hideSearch && (records.value.length > 0 || !hasEmptySlot.value || filter_value.value.length > 0))
6388
+ (!__props.hideSearch && (pagination_data.value?.end > 1 || filter_value.value.length > 0))
6422
6389
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$6, [
6423
6390
  vue.createElementVNode("div", _hoisted_5$4, [
6424
6391
  vue.createElementVNode("div", {
@@ -6873,7 +6840,7 @@ return (_ctx, _cache) => {
6873
6840
  ]))
6874
6841
  : vue.createCommentVNode("v-if", true)
6875
6842
  ])),
6876
- (pagination_data.value && (records.value.length > 0 || !hasEmptySlot.value || filter_value.value.length > 0))
6843
+ (pagination_data.value && (records.value.length > 0 || filter_value.value.length > 0))
6877
6844
  ? (vue.openBlock(), vue.createBlock(script$e, {
6878
6845
  key: 7,
6879
6846
  onLoadMoreRecords: loadMoreRecords,
@@ -8689,19 +8656,6 @@ const ShFrontend = {
8689
8656
  }
8690
8657
  };
8691
8658
 
8692
- const query = async qlQuery => {
8693
- const result = await shApis.graphQlQuery(qlQuery);
8694
- return result.data
8695
- };
8696
- const mutate = async mutation => {
8697
- const result = await shApis.graphQlMutate(mutation);
8698
- return result.data
8699
- };
8700
- var shGql = {
8701
- query,
8702
- mutate
8703
- };
8704
-
8705
8659
  /**
8706
8660
  * useShFetch is a custom hook for fetching data from a given URL and caching it.
8707
8661
  * @param {string} url - The URL to fetch data from.
@@ -8786,7 +8740,6 @@ exports.ShSuggest = script$A;
8786
8740
  exports.ShTable = script$d;
8787
8741
  exports.ShTabs = script$c;
8788
8742
  exports.shApis = shApis;
8789
- exports.shGql = shGql;
8790
8743
  exports.shRepo = shRepo;
8791
8744
  exports.shStorage = shStorage;
8792
8745
  exports.useAppStore = useAppStore;
package/dist/library.mjs CHANGED
@@ -608,7 +608,6 @@ const updateSession = () =>{
608
608
  shStorage.setItem('last_activity', timeNow);
609
609
  };
610
610
 
611
- const graphQlEndpoint = 'sh-ql';
612
611
  // eslint-disable-next-line no-undef
613
612
  let axios;
614
613
 
@@ -718,28 +717,14 @@ function doPatch(endPoint, data, extraConfig) {
718
717
 
719
718
  }
720
719
 
721
- function graphQlQuery(query) {
722
- const data = {
723
- query
724
- };
725
- return doGet(graphQlEndpoint, data)
726
- }
727
720
 
728
- function graphQlMutate(mutation) {
729
- const data = {
730
- query: `mutation ${mutation}`
731
- };
732
- return doPost(graphQlEndpoint, data)
733
- }
734
721
 
735
722
  var shApis = {
736
723
  doGet,
737
724
  doPost,
738
- graphQlQuery,
739
725
  doDelete,
740
726
  doPut,
741
- doPatch,
742
- graphQlMutate
727
+ doPatch
743
728
  };
744
729
 
745
730
  const countries = [
@@ -3719,10 +3704,6 @@ var script$q = {
3719
3704
  type: Array,
3720
3705
  required: false
3721
3706
  },
3722
- gqlMutation: {
3723
- type: String,
3724
- required: false
3725
- },
3726
3707
  required: {
3727
3708
  type: Array,
3728
3709
  required: false
@@ -3935,34 +3916,16 @@ const submitForm = async (e) => {
3935
3916
 
3936
3917
  emit('preSubmit', data);
3937
3918
 
3938
- // Handle GraphQL mutation
3939
- if (props.gqlMutation) {
3940
- const selectFields = Object.keys(data);
3941
- let args = selectFields
3942
- .filter(key => data[key])
3943
- .map(key => `${key}: "${data[key]}"`)
3944
- .join(', ');
3945
-
3946
- if (args) {
3947
- args = `(${args})`;
3948
- }
3919
+ // Handle REST API
3920
+ const method = props.method === 'put'
3921
+ ? shApis.doPut
3922
+ : props.method === 'delete'
3923
+ ? shApis.doDelete
3924
+ : shApis.doPost;
3949
3925
 
3950
- const mutation = `{\n${props.gqlMutation}${args} {\n${selectFields.join('\n')}\n}\n}`;
3951
- shApis.graphQlMutate(mutation)
3952
- .then(handleSuccessRequest)
3953
- .catch(handleFailedRequest);
3954
- } else {
3955
- // Handle REST API
3956
- const method = props.method === 'put'
3957
- ? shApis.doPut
3958
- : props.method === 'delete'
3959
- ? shApis.doDelete
3960
- : shApis.doPost;
3961
-
3962
- method(props.action, data)
3963
- .then(handleSuccessRequest)
3964
- .catch(handleFailedRequest);
3965
- }
3926
+ method(props.action, data)
3927
+ .then(handleSuccessRequest)
3928
+ .catch(handleFailedRequest);
3966
3929
 
3967
3930
  return false
3968
3931
  };
@@ -5601,22 +5564,26 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
5601
5564
  return ($props.paginationStyle !== 'loadMore')
5602
5565
  ? (openBlock(), createElementBlock("div", _hoisted_1$c, [
5603
5566
  createElementVNode("div", _hoisted_2$9, [
5604
- _cache[5] || (_cache[5] = createElementVNode("span", { class: "per_page_show" }, "Showing", -1 /* CACHED */)),
5605
- _cache[6] || (_cache[6] = createTextVNode("  ", -1 /* CACHED */)),
5606
- withDirectives(createElementVNode("select", {
5607
- class: "select_per_page",
5608
- onChange: _cache[0] || (_cache[0] = (...args) => ($options.changePerPage && $options.changePerPage(...args))),
5609
- "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => (($data.per_page) = $event))
5610
- }, [
5611
- (openBlock(true), createElementBlock(Fragment, null, renderList($data.pageOptions, (option) => {
5612
- return (openBlock(), createElementBlock("option", { value: option }, toDisplayString(option), 9 /* TEXT, PROPS */, _hoisted_3$7))
5613
- }), 256 /* UNKEYED_FRAGMENT */))
5614
- ], 544 /* NEED_HYDRATION, NEED_PATCH */), [
5615
- [vModelSelect, $data.per_page]
5616
- ]),
5617
- createElementVNode("span", _hoisted_4$7, " of " + toDisplayString($props.pagination_data.record_count) + " items", 1 /* TEXT */)
5567
+ ($props.pagination_data.end > 1)
5568
+ ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
5569
+ _cache[5] || (_cache[5] = createElementVNode("span", { class: "per_page_show" }, "Showing", -1 /* CACHED */)),
5570
+ _cache[6] || (_cache[6] = createTextVNode("  ", -1 /* CACHED */)),
5571
+ withDirectives(createElementVNode("select", {
5572
+ class: "select_per_page",
5573
+ onChange: _cache[0] || (_cache[0] = (...args) => ($options.changePerPage && $options.changePerPage(...args))),
5574
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => (($data.per_page) = $event))
5575
+ }, [
5576
+ (openBlock(true), createElementBlock(Fragment, null, renderList($data.pageOptions, (option) => {
5577
+ return (openBlock(), createElementBlock("option", { value: option }, toDisplayString(option), 9 /* TEXT, PROPS */, _hoisted_3$7))
5578
+ }), 256 /* UNKEYED_FRAGMENT */))
5579
+ ], 544 /* NEED_HYDRATION, NEED_PATCH */), [
5580
+ [vModelSelect, $data.per_page]
5581
+ ])
5582
+ ], 64 /* STABLE_FRAGMENT */))
5583
+ : createCommentVNode("v-if", true),
5584
+ createElementVNode("span", _hoisted_4$7, " Showing " + toDisplayString($props.pagination_data.record_count) + " items", 1 /* TEXT */)
5618
5585
  ]),
5619
- ($props.pagination_data != null)
5586
+ ($props.pagination_data != null && $props.pagination_data.end > 1)
5620
5587
  ? (openBlock(), createElementBlock("nav", _hoisted_5$5, [
5621
5588
  createElementVNode("ul", _hoisted_6$4, [
5622
5589
  createElementVNode("li", {
@@ -6407,7 +6374,7 @@ return (_ctx, _cache) => {
6407
6374
  ], 8 /* PROPS */, _hoisted_3$6)
6408
6375
  ]))
6409
6376
  : createCommentVNode("v-if", true),
6410
- (!__props.hideSearch && (records.value.length > 0 || !hasEmptySlot.value || filter_value.value.length > 0))
6377
+ (!__props.hideSearch && (pagination_data.value?.end > 1 || filter_value.value.length > 0))
6411
6378
  ? (openBlock(), createElementBlock("div", _hoisted_4$6, [
6412
6379
  createElementVNode("div", _hoisted_5$4, [
6413
6380
  createElementVNode("div", {
@@ -6862,7 +6829,7 @@ return (_ctx, _cache) => {
6862
6829
  ]))
6863
6830
  : createCommentVNode("v-if", true)
6864
6831
  ])),
6865
- (pagination_data.value && (records.value.length > 0 || !hasEmptySlot.value || filter_value.value.length > 0))
6832
+ (pagination_data.value && (records.value.length > 0 || filter_value.value.length > 0))
6866
6833
  ? (openBlock(), createBlock(script$e, {
6867
6834
  key: 7,
6868
6835
  onLoadMoreRecords: loadMoreRecords,
@@ -8678,19 +8645,6 @@ const ShFrontend = {
8678
8645
  }
8679
8646
  };
8680
8647
 
8681
- const query = async qlQuery => {
8682
- const result = await shApis.graphQlQuery(qlQuery);
8683
- return result.data
8684
- };
8685
- const mutate = async mutation => {
8686
- const result = await shApis.graphQlMutate(mutation);
8687
- return result.data
8688
- };
8689
- var shGql = {
8690
- query,
8691
- mutate
8692
- };
8693
-
8694
8648
  /**
8695
8649
  * useShFetch is a custom hook for fetching data from a given URL and caching it.
8696
8650
  * @param {string} url - The URL to fetch data from.
@@ -8751,4 +8705,4 @@ const useShFetch = (url, path, cacheKey) => {
8751
8705
  }
8752
8706
  };
8753
8707
 
8754
- export { countries as Countries, script$8 as ManagePermissions, script$q as ShAutoForm, script$l as ShCanvas, script$9 as ShCanvasBtn, script$4 as ShCardLayout, script$j as ShConfirmAction, script$o as ShDropDownForm, script$b as ShDynamicTabs, script$z as ShForm, ShFrontend, script$p as ShModal, script$a as ShModalBtn, script$n as ShModalForm, script$m as ShModalFormAuto, script$B as ShPhone, script$5 as ShQueryPopups, script$f as ShRange, script$7 as ShRoutePopups, script$i as ShSilentAction, script$A as ShSuggest, script$d as ShTable, script$c as ShTabs, shApis, shGql, shRepo, shStorage, useAppStore, useShFetch, useUserStore };
8708
+ export { countries as Countries, script$8 as ManagePermissions, script$q as ShAutoForm, script$l as ShCanvas, script$9 as ShCanvasBtn, script$4 as ShCardLayout, script$j as ShConfirmAction, script$o as ShDropDownForm, script$b as ShDynamicTabs, script$z as ShForm, ShFrontend, script$p as ShModal, script$a as ShModalBtn, script$n as ShModalForm, script$m as ShModalFormAuto, script$B as ShPhone, script$5 as ShQueryPopups, script$f as ShRange, script$7 as ShRoutePopups, script$i as ShSilentAction, script$A as ShSuggest, script$d as ShTable, script$c as ShTabs, shApis, shRepo, shStorage, useAppStore, useShFetch, useUserStore };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/shframework",
3
- "version": "5.8.8",
3
+ "version": "5.9.1",
4
4
  "description": "Vue library for handling laravel backend",
5
5
  "repository": {
6
6
  "type": "git",