@iankibetsh/shframework 1.6.0 → 1.6.3

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.
@@ -95,21 +95,6 @@
95
95
  flex-grow: 1;
96
96
  }
97
97
 
98
- .sh-selected-item{
99
- line-height: unset!important;
100
- }
101
- .sh-suggestion-input{
102
- padding: 0.375rem 0.75rem;
103
- }
104
- .sh-suggest{
105
- margin-bottom: 1rem;
106
- }
107
- .sh-suggest-control::after{
108
- margin-top: auto;
109
- margin-bottom: auto;
110
- margin-right: 0.255em;
111
- }
112
-
113
98
  :root {
114
99
  --ck-z-default: 10555 !important;
115
100
  --ck-z-modal: calc(var(--ck-z-default) + 999) !important;
@@ -131,6 +116,21 @@
131
116
  }
132
117
  }
133
118
 
119
+ .sh-selected-item{
120
+ line-height: unset!important;
121
+ }
122
+ .sh-suggestion-input{
123
+ padding: 0.375rem 0.75rem;
124
+ }
125
+ .sh-suggest{
126
+ margin-bottom: 1rem;
127
+ }
128
+ .sh-suggest-control::after{
129
+ margin-top: auto;
130
+ margin-bottom: auto;
131
+ margin-right: 0.255em;
132
+ }
133
+
134
134
  .sh-forgot-link, .sh-register-link{
135
135
  cursor: pointer;
136
136
  }
package/dist/library.js CHANGED
@@ -1874,7 +1874,7 @@ const countries = [
1874
1874
  }
1875
1875
  ];
1876
1876
 
1877
- var script$o = {
1877
+ var script$p = {
1878
1878
  name: 'PhoneInput',
1879
1879
  props: ['modelValue', 'country_code'],
1880
1880
  data () {
@@ -1936,7 +1936,7 @@ var script$o = {
1936
1936
  }
1937
1937
  };
1938
1938
 
1939
- const _hoisted_1$j = { class: "sh-phone mb-3" };
1939
+ const _hoisted_1$k = { class: "sh-phone mb-3" };
1940
1940
  const _hoisted_2$d = {
1941
1941
  key: 0,
1942
1942
  style: {"display":"contents"}
@@ -1945,7 +1945,7 @@ const _hoisted_3$c = ["src"];
1945
1945
  const _hoisted_4$c = ["value"];
1946
1946
 
1947
1947
  function render$7(_ctx, _cache, $props, $setup, $data, $options) {
1948
- return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$j, [
1948
+ return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$k, [
1949
1949
  ($data.selectedCountry)
1950
1950
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$d, [
1951
1951
  vue.createElementVNode("img", { src: $data.flag }, null, 8 /* PROPS */, _hoisted_3$c),
@@ -1979,10 +1979,10 @@ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
1979
1979
  ]))
1980
1980
  }
1981
1981
 
1982
- script$o.render = render$7;
1983
- script$o.__file = "src/lib/components/form-components/PhoneInput.vue";
1982
+ script$p.render = render$7;
1983
+ script$p.__file = "src/lib/components/form-components/PhoneInput.vue";
1984
1984
 
1985
- var script$n = {
1985
+ var script$o = {
1986
1986
  name: 'ShEditor',
1987
1987
  props: ['modelValue'],
1988
1988
  components: {
@@ -2021,7 +2021,7 @@ var script$n = {
2021
2021
  }
2022
2022
  };
2023
2023
 
2024
- const _hoisted_1$i = /*#__PURE__*/vue.createElementVNode("textarea", {
2024
+ const _hoisted_1$j = /*#__PURE__*/vue.createElementVNode("textarea", {
2025
2025
  id: "tiny",
2026
2026
  style: {"display":"none"},
2027
2027
  "data-cy": "tinymce_editor"
@@ -2031,7 +2031,7 @@ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
2031
2031
  const _component_editor = vue.resolveComponent("editor");
2032
2032
 
2033
2033
  return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
2034
- _hoisted_1$i,
2034
+ _hoisted_1$j,
2035
2035
  vue.createElementVNode("div", {
2036
2036
  onFocusin: _cache[1] || (_cache[1] = vue.withModifiers(() => {}, ["stop"])),
2037
2037
  class: "sh-editor w-100"
@@ -2056,10 +2056,10 @@ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
2056
2056
  ], 64 /* STABLE_FRAGMENT */))
2057
2057
  }
2058
2058
 
2059
- script$n.render = render$6;
2060
- script$n.__file = "src/lib/components/form-components/ShEditor.vue";
2059
+ script$o.render = render$6;
2060
+ script$o.__file = "src/lib/components/form-components/ShEditor.vue";
2061
2061
 
2062
- const _hoisted_1$h = {
2062
+ const _hoisted_1$i = {
2063
2063
  key: 0,
2064
2064
  class: "dropdown sh-suggest"
2065
2065
  };
@@ -2080,7 +2080,7 @@ const _hoisted_10$4 = {
2080
2080
  };
2081
2081
 
2082
2082
 
2083
- var script$m = {
2083
+ var script$n = {
2084
2084
  __name: 'ShSuggest',
2085
2085
  props: ['fillSelects','modelValue'],
2086
2086
  emits: ['update:modelValue'],
@@ -2161,7 +2161,7 @@ function filterData(e){
2161
2161
 
2162
2162
  return (_ctx, _cache) => {
2163
2163
  return (vue.unref(id))
2164
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
2164
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, [
2165
2165
  vue.createElementVNode("div", {
2166
2166
  id: vue.unref(id),
2167
2167
  "data-bs-toggle": "dropdown",
@@ -2221,16 +2221,16 @@ return (_ctx, _cache) => {
2221
2221
 
2222
2222
  };
2223
2223
 
2224
- script$m.__scopeId = "data-v-71cc9569";
2225
- script$m.__file = "src/lib/components/form-components/ShSuggest.vue";
2224
+ script$n.__scopeId = "data-v-71cc9569";
2225
+ script$n.__file = "src/lib/components/form-components/ShSuggest.vue";
2226
2226
 
2227
- var script$l = {
2227
+ var script$m = {
2228
2228
  name: 'ShForm',
2229
2229
  components: {
2230
- PhoneInput: script$o,
2231
- ShSuggest: script$m,
2232
- ShEditor: script$n,
2233
- ShPhone: script$o
2230
+ PhoneInput: script$p,
2231
+ ShSuggest: script$n,
2232
+ ShEditor: script$o,
2233
+ ShPhone: script$p
2234
2234
  },
2235
2235
  props: [
2236
2236
  'action',
@@ -2291,6 +2291,9 @@ var script$l = {
2291
2291
  }
2292
2292
  },
2293
2293
  getFieldType: function (field) {
2294
+ if(this.fillSelects && this.fillSelects[field]){
2295
+ return 'select';
2296
+ }
2294
2297
  if(this.customComponent && this.customComponent[field]){
2295
2298
  return 'component'
2296
2299
  }
@@ -2509,14 +2512,10 @@ var script$l = {
2509
2512
  }
2510
2513
  this.suggests.push(key);
2511
2514
  } else if (this.fillSelects[key].data) {
2512
- selectData[key] = this.fillSelects[key].data;
2513
- this.selectData = selectData;
2514
- console.log(this.selectData);
2515
+ this.selectData[key] = this.fillSelects[key].data;
2515
2516
  } else {
2516
2517
  shApis.doGet(this.fillSelects[key].url, { all: 1 }).then(res => {
2517
- // selectData[key] = res.data
2518
- // console.log(res)
2519
- this.selectData[key] = res.data.data;
2518
+ this.selectData[key] = res.data;
2520
2519
  }).catch(res => {
2521
2520
  console.log(res);
2522
2521
  });
@@ -2542,7 +2541,7 @@ var script$l = {
2542
2541
  }
2543
2542
  };
2544
2543
 
2545
- const _hoisted_1$g = /*#__PURE__*/vue.createElementVNode("h5", { class: "d-none" }, null, -1 /* HOISTED */);
2544
+ const _hoisted_1$h = /*#__PURE__*/vue.createElementVNode("h5", { class: "d-none" }, null, -1 /* HOISTED */);
2546
2545
  const _hoisted_2$b = {
2547
2546
  ref: "ShAutoForm",
2548
2547
  class: "sh-form"
@@ -2604,7 +2603,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2604
2603
  const _component_ShEditor = vue.resolveComponent("ShEditor");
2605
2604
 
2606
2605
  return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
2607
- _hoisted_1$g,
2606
+ _hoisted_1$h,
2608
2607
  vue.createElementVNode("form", _hoisted_2$b, [
2609
2608
  vue.createCommentVNode(" <div v-if=\"form_status == 1\" class=\"alert alert-info\">Processing...</div>"),
2610
2609
  vue.createCommentVNode(" <div v-if=\"form_status == 2\" class=\"alert alert-success\">Success</div>"),
@@ -2772,7 +2771,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2772
2771
  [vue.vModelText, _ctx.form_elements[field]]
2773
2772
  ])
2774
2773
  : vue.createCommentVNode("v-if", true),
2775
- ($options.getFieldType(field) === 'select' && _ctx.selectData[field] != null)
2774
+ ($options.getFieldType(field) === 'select')
2776
2775
  ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("select", {
2777
2776
  key: 11,
2778
2777
  name: field,
@@ -2821,10 +2820,10 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2821
2820
  ], 64 /* STABLE_FRAGMENT */))
2822
2821
  }
2823
2822
 
2824
- script$l.render = render$5;
2825
- script$l.__file = "src/lib/components/ShForm.vue";
2823
+ script$m.render = render$5;
2824
+ script$m.__file = "src/lib/components/ShForm.vue";
2826
2825
 
2827
- var script$k = {
2826
+ var script$l = {
2828
2827
  __name: 'EmailInput',
2829
2828
  props: ['modelValue','label'],
2830
2829
  emits: ['update:modelValue','clearValidationErrors'],
@@ -2860,12 +2859,12 @@ return (_ctx, _cache) => {
2860
2859
 
2861
2860
  };
2862
2861
 
2863
- script$k.__file = "src/lib/components/form-components/EmailInput.vue";
2862
+ script$l.__file = "src/lib/components/form-components/EmailInput.vue";
2864
2863
 
2865
- const _hoisted_1$f = ["min", "max"];
2864
+ const _hoisted_1$g = ["min", "max"];
2866
2865
 
2867
2866
 
2868
- var script$j = {
2867
+ var script$k = {
2869
2868
  __name: 'NumberInput',
2870
2869
  props: ['modelValue','label','min','max'],
2871
2870
  emits: ['update:modelValue','clearValidationErrors'],
@@ -2895,7 +2894,7 @@ return (_ctx, _cache) => {
2895
2894
  onChange: modelValueUpdated,
2896
2895
  onKeydown: modelValueUpdated,
2897
2896
  onUpdated: modelValueUpdated
2898
- }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_1$f)), [
2897
+ }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_1$g)), [
2899
2898
  [vue.vModelText, inputModel.value]
2900
2899
  ])
2901
2900
  }
@@ -2903,9 +2902,9 @@ return (_ctx, _cache) => {
2903
2902
 
2904
2903
  };
2905
2904
 
2906
- script$j.__file = "src/lib/components/form-components/NumberInput.vue";
2905
+ script$k.__file = "src/lib/components/form-components/NumberInput.vue";
2907
2906
 
2908
- var script$i = {
2907
+ var script$j = {
2909
2908
  __name: 'TextInput',
2910
2909
  props: ['modelValue','label','isInvalid'],
2911
2910
  emits: ['update:modelValue','clearValidationErrors'],
@@ -2941,9 +2940,9 @@ return (_ctx, _cache) => {
2941
2940
 
2942
2941
  };
2943
2942
 
2944
- script$i.__file = "src/lib/components/form-components/TextInput.vue";
2943
+ script$j.__file = "src/lib/components/form-components/TextInput.vue";
2945
2944
 
2946
- var script$h = {
2945
+ var script$i = {
2947
2946
  __name: 'TextAreaInput',
2948
2947
  props: ['modelValue','label'],
2949
2948
  emits: ['update:modelValue','clearValidationErrors'],
@@ -2979,12 +2978,12 @@ return (_ctx, _cache) => {
2979
2978
 
2980
2979
  };
2981
2980
 
2982
- script$h.__file = "src/lib/components/form-components/TextAreaInput.vue";
2981
+ script$i.__file = "src/lib/components/form-components/TextAreaInput.vue";
2983
2982
 
2984
- const _hoisted_1$e = ["value"];
2983
+ const _hoisted_1$f = ["value"];
2985
2984
 
2986
2985
 
2987
- var script$g = {
2986
+ var script$h = {
2988
2987
  __name: 'SelectInput',
2989
2988
  props: ['modelValue','label','data','dataUrl'],
2990
2989
  emits: ['update:modelValue','clearValidationErrors'],
@@ -3035,7 +3034,7 @@ return (_ctx, _cache) => {
3035
3034
  return (vue.openBlock(), vue.createElementBlock("option", {
3036
3035
  key: option.id,
3037
3036
  value: option.id
3038
- }, vue.toDisplayString(option.name), 9 /* TEXT, PROPS */, _hoisted_1$e))
3037
+ }, vue.toDisplayString(option.name), 9 /* TEXT, PROPS */, _hoisted_1$f))
3039
3038
  }), 128 /* KEYED_FRAGMENT */))
3040
3039
  ], 544 /* HYDRATE_EVENTS, NEED_PATCH */)), [
3041
3040
  [vue.vModelSelect, inputModel.value]
@@ -3045,9 +3044,9 @@ return (_ctx, _cache) => {
3045
3044
 
3046
3045
  };
3047
3046
 
3048
- script$g.__file = "src/lib/components/form-components/SelectInput.vue";
3047
+ script$h.__file = "src/lib/components/form-components/SelectInput.vue";
3049
3048
 
3050
- var script$f = {
3049
+ var script$g = {
3051
3050
  __name: 'PasswordInput',
3052
3051
  props: ['modelValue','label'],
3053
3052
  emits: ['update:modelValue','clearValidationErrors'],
@@ -3083,9 +3082,9 @@ return (_ctx, _cache) => {
3083
3082
 
3084
3083
  };
3085
3084
 
3086
- script$f.__file = "src/lib/components/form-components/PasswordInput.vue";
3085
+ script$g.__file = "src/lib/components/form-components/PasswordInput.vue";
3087
3086
 
3088
- const _hoisted_1$d = /*#__PURE__*/vue.createElementVNode("div", null, null, -1 /* HOISTED */);
3087
+ const _hoisted_1$e = /*#__PURE__*/vue.createElementVNode("div", null, null, -1 /* HOISTED */);
3089
3088
  const _hoisted_2$a = ["innerHTML"];
3090
3089
  const _hoisted_3$9 = ["innerHTML"];
3091
3090
  const _hoisted_4$9 = ["innerHTML"];
@@ -3099,13 +3098,14 @@ const _hoisted_6$6 = {
3099
3098
  const _hoisted_7$4 = { key: 1 };
3100
3099
 
3101
3100
 
3102
- var script$e = {
3101
+ var script$f = {
3103
3102
  __name: 'ShAutoForm',
3104
3103
  props: [
3105
3104
  'action','successCallback','retainDataAfterSubmission',
3106
3105
  'successMessage','fields','customComponents','placeHolders',
3107
3106
  'formClasses',
3108
3107
  'helperTexts','labels','data',
3108
+ 'formClass',
3109
3109
  'actionLabel',
3110
3110
  'textAreas',
3111
3111
  'currentData',
@@ -3131,13 +3131,13 @@ const getFieldComponent = (fieldObj)=>{
3131
3131
  const defaultPhones = ['phone'];
3132
3132
  const defaultEmails = ['email'];
3133
3133
  const formComponents = vue.inject('formComponents');
3134
- const TextComponent = formComponents.text ?? script$i;
3135
- const TextAreaComponent = formComponents.textArea ?? script$h;
3136
- const EmailComponent = formComponents.email ?? script$k;
3137
- const PhoneComponent = formComponents.phone ?? script$o;
3138
- const NumberComponent = formComponents.number ?? script$j;
3139
- const SelectComponent = formComponents.select ?? script$g;
3140
- const PasswordComponent = formComponents.password ?? script$f;
3134
+ const TextComponent = formComponents.text ?? script$j;
3135
+ const TextAreaComponent = formComponents.textArea ?? script$i;
3136
+ const EmailComponent = formComponents.email ?? script$l;
3137
+ const PhoneComponent = formComponents.phone ?? script$p;
3138
+ const NumberComponent = formComponents.number ?? script$k;
3139
+ const SelectComponent = formComponents.select ?? script$h;
3140
+ const PasswordComponent = formComponents.password ?? script$g;
3141
3141
  if(props.customComponents && props.customComponents[field]) {
3142
3142
  return props.customComponents[field]
3143
3143
  }
@@ -3149,16 +3149,16 @@ const getFieldComponent = (fieldObj)=>{
3149
3149
  }
3150
3150
  else
3151
3151
  if((props.textAreas && props.textAreas.includes(field)) || defaultTextareas.includes(field)){
3152
- return formComponents.textArea ?? script$h
3152
+ return formComponents.textArea ?? script$i
3153
3153
  } else
3154
3154
  if((props.emails && props.emails.includes(field)) || defaultEmails.includes(field)){
3155
- return formComponents.email ?? script$k
3155
+ return formComponents.email ?? script$l
3156
3156
  } else
3157
3157
  if((props.phones && props.phones.includes(field)) || defaultPhones.includes(field)){
3158
- return formComponents.phone ?? script$o
3158
+ return formComponents.phone ?? script$p
3159
3159
  } else
3160
3160
  if((props.numbers && props.numbers.includes(field)) || defaultNumbers.includes(field)){
3161
- return formComponents.number ?? script$j
3161
+ return formComponents.number ?? script$k
3162
3162
  }
3163
3163
  // else
3164
3164
  // if((props.selects && props.selects.includes(field)) || defaultSelects.includes(field)){
@@ -3167,14 +3167,14 @@ const getFieldComponent = (fieldObj)=>{
3167
3167
  // if((props.dates && props.dates.includes(field)) || defaultDates.includes(field)){
3168
3168
  // return formComponents.date ?? DateInput
3169
3169
  // }
3170
- return formComponents.text ?? script$i
3170
+ return formComponents.text ?? script$j
3171
3171
  };
3172
3172
  const shFormElementClasses = vue.ref(null);
3173
3173
  shFormElementClasses.value = vue.inject('shFormElementClasses');
3174
3174
  const shAutoForm = vue.ref(null);
3175
3175
  const closeModal = e => {
3176
3176
  setTimeout(() => {
3177
- const modal = script$e.value.closest('.modal-dialog');
3177
+ const modal = script$f.value.closest('.modal-dialog');
3178
3178
  if(modal){
3179
3179
  const closeBtn = modal.querySelector('[data-bs-dismiss="modal"]');
3180
3180
  closeBtn && closeBtn.click();
@@ -3270,11 +3270,11 @@ vue.onMounted((ev)=>{
3270
3270
 
3271
3271
  return (_ctx, _cache) => {
3272
3272
  return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
3273
- _hoisted_1$d,
3273
+ _hoisted_1$e,
3274
3274
  vue.createElementVNode("form", {
3275
+ class: vue.normalizeClass([__props.formClass, "sh-form"]),
3275
3276
  ref_key: "shAutoForm",
3276
3277
  ref: shAutoForm,
3277
- class: "sh-form",
3278
3278
  onSubmit: _cache[0] || (_cache[0] = e => submitForm(e))
3279
3279
  }, [
3280
3280
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(formFields.value, (field, index) => {
@@ -3338,19 +3338,19 @@ return (_ctx, _cache) => {
3338
3338
  : vue.createCommentVNode("v-if", true)
3339
3339
  ], 14 /* CLASS, STYLE, PROPS */, _hoisted_5$7)
3340
3340
  ], 2 /* CLASS */)
3341
- ], 544 /* HYDRATE_EVENTS, NEED_PATCH */)
3341
+ ], 34 /* CLASS, HYDRATE_EVENTS */)
3342
3342
  ], 64 /* STABLE_FRAGMENT */))
3343
3343
  }
3344
3344
  }
3345
3345
 
3346
3346
  };
3347
3347
 
3348
- script$e.__file = "src/lib/components/ShAutoForm.vue";
3348
+ script$f.__file = "src/lib/components/ShAutoForm.vue";
3349
3349
 
3350
- const _hoisted_1$c = /*#__PURE__*/vue.createElementVNode("h5", { class: "d-none" }, "To prevent default class", -1 /* HOISTED */);
3350
+ const _hoisted_1$d = /*#__PURE__*/vue.createElementVNode("h5", { class: "d-none" }, "To prevent default class", -1 /* HOISTED */);
3351
3351
  const _hoisted_2$9 = { class: "dropdown" };
3352
3352
 
3353
- var script$d = {
3353
+ var script$e = {
3354
3354
  __name: 'ShDropDownForm',
3355
3355
  props: ['action',
3356
3356
  'classes',
@@ -3380,7 +3380,7 @@ const dropdownId = 'rand' + (Math.random() + 1).toString(36).substring(2);
3380
3380
 
3381
3381
  return (_ctx, _cache) => {
3382
3382
  return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
3383
- _hoisted_1$c,
3383
+ _hoisted_1$d,
3384
3384
  vue.createElementVNode("div", _hoisted_2$9, [
3385
3385
  vue.createElementVNode("a", {
3386
3386
  class: vue.normalizeClass(vue.unref(btnClass)),
@@ -3397,7 +3397,7 @@ return (_ctx, _cache) => {
3397
3397
  class: "dropdown-menu px-2 py-1",
3398
3398
  "aria-labelledby": dropdownId
3399
3399
  }, [
3400
- vue.createVNode(script$l, vue.normalizeProps(vue.guardReactiveProps(props)), null, 16 /* FULL_PROPS */)
3400
+ vue.createVNode(script$m, vue.normalizeProps(vue.guardReactiveProps(props)), null, 16 /* FULL_PROPS */)
3401
3401
  ])
3402
3402
  ])
3403
3403
  ], 64 /* STABLE_FRAGMENT */))
@@ -3406,16 +3406,16 @@ return (_ctx, _cache) => {
3406
3406
 
3407
3407
  };
3408
3408
 
3409
- script$d.__file = "src/lib/components/ShDropDownForm.vue";
3409
+ script$e.__file = "src/lib/components/ShDropDownForm.vue";
3410
3410
 
3411
- var script$c = {
3411
+ var script$d = {
3412
3412
  name: 'ShModal',
3413
3413
  props: ['modalTitle', 'modalId', 'modalSize'],
3414
3414
  components: {
3415
3415
  }
3416
3416
  };
3417
3417
 
3418
- const _hoisted_1$b = ["id"];
3418
+ const _hoisted_1$c = ["id"];
3419
3419
  const _hoisted_2$8 = { class: "modal-content" };
3420
3420
  const _hoisted_3$8 = { class: "modal-header" };
3421
3421
  const _hoisted_4$8 = { class: "modal-title" };
@@ -3448,15 +3448,15 @@ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
3448
3448
  ])
3449
3449
  ])
3450
3450
  ], 2 /* CLASS */)
3451
- ], 8 /* PROPS */, _hoisted_1$b))
3451
+ ], 8 /* PROPS */, _hoisted_1$c))
3452
3452
  }
3453
3453
 
3454
- script$c.render = render$4;
3455
- script$c.__file = "src/lib/components/ShModal.vue";
3454
+ script$d.render = render$4;
3455
+ script$d.__file = "src/lib/components/ShModal.vue";
3456
3456
 
3457
- const _hoisted_1$a = ["href"];
3457
+ const _hoisted_1$b = ["href"];
3458
3458
 
3459
- var script$b = {
3459
+ var script$c = {
3460
3460
  __name: 'ShModalForm',
3461
3461
  props: ['action',
3462
3462
  'classes',
@@ -3487,6 +3487,66 @@ const success = (res)=>{
3487
3487
  emit('success',res);
3488
3488
  };
3489
3489
 
3490
+ return (_ctx, _cache) => {
3491
+ return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
3492
+ vue.createElementVNode("a", {
3493
+ class: vue.normalizeClass(vue.unref(btnClass)),
3494
+ href: '#' + modalId,
3495
+ "data-bs-toggle": "modal"
3496
+ }, [
3497
+ vue.renderSlot(_ctx.$slots, "default")
3498
+ ], 10 /* CLASS, PROPS */, _hoisted_1$b),
3499
+ vue.createVNode(script$d, {
3500
+ "modal-id": modalId,
3501
+ "modal-title": __props.modalTitle
3502
+ }, {
3503
+ default: vue.withCtx(() => [
3504
+ vue.createVNode(script$m, vue.mergeProps({ onSuccess: success }, props), null, 16 /* FULL_PROPS */)
3505
+ ]),
3506
+ _: 1 /* STABLE */
3507
+ }, 8 /* PROPS */, ["modal-title"])
3508
+ ], 64 /* STABLE_FRAGMENT */))
3509
+ }
3510
+ }
3511
+
3512
+ };
3513
+
3514
+ script$c.__file = "src/lib/components/ShModalForm.vue";
3515
+
3516
+ const _hoisted_1$a = ["href"];
3517
+
3518
+ var script$b = {
3519
+ __name: 'ShModalFormAuto',
3520
+ props: ['action',
3521
+ 'classes',
3522
+ 'hasTerms',
3523
+ 'country_code',
3524
+ 'submitBtnClass',
3525
+ 'fields',
3526
+ 'columns', 'placeholders', 'field_permissions', 'retainDataAfterSubmission',
3527
+ 'currentData', 'actionLabel', 'fillSelects', 'phones', 'successCallback',
3528
+ 'failedCallback', 'labels', 'editors',
3529
+ 'datePickers',
3530
+ 'textAreas',
3531
+ 'files',
3532
+ 'phones',
3533
+ 'numbers',
3534
+ 'customComponent','modalTitle','class','successMessage'],
3535
+ emits: ['success'],
3536
+ setup(__props, { emit }) {
3537
+
3538
+ const props = __props;
3539
+
3540
+
3541
+
3542
+ const formProps = vue.ref(props);
3543
+ let btnClass=props.class;
3544
+ const modalId = 'rand' + (Math.random() + 1).toString(36).substring(2);
3545
+ const success = (res)=>{
3546
+ emit('success',res);
3547
+ };
3548
+ delete formProps.class;
3549
+
3490
3550
  return (_ctx, _cache) => {
3491
3551
  return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
3492
3552
  vue.createElementVNode("a", {
@@ -3496,12 +3556,12 @@ return (_ctx, _cache) => {
3496
3556
  }, [
3497
3557
  vue.renderSlot(_ctx.$slots, "default")
3498
3558
  ], 10 /* CLASS, PROPS */, _hoisted_1$a),
3499
- vue.createVNode(script$c, {
3559
+ vue.createVNode(script$d, {
3500
3560
  "modal-id": modalId,
3501
3561
  "modal-title": __props.modalTitle
3502
3562
  }, {
3503
3563
  default: vue.withCtx(() => [
3504
- vue.createVNode(script$l, vue.mergeProps({ onSuccess: success }, props), null, 16 /* FULL_PROPS */)
3564
+ vue.createVNode(script$f, vue.mergeProps({ onSuccess: success }, props), null, 16 /* FULL_PROPS */)
3505
3565
  ]),
3506
3566
  _: 1 /* STABLE */
3507
3567
  }, 8 /* PROPS */, ["modal-title"])
@@ -3511,7 +3571,7 @@ return (_ctx, _cache) => {
3511
3571
 
3512
3572
  };
3513
3573
 
3514
- script$b.__file = "src/lib/components/ShModalForm.vue";
3574
+ script$b.__file = "src/lib/components/ShModalFormAuto.vue";
3515
3575
 
3516
3576
  var script$a = {
3517
3577
  name: 'ShCanvas',
@@ -5405,12 +5465,12 @@ return (_ctx, _cache) => {
5405
5465
  ]
5406
5466
  }
5407
5467
  }),
5408
- vue.createVNode(script$c, {
5468
+ vue.createVNode(script$d, {
5409
5469
  "modal-id": "sh-department_modal",
5410
5470
  "modal-title": "Department Form"
5411
5471
  }, {
5412
5472
  default: vue.withCtx(() => [
5413
- vue.createVNode(script$l, {
5473
+ vue.createVNode(script$m, {
5414
5474
  "success-callback": "departmentAdded",
5415
5475
  onDepartmentAdded: departmentAdded,
5416
5476
  action: "admin/departments/store",
@@ -5564,12 +5624,12 @@ return (_ctx, _cache) => {
5564
5624
  headers: ['id',showModule,'created_at'],
5565
5625
  "end-point": 'admin/departments/department/list-modules/' + id.value
5566
5626
  }, null, 8 /* PROPS */, ["actions", "reload", "headers", "end-point"]),
5567
- vue.createVNode(script$c, {
5627
+ vue.createVNode(script$d, {
5568
5628
  "modal-id": "addModule",
5569
5629
  "modal-title": "Add Module Department"
5570
5630
  }, {
5571
5631
  default: vue.withCtx(() => [
5572
- vue.createVNode(script$l, {
5632
+ vue.createVNode(script$m, {
5573
5633
  "reload-select-items": vue.unref(reload),
5574
5634
  "success-callback": moduleAdded,
5575
5635
  "fill-selects": {
@@ -5706,7 +5766,7 @@ return (_ctx, _cache) => {
5706
5766
  : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
5707
5767
  (section.value === 'login')
5708
5768
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [
5709
- vue.createVNode(script$l, {
5769
+ vue.createVNode(script$m, {
5710
5770
  class: "sh-login-form",
5711
5771
  fields: ['email','password'],
5712
5772
  "action-label": "Login",
@@ -5731,7 +5791,7 @@ return (_ctx, _cache) => {
5731
5791
  (vue.unref(registerSubTitle))
5732
5792
  ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_8, vue.toDisplayString(vue.unref(registerSubTitle)), 1 /* TEXT */))
5733
5793
  : vue.createCommentVNode("v-if", true),
5734
- vue.createVNode(script$l, {
5794
+ vue.createVNode(script$m, {
5735
5795
  class: "sh-login-form",
5736
5796
  fields: vue.unref(registrationFields),
5737
5797
  "action-label": "Sign Up",
@@ -5778,7 +5838,7 @@ const ShFrontend = {
5778
5838
  const registerTitle = options.registerTitle ?? 'Create a new account';
5779
5839
  const registerSubTitle = options.registerSubTitle ?? `It's quick and easy`;
5780
5840
  const logoutApiEndpoint = options.logoutApiEndpoint ?? `auth/logout`;
5781
- options.formTextInput ?? script$i;
5841
+ options.formTextInput ?? script$j;
5782
5842
  const loginUrl = options.loginUrl ?? `/login`;
5783
5843
  const redirectLogin = options.redirectLogin ?? `/`;
5784
5844
  const redirectRegister = options.redirectRegister ?? `/`;
@@ -5825,16 +5885,17 @@ const ShFrontend = {
5825
5885
 
5826
5886
  exports.Countries = countries;
5827
5887
  exports.ManagePermissions = script$3;
5828
- exports.ShAutoForm = script$e;
5888
+ exports.ShAutoForm = script$f;
5829
5889
  exports.ShCanvas = script$a;
5830
5890
  exports.ShConfirmAction = script$8;
5831
- exports.ShDropDownForm = script$d;
5891
+ exports.ShDropDownForm = script$e;
5832
5892
  exports.ShDynamicTabs = script$4;
5833
- exports.ShForm = script$l;
5893
+ exports.ShForm = script$m;
5834
5894
  exports.ShFrontend = ShFrontend;
5835
- exports.ShModal = script$c;
5836
- exports.ShModalForm = script$b;
5837
- exports.ShPhone = script$o;
5895
+ exports.ShModal = script$d;
5896
+ exports.ShModalForm = script$c;
5897
+ exports.ShModalFormAuto = script$b;
5898
+ exports.ShPhone = script$p;
5838
5899
  exports.ShSilentAction = script$7;
5839
5900
  exports.ShTable = script$6;
5840
5901
  exports.ShTabs = script$5;
package/dist/library.mjs CHANGED
@@ -1861,7 +1861,7 @@ const countries = [
1861
1861
  }
1862
1862
  ];
1863
1863
 
1864
- var script$o = {
1864
+ var script$p = {
1865
1865
  name: 'PhoneInput',
1866
1866
  props: ['modelValue', 'country_code'],
1867
1867
  data () {
@@ -1923,7 +1923,7 @@ var script$o = {
1923
1923
  }
1924
1924
  };
1925
1925
 
1926
- const _hoisted_1$j = { class: "sh-phone mb-3" };
1926
+ const _hoisted_1$k = { class: "sh-phone mb-3" };
1927
1927
  const _hoisted_2$d = {
1928
1928
  key: 0,
1929
1929
  style: {"display":"contents"}
@@ -1932,7 +1932,7 @@ const _hoisted_3$c = ["src"];
1932
1932
  const _hoisted_4$c = ["value"];
1933
1933
 
1934
1934
  function render$7(_ctx, _cache, $props, $setup, $data, $options) {
1935
- return (openBlock(), createElementBlock("div", _hoisted_1$j, [
1935
+ return (openBlock(), createElementBlock("div", _hoisted_1$k, [
1936
1936
  ($data.selectedCountry)
1937
1937
  ? (openBlock(), createElementBlock("div", _hoisted_2$d, [
1938
1938
  createElementVNode("img", { src: $data.flag }, null, 8 /* PROPS */, _hoisted_3$c),
@@ -1966,10 +1966,10 @@ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
1966
1966
  ]))
1967
1967
  }
1968
1968
 
1969
- script$o.render = render$7;
1970
- script$o.__file = "src/lib/components/form-components/PhoneInput.vue";
1969
+ script$p.render = render$7;
1970
+ script$p.__file = "src/lib/components/form-components/PhoneInput.vue";
1971
1971
 
1972
- var script$n = {
1972
+ var script$o = {
1973
1973
  name: 'ShEditor',
1974
1974
  props: ['modelValue'],
1975
1975
  components: {
@@ -2008,7 +2008,7 @@ var script$n = {
2008
2008
  }
2009
2009
  };
2010
2010
 
2011
- const _hoisted_1$i = /*#__PURE__*/createElementVNode("textarea", {
2011
+ const _hoisted_1$j = /*#__PURE__*/createElementVNode("textarea", {
2012
2012
  id: "tiny",
2013
2013
  style: {"display":"none"},
2014
2014
  "data-cy": "tinymce_editor"
@@ -2018,7 +2018,7 @@ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
2018
2018
  const _component_editor = resolveComponent("editor");
2019
2019
 
2020
2020
  return (openBlock(), createElementBlock(Fragment, null, [
2021
- _hoisted_1$i,
2021
+ _hoisted_1$j,
2022
2022
  createElementVNode("div", {
2023
2023
  onFocusin: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"])),
2024
2024
  class: "sh-editor w-100"
@@ -2043,10 +2043,10 @@ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
2043
2043
  ], 64 /* STABLE_FRAGMENT */))
2044
2044
  }
2045
2045
 
2046
- script$n.render = render$6;
2047
- script$n.__file = "src/lib/components/form-components/ShEditor.vue";
2046
+ script$o.render = render$6;
2047
+ script$o.__file = "src/lib/components/form-components/ShEditor.vue";
2048
2048
 
2049
- const _hoisted_1$h = {
2049
+ const _hoisted_1$i = {
2050
2050
  key: 0,
2051
2051
  class: "dropdown sh-suggest"
2052
2052
  };
@@ -2067,7 +2067,7 @@ const _hoisted_10$4 = {
2067
2067
  };
2068
2068
 
2069
2069
 
2070
- var script$m = {
2070
+ var script$n = {
2071
2071
  __name: 'ShSuggest',
2072
2072
  props: ['fillSelects','modelValue'],
2073
2073
  emits: ['update:modelValue'],
@@ -2148,7 +2148,7 @@ function filterData(e){
2148
2148
 
2149
2149
  return (_ctx, _cache) => {
2150
2150
  return (unref(id))
2151
- ? (openBlock(), createElementBlock("div", _hoisted_1$h, [
2151
+ ? (openBlock(), createElementBlock("div", _hoisted_1$i, [
2152
2152
  createElementVNode("div", {
2153
2153
  id: unref(id),
2154
2154
  "data-bs-toggle": "dropdown",
@@ -2208,16 +2208,16 @@ return (_ctx, _cache) => {
2208
2208
 
2209
2209
  };
2210
2210
 
2211
- script$m.__scopeId = "data-v-71cc9569";
2212
- script$m.__file = "src/lib/components/form-components/ShSuggest.vue";
2211
+ script$n.__scopeId = "data-v-71cc9569";
2212
+ script$n.__file = "src/lib/components/form-components/ShSuggest.vue";
2213
2213
 
2214
- var script$l = {
2214
+ var script$m = {
2215
2215
  name: 'ShForm',
2216
2216
  components: {
2217
- PhoneInput: script$o,
2218
- ShSuggest: script$m,
2219
- ShEditor: script$n,
2220
- ShPhone: script$o
2217
+ PhoneInput: script$p,
2218
+ ShSuggest: script$n,
2219
+ ShEditor: script$o,
2220
+ ShPhone: script$p
2221
2221
  },
2222
2222
  props: [
2223
2223
  'action',
@@ -2278,6 +2278,9 @@ var script$l = {
2278
2278
  }
2279
2279
  },
2280
2280
  getFieldType: function (field) {
2281
+ if(this.fillSelects && this.fillSelects[field]){
2282
+ return 'select';
2283
+ }
2281
2284
  if(this.customComponent && this.customComponent[field]){
2282
2285
  return 'component'
2283
2286
  }
@@ -2496,14 +2499,10 @@ var script$l = {
2496
2499
  }
2497
2500
  this.suggests.push(key);
2498
2501
  } else if (this.fillSelects[key].data) {
2499
- selectData[key] = this.fillSelects[key].data;
2500
- this.selectData = selectData;
2501
- console.log(this.selectData);
2502
+ this.selectData[key] = this.fillSelects[key].data;
2502
2503
  } else {
2503
2504
  shApis.doGet(this.fillSelects[key].url, { all: 1 }).then(res => {
2504
- // selectData[key] = res.data
2505
- // console.log(res)
2506
- this.selectData[key] = res.data.data;
2505
+ this.selectData[key] = res.data;
2507
2506
  }).catch(res => {
2508
2507
  console.log(res);
2509
2508
  });
@@ -2529,7 +2528,7 @@ var script$l = {
2529
2528
  }
2530
2529
  };
2531
2530
 
2532
- const _hoisted_1$g = /*#__PURE__*/createElementVNode("h5", { class: "d-none" }, null, -1 /* HOISTED */);
2531
+ const _hoisted_1$h = /*#__PURE__*/createElementVNode("h5", { class: "d-none" }, null, -1 /* HOISTED */);
2533
2532
  const _hoisted_2$b = {
2534
2533
  ref: "ShAutoForm",
2535
2534
  class: "sh-form"
@@ -2591,7 +2590,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2591
2590
  const _component_ShEditor = resolveComponent("ShEditor");
2592
2591
 
2593
2592
  return (openBlock(), createElementBlock(Fragment, null, [
2594
- _hoisted_1$g,
2593
+ _hoisted_1$h,
2595
2594
  createElementVNode("form", _hoisted_2$b, [
2596
2595
  createCommentVNode(" <div v-if=\"form_status == 1\" class=\"alert alert-info\">Processing...</div>"),
2597
2596
  createCommentVNode(" <div v-if=\"form_status == 2\" class=\"alert alert-success\">Success</div>"),
@@ -2759,7 +2758,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2759
2758
  [vModelText, _ctx.form_elements[field]]
2760
2759
  ])
2761
2760
  : createCommentVNode("v-if", true),
2762
- ($options.getFieldType(field) === 'select' && _ctx.selectData[field] != null)
2761
+ ($options.getFieldType(field) === 'select')
2763
2762
  ? withDirectives((openBlock(), createElementBlock("select", {
2764
2763
  key: 11,
2765
2764
  name: field,
@@ -2808,10 +2807,10 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2808
2807
  ], 64 /* STABLE_FRAGMENT */))
2809
2808
  }
2810
2809
 
2811
- script$l.render = render$5;
2812
- script$l.__file = "src/lib/components/ShForm.vue";
2810
+ script$m.render = render$5;
2811
+ script$m.__file = "src/lib/components/ShForm.vue";
2813
2812
 
2814
- var script$k = {
2813
+ var script$l = {
2815
2814
  __name: 'EmailInput',
2816
2815
  props: ['modelValue','label'],
2817
2816
  emits: ['update:modelValue','clearValidationErrors'],
@@ -2847,12 +2846,12 @@ return (_ctx, _cache) => {
2847
2846
 
2848
2847
  };
2849
2848
 
2850
- script$k.__file = "src/lib/components/form-components/EmailInput.vue";
2849
+ script$l.__file = "src/lib/components/form-components/EmailInput.vue";
2851
2850
 
2852
- const _hoisted_1$f = ["min", "max"];
2851
+ const _hoisted_1$g = ["min", "max"];
2853
2852
 
2854
2853
 
2855
- var script$j = {
2854
+ var script$k = {
2856
2855
  __name: 'NumberInput',
2857
2856
  props: ['modelValue','label','min','max'],
2858
2857
  emits: ['update:modelValue','clearValidationErrors'],
@@ -2882,7 +2881,7 @@ return (_ctx, _cache) => {
2882
2881
  onChange: modelValueUpdated,
2883
2882
  onKeydown: modelValueUpdated,
2884
2883
  onUpdated: modelValueUpdated
2885
- }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_1$f)), [
2884
+ }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_1$g)), [
2886
2885
  [vModelText, inputModel.value]
2887
2886
  ])
2888
2887
  }
@@ -2890,9 +2889,9 @@ return (_ctx, _cache) => {
2890
2889
 
2891
2890
  };
2892
2891
 
2893
- script$j.__file = "src/lib/components/form-components/NumberInput.vue";
2892
+ script$k.__file = "src/lib/components/form-components/NumberInput.vue";
2894
2893
 
2895
- var script$i = {
2894
+ var script$j = {
2896
2895
  __name: 'TextInput',
2897
2896
  props: ['modelValue','label','isInvalid'],
2898
2897
  emits: ['update:modelValue','clearValidationErrors'],
@@ -2928,9 +2927,9 @@ return (_ctx, _cache) => {
2928
2927
 
2929
2928
  };
2930
2929
 
2931
- script$i.__file = "src/lib/components/form-components/TextInput.vue";
2930
+ script$j.__file = "src/lib/components/form-components/TextInput.vue";
2932
2931
 
2933
- var script$h = {
2932
+ var script$i = {
2934
2933
  __name: 'TextAreaInput',
2935
2934
  props: ['modelValue','label'],
2936
2935
  emits: ['update:modelValue','clearValidationErrors'],
@@ -2966,12 +2965,12 @@ return (_ctx, _cache) => {
2966
2965
 
2967
2966
  };
2968
2967
 
2969
- script$h.__file = "src/lib/components/form-components/TextAreaInput.vue";
2968
+ script$i.__file = "src/lib/components/form-components/TextAreaInput.vue";
2970
2969
 
2971
- const _hoisted_1$e = ["value"];
2970
+ const _hoisted_1$f = ["value"];
2972
2971
 
2973
2972
 
2974
- var script$g = {
2973
+ var script$h = {
2975
2974
  __name: 'SelectInput',
2976
2975
  props: ['modelValue','label','data','dataUrl'],
2977
2976
  emits: ['update:modelValue','clearValidationErrors'],
@@ -3022,7 +3021,7 @@ return (_ctx, _cache) => {
3022
3021
  return (openBlock(), createElementBlock("option", {
3023
3022
  key: option.id,
3024
3023
  value: option.id
3025
- }, toDisplayString(option.name), 9 /* TEXT, PROPS */, _hoisted_1$e))
3024
+ }, toDisplayString(option.name), 9 /* TEXT, PROPS */, _hoisted_1$f))
3026
3025
  }), 128 /* KEYED_FRAGMENT */))
3027
3026
  ], 544 /* HYDRATE_EVENTS, NEED_PATCH */)), [
3028
3027
  [vModelSelect, inputModel.value]
@@ -3032,9 +3031,9 @@ return (_ctx, _cache) => {
3032
3031
 
3033
3032
  };
3034
3033
 
3035
- script$g.__file = "src/lib/components/form-components/SelectInput.vue";
3034
+ script$h.__file = "src/lib/components/form-components/SelectInput.vue";
3036
3035
 
3037
- var script$f = {
3036
+ var script$g = {
3038
3037
  __name: 'PasswordInput',
3039
3038
  props: ['modelValue','label'],
3040
3039
  emits: ['update:modelValue','clearValidationErrors'],
@@ -3070,9 +3069,9 @@ return (_ctx, _cache) => {
3070
3069
 
3071
3070
  };
3072
3071
 
3073
- script$f.__file = "src/lib/components/form-components/PasswordInput.vue";
3072
+ script$g.__file = "src/lib/components/form-components/PasswordInput.vue";
3074
3073
 
3075
- const _hoisted_1$d = /*#__PURE__*/createElementVNode("div", null, null, -1 /* HOISTED */);
3074
+ const _hoisted_1$e = /*#__PURE__*/createElementVNode("div", null, null, -1 /* HOISTED */);
3076
3075
  const _hoisted_2$a = ["innerHTML"];
3077
3076
  const _hoisted_3$9 = ["innerHTML"];
3078
3077
  const _hoisted_4$9 = ["innerHTML"];
@@ -3086,13 +3085,14 @@ const _hoisted_6$6 = {
3086
3085
  const _hoisted_7$4 = { key: 1 };
3087
3086
 
3088
3087
 
3089
- var script$e = {
3088
+ var script$f = {
3090
3089
  __name: 'ShAutoForm',
3091
3090
  props: [
3092
3091
  'action','successCallback','retainDataAfterSubmission',
3093
3092
  'successMessage','fields','customComponents','placeHolders',
3094
3093
  'formClasses',
3095
3094
  'helperTexts','labels','data',
3095
+ 'formClass',
3096
3096
  'actionLabel',
3097
3097
  'textAreas',
3098
3098
  'currentData',
@@ -3118,13 +3118,13 @@ const getFieldComponent = (fieldObj)=>{
3118
3118
  const defaultPhones = ['phone'];
3119
3119
  const defaultEmails = ['email'];
3120
3120
  const formComponents = inject('formComponents');
3121
- const TextComponent = formComponents.text ?? script$i;
3122
- const TextAreaComponent = formComponents.textArea ?? script$h;
3123
- const EmailComponent = formComponents.email ?? script$k;
3124
- const PhoneComponent = formComponents.phone ?? script$o;
3125
- const NumberComponent = formComponents.number ?? script$j;
3126
- const SelectComponent = formComponents.select ?? script$g;
3127
- const PasswordComponent = formComponents.password ?? script$f;
3121
+ const TextComponent = formComponents.text ?? script$j;
3122
+ const TextAreaComponent = formComponents.textArea ?? script$i;
3123
+ const EmailComponent = formComponents.email ?? script$l;
3124
+ const PhoneComponent = formComponents.phone ?? script$p;
3125
+ const NumberComponent = formComponents.number ?? script$k;
3126
+ const SelectComponent = formComponents.select ?? script$h;
3127
+ const PasswordComponent = formComponents.password ?? script$g;
3128
3128
  if(props.customComponents && props.customComponents[field]) {
3129
3129
  return props.customComponents[field]
3130
3130
  }
@@ -3136,16 +3136,16 @@ const getFieldComponent = (fieldObj)=>{
3136
3136
  }
3137
3137
  else
3138
3138
  if((props.textAreas && props.textAreas.includes(field)) || defaultTextareas.includes(field)){
3139
- return formComponents.textArea ?? script$h
3139
+ return formComponents.textArea ?? script$i
3140
3140
  } else
3141
3141
  if((props.emails && props.emails.includes(field)) || defaultEmails.includes(field)){
3142
- return formComponents.email ?? script$k
3142
+ return formComponents.email ?? script$l
3143
3143
  } else
3144
3144
  if((props.phones && props.phones.includes(field)) || defaultPhones.includes(field)){
3145
- return formComponents.phone ?? script$o
3145
+ return formComponents.phone ?? script$p
3146
3146
  } else
3147
3147
  if((props.numbers && props.numbers.includes(field)) || defaultNumbers.includes(field)){
3148
- return formComponents.number ?? script$j
3148
+ return formComponents.number ?? script$k
3149
3149
  }
3150
3150
  // else
3151
3151
  // if((props.selects && props.selects.includes(field)) || defaultSelects.includes(field)){
@@ -3154,14 +3154,14 @@ const getFieldComponent = (fieldObj)=>{
3154
3154
  // if((props.dates && props.dates.includes(field)) || defaultDates.includes(field)){
3155
3155
  // return formComponents.date ?? DateInput
3156
3156
  // }
3157
- return formComponents.text ?? script$i
3157
+ return formComponents.text ?? script$j
3158
3158
  };
3159
3159
  const shFormElementClasses = ref(null);
3160
3160
  shFormElementClasses.value = inject('shFormElementClasses');
3161
3161
  const shAutoForm = ref(null);
3162
3162
  const closeModal = e => {
3163
3163
  setTimeout(() => {
3164
- const modal = script$e.value.closest('.modal-dialog');
3164
+ const modal = script$f.value.closest('.modal-dialog');
3165
3165
  if(modal){
3166
3166
  const closeBtn = modal.querySelector('[data-bs-dismiss="modal"]');
3167
3167
  closeBtn && closeBtn.click();
@@ -3257,11 +3257,11 @@ onMounted((ev)=>{
3257
3257
 
3258
3258
  return (_ctx, _cache) => {
3259
3259
  return (openBlock(), createElementBlock(Fragment, null, [
3260
- _hoisted_1$d,
3260
+ _hoisted_1$e,
3261
3261
  createElementVNode("form", {
3262
+ class: normalizeClass([__props.formClass, "sh-form"]),
3262
3263
  ref_key: "shAutoForm",
3263
3264
  ref: shAutoForm,
3264
- class: "sh-form",
3265
3265
  onSubmit: _cache[0] || (_cache[0] = e => submitForm(e))
3266
3266
  }, [
3267
3267
  (openBlock(true), createElementBlock(Fragment, null, renderList(formFields.value, (field, index) => {
@@ -3325,19 +3325,19 @@ return (_ctx, _cache) => {
3325
3325
  : createCommentVNode("v-if", true)
3326
3326
  ], 14 /* CLASS, STYLE, PROPS */, _hoisted_5$7)
3327
3327
  ], 2 /* CLASS */)
3328
- ], 544 /* HYDRATE_EVENTS, NEED_PATCH */)
3328
+ ], 34 /* CLASS, HYDRATE_EVENTS */)
3329
3329
  ], 64 /* STABLE_FRAGMENT */))
3330
3330
  }
3331
3331
  }
3332
3332
 
3333
3333
  };
3334
3334
 
3335
- script$e.__file = "src/lib/components/ShAutoForm.vue";
3335
+ script$f.__file = "src/lib/components/ShAutoForm.vue";
3336
3336
 
3337
- const _hoisted_1$c = /*#__PURE__*/createElementVNode("h5", { class: "d-none" }, "To prevent default class", -1 /* HOISTED */);
3337
+ const _hoisted_1$d = /*#__PURE__*/createElementVNode("h5", { class: "d-none" }, "To prevent default class", -1 /* HOISTED */);
3338
3338
  const _hoisted_2$9 = { class: "dropdown" };
3339
3339
 
3340
- var script$d = {
3340
+ var script$e = {
3341
3341
  __name: 'ShDropDownForm',
3342
3342
  props: ['action',
3343
3343
  'classes',
@@ -3367,7 +3367,7 @@ const dropdownId = 'rand' + (Math.random() + 1).toString(36).substring(2);
3367
3367
 
3368
3368
  return (_ctx, _cache) => {
3369
3369
  return (openBlock(), createElementBlock(Fragment, null, [
3370
- _hoisted_1$c,
3370
+ _hoisted_1$d,
3371
3371
  createElementVNode("div", _hoisted_2$9, [
3372
3372
  createElementVNode("a", {
3373
3373
  class: normalizeClass(unref(btnClass)),
@@ -3384,7 +3384,7 @@ return (_ctx, _cache) => {
3384
3384
  class: "dropdown-menu px-2 py-1",
3385
3385
  "aria-labelledby": dropdownId
3386
3386
  }, [
3387
- createVNode(script$l, normalizeProps(guardReactiveProps(props)), null, 16 /* FULL_PROPS */)
3387
+ createVNode(script$m, normalizeProps(guardReactiveProps(props)), null, 16 /* FULL_PROPS */)
3388
3388
  ])
3389
3389
  ])
3390
3390
  ], 64 /* STABLE_FRAGMENT */))
@@ -3393,16 +3393,16 @@ return (_ctx, _cache) => {
3393
3393
 
3394
3394
  };
3395
3395
 
3396
- script$d.__file = "src/lib/components/ShDropDownForm.vue";
3396
+ script$e.__file = "src/lib/components/ShDropDownForm.vue";
3397
3397
 
3398
- var script$c = {
3398
+ var script$d = {
3399
3399
  name: 'ShModal',
3400
3400
  props: ['modalTitle', 'modalId', 'modalSize'],
3401
3401
  components: {
3402
3402
  }
3403
3403
  };
3404
3404
 
3405
- const _hoisted_1$b = ["id"];
3405
+ const _hoisted_1$c = ["id"];
3406
3406
  const _hoisted_2$8 = { class: "modal-content" };
3407
3407
  const _hoisted_3$8 = { class: "modal-header" };
3408
3408
  const _hoisted_4$8 = { class: "modal-title" };
@@ -3435,15 +3435,15 @@ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
3435
3435
  ])
3436
3436
  ])
3437
3437
  ], 2 /* CLASS */)
3438
- ], 8 /* PROPS */, _hoisted_1$b))
3438
+ ], 8 /* PROPS */, _hoisted_1$c))
3439
3439
  }
3440
3440
 
3441
- script$c.render = render$4;
3442
- script$c.__file = "src/lib/components/ShModal.vue";
3441
+ script$d.render = render$4;
3442
+ script$d.__file = "src/lib/components/ShModal.vue";
3443
3443
 
3444
- const _hoisted_1$a = ["href"];
3444
+ const _hoisted_1$b = ["href"];
3445
3445
 
3446
- var script$b = {
3446
+ var script$c = {
3447
3447
  __name: 'ShModalForm',
3448
3448
  props: ['action',
3449
3449
  'classes',
@@ -3474,6 +3474,66 @@ const success = (res)=>{
3474
3474
  emit('success',res);
3475
3475
  };
3476
3476
 
3477
+ return (_ctx, _cache) => {
3478
+ return (openBlock(), createElementBlock(Fragment, null, [
3479
+ createElementVNode("a", {
3480
+ class: normalizeClass(unref(btnClass)),
3481
+ href: '#' + modalId,
3482
+ "data-bs-toggle": "modal"
3483
+ }, [
3484
+ renderSlot(_ctx.$slots, "default")
3485
+ ], 10 /* CLASS, PROPS */, _hoisted_1$b),
3486
+ createVNode(script$d, {
3487
+ "modal-id": modalId,
3488
+ "modal-title": __props.modalTitle
3489
+ }, {
3490
+ default: withCtx(() => [
3491
+ createVNode(script$m, mergeProps({ onSuccess: success }, props), null, 16 /* FULL_PROPS */)
3492
+ ]),
3493
+ _: 1 /* STABLE */
3494
+ }, 8 /* PROPS */, ["modal-title"])
3495
+ ], 64 /* STABLE_FRAGMENT */))
3496
+ }
3497
+ }
3498
+
3499
+ };
3500
+
3501
+ script$c.__file = "src/lib/components/ShModalForm.vue";
3502
+
3503
+ const _hoisted_1$a = ["href"];
3504
+
3505
+ var script$b = {
3506
+ __name: 'ShModalFormAuto',
3507
+ props: ['action',
3508
+ 'classes',
3509
+ 'hasTerms',
3510
+ 'country_code',
3511
+ 'submitBtnClass',
3512
+ 'fields',
3513
+ 'columns', 'placeholders', 'field_permissions', 'retainDataAfterSubmission',
3514
+ 'currentData', 'actionLabel', 'fillSelects', 'phones', 'successCallback',
3515
+ 'failedCallback', 'labels', 'editors',
3516
+ 'datePickers',
3517
+ 'textAreas',
3518
+ 'files',
3519
+ 'phones',
3520
+ 'numbers',
3521
+ 'customComponent','modalTitle','class','successMessage'],
3522
+ emits: ['success'],
3523
+ setup(__props, { emit }) {
3524
+
3525
+ const props = __props;
3526
+
3527
+
3528
+
3529
+ const formProps = ref(props);
3530
+ let btnClass=props.class;
3531
+ const modalId = 'rand' + (Math.random() + 1).toString(36).substring(2);
3532
+ const success = (res)=>{
3533
+ emit('success',res);
3534
+ };
3535
+ delete formProps.class;
3536
+
3477
3537
  return (_ctx, _cache) => {
3478
3538
  return (openBlock(), createElementBlock(Fragment, null, [
3479
3539
  createElementVNode("a", {
@@ -3483,12 +3543,12 @@ return (_ctx, _cache) => {
3483
3543
  }, [
3484
3544
  renderSlot(_ctx.$slots, "default")
3485
3545
  ], 10 /* CLASS, PROPS */, _hoisted_1$a),
3486
- createVNode(script$c, {
3546
+ createVNode(script$d, {
3487
3547
  "modal-id": modalId,
3488
3548
  "modal-title": __props.modalTitle
3489
3549
  }, {
3490
3550
  default: withCtx(() => [
3491
- createVNode(script$l, mergeProps({ onSuccess: success }, props), null, 16 /* FULL_PROPS */)
3551
+ createVNode(script$f, mergeProps({ onSuccess: success }, props), null, 16 /* FULL_PROPS */)
3492
3552
  ]),
3493
3553
  _: 1 /* STABLE */
3494
3554
  }, 8 /* PROPS */, ["modal-title"])
@@ -3498,7 +3558,7 @@ return (_ctx, _cache) => {
3498
3558
 
3499
3559
  };
3500
3560
 
3501
- script$b.__file = "src/lib/components/ShModalForm.vue";
3561
+ script$b.__file = "src/lib/components/ShModalFormAuto.vue";
3502
3562
 
3503
3563
  var script$a = {
3504
3564
  name: 'ShCanvas',
@@ -5392,12 +5452,12 @@ return (_ctx, _cache) => {
5392
5452
  ]
5393
5453
  }
5394
5454
  }),
5395
- createVNode(script$c, {
5455
+ createVNode(script$d, {
5396
5456
  "modal-id": "sh-department_modal",
5397
5457
  "modal-title": "Department Form"
5398
5458
  }, {
5399
5459
  default: withCtx(() => [
5400
- createVNode(script$l, {
5460
+ createVNode(script$m, {
5401
5461
  "success-callback": "departmentAdded",
5402
5462
  onDepartmentAdded: departmentAdded,
5403
5463
  action: "admin/departments/store",
@@ -5551,12 +5611,12 @@ return (_ctx, _cache) => {
5551
5611
  headers: ['id',showModule,'created_at'],
5552
5612
  "end-point": 'admin/departments/department/list-modules/' + id.value
5553
5613
  }, null, 8 /* PROPS */, ["actions", "reload", "headers", "end-point"]),
5554
- createVNode(script$c, {
5614
+ createVNode(script$d, {
5555
5615
  "modal-id": "addModule",
5556
5616
  "modal-title": "Add Module Department"
5557
5617
  }, {
5558
5618
  default: withCtx(() => [
5559
- createVNode(script$l, {
5619
+ createVNode(script$m, {
5560
5620
  "reload-select-items": unref(reload),
5561
5621
  "success-callback": moduleAdded,
5562
5622
  "fill-selects": {
@@ -5693,7 +5753,7 @@ return (_ctx, _cache) => {
5693
5753
  : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
5694
5754
  (section.value === 'login')
5695
5755
  ? (openBlock(), createElementBlock("div", _hoisted_2, [
5696
- createVNode(script$l, {
5756
+ createVNode(script$m, {
5697
5757
  class: "sh-login-form",
5698
5758
  fields: ['email','password'],
5699
5759
  "action-label": "Login",
@@ -5718,7 +5778,7 @@ return (_ctx, _cache) => {
5718
5778
  (unref(registerSubTitle))
5719
5779
  ? (openBlock(), createElementBlock("span", _hoisted_8, toDisplayString(unref(registerSubTitle)), 1 /* TEXT */))
5720
5780
  : createCommentVNode("v-if", true),
5721
- createVNode(script$l, {
5781
+ createVNode(script$m, {
5722
5782
  class: "sh-login-form",
5723
5783
  fields: unref(registrationFields),
5724
5784
  "action-label": "Sign Up",
@@ -5765,7 +5825,7 @@ const ShFrontend = {
5765
5825
  const registerTitle = options.registerTitle ?? 'Create a new account';
5766
5826
  const registerSubTitle = options.registerSubTitle ?? `It's quick and easy`;
5767
5827
  const logoutApiEndpoint = options.logoutApiEndpoint ?? `auth/logout`;
5768
- options.formTextInput ?? script$i;
5828
+ options.formTextInput ?? script$j;
5769
5829
  const loginUrl = options.loginUrl ?? `/login`;
5770
5830
  const redirectLogin = options.redirectLogin ?? `/`;
5771
5831
  const redirectRegister = options.redirectRegister ?? `/`;
@@ -5810,4 +5870,4 @@ const ShFrontend = {
5810
5870
  }
5811
5871
  };
5812
5872
 
5813
- export { countries as Countries, script$3 as ManagePermissions, script$e as ShAutoForm, script$a as ShCanvas, script$8 as ShConfirmAction, script$d as ShDropDownForm, script$4 as ShDynamicTabs, script$l as ShForm, ShFrontend, script$c as ShModal, script$b as ShModalForm, script$o as ShPhone, script$7 as ShSilentAction, script$6 as ShTable, script$5 as ShTabs, shApis, shRepo, ShStorage as shStorage, useUserStore };
5873
+ export { countries as Countries, script$3 as ManagePermissions, script$f as ShAutoForm, script$a as ShCanvas, script$8 as ShConfirmAction, script$e as ShDropDownForm, script$4 as ShDynamicTabs, script$m as ShForm, ShFrontend, script$d as ShModal, script$c as ShModalForm, script$b as ShModalFormAuto, script$p as ShPhone, script$7 as ShSilentAction, script$6 as ShTable, script$5 as ShTabs, shApis, shRepo, ShStorage as shStorage, useUserStore };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/shframework",
3
- "version": "1.6.0",
3
+ "version": "1.6.3",
4
4
  "description": "Vue library for handling laravel backend",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.mjs",