@iankibetsh/shframework 1.3.5 → 1.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/library.js CHANGED
@@ -1874,8 +1874,8 @@ const countries = [
1874
1874
  }
1875
1875
  ];
1876
1876
 
1877
- var script$l = {
1878
- name: 'ShPhone',
1877
+ var script$n = {
1878
+ name: 'PhoneInput',
1879
1879
  props: ['modelValue', 'country_code'],
1880
1880
  data () {
1881
1881
  return {
@@ -1936,7 +1936,7 @@ var script$l = {
1936
1936
  }
1937
1937
  };
1938
1938
 
1939
- const _hoisted_1$g = { class: "sh-phone mb-3" };
1939
+ const _hoisted_1$i = { class: "sh-phone mb-3" };
1940
1940
  const _hoisted_2$c = {
1941
1941
  key: 0,
1942
1942
  style: {"display":"contents"}
@@ -1945,7 +1945,7 @@ const _hoisted_3$b = ["src"];
1945
1945
  const _hoisted_4$b = ["value"];
1946
1946
 
1947
1947
  function render$7(_ctx, _cache, $props, $setup, $data, $options) {
1948
- return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
1948
+ return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, [
1949
1949
  ($data.selectedCountry)
1950
1950
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$c, [
1951
1951
  vue.createElementVNode("img", { src: $data.flag }, null, 8 /* PROPS */, _hoisted_3$b),
@@ -1979,10 +1979,10 @@ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
1979
1979
  ]))
1980
1980
  }
1981
1981
 
1982
- script$l.render = render$7;
1983
- script$l.__file = "src/lib/components/form-components/ShPhone.vue";
1982
+ script$n.render = render$7;
1983
+ script$n.__file = "src/lib/components/form-components/PhoneInput.vue";
1984
1984
 
1985
- var script$k = {
1985
+ var script$m = {
1986
1986
  name: 'ShEditor',
1987
1987
  props: ['modelValue'],
1988
1988
  components: {
@@ -2021,7 +2021,7 @@ var script$k = {
2021
2021
  }
2022
2022
  };
2023
2023
 
2024
- const _hoisted_1$f = /*#__PURE__*/vue.createElementVNode("textarea", {
2024
+ const _hoisted_1$h = /*#__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$f,
2034
+ _hoisted_1$h,
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$k.render = render$6;
2060
- script$k.__file = "src/lib/components/form-components/ShEditor.vue";
2059
+ script$m.render = render$6;
2060
+ script$m.__file = "src/lib/components/form-components/ShEditor.vue";
2061
2061
 
2062
- const _hoisted_1$e = {
2062
+ const _hoisted_1$g = {
2063
2063
  key: 0,
2064
2064
  class: "dropdown sh-suggest"
2065
2065
  };
@@ -2080,7 +2080,7 @@ const _hoisted_10$3 = {
2080
2080
  };
2081
2081
 
2082
2082
 
2083
- var script$j = {
2083
+ var script$l = {
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$e, [
2164
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
2165
2165
  vue.createElementVNode("div", {
2166
2166
  id: vue.unref(id),
2167
2167
  "data-bs-toggle": "dropdown",
@@ -2221,15 +2221,16 @@ return (_ctx, _cache) => {
2221
2221
 
2222
2222
  };
2223
2223
 
2224
- script$j.__scopeId = "data-v-71cc9569";
2225
- script$j.__file = "src/lib/components/form-components/ShSuggest.vue";
2224
+ script$l.__scopeId = "data-v-71cc9569";
2225
+ script$l.__file = "src/lib/components/form-components/ShSuggest.vue";
2226
2226
 
2227
- var script$i = {
2227
+ var script$k = {
2228
2228
  name: 'ShForm',
2229
2229
  components: {
2230
- ShSuggest: script$j,
2231
- ShEditor: script$k,
2232
- ShPhone: script$l
2230
+ PhoneInput: script$n,
2231
+ ShSuggest: script$l,
2232
+ ShEditor: script$m,
2233
+ ShPhone: script$n
2233
2234
  },
2234
2235
  props: [
2235
2236
  'action',
@@ -2547,7 +2548,7 @@ var script$i = {
2547
2548
  }
2548
2549
  };
2549
2550
 
2550
- const _hoisted_1$d = /*#__PURE__*/vue.createElementVNode("h5", { class: "d-none" }, null, -1 /* HOISTED */);
2551
+ const _hoisted_1$f = /*#__PURE__*/vue.createElementVNode("h5", { class: "d-none" }, null, -1 /* HOISTED */);
2551
2552
  const _hoisted_2$a = {
2552
2553
  ref: "ShAutoForm",
2553
2554
  class: "sh-form"
@@ -2604,12 +2605,12 @@ const _hoisted_24$1 = /*#__PURE__*/vue.createElementVNode("span", {
2604
2605
  }, null, -1 /* HOISTED */);
2605
2606
 
2606
2607
  function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2607
- const _component_ShPhone = vue.resolveComponent("ShPhone");
2608
+ const _component_phone_input = vue.resolveComponent("phone-input");
2608
2609
  const _component_ShSuggest = vue.resolveComponent("ShSuggest");
2609
2610
  const _component_ShEditor = vue.resolveComponent("ShEditor");
2610
2611
 
2611
2612
  return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
2612
- _hoisted_1$d,
2613
+ _hoisted_1$f,
2613
2614
  vue.createElementVNode("form", _hoisted_2$a, [
2614
2615
  vue.createCommentVNode(" <div v-if=\"form_status == 1\" class=\"alert alert-info\">Processing...</div>"),
2615
2616
  vue.createCommentVNode(" <div v-if=\"form_status == 2\" class=\"alert alert-success\">Success</div>"),
@@ -2719,7 +2720,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2719
2720
  ])
2720
2721
  : vue.createCommentVNode("v-if", true),
2721
2722
  ($options.getFieldType(field) === 'phone')
2722
- ? (vue.openBlock(), vue.createBlock(_component_ShPhone, {
2723
+ ? (vue.openBlock(), vue.createBlock(_component_phone_input, {
2723
2724
  key: 6,
2724
2725
  country_code: $props.country_code,
2725
2726
  placeholder: _ctx.allPlaceHolders[field] ? _ctx.allPlaceHolders[field] : '',
@@ -2826,10 +2827,10 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2826
2827
  ], 64 /* STABLE_FRAGMENT */))
2827
2828
  }
2828
2829
 
2829
- script$i.render = render$5;
2830
- script$i.__file = "src/lib/components/ShForm.vue";
2830
+ script$k.render = render$5;
2831
+ script$k.__file = "src/lib/components/ShForm.vue";
2831
2832
 
2832
- var script$h = {
2833
+ var script$j = {
2833
2834
  __name: 'EmailInput',
2834
2835
  props: ['modelValue','label'],
2835
2836
  emits: ['update:modelValue','clearValidationErrors'],
@@ -2865,11 +2866,14 @@ return (_ctx, _cache) => {
2865
2866
 
2866
2867
  };
2867
2868
 
2868
- script$h.__file = "src/lib/components/form-components/EmailInput.vue";
2869
+ script$j.__file = "src/lib/components/form-components/EmailInput.vue";
2869
2870
 
2870
- var script$g = {
2871
+ const _hoisted_1$e = ["min", "max"];
2872
+
2873
+
2874
+ var script$i = {
2871
2875
  __name: 'NumberInput',
2872
- props: ['modelValue','label'],
2876
+ props: ['modelValue','label','min','max'],
2873
2877
  emits: ['update:modelValue','clearValidationErrors'],
2874
2878
  setup(__props, { emit }) {
2875
2879
 
@@ -2890,12 +2894,14 @@ vue.onMounted(()=>{
2890
2894
 
2891
2895
  return (_ctx, _cache) => {
2892
2896
  return vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
2897
+ min: __props.min,
2898
+ max: __props.max,
2893
2899
  type: "number",
2894
2900
  "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((inputModel).value = $event)),
2895
2901
  onChange: modelValueUpdated,
2896
2902
  onKeydown: modelValueUpdated,
2897
2903
  onUpdated: modelValueUpdated
2898
- }, null, 544 /* HYDRATE_EVENTS, NEED_PATCH */)), [
2904
+ }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_1$e)), [
2899
2905
  [vue.vModelText, inputModel.value]
2900
2906
  ])
2901
2907
  }
@@ -2903,9 +2909,9 @@ return (_ctx, _cache) => {
2903
2909
 
2904
2910
  };
2905
2911
 
2906
- script$g.__file = "src/lib/components/form-components/NumberInput.vue";
2912
+ script$i.__file = "src/lib/components/form-components/NumberInput.vue";
2907
2913
 
2908
- var script$f = {
2914
+ var script$h = {
2909
2915
  __name: 'TextInput',
2910
2916
  props: ['modelValue','label'],
2911
2917
  emits: ['update:modelValue','clearValidationErrors'],
@@ -2941,9 +2947,9 @@ return (_ctx, _cache) => {
2941
2947
 
2942
2948
  };
2943
2949
 
2944
- script$f.__file = "src/lib/components/form-components/TextInput.vue";
2950
+ script$h.__file = "src/lib/components/form-components/TextInput.vue";
2945
2951
 
2946
- var script$e = {
2952
+ var script$g = {
2947
2953
  __name: 'TextAreaInput',
2948
2954
  props: ['modelValue','label'],
2949
2955
  emits: ['update:modelValue','clearValidationErrors'],
@@ -2979,7 +2985,111 @@ return (_ctx, _cache) => {
2979
2985
 
2980
2986
  };
2981
2987
 
2982
- script$e.__file = "src/lib/components/form-components/TextAreaInput.vue";
2988
+ script$g.__file = "src/lib/components/form-components/TextAreaInput.vue";
2989
+
2990
+ const _hoisted_1$d = ["value"];
2991
+
2992
+
2993
+ var script$f = {
2994
+ __name: 'SelectInput',
2995
+ props: ['modelValue','label','data','dataUrl'],
2996
+ emits: ['update:modelValue','clearValidationErrors'],
2997
+ setup(__props, { emit }) {
2998
+
2999
+ const props = __props;
3000
+
3001
+
3002
+
3003
+ const inputModel = vue.ref(null);
3004
+ const selectOptions = vue.ref(null);
3005
+ const modelValueUpdated = (e) => {
3006
+ emit('clearValidationErrors');
3007
+ emit('update:modelValue',inputModel);
3008
+ };
3009
+ vue.onMounted(()=>{
3010
+ props.modelValue && (inputModel.value = props.modelValue);
3011
+ if(props.data){
3012
+ selectOptions.value = props.data.map(item=>{
3013
+ return {
3014
+ id: item.id ? item.id : item.key ? item.key : item.value ? item.value:item.name ? item.name:item.label,
3015
+ name: item.label ? item.label : item.name ? item.name : item.value ? item.value:item.id ? item.id:item.option
3016
+ }
3017
+ });
3018
+ } else if (props.dataUrl){
3019
+ shApis.doGet(props.dataUrl,{all:1}).then(res=>{
3020
+ selectOptions.value = res.data.map(item=>{
3021
+ return {
3022
+ id: item.id ? item.id : item.key ? item.key : item.value ? item.value:item.name ? item.name:item.label,
3023
+ name: item.label ? item.label : item.name ? item.name : item.value ? item.value:item.id ? item.id:item.option
3024
+ }
3025
+ });
3026
+ }).catch(ex=>{
3027
+ console.log(ex);
3028
+ });
3029
+ }
3030
+ });
3031
+
3032
+
3033
+ return (_ctx, _cache) => {
3034
+ return vue.withDirectives((vue.openBlock(), vue.createElementBlock("select", {
3035
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((inputModel).value = $event)),
3036
+ onChange: modelValueUpdated,
3037
+ onKeydown: modelValueUpdated,
3038
+ onUpdated: modelValueUpdated
3039
+ }, [
3040
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(selectOptions.value, (option) => {
3041
+ return (vue.openBlock(), vue.createElementBlock("option", {
3042
+ key: option.id,
3043
+ value: option.id
3044
+ }, vue.toDisplayString(option.name), 9 /* TEXT, PROPS */, _hoisted_1$d))
3045
+ }), 128 /* KEYED_FRAGMENT */))
3046
+ ], 544 /* HYDRATE_EVENTS, NEED_PATCH */)), [
3047
+ [vue.vModelSelect, inputModel.value]
3048
+ ])
3049
+ }
3050
+ }
3051
+
3052
+ };
3053
+
3054
+ script$f.__file = "src/lib/components/form-components/SelectInput.vue";
3055
+
3056
+ var script$e = {
3057
+ __name: 'PasswordInput',
3058
+ props: ['modelValue','label'],
3059
+ emits: ['update:modelValue','clearValidationErrors'],
3060
+ setup(__props, { emit }) {
3061
+
3062
+ const props = __props;
3063
+
3064
+
3065
+
3066
+ const inputModel = vue.ref(null);
3067
+
3068
+ const modelValueUpdated = (e) => {
3069
+ emit('clearValidationErrors');
3070
+ emit('update:modelValue',inputModel);
3071
+ };
3072
+ vue.onMounted(()=>{
3073
+ props.modelValue && (inputModel.value = props.modelValue);
3074
+ });
3075
+
3076
+
3077
+ return (_ctx, _cache) => {
3078
+ return vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
3079
+ type: "password",
3080
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((inputModel).value = $event)),
3081
+ onChange: modelValueUpdated,
3082
+ onKeydown: modelValueUpdated,
3083
+ onUpdated: modelValueUpdated
3084
+ }, null, 544 /* HYDRATE_EVENTS, NEED_PATCH */)), [
3085
+ [vue.vModelText, inputModel.value]
3086
+ ])
3087
+ }
3088
+ }
3089
+
3090
+ };
3091
+
3092
+ script$e.__file = "src/lib/components/form-components/PasswordInput.vue";
2983
3093
 
2984
3094
  const _hoisted_1$c = /*#__PURE__*/vue.createElementVNode("div", null, null, -1 /* HOISTED */);
2985
3095
  const _hoisted_2$9 = ["innerHTML"];
@@ -3015,26 +3125,42 @@ const props = __props;
3015
3125
 
3016
3126
 
3017
3127
  const formFields = vue.ref([]);
3018
- const getFieldComponent = (field)=>{
3128
+ const getFieldComponent = (fieldObj)=>{
3129
+ const field = fieldObj.field;
3019
3130
  const defaultTextareas = ['message', 'meta_description', 'comment', 'call_response', 'comments', 'description'];
3020
3131
  const defaultNumbers = ['age'];
3132
+ const passwords = ['password','password_confirmation','pin'];
3021
3133
  const defaultPhones = ['phone'];
3022
- const defaultEmails = ['phone'];
3134
+ const defaultEmails = ['email'];
3023
3135
  const formComponents = vue.inject('formComponents');
3136
+ const TextComponent = formComponents.text ?? script$h;
3137
+ const TextAreaComponent = formComponents.textArea ?? script$g;
3138
+ const EmailComponent = formComponents.email ?? script$j;
3139
+ const PhoneComponent = formComponents.phone ?? script$n;
3140
+ const NumberComponent = formComponents.number ?? script$i;
3141
+ const SelectComponent = formComponents.select ?? script$f;
3142
+ const PasswordComponent = formComponents.password ?? script$e;
3024
3143
  if(props.customComponents && props.customComponents[field]) {
3025
3144
  return props.customComponents[field]
3026
- } else
3145
+ }
3146
+ if(fieldObj.type){
3147
+ return fieldObj.type === 'number' ? NumberComponent:fieldObj.type === 'textarea' ? TextAreaComponent : fieldObj.type === 'email' ? EmailComponent : fieldObj.type === 'phone' ? PhoneComponent : fieldObj.type ? SelectComponent:TextComponent
3148
+ }else
3149
+ if(passwords.includes(field)){
3150
+ return PasswordComponent
3151
+ }
3152
+ else
3027
3153
  if((props.textAreas && props.textAreas.includes(field)) || defaultTextareas.includes(field)){
3028
- return formComponents.textArea ?? script$e
3154
+ return formComponents.textArea ?? script$g
3029
3155
  } else
3030
3156
  if((props.emails && props.emails.includes(field)) || defaultEmails.includes(field)){
3031
- return formComponents.email ?? script$h
3157
+ return formComponents.email ?? script$j
3032
3158
  } else
3033
3159
  if((props.phones && props.phones.includes(field)) || defaultPhones.includes(field)){
3034
- return formComponents.phone ?? script$l
3160
+ return formComponents.phone ?? script$n
3035
3161
  } else
3036
3162
  if((props.numbers && props.numbers.includes(field)) || defaultNumbers.includes(field)){
3037
- return formComponents.number ?? script$g
3163
+ return formComponents.number ?? script$i
3038
3164
  }
3039
3165
  // else
3040
3166
  // if((props.selects && props.selects.includes(field)) || defaultSelects.includes(field)){
@@ -3043,7 +3169,7 @@ const getFieldComponent = (field)=>{
3043
3169
  // if((props.dates && props.dates.includes(field)) || defaultDates.includes(field)){
3044
3170
  // return formComponents.date ?? DateInput
3045
3171
  // }
3046
- return formComponents.text ?? script$f
3172
+ return formComponents.text ?? script$h
3047
3173
  };
3048
3174
  const shFormElementClasses = vue.ref(null);
3049
3175
  shFormElementClasses.value = vue.inject('shFormElementClasses');
@@ -3110,7 +3236,6 @@ vue.onMounted((ev)=>{
3110
3236
  fieldObj.label && getLabel(fieldObj.field);
3111
3237
  !fieldObj.helper && fieldObj.helperText ? fieldObj.helper = fieldObj.helperText : fieldObj.helper = getHelperText(fieldObj.field);
3112
3238
  fieldObj.helperText === undefined && (fieldObj.label = getLabel(fieldObj.field));
3113
- fieldObj.component && getfieldObjComponent(fieldObj.field);
3114
3239
  fieldObj.placeholder && fieldObj.placeHolder && getPlaceholder(fieldObj.field);
3115
3240
  fieldObj.value = null;
3116
3241
  formFields.value.push(fieldObj);
@@ -3118,7 +3243,6 @@ vue.onMounted((ev)=>{
3118
3243
  formFields.value.push({
3119
3244
  field:field,label: getLabel(field),
3120
3245
  helper: getHelperText(field),
3121
- component: getFieldComponent(field),
3122
3246
  placeholder: getPlaceholder(field),
3123
3247
  value: null
3124
3248
  });
@@ -3148,7 +3272,7 @@ return (_ctx, _cache) => {
3148
3272
  innerHTML: field.label
3149
3273
  }, null, 10 /* CLASS, PROPS */, _hoisted_2$9))
3150
3274
  : vue.createCommentVNode("v-if", true),
3151
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(getFieldComponent(field.field)), vue.mergeProps(getComponentProps(field), {
3275
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(getFieldComponent(field)), vue.mergeProps(getComponentProps(field), {
3152
3276
  onClick: $event => (removeValidationError(field.field)),
3153
3277
  "onUpdate:modelValue": [$event => (removeValidationError(field.field)), $event => ((formFields.value[index].value) = $event)],
3154
3278
  modelValue: formFields.value[index].value,
@@ -3254,7 +3378,7 @@ return (_ctx, _cache) => {
3254
3378
  class: "dropdown-menu px-2 py-1",
3255
3379
  "aria-labelledby": dropdownId
3256
3380
  }, [
3257
- vue.createVNode(script$i, vue.normalizeProps(vue.guardReactiveProps(props)), null, 16 /* FULL_PROPS */)
3381
+ vue.createVNode(script$k, vue.normalizeProps(vue.guardReactiveProps(props)), null, 16 /* FULL_PROPS */)
3258
3382
  ])
3259
3383
  ])
3260
3384
  ], 64 /* STABLE_FRAGMENT */))
@@ -3358,7 +3482,7 @@ return (_ctx, _cache) => {
3358
3482
  "modal-title": __props.modalTitle
3359
3483
  }, {
3360
3484
  default: vue.withCtx(() => [
3361
- vue.createVNode(script$i, vue.mergeProps({ onSuccess: success }, props), null, 16 /* FULL_PROPS */)
3485
+ vue.createVNode(script$k, vue.mergeProps({ onSuccess: success }, props), null, 16 /* FULL_PROPS */)
3362
3486
  ]),
3363
3487
  _: 1 /* STABLE */
3364
3488
  }, 8 /* PROPS */, ["modal-title"])
@@ -5024,7 +5148,7 @@ return (_ctx, _cache) => {
5024
5148
  "modal-title": "Department Form"
5025
5149
  }, {
5026
5150
  default: vue.withCtx(() => [
5027
- vue.createVNode(script$i, {
5151
+ vue.createVNode(script$k, {
5028
5152
  "success-callback": "departmentAdded",
5029
5153
  onDepartmentAdded: departmentAdded,
5030
5154
  action: "admin/departments/store",
@@ -5183,7 +5307,7 @@ return (_ctx, _cache) => {
5183
5307
  "modal-title": "Add Module Department"
5184
5308
  }, {
5185
5309
  default: vue.withCtx(() => [
5186
- vue.createVNode(script$i, {
5310
+ vue.createVNode(script$k, {
5187
5311
  "reload-select-items": vue.unref(reload),
5188
5312
  "success-callback": moduleAdded,
5189
5313
  "fill-selects": {
@@ -5320,7 +5444,7 @@ return (_ctx, _cache) => {
5320
5444
  : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
5321
5445
  (section.value === 'login')
5322
5446
  ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [
5323
- vue.createVNode(script$i, {
5447
+ vue.createVNode(script$k, {
5324
5448
  class: "sh-login-form",
5325
5449
  fields: ['email','password'],
5326
5450
  "action-label": "Login",
@@ -5345,7 +5469,7 @@ return (_ctx, _cache) => {
5345
5469
  (vue.unref(registerSubTitle))
5346
5470
  ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_8, vue.toDisplayString(vue.unref(registerSubTitle)), 1 /* TEXT */))
5347
5471
  : vue.createCommentVNode("v-if", true),
5348
- vue.createVNode(script$i, {
5472
+ vue.createVNode(script$k, {
5349
5473
  class: "sh-login-form",
5350
5474
  fields: vue.unref(registrationFields),
5351
5475
  "action-label": "Sign Up",
@@ -5392,7 +5516,7 @@ const ShFrontend = {
5392
5516
  const registerTitle = options.registerTitle ?? 'Create a new account';
5393
5517
  const registerSubTitle = options.registerSubTitle ?? `It's quick and easy`;
5394
5518
  const logoutApiEndpoint = options.logoutApiEndpoint ?? `auth/logout`;
5395
- options.formTextInput ?? script$f;
5519
+ options.formTextInput ?? script$h;
5396
5520
  const loginUrl = options.loginUrl ?? `/login`;
5397
5521
  const redirectLogin = options.redirectLogin ?? `/`;
5398
5522
  const redirectRegister = options.redirectRegister ?? `/`;
@@ -5433,16 +5557,17 @@ const ShFrontend = {
5433
5557
  }
5434
5558
  };
5435
5559
 
5560
+ exports.Countries = countries;
5436
5561
  exports.ShAutoForm = script$d;
5437
5562
  exports.ShCanvas = script$9;
5438
5563
  exports.ShConfirmAction = script$7;
5439
5564
  exports.ShDropDownForm = script$c;
5440
5565
  exports.ShDynamicTabs = script$3;
5441
- exports.ShForm = script$i;
5566
+ exports.ShForm = script$k;
5442
5567
  exports.ShFrontend = ShFrontend;
5443
5568
  exports.ShModal = script$b;
5444
5569
  exports.ShModalForm = script$a;
5445
- exports.ShPhone = script$l;
5570
+ exports.ShPhone = script$n;
5446
5571
  exports.ShSilentAction = script$6;
5447
5572
  exports.ShTable = script$5;
5448
5573
  exports.ShTabs = script$4;
package/dist/library.mjs CHANGED
@@ -1861,8 +1861,8 @@ const countries = [
1861
1861
  }
1862
1862
  ];
1863
1863
 
1864
- var script$l = {
1865
- name: 'ShPhone',
1864
+ var script$n = {
1865
+ name: 'PhoneInput',
1866
1866
  props: ['modelValue', 'country_code'],
1867
1867
  data () {
1868
1868
  return {
@@ -1923,7 +1923,7 @@ var script$l = {
1923
1923
  }
1924
1924
  };
1925
1925
 
1926
- const _hoisted_1$g = { class: "sh-phone mb-3" };
1926
+ const _hoisted_1$i = { class: "sh-phone mb-3" };
1927
1927
  const _hoisted_2$c = {
1928
1928
  key: 0,
1929
1929
  style: {"display":"contents"}
@@ -1932,7 +1932,7 @@ const _hoisted_3$b = ["src"];
1932
1932
  const _hoisted_4$b = ["value"];
1933
1933
 
1934
1934
  function render$7(_ctx, _cache, $props, $setup, $data, $options) {
1935
- return (openBlock(), createElementBlock("div", _hoisted_1$g, [
1935
+ return (openBlock(), createElementBlock("div", _hoisted_1$i, [
1936
1936
  ($data.selectedCountry)
1937
1937
  ? (openBlock(), createElementBlock("div", _hoisted_2$c, [
1938
1938
  createElementVNode("img", { src: $data.flag }, null, 8 /* PROPS */, _hoisted_3$b),
@@ -1966,10 +1966,10 @@ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
1966
1966
  ]))
1967
1967
  }
1968
1968
 
1969
- script$l.render = render$7;
1970
- script$l.__file = "src/lib/components/form-components/ShPhone.vue";
1969
+ script$n.render = render$7;
1970
+ script$n.__file = "src/lib/components/form-components/PhoneInput.vue";
1971
1971
 
1972
- var script$k = {
1972
+ var script$m = {
1973
1973
  name: 'ShEditor',
1974
1974
  props: ['modelValue'],
1975
1975
  components: {
@@ -2008,7 +2008,7 @@ var script$k = {
2008
2008
  }
2009
2009
  };
2010
2010
 
2011
- const _hoisted_1$f = /*#__PURE__*/createElementVNode("textarea", {
2011
+ const _hoisted_1$h = /*#__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$f,
2021
+ _hoisted_1$h,
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$k.render = render$6;
2047
- script$k.__file = "src/lib/components/form-components/ShEditor.vue";
2046
+ script$m.render = render$6;
2047
+ script$m.__file = "src/lib/components/form-components/ShEditor.vue";
2048
2048
 
2049
- const _hoisted_1$e = {
2049
+ const _hoisted_1$g = {
2050
2050
  key: 0,
2051
2051
  class: "dropdown sh-suggest"
2052
2052
  };
@@ -2067,7 +2067,7 @@ const _hoisted_10$3 = {
2067
2067
  };
2068
2068
 
2069
2069
 
2070
- var script$j = {
2070
+ var script$l = {
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$e, [
2151
+ ? (openBlock(), createElementBlock("div", _hoisted_1$g, [
2152
2152
  createElementVNode("div", {
2153
2153
  id: unref(id),
2154
2154
  "data-bs-toggle": "dropdown",
@@ -2208,15 +2208,16 @@ return (_ctx, _cache) => {
2208
2208
 
2209
2209
  };
2210
2210
 
2211
- script$j.__scopeId = "data-v-71cc9569";
2212
- script$j.__file = "src/lib/components/form-components/ShSuggest.vue";
2211
+ script$l.__scopeId = "data-v-71cc9569";
2212
+ script$l.__file = "src/lib/components/form-components/ShSuggest.vue";
2213
2213
 
2214
- var script$i = {
2214
+ var script$k = {
2215
2215
  name: 'ShForm',
2216
2216
  components: {
2217
- ShSuggest: script$j,
2218
- ShEditor: script$k,
2219
- ShPhone: script$l
2217
+ PhoneInput: script$n,
2218
+ ShSuggest: script$l,
2219
+ ShEditor: script$m,
2220
+ ShPhone: script$n
2220
2221
  },
2221
2222
  props: [
2222
2223
  'action',
@@ -2534,7 +2535,7 @@ var script$i = {
2534
2535
  }
2535
2536
  };
2536
2537
 
2537
- const _hoisted_1$d = /*#__PURE__*/createElementVNode("h5", { class: "d-none" }, null, -1 /* HOISTED */);
2538
+ const _hoisted_1$f = /*#__PURE__*/createElementVNode("h5", { class: "d-none" }, null, -1 /* HOISTED */);
2538
2539
  const _hoisted_2$a = {
2539
2540
  ref: "ShAutoForm",
2540
2541
  class: "sh-form"
@@ -2591,12 +2592,12 @@ const _hoisted_24$1 = /*#__PURE__*/createElementVNode("span", {
2591
2592
  }, null, -1 /* HOISTED */);
2592
2593
 
2593
2594
  function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2594
- const _component_ShPhone = resolveComponent("ShPhone");
2595
+ const _component_phone_input = resolveComponent("phone-input");
2595
2596
  const _component_ShSuggest = resolveComponent("ShSuggest");
2596
2597
  const _component_ShEditor = resolveComponent("ShEditor");
2597
2598
 
2598
2599
  return (openBlock(), createElementBlock(Fragment, null, [
2599
- _hoisted_1$d,
2600
+ _hoisted_1$f,
2600
2601
  createElementVNode("form", _hoisted_2$a, [
2601
2602
  createCommentVNode(" <div v-if=\"form_status == 1\" class=\"alert alert-info\">Processing...</div>"),
2602
2603
  createCommentVNode(" <div v-if=\"form_status == 2\" class=\"alert alert-success\">Success</div>"),
@@ -2706,7 +2707,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2706
2707
  ])
2707
2708
  : createCommentVNode("v-if", true),
2708
2709
  ($options.getFieldType(field) === 'phone')
2709
- ? (openBlock(), createBlock(_component_ShPhone, {
2710
+ ? (openBlock(), createBlock(_component_phone_input, {
2710
2711
  key: 6,
2711
2712
  country_code: $props.country_code,
2712
2713
  placeholder: _ctx.allPlaceHolders[field] ? _ctx.allPlaceHolders[field] : '',
@@ -2813,10 +2814,10 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
2813
2814
  ], 64 /* STABLE_FRAGMENT */))
2814
2815
  }
2815
2816
 
2816
- script$i.render = render$5;
2817
- script$i.__file = "src/lib/components/ShForm.vue";
2817
+ script$k.render = render$5;
2818
+ script$k.__file = "src/lib/components/ShForm.vue";
2818
2819
 
2819
- var script$h = {
2820
+ var script$j = {
2820
2821
  __name: 'EmailInput',
2821
2822
  props: ['modelValue','label'],
2822
2823
  emits: ['update:modelValue','clearValidationErrors'],
@@ -2852,11 +2853,14 @@ return (_ctx, _cache) => {
2852
2853
 
2853
2854
  };
2854
2855
 
2855
- script$h.__file = "src/lib/components/form-components/EmailInput.vue";
2856
+ script$j.__file = "src/lib/components/form-components/EmailInput.vue";
2856
2857
 
2857
- var script$g = {
2858
+ const _hoisted_1$e = ["min", "max"];
2859
+
2860
+
2861
+ var script$i = {
2858
2862
  __name: 'NumberInput',
2859
- props: ['modelValue','label'],
2863
+ props: ['modelValue','label','min','max'],
2860
2864
  emits: ['update:modelValue','clearValidationErrors'],
2861
2865
  setup(__props, { emit }) {
2862
2866
 
@@ -2877,12 +2881,14 @@ onMounted(()=>{
2877
2881
 
2878
2882
  return (_ctx, _cache) => {
2879
2883
  return withDirectives((openBlock(), createElementBlock("input", {
2884
+ min: __props.min,
2885
+ max: __props.max,
2880
2886
  type: "number",
2881
2887
  "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((inputModel).value = $event)),
2882
2888
  onChange: modelValueUpdated,
2883
2889
  onKeydown: modelValueUpdated,
2884
2890
  onUpdated: modelValueUpdated
2885
- }, null, 544 /* HYDRATE_EVENTS, NEED_PATCH */)), [
2891
+ }, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_1$e)), [
2886
2892
  [vModelText, inputModel.value]
2887
2893
  ])
2888
2894
  }
@@ -2890,9 +2896,9 @@ return (_ctx, _cache) => {
2890
2896
 
2891
2897
  };
2892
2898
 
2893
- script$g.__file = "src/lib/components/form-components/NumberInput.vue";
2899
+ script$i.__file = "src/lib/components/form-components/NumberInput.vue";
2894
2900
 
2895
- var script$f = {
2901
+ var script$h = {
2896
2902
  __name: 'TextInput',
2897
2903
  props: ['modelValue','label'],
2898
2904
  emits: ['update:modelValue','clearValidationErrors'],
@@ -2928,9 +2934,9 @@ return (_ctx, _cache) => {
2928
2934
 
2929
2935
  };
2930
2936
 
2931
- script$f.__file = "src/lib/components/form-components/TextInput.vue";
2937
+ script$h.__file = "src/lib/components/form-components/TextInput.vue";
2932
2938
 
2933
- var script$e = {
2939
+ var script$g = {
2934
2940
  __name: 'TextAreaInput',
2935
2941
  props: ['modelValue','label'],
2936
2942
  emits: ['update:modelValue','clearValidationErrors'],
@@ -2966,7 +2972,111 @@ return (_ctx, _cache) => {
2966
2972
 
2967
2973
  };
2968
2974
 
2969
- script$e.__file = "src/lib/components/form-components/TextAreaInput.vue";
2975
+ script$g.__file = "src/lib/components/form-components/TextAreaInput.vue";
2976
+
2977
+ const _hoisted_1$d = ["value"];
2978
+
2979
+
2980
+ var script$f = {
2981
+ __name: 'SelectInput',
2982
+ props: ['modelValue','label','data','dataUrl'],
2983
+ emits: ['update:modelValue','clearValidationErrors'],
2984
+ setup(__props, { emit }) {
2985
+
2986
+ const props = __props;
2987
+
2988
+
2989
+
2990
+ const inputModel = ref(null);
2991
+ const selectOptions = ref(null);
2992
+ const modelValueUpdated = (e) => {
2993
+ emit('clearValidationErrors');
2994
+ emit('update:modelValue',inputModel);
2995
+ };
2996
+ onMounted(()=>{
2997
+ props.modelValue && (inputModel.value = props.modelValue);
2998
+ if(props.data){
2999
+ selectOptions.value = props.data.map(item=>{
3000
+ return {
3001
+ id: item.id ? item.id : item.key ? item.key : item.value ? item.value:item.name ? item.name:item.label,
3002
+ name: item.label ? item.label : item.name ? item.name : item.value ? item.value:item.id ? item.id:item.option
3003
+ }
3004
+ });
3005
+ } else if (props.dataUrl){
3006
+ shApis.doGet(props.dataUrl,{all:1}).then(res=>{
3007
+ selectOptions.value = res.data.map(item=>{
3008
+ return {
3009
+ id: item.id ? item.id : item.key ? item.key : item.value ? item.value:item.name ? item.name:item.label,
3010
+ name: item.label ? item.label : item.name ? item.name : item.value ? item.value:item.id ? item.id:item.option
3011
+ }
3012
+ });
3013
+ }).catch(ex=>{
3014
+ console.log(ex);
3015
+ });
3016
+ }
3017
+ });
3018
+
3019
+
3020
+ return (_ctx, _cache) => {
3021
+ return withDirectives((openBlock(), createElementBlock("select", {
3022
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((inputModel).value = $event)),
3023
+ onChange: modelValueUpdated,
3024
+ onKeydown: modelValueUpdated,
3025
+ onUpdated: modelValueUpdated
3026
+ }, [
3027
+ (openBlock(true), createElementBlock(Fragment, null, renderList(selectOptions.value, (option) => {
3028
+ return (openBlock(), createElementBlock("option", {
3029
+ key: option.id,
3030
+ value: option.id
3031
+ }, toDisplayString(option.name), 9 /* TEXT, PROPS */, _hoisted_1$d))
3032
+ }), 128 /* KEYED_FRAGMENT */))
3033
+ ], 544 /* HYDRATE_EVENTS, NEED_PATCH */)), [
3034
+ [vModelSelect, inputModel.value]
3035
+ ])
3036
+ }
3037
+ }
3038
+
3039
+ };
3040
+
3041
+ script$f.__file = "src/lib/components/form-components/SelectInput.vue";
3042
+
3043
+ var script$e = {
3044
+ __name: 'PasswordInput',
3045
+ props: ['modelValue','label'],
3046
+ emits: ['update:modelValue','clearValidationErrors'],
3047
+ setup(__props, { emit }) {
3048
+
3049
+ const props = __props;
3050
+
3051
+
3052
+
3053
+ const inputModel = ref(null);
3054
+
3055
+ const modelValueUpdated = (e) => {
3056
+ emit('clearValidationErrors');
3057
+ emit('update:modelValue',inputModel);
3058
+ };
3059
+ onMounted(()=>{
3060
+ props.modelValue && (inputModel.value = props.modelValue);
3061
+ });
3062
+
3063
+
3064
+ return (_ctx, _cache) => {
3065
+ return withDirectives((openBlock(), createElementBlock("input", {
3066
+ type: "password",
3067
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((inputModel).value = $event)),
3068
+ onChange: modelValueUpdated,
3069
+ onKeydown: modelValueUpdated,
3070
+ onUpdated: modelValueUpdated
3071
+ }, null, 544 /* HYDRATE_EVENTS, NEED_PATCH */)), [
3072
+ [vModelText, inputModel.value]
3073
+ ])
3074
+ }
3075
+ }
3076
+
3077
+ };
3078
+
3079
+ script$e.__file = "src/lib/components/form-components/PasswordInput.vue";
2970
3080
 
2971
3081
  const _hoisted_1$c = /*#__PURE__*/createElementVNode("div", null, null, -1 /* HOISTED */);
2972
3082
  const _hoisted_2$9 = ["innerHTML"];
@@ -3002,26 +3112,42 @@ const props = __props;
3002
3112
 
3003
3113
 
3004
3114
  const formFields = ref([]);
3005
- const getFieldComponent = (field)=>{
3115
+ const getFieldComponent = (fieldObj)=>{
3116
+ const field = fieldObj.field;
3006
3117
  const defaultTextareas = ['message', 'meta_description', 'comment', 'call_response', 'comments', 'description'];
3007
3118
  const defaultNumbers = ['age'];
3119
+ const passwords = ['password','password_confirmation','pin'];
3008
3120
  const defaultPhones = ['phone'];
3009
- const defaultEmails = ['phone'];
3121
+ const defaultEmails = ['email'];
3010
3122
  const formComponents = inject('formComponents');
3123
+ const TextComponent = formComponents.text ?? script$h;
3124
+ const TextAreaComponent = formComponents.textArea ?? script$g;
3125
+ const EmailComponent = formComponents.email ?? script$j;
3126
+ const PhoneComponent = formComponents.phone ?? script$n;
3127
+ const NumberComponent = formComponents.number ?? script$i;
3128
+ const SelectComponent = formComponents.select ?? script$f;
3129
+ const PasswordComponent = formComponents.password ?? script$e;
3011
3130
  if(props.customComponents && props.customComponents[field]) {
3012
3131
  return props.customComponents[field]
3013
- } else
3132
+ }
3133
+ if(fieldObj.type){
3134
+ return fieldObj.type === 'number' ? NumberComponent:fieldObj.type === 'textarea' ? TextAreaComponent : fieldObj.type === 'email' ? EmailComponent : fieldObj.type === 'phone' ? PhoneComponent : fieldObj.type ? SelectComponent:TextComponent
3135
+ }else
3136
+ if(passwords.includes(field)){
3137
+ return PasswordComponent
3138
+ }
3139
+ else
3014
3140
  if((props.textAreas && props.textAreas.includes(field)) || defaultTextareas.includes(field)){
3015
- return formComponents.textArea ?? script$e
3141
+ return formComponents.textArea ?? script$g
3016
3142
  } else
3017
3143
  if((props.emails && props.emails.includes(field)) || defaultEmails.includes(field)){
3018
- return formComponents.email ?? script$h
3144
+ return formComponents.email ?? script$j
3019
3145
  } else
3020
3146
  if((props.phones && props.phones.includes(field)) || defaultPhones.includes(field)){
3021
- return formComponents.phone ?? script$l
3147
+ return formComponents.phone ?? script$n
3022
3148
  } else
3023
3149
  if((props.numbers && props.numbers.includes(field)) || defaultNumbers.includes(field)){
3024
- return formComponents.number ?? script$g
3150
+ return formComponents.number ?? script$i
3025
3151
  }
3026
3152
  // else
3027
3153
  // if((props.selects && props.selects.includes(field)) || defaultSelects.includes(field)){
@@ -3030,7 +3156,7 @@ const getFieldComponent = (field)=>{
3030
3156
  // if((props.dates && props.dates.includes(field)) || defaultDates.includes(field)){
3031
3157
  // return formComponents.date ?? DateInput
3032
3158
  // }
3033
- return formComponents.text ?? script$f
3159
+ return formComponents.text ?? script$h
3034
3160
  };
3035
3161
  const shFormElementClasses = ref(null);
3036
3162
  shFormElementClasses.value = inject('shFormElementClasses');
@@ -3097,7 +3223,6 @@ onMounted((ev)=>{
3097
3223
  fieldObj.label && getLabel(fieldObj.field);
3098
3224
  !fieldObj.helper && fieldObj.helperText ? fieldObj.helper = fieldObj.helperText : fieldObj.helper = getHelperText(fieldObj.field);
3099
3225
  fieldObj.helperText === undefined && (fieldObj.label = getLabel(fieldObj.field));
3100
- fieldObj.component && getfieldObjComponent(fieldObj.field);
3101
3226
  fieldObj.placeholder && fieldObj.placeHolder && getPlaceholder(fieldObj.field);
3102
3227
  fieldObj.value = null;
3103
3228
  formFields.value.push(fieldObj);
@@ -3105,7 +3230,6 @@ onMounted((ev)=>{
3105
3230
  formFields.value.push({
3106
3231
  field:field,label: getLabel(field),
3107
3232
  helper: getHelperText(field),
3108
- component: getFieldComponent(field),
3109
3233
  placeholder: getPlaceholder(field),
3110
3234
  value: null
3111
3235
  });
@@ -3135,7 +3259,7 @@ return (_ctx, _cache) => {
3135
3259
  innerHTML: field.label
3136
3260
  }, null, 10 /* CLASS, PROPS */, _hoisted_2$9))
3137
3261
  : createCommentVNode("v-if", true),
3138
- (openBlock(), createBlock(resolveDynamicComponent(getFieldComponent(field.field)), mergeProps(getComponentProps(field), {
3262
+ (openBlock(), createBlock(resolveDynamicComponent(getFieldComponent(field)), mergeProps(getComponentProps(field), {
3139
3263
  onClick: $event => (removeValidationError(field.field)),
3140
3264
  "onUpdate:modelValue": [$event => (removeValidationError(field.field)), $event => ((formFields.value[index].value) = $event)],
3141
3265
  modelValue: formFields.value[index].value,
@@ -3241,7 +3365,7 @@ return (_ctx, _cache) => {
3241
3365
  class: "dropdown-menu px-2 py-1",
3242
3366
  "aria-labelledby": dropdownId
3243
3367
  }, [
3244
- createVNode(script$i, normalizeProps(guardReactiveProps(props)), null, 16 /* FULL_PROPS */)
3368
+ createVNode(script$k, normalizeProps(guardReactiveProps(props)), null, 16 /* FULL_PROPS */)
3245
3369
  ])
3246
3370
  ])
3247
3371
  ], 64 /* STABLE_FRAGMENT */))
@@ -3345,7 +3469,7 @@ return (_ctx, _cache) => {
3345
3469
  "modal-title": __props.modalTitle
3346
3470
  }, {
3347
3471
  default: withCtx(() => [
3348
- createVNode(script$i, mergeProps({ onSuccess: success }, props), null, 16 /* FULL_PROPS */)
3472
+ createVNode(script$k, mergeProps({ onSuccess: success }, props), null, 16 /* FULL_PROPS */)
3349
3473
  ]),
3350
3474
  _: 1 /* STABLE */
3351
3475
  }, 8 /* PROPS */, ["modal-title"])
@@ -5011,7 +5135,7 @@ return (_ctx, _cache) => {
5011
5135
  "modal-title": "Department Form"
5012
5136
  }, {
5013
5137
  default: withCtx(() => [
5014
- createVNode(script$i, {
5138
+ createVNode(script$k, {
5015
5139
  "success-callback": "departmentAdded",
5016
5140
  onDepartmentAdded: departmentAdded,
5017
5141
  action: "admin/departments/store",
@@ -5170,7 +5294,7 @@ return (_ctx, _cache) => {
5170
5294
  "modal-title": "Add Module Department"
5171
5295
  }, {
5172
5296
  default: withCtx(() => [
5173
- createVNode(script$i, {
5297
+ createVNode(script$k, {
5174
5298
  "reload-select-items": unref(reload),
5175
5299
  "success-callback": moduleAdded,
5176
5300
  "fill-selects": {
@@ -5307,7 +5431,7 @@ return (_ctx, _cache) => {
5307
5431
  : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
5308
5432
  (section.value === 'login')
5309
5433
  ? (openBlock(), createElementBlock("div", _hoisted_2, [
5310
- createVNode(script$i, {
5434
+ createVNode(script$k, {
5311
5435
  class: "sh-login-form",
5312
5436
  fields: ['email','password'],
5313
5437
  "action-label": "Login",
@@ -5332,7 +5456,7 @@ return (_ctx, _cache) => {
5332
5456
  (unref(registerSubTitle))
5333
5457
  ? (openBlock(), createElementBlock("span", _hoisted_8, toDisplayString(unref(registerSubTitle)), 1 /* TEXT */))
5334
5458
  : createCommentVNode("v-if", true),
5335
- createVNode(script$i, {
5459
+ createVNode(script$k, {
5336
5460
  class: "sh-login-form",
5337
5461
  fields: unref(registrationFields),
5338
5462
  "action-label": "Sign Up",
@@ -5379,7 +5503,7 @@ const ShFrontend = {
5379
5503
  const registerTitle = options.registerTitle ?? 'Create a new account';
5380
5504
  const registerSubTitle = options.registerSubTitle ?? `It's quick and easy`;
5381
5505
  const logoutApiEndpoint = options.logoutApiEndpoint ?? `auth/logout`;
5382
- options.formTextInput ?? script$f;
5506
+ options.formTextInput ?? script$h;
5383
5507
  const loginUrl = options.loginUrl ?? `/login`;
5384
5508
  const redirectLogin = options.redirectLogin ?? `/`;
5385
5509
  const redirectRegister = options.redirectRegister ?? `/`;
@@ -5420,4 +5544,4 @@ const ShFrontend = {
5420
5544
  }
5421
5545
  };
5422
5546
 
5423
- export { script$d as ShAutoForm, script$9 as ShCanvas, script$7 as ShConfirmAction, script$c as ShDropDownForm, script$3 as ShDynamicTabs, script$i as ShForm, ShFrontend, script$b as ShModal, script$a as ShModalForm, script$l as ShPhone, script$6 as ShSilentAction, script$5 as ShTable, script$4 as ShTabs, shApis, shRepo, ShStorage as shStorage, useUserStore };
5547
+ export { countries as Countries, script$d as ShAutoForm, script$9 as ShCanvas, script$7 as ShConfirmAction, script$c as ShDropDownForm, script$3 as ShDynamicTabs, script$k as ShForm, ShFrontend, script$b as ShModal, script$a as ShModalForm, script$n as ShPhone, script$6 as ShSilentAction, script$5 as ShTable, script$4 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.3.5",
3
+ "version": "1.3.7",
4
4
  "description": "Vue library for handling laravel backend",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.mjs",
@@ -15,6 +15,9 @@
15
15
  "dev": "vite",
16
16
  "serve": "vite"
17
17
  },
18
+ "bin": {
19
+ "sh-set-defaults": "./src/lib/cmds/cli.js"
20
+ },
18
21
  "keywords": [],
19
22
  "author": "",
20
23
  "license": "ISC",
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ const fs = require('fs')
3
+ const [,, ... args] = process.argv
4
+ const templatesDir =`${__dirname}/../components/form-components/`
5
+ const destination = `${process.cwd()}/src/components/form-components/`
6
+ console.log(`Copying form component files to ${destination}`)
7
+ !fs.existsSync(destination) && fs.mkdirSync(destination,{ recursive: true })
8
+
9
+ fs.readdirSync(templatesDir).map(file=>{
10
+ console.log(`cp ${file}`)
11
+ const src = `${templatesDir}${file}`
12
+ const dest = `${destination}${file}`
13
+ let contents = fs.readFileSync(src,'utf8')
14
+ contents = contents.replace(`import shApis from '../../repo/helpers/ShApis.js'`,`import { shApis } from '@iankibetsh/shframework'`)
15
+ contents = contents.replace(`import countries from '../../repo/helpers/countries.js'`,`import { countries } from '@iankibetsh/shframework'`)
16
+ fs.writeFileSync(dest,contents)
17
+ })
18
+ console.log("DONE")