@iankibetsh/shframework 1.2.9 → 1.3.2
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/dist/library.mjs.css +15 -15
- package/dist/library.js +405 -65
- package/dist/library.mjs +403 -65
- package/package.json +1 -1
package/dist/library.js
CHANGED
|
@@ -8,7 +8,7 @@ var Swal = require('sweetalert2');
|
|
|
8
8
|
var NProgress = require('nprogress');
|
|
9
9
|
var vue = require('vue');
|
|
10
10
|
var Editor = require('@tinymce/tinymce-vue');
|
|
11
|
-
require('lodash');
|
|
11
|
+
var _ = require('lodash');
|
|
12
12
|
var pinia = require('pinia');
|
|
13
13
|
var vueRouter = require('vue-router');
|
|
14
14
|
|
|
@@ -19,6 +19,7 @@ var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
|
|
19
19
|
var Swal__default = /*#__PURE__*/_interopDefaultLegacy(Swal);
|
|
20
20
|
var NProgress__default = /*#__PURE__*/_interopDefaultLegacy(NProgress);
|
|
21
21
|
var Editor__default = /*#__PURE__*/_interopDefaultLegacy(Editor);
|
|
22
|
+
var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
|
|
22
23
|
|
|
23
24
|
function setItem (key, value) {
|
|
24
25
|
let toStore = value;
|
|
@@ -1873,7 +1874,7 @@ const countries = [
|
|
|
1873
1874
|
}
|
|
1874
1875
|
];
|
|
1875
1876
|
|
|
1876
|
-
var script$
|
|
1877
|
+
var script$l = {
|
|
1877
1878
|
name: 'ShPhone',
|
|
1878
1879
|
props: ['modelValue', 'country_code'],
|
|
1879
1880
|
data () {
|
|
@@ -1935,19 +1936,19 @@ var script$h = {
|
|
|
1935
1936
|
}
|
|
1936
1937
|
};
|
|
1937
1938
|
|
|
1938
|
-
const _hoisted_1$
|
|
1939
|
-
const _hoisted_2$
|
|
1939
|
+
const _hoisted_1$g = { class: "sh-phone mb-3" };
|
|
1940
|
+
const _hoisted_2$c = {
|
|
1940
1941
|
key: 0,
|
|
1941
1942
|
style: {"display":"contents"}
|
|
1942
1943
|
};
|
|
1943
|
-
const _hoisted_3$
|
|
1944
|
-
const _hoisted_4$
|
|
1944
|
+
const _hoisted_3$b = ["src"];
|
|
1945
|
+
const _hoisted_4$b = ["value"];
|
|
1945
1946
|
|
|
1946
1947
|
function render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1947
|
-
return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
1948
|
+
return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
|
|
1948
1949
|
($data.selectedCountry)
|
|
1949
|
-
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$
|
|
1950
|
-
vue.createElementVNode("img", { src: $data.flag }, null, 8 /* PROPS */, _hoisted_3$
|
|
1950
|
+
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$c, [
|
|
1951
|
+
vue.createElementVNode("img", { src: $data.flag }, null, 8 /* PROPS */, _hoisted_3$b),
|
|
1951
1952
|
vue.createTextVNode(" " + vue.toDisplayString($data.selectedCountry.dialCode), 1 /* TEXT */)
|
|
1952
1953
|
]))
|
|
1953
1954
|
: vue.createCommentVNode("v-if", true),
|
|
@@ -1960,7 +1961,7 @@ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1960
1961
|
return (vue.openBlock(), vue.createElementBlock("option", {
|
|
1961
1962
|
value: country,
|
|
1962
1963
|
key: country.dialCode
|
|
1963
|
-
}, vue.toDisplayString(country.name + '(' + country.dialCode + ')'), 9 /* TEXT, PROPS */, _hoisted_4$
|
|
1964
|
+
}, vue.toDisplayString(country.name + '(' + country.dialCode + ')'), 9 /* TEXT, PROPS */, _hoisted_4$b))
|
|
1964
1965
|
}), 128 /* KEYED_FRAGMENT */))
|
|
1965
1966
|
], 544 /* HYDRATE_EVENTS, NEED_PATCH */), [
|
|
1966
1967
|
[vue.vModelSelect, $data.selectedCountry]
|
|
@@ -1978,10 +1979,10 @@ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1978
1979
|
]))
|
|
1979
1980
|
}
|
|
1980
1981
|
|
|
1981
|
-
script$
|
|
1982
|
-
script$
|
|
1982
|
+
script$l.render = render$7;
|
|
1983
|
+
script$l.__file = "src/lib/components/form-components/ShPhone.vue";
|
|
1983
1984
|
|
|
1984
|
-
var script$
|
|
1985
|
+
var script$k = {
|
|
1985
1986
|
name: 'ShEditor',
|
|
1986
1987
|
props: ['modelValue'],
|
|
1987
1988
|
components: {
|
|
@@ -2020,7 +2021,7 @@ var script$g = {
|
|
|
2020
2021
|
}
|
|
2021
2022
|
};
|
|
2022
2023
|
|
|
2023
|
-
const _hoisted_1$
|
|
2024
|
+
const _hoisted_1$f = /*#__PURE__*/vue.createElementVNode("textarea", {
|
|
2024
2025
|
id: "tiny",
|
|
2025
2026
|
style: {"display":"none"},
|
|
2026
2027
|
"data-cy": "tinymce_editor"
|
|
@@ -2030,7 +2031,7 @@ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2030
2031
|
const _component_editor = vue.resolveComponent("editor");
|
|
2031
2032
|
|
|
2032
2033
|
return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
2033
|
-
_hoisted_1$
|
|
2034
|
+
_hoisted_1$f,
|
|
2034
2035
|
vue.createElementVNode("div", {
|
|
2035
2036
|
onFocusin: _cache[1] || (_cache[1] = vue.withModifiers(() => {}, ["stop"])),
|
|
2036
2037
|
class: "sh-editor w-100"
|
|
@@ -2055,19 +2056,19 @@ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2055
2056
|
], 64 /* STABLE_FRAGMENT */))
|
|
2056
2057
|
}
|
|
2057
2058
|
|
|
2058
|
-
script$
|
|
2059
|
-
script$
|
|
2059
|
+
script$k.render = render$6;
|
|
2060
|
+
script$k.__file = "src/lib/components/form-components/ShEditor.vue";
|
|
2060
2061
|
|
|
2061
|
-
const _hoisted_1$
|
|
2062
|
+
const _hoisted_1$e = {
|
|
2062
2063
|
key: 0,
|
|
2063
2064
|
class: "dropdown sh-suggest"
|
|
2064
2065
|
};
|
|
2065
|
-
const _hoisted_2$
|
|
2066
|
-
const _hoisted_3$
|
|
2067
|
-
const _hoisted_4$
|
|
2068
|
-
const _hoisted_5$
|
|
2069
|
-
const _hoisted_6$
|
|
2070
|
-
const _hoisted_7$
|
|
2066
|
+
const _hoisted_2$b = ["id"];
|
|
2067
|
+
const _hoisted_3$a = { class: "badge bg-secondary m-1 sh-selected-item" };
|
|
2068
|
+
const _hoisted_4$a = ["onClick"];
|
|
2069
|
+
const _hoisted_5$8 = ["id"];
|
|
2070
|
+
const _hoisted_6$7 = ["id", "aria-labelledby"];
|
|
2071
|
+
const _hoisted_7$5 = { key: 0 };
|
|
2071
2072
|
const _hoisted_8$3 = ["onClick"];
|
|
2072
2073
|
const _hoisted_9$4 = {
|
|
2073
2074
|
key: 1,
|
|
@@ -2079,7 +2080,7 @@ const _hoisted_10$3 = {
|
|
|
2079
2080
|
};
|
|
2080
2081
|
|
|
2081
2082
|
|
|
2082
|
-
var script$
|
|
2083
|
+
var script$j = {
|
|
2083
2084
|
__name: 'ShSuggest',
|
|
2084
2085
|
props: ['fillSelects','modelValue'],
|
|
2085
2086
|
emits: ['update:modelValue'],
|
|
@@ -2160,7 +2161,7 @@ function filterData(e){
|
|
|
2160
2161
|
|
|
2161
2162
|
return (_ctx, _cache) => {
|
|
2162
2163
|
return (vue.unref(id))
|
|
2163
|
-
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2164
|
+
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [
|
|
2164
2165
|
vue.createElementVNode("div", {
|
|
2165
2166
|
id: vue.unref(id),
|
|
2166
2167
|
"data-bs-toggle": "dropdown",
|
|
@@ -2169,14 +2170,14 @@ return (_ctx, _cache) => {
|
|
|
2169
2170
|
}, [
|
|
2170
2171
|
vue.createElementVNode("div", null, [
|
|
2171
2172
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(selectedSuggestions), (sgt) => {
|
|
2172
|
-
return (vue.openBlock(), vue.createElementBlock("h5", _hoisted_3$
|
|
2173
|
+
return (vue.openBlock(), vue.createElementBlock("h5", _hoisted_3$a, [
|
|
2173
2174
|
vue.createTextVNode(vue.toDisplayString(sgt.name) + " ", 1 /* TEXT */),
|
|
2174
2175
|
vue.createElementVNode("button", {
|
|
2175
2176
|
onClick: $event => (removeSuggestion(sgt.id)),
|
|
2176
2177
|
type: "button",
|
|
2177
2178
|
class: "btn-close border-start border-1 ms-1",
|
|
2178
2179
|
"aria-label": "Close"
|
|
2179
|
-
}, null, 8 /* PROPS */, _hoisted_4$
|
|
2180
|
+
}, null, 8 /* PROPS */, _hoisted_4$a)
|
|
2180
2181
|
]))
|
|
2181
2182
|
}), 256 /* UNKEYED_FRAGMENT */))
|
|
2182
2183
|
]),
|
|
@@ -2186,8 +2187,8 @@ return (_ctx, _cache) => {
|
|
|
2186
2187
|
onClick: filterData,
|
|
2187
2188
|
onInput: filterData,
|
|
2188
2189
|
class: "flex-fill h-100 sh-suggestion-input"
|
|
2189
|
-
}, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_5$
|
|
2190
|
-
], 8 /* PROPS */, _hoisted_2$
|
|
2190
|
+
}, null, 40 /* PROPS, HYDRATE_EVENTS */, _hoisted_5$8)
|
|
2191
|
+
], 8 /* PROPS */, _hoisted_2$b),
|
|
2191
2192
|
vue.createElementVNode("ul", {
|
|
2192
2193
|
class: "dropdown-menu w-100",
|
|
2193
2194
|
id: 'dropwdown_section' + vue.unref(id),
|
|
@@ -2199,7 +2200,7 @@ return (_ctx, _cache) => {
|
|
|
2199
2200
|
key: suggestion.id
|
|
2200
2201
|
}, [
|
|
2201
2202
|
(suggestion.name)
|
|
2202
|
-
? (vue.openBlock(), vue.createElementBlock("li", _hoisted_7$
|
|
2203
|
+
? (vue.openBlock(), vue.createElementBlock("li", _hoisted_7$5, [
|
|
2203
2204
|
vue.createElementVNode("a", {
|
|
2204
2205
|
onClick: $event => (addSuggestion(suggestion)),
|
|
2205
2206
|
class: vue.normalizeClass(["dropdown-item", vue.unref(selectedSuggestions).includes(suggestion) ? 'active':'']),
|
|
@@ -2212,7 +2213,7 @@ return (_ctx, _cache) => {
|
|
|
2212
2213
|
: (vue.unref(searchText))
|
|
2213
2214
|
? (vue.openBlock(), vue.createElementBlock("li", _hoisted_9$4, " No results found "))
|
|
2214
2215
|
: (vue.openBlock(), vue.createElementBlock("li", _hoisted_10$3, " Type to search... "))
|
|
2215
|
-
], 8 /* PROPS */, _hoisted_6$
|
|
2216
|
+
], 8 /* PROPS */, _hoisted_6$7)
|
|
2216
2217
|
]))
|
|
2217
2218
|
: vue.createCommentVNode("v-if", true)
|
|
2218
2219
|
}
|
|
@@ -2220,15 +2221,15 @@ return (_ctx, _cache) => {
|
|
|
2220
2221
|
|
|
2221
2222
|
};
|
|
2222
2223
|
|
|
2223
|
-
script$
|
|
2224
|
-
script$
|
|
2224
|
+
script$j.__scopeId = "data-v-71cc9569";
|
|
2225
|
+
script$j.__file = "src/lib/components/form-components/ShSuggest.vue";
|
|
2225
2226
|
|
|
2226
|
-
var script$
|
|
2227
|
+
var script$i = {
|
|
2227
2228
|
name: 'ShForm',
|
|
2228
2229
|
components: {
|
|
2229
|
-
ShSuggest: script$
|
|
2230
|
-
ShEditor: script$
|
|
2231
|
-
ShPhone: script$
|
|
2230
|
+
ShSuggest: script$j,
|
|
2231
|
+
ShEditor: script$k,
|
|
2232
|
+
ShPhone: script$l
|
|
2232
2233
|
},
|
|
2233
2234
|
props: [
|
|
2234
2235
|
'action',
|
|
@@ -2546,20 +2547,20 @@ var script$e = {
|
|
|
2546
2547
|
}
|
|
2547
2548
|
};
|
|
2548
2549
|
|
|
2549
|
-
const _hoisted_1$
|
|
2550
|
-
const _hoisted_2$
|
|
2550
|
+
const _hoisted_1$d = /*#__PURE__*/vue.createElementVNode("h5", { class: "d-none" }, null, -1 /* HOISTED */);
|
|
2551
|
+
const _hoisted_2$a = {
|
|
2551
2552
|
ref: "ShAutoForm",
|
|
2552
2553
|
class: "sh-form"
|
|
2553
2554
|
};
|
|
2554
|
-
const _hoisted_3$
|
|
2555
|
+
const _hoisted_3$9 = {
|
|
2555
2556
|
key: 0,
|
|
2556
2557
|
class: "alert alert-danger alert-dismissible fade show sh-form-submission-error",
|
|
2557
2558
|
role: "alert"
|
|
2558
2559
|
};
|
|
2559
|
-
const _hoisted_4$
|
|
2560
|
-
const _hoisted_5$
|
|
2561
|
-
const _hoisted_6$
|
|
2562
|
-
const _hoisted_7$
|
|
2560
|
+
const _hoisted_4$9 = /*#__PURE__*/vue.createElementVNode("i", { class: "bi-exclamation-triangle-fill me-1" }, null, -1 /* HOISTED */);
|
|
2561
|
+
const _hoisted_5$7 = { key: 0 };
|
|
2562
|
+
const _hoisted_6$6 = { key: 1 };
|
|
2563
|
+
const _hoisted_7$4 = { class: "row" };
|
|
2563
2564
|
const _hoisted_8$2 = { class: "fg-label control-label text-capitalize control-bel col-md-12 request-form-label mb-2" };
|
|
2564
2565
|
const _hoisted_9$3 = { class: "col-md-12" };
|
|
2565
2566
|
const _hoisted_10$2 = ["data-cy", "placeholder", "name", "onFocus", "onChange"];
|
|
@@ -2608,16 +2609,16 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2608
2609
|
const _component_ShEditor = vue.resolveComponent("ShEditor");
|
|
2609
2610
|
|
|
2610
2611
|
return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
2611
|
-
_hoisted_1$
|
|
2612
|
-
vue.createElementVNode("form", _hoisted_2$
|
|
2612
|
+
_hoisted_1$d,
|
|
2613
|
+
vue.createElementVNode("form", _hoisted_2$a, [
|
|
2613
2614
|
vue.createCommentVNode(" <div v-if=\"form_status == 1\" class=\"alert alert-info\">Processing...</div>"),
|
|
2614
2615
|
vue.createCommentVNode(" <div v-if=\"form_status == 2\" class=\"alert alert-success\">Success</div>"),
|
|
2615
2616
|
(_ctx.form_status == 3)
|
|
2616
|
-
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$
|
|
2617
|
-
_hoisted_4$
|
|
2617
|
+
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$9, [
|
|
2618
|
+
_hoisted_4$9,
|
|
2618
2619
|
(_ctx.errorText)
|
|
2619
|
-
? (vue.openBlock(), vue.createElementBlock("span", _hoisted_5$
|
|
2620
|
-
: (vue.openBlock(), vue.createElementBlock("span", _hoisted_6$
|
|
2620
|
+
? (vue.openBlock(), vue.createElementBlock("span", _hoisted_5$7, vue.toDisplayString(_ctx.errorText), 1 /* TEXT */))
|
|
2621
|
+
: (vue.openBlock(), vue.createElementBlock("span", _hoisted_6$6, "Unexpected Error Occurred")),
|
|
2621
2622
|
vue.createCommentVNode(" <button @click=\"hideError\" type=\"button\" class=\"btn-close\" aria-label=\"Close\"></button>")
|
|
2622
2623
|
]))
|
|
2623
2624
|
: vue.createCommentVNode("v-if", true),
|
|
@@ -2627,7 +2628,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2627
2628
|
}, null, 512 /* NEED_PATCH */), [
|
|
2628
2629
|
[vue.vModelText, _ctx.form_elements['id']]
|
|
2629
2630
|
]),
|
|
2630
|
-
vue.createElementVNode("div", _hoisted_7$
|
|
2631
|
+
vue.createElementVNode("div", _hoisted_7$4, [
|
|
2631
2632
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.fields, (field) => {
|
|
2632
2633
|
return (vue.openBlock(), vue.createElementBlock("div", {
|
|
2633
2634
|
class: vue.normalizeClass(["form-group", 'col-md-' + $options.getColumns()]),
|
|
@@ -2825,10 +2826,86 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2825
2826
|
], 64 /* STABLE_FRAGMENT */))
|
|
2826
2827
|
}
|
|
2827
2828
|
|
|
2828
|
-
script$
|
|
2829
|
-
script$
|
|
2829
|
+
script$i.render = render$5;
|
|
2830
|
+
script$i.__file = "src/lib/components/ShForm.vue";
|
|
2830
2831
|
|
|
2831
|
-
var script$
|
|
2832
|
+
var script$h = {
|
|
2833
|
+
__name: 'EmailInput',
|
|
2834
|
+
props: ['modelValue','label'],
|
|
2835
|
+
emits: ['update:modelValue','clearValidationErrors'],
|
|
2836
|
+
setup(__props, { emit }) {
|
|
2837
|
+
|
|
2838
|
+
const props = __props;
|
|
2839
|
+
|
|
2840
|
+
|
|
2841
|
+
|
|
2842
|
+
const inputModel = vue.ref(null);
|
|
2843
|
+
|
|
2844
|
+
const modelValueUpdated = (e) => {
|
|
2845
|
+
emit('clearValidationErrors');
|
|
2846
|
+
emit('update:modelValue',inputModel);
|
|
2847
|
+
};
|
|
2848
|
+
vue.onMounted(()=>{
|
|
2849
|
+
props.modelValue && (inputModel.value = props.modelValue);
|
|
2850
|
+
});
|
|
2851
|
+
|
|
2852
|
+
|
|
2853
|
+
return (_ctx, _cache) => {
|
|
2854
|
+
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
|
|
2855
|
+
type: "email",
|
|
2856
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((inputModel).value = $event)),
|
|
2857
|
+
onChange: modelValueUpdated,
|
|
2858
|
+
onKeydown: modelValueUpdated,
|
|
2859
|
+
onUpdated: modelValueUpdated
|
|
2860
|
+
}, null, 544 /* HYDRATE_EVENTS, NEED_PATCH */)), [
|
|
2861
|
+
[vue.vModelText, inputModel.value]
|
|
2862
|
+
])
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2865
|
+
|
|
2866
|
+
};
|
|
2867
|
+
|
|
2868
|
+
script$h.__file = "src/lib/components/form-components/EmailInput.vue";
|
|
2869
|
+
|
|
2870
|
+
var script$g = {
|
|
2871
|
+
__name: 'NumberInput',
|
|
2872
|
+
props: ['modelValue','label'],
|
|
2873
|
+
emits: ['update:modelValue','clearValidationErrors'],
|
|
2874
|
+
setup(__props, { emit }) {
|
|
2875
|
+
|
|
2876
|
+
const props = __props;
|
|
2877
|
+
|
|
2878
|
+
|
|
2879
|
+
|
|
2880
|
+
const inputModel = vue.ref(null);
|
|
2881
|
+
|
|
2882
|
+
const modelValueUpdated = (e) => {
|
|
2883
|
+
emit('clearValidationErrors');
|
|
2884
|
+
emit('update:modelValue',inputModel);
|
|
2885
|
+
};
|
|
2886
|
+
vue.onMounted(()=>{
|
|
2887
|
+
props.modelValue && (inputModel.value = props.modelValue);
|
|
2888
|
+
});
|
|
2889
|
+
|
|
2890
|
+
|
|
2891
|
+
return (_ctx, _cache) => {
|
|
2892
|
+
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
|
|
2893
|
+
type: "number",
|
|
2894
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((inputModel).value = $event)),
|
|
2895
|
+
onChange: modelValueUpdated,
|
|
2896
|
+
onKeydown: modelValueUpdated,
|
|
2897
|
+
onUpdated: modelValueUpdated
|
|
2898
|
+
}, null, 544 /* HYDRATE_EVENTS, NEED_PATCH */)), [
|
|
2899
|
+
[vue.vModelText, inputModel.value]
|
|
2900
|
+
])
|
|
2901
|
+
}
|
|
2902
|
+
}
|
|
2903
|
+
|
|
2904
|
+
};
|
|
2905
|
+
|
|
2906
|
+
script$g.__file = "src/lib/components/form-components/NumberInput.vue";
|
|
2907
|
+
|
|
2908
|
+
var script$f = {
|
|
2832
2909
|
__name: 'TextInput',
|
|
2833
2910
|
props: ['modelValue','label'],
|
|
2834
2911
|
emits: ['update:modelValue','clearValidationErrors'],
|
|
@@ -2864,7 +2941,269 @@ return (_ctx, _cache) => {
|
|
|
2864
2941
|
|
|
2865
2942
|
};
|
|
2866
2943
|
|
|
2867
|
-
script$
|
|
2944
|
+
script$f.__file = "src/lib/components/form-components/TextInput.vue";
|
|
2945
|
+
|
|
2946
|
+
var script$e = {
|
|
2947
|
+
__name: 'TextAreaInput',
|
|
2948
|
+
props: ['modelValue','label'],
|
|
2949
|
+
emits: ['update:modelValue','clearValidationErrors'],
|
|
2950
|
+
setup(__props, { emit }) {
|
|
2951
|
+
|
|
2952
|
+
const props = __props;
|
|
2953
|
+
|
|
2954
|
+
|
|
2955
|
+
|
|
2956
|
+
const inputModel = vue.ref(null);
|
|
2957
|
+
|
|
2958
|
+
const modelValueUpdated = (e) => {
|
|
2959
|
+
emit('clearValidationErrors');
|
|
2960
|
+
emit('update:modelValue',inputModel);
|
|
2961
|
+
};
|
|
2962
|
+
vue.onMounted(()=>{
|
|
2963
|
+
props.modelValue && (inputModel.value = props.modelValue);
|
|
2964
|
+
});
|
|
2965
|
+
|
|
2966
|
+
|
|
2967
|
+
return (_ctx, _cache) => {
|
|
2968
|
+
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("textarea", {
|
|
2969
|
+
type: "text",
|
|
2970
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((inputModel).value = $event)),
|
|
2971
|
+
onChange: modelValueUpdated,
|
|
2972
|
+
onKeydown: modelValueUpdated,
|
|
2973
|
+
onUpdated: modelValueUpdated
|
|
2974
|
+
}, null, 544 /* HYDRATE_EVENTS, NEED_PATCH */)), [
|
|
2975
|
+
[vue.vModelText, inputModel.value]
|
|
2976
|
+
])
|
|
2977
|
+
}
|
|
2978
|
+
}
|
|
2979
|
+
|
|
2980
|
+
};
|
|
2981
|
+
|
|
2982
|
+
script$e.__file = "src/lib/components/form-components/TextAreaInput.vue";
|
|
2983
|
+
|
|
2984
|
+
const _hoisted_1$c = /*#__PURE__*/vue.createElementVNode("div", null, null, -1 /* HOISTED */);
|
|
2985
|
+
const _hoisted_2$9 = ["innerHTML"];
|
|
2986
|
+
const _hoisted_3$8 = ["innerHTML"];
|
|
2987
|
+
const _hoisted_4$8 = ["innerHTML"];
|
|
2988
|
+
const _hoisted_5$6 = ["disabled"];
|
|
2989
|
+
const _hoisted_6$5 = {
|
|
2990
|
+
key: 0,
|
|
2991
|
+
class: "spinner-border spinner-border-sm",
|
|
2992
|
+
role: "status",
|
|
2993
|
+
"aria-hidden": "true"
|
|
2994
|
+
};
|
|
2995
|
+
const _hoisted_7$3 = { key: 1 };
|
|
2996
|
+
|
|
2997
|
+
|
|
2998
|
+
var script$d = {
|
|
2999
|
+
__name: 'ShAutoForm',
|
|
3000
|
+
props: [
|
|
3001
|
+
'action','successCallback','retainDataAfterSubmission',
|
|
3002
|
+
'successMessage','fields','customComponents','placeHolders',
|
|
3003
|
+
'formClasses',
|
|
3004
|
+
'helperTexts','labels','data',
|
|
3005
|
+
'actionLabel',
|
|
3006
|
+
'textAreas',
|
|
3007
|
+
'emails',
|
|
3008
|
+
'phones','numbers','selects','dates'
|
|
3009
|
+
],
|
|
3010
|
+
emits: ['success'],
|
|
3011
|
+
setup(__props, { emit }) {
|
|
3012
|
+
|
|
3013
|
+
const props = __props;
|
|
3014
|
+
|
|
3015
|
+
|
|
3016
|
+
|
|
3017
|
+
const formFields = vue.ref([]);
|
|
3018
|
+
const getFieldComponent = (field)=>{
|
|
3019
|
+
const defaultTextareas = ['message', 'meta_description', 'comment', 'call_response', 'comments', 'description'];
|
|
3020
|
+
const defaultSelects = ['gender', 'payment_method', 'allow_view_mode', 'reasons_name', 'has_free_tier', 'payment_period', 'role', 'register_as', 'account_type'];
|
|
3021
|
+
const defaultNumbers = ['age'];
|
|
3022
|
+
const defaultDates = ['free_tier_days', 'recurring_date', 'date', 'paid_at'];
|
|
3023
|
+
const defaultPhones = ['phone'];
|
|
3024
|
+
const defaultEmails = ['phone'];
|
|
3025
|
+
const formComponents = vue.inject('formComponents');
|
|
3026
|
+
if(props.customComponents && props.customComponents[field]) {
|
|
3027
|
+
return props.customComponents[field]
|
|
3028
|
+
} else
|
|
3029
|
+
if((props.textAreas && props.textAreas.includes(field)) || defaultTextareas.includes(field)){
|
|
3030
|
+
return formComponents.textArea ?? script$e
|
|
3031
|
+
} else
|
|
3032
|
+
if((props.emails && props.emails.includes(field)) || defaultEmails.includes(field)){
|
|
3033
|
+
return formComponents.email ?? script$h
|
|
3034
|
+
} else
|
|
3035
|
+
if((props.phones && props.phones.includes(field)) || defaultPhones.includes(field)){
|
|
3036
|
+
return formComponents.phone ?? script$l
|
|
3037
|
+
} else
|
|
3038
|
+
if((props.numbers && props.numbers.includes(field)) || defaultNumbers.includes(field)){
|
|
3039
|
+
return formComponents.number ?? script$g
|
|
3040
|
+
} else
|
|
3041
|
+
if((props.selects && props.selects.includes(field)) || defaultSelects.includes(field)){
|
|
3042
|
+
return formComponents.select ?? SelectInput
|
|
3043
|
+
} else
|
|
3044
|
+
if((props.dates && props.dates.includes(field)) || defaultDates.includes(field)){
|
|
3045
|
+
return formComponents.date ?? DateInput
|
|
3046
|
+
}
|
|
3047
|
+
return formComponents.text ?? script$f
|
|
3048
|
+
};
|
|
3049
|
+
const shFormElementClasses = vue.ref(null);
|
|
3050
|
+
shFormElementClasses.value = vue.inject('shFormElementClasses');
|
|
3051
|
+
const shAutoForm = vue.ref(null);
|
|
3052
|
+
const closeModal = e => {
|
|
3053
|
+
setTimeout(()=>{
|
|
3054
|
+
const closeBtn = shAutoForm.value.closest('.modal-dialog').querySelector('[data-bs-dismiss="modal"]');
|
|
3055
|
+
closeBtn && closeBtn.click();
|
|
3056
|
+
},1000);
|
|
3057
|
+
};
|
|
3058
|
+
const getLabel = field => (props.labels && (props.labels[field] !== undefined)) ? props.labels[field]:___default["default"].startCase(___default["default"].camelCase(field));
|
|
3059
|
+
const getComponentClass = field => validationErrors.value[field] ? getElementClass('formControl') + ' is-invalid':getElementClass('formControl');
|
|
3060
|
+
const getHelperText = field => (props.helperTexts && props.helperTexts[field]) ? props.helperTexts[field]:false;
|
|
3061
|
+
const getElementClass = section => (props.formClasses && props.formClasses[section]) ? props.formClasses[section]:shFormElementClasses.value[section] ?? ___default["default"].snakeCase(section).replace(/_/gi,'-');
|
|
3062
|
+
const getPlaceholder = field => (props.placeHolders && props.placeHolders[field]) && props.placeHolders[field];
|
|
3063
|
+
const removeValidationError = field => delete validationErrors.value[field];
|
|
3064
|
+
const getComponentProps = field => {
|
|
3065
|
+
const newField = {...field};
|
|
3066
|
+
delete newField.component;
|
|
3067
|
+
delete newField.value;
|
|
3068
|
+
return newField
|
|
3069
|
+
};
|
|
3070
|
+
const isFloating = getElementClass('formGroup').includes('form-floating');
|
|
3071
|
+
const loading = vue.ref(false);
|
|
3072
|
+
const submitBtn = vue.ref(false);
|
|
3073
|
+
const validationErrors = vue.ref({});
|
|
3074
|
+
const formError = vue.ref(null);
|
|
3075
|
+
const submitForm = e => {
|
|
3076
|
+
console.log(formFields.value);
|
|
3077
|
+
submitBtnWidth.value = submitBtn.value.getBoundingClientRect().width + 'px !important';
|
|
3078
|
+
validationErrors.value = {};
|
|
3079
|
+
e.preventDefault();
|
|
3080
|
+
loading.value = true;
|
|
3081
|
+
const data = {};
|
|
3082
|
+
formFields.value.map(field=>data[field.field] = field.value);
|
|
3083
|
+
shApis.doPost(props.action,data).then(res=>{
|
|
3084
|
+
loading.value = false;
|
|
3085
|
+
emit('formSubmitted',res.data);
|
|
3086
|
+
emit('success',res.data);
|
|
3087
|
+
props.successMessage && shRepo.showToast(props.successMessage);
|
|
3088
|
+
props.successCallback && props.successCallback(res.data);
|
|
3089
|
+
!props.retainDataAfterSubmission && formFields.value.map(field=>field.value = null);
|
|
3090
|
+
closeModal();
|
|
3091
|
+
}).catch(reason=>{
|
|
3092
|
+
console.log(reason);
|
|
3093
|
+
loading.value = false;
|
|
3094
|
+
const httpStatus = reason.response ? reason.response.status:0;
|
|
3095
|
+
formError.value = httpStatus === 422 ? formError.value = null:reason.message ?? null;
|
|
3096
|
+
let httpErrors = {};
|
|
3097
|
+
httpStatus === 422 && typeof reason.response.data.errors === 'object' && (httpErrors = reason.response.data.errors);
|
|
3098
|
+
if(httpErrors && reason.response){
|
|
3099
|
+
Object.keys(httpErrors).map(key=>validationErrors.value[key] = typeof httpErrors[key] === 'string' ? httpErrors[key]:httpErrors[key][0]);
|
|
3100
|
+
}
|
|
3101
|
+
(httpStatus !== 422 && formError.value) && shRepo.showToast(formError.value,'error');
|
|
3102
|
+
validationErrors.value;
|
|
3103
|
+
});
|
|
3104
|
+
return false
|
|
3105
|
+
};
|
|
3106
|
+
const submitBtnWidth = vue.ref(null);
|
|
3107
|
+
vue.onMounted((ev)=>{
|
|
3108
|
+
props.fields && props.fields.map(field=>{
|
|
3109
|
+
if(typeof field === 'object') {
|
|
3110
|
+
const fieldObj = {...field};
|
|
3111
|
+
fieldObj.label && getLabel(fieldObj.field);
|
|
3112
|
+
!fieldObj.helper && fieldObj.helperText ? fieldObj.helper = fieldObj.helperText : fieldObj.helper = getHelperText(fieldObj.field);
|
|
3113
|
+
fieldObj.helperText === undefined && (fieldObj.label = getLabel(fieldObj.field));
|
|
3114
|
+
fieldObj.component && getfieldObjComponent(fieldObj.field);
|
|
3115
|
+
fieldObj.placeholder && fieldObj.placeHolder && getPlaceholder(fieldObj.field);
|
|
3116
|
+
fieldObj.value = null;
|
|
3117
|
+
formFields.value.push(fieldObj);
|
|
3118
|
+
} else {
|
|
3119
|
+
formFields.value.push({
|
|
3120
|
+
field:field,label: getLabel(field),
|
|
3121
|
+
helper: getHelperText(field),
|
|
3122
|
+
component: getFieldComponent(field),
|
|
3123
|
+
placeholder: getPlaceholder(field),
|
|
3124
|
+
value: null
|
|
3125
|
+
});
|
|
3126
|
+
}
|
|
3127
|
+
});
|
|
3128
|
+
});
|
|
3129
|
+
|
|
3130
|
+
|
|
3131
|
+
return (_ctx, _cache) => {
|
|
3132
|
+
return (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
3133
|
+
_hoisted_1$c,
|
|
3134
|
+
vue.createElementVNode("form", {
|
|
3135
|
+
ref_key: "shAutoForm",
|
|
3136
|
+
ref: shAutoForm,
|
|
3137
|
+
class: "sh-form",
|
|
3138
|
+
onSubmit: _cache[0] || (_cache[0] = e => submitForm(e))
|
|
3139
|
+
}, [
|
|
3140
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(formFields.value, (field, index) => {
|
|
3141
|
+
return (vue.openBlock(), vue.createElementBlock("div", {
|
|
3142
|
+
key: field,
|
|
3143
|
+
class: vue.normalizeClass(getElementClass('formGroup'))
|
|
3144
|
+
}, [
|
|
3145
|
+
(!vue.unref(isFloating) && field.label)
|
|
3146
|
+
? (vue.openBlock(), vue.createElementBlock("label", {
|
|
3147
|
+
key: 0,
|
|
3148
|
+
class: vue.normalizeClass(getElementClass('formLabel')),
|
|
3149
|
+
innerHTML: field.label
|
|
3150
|
+
}, null, 10 /* CLASS, PROPS */, _hoisted_2$9))
|
|
3151
|
+
: vue.createCommentVNode("v-if", true),
|
|
3152
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(getFieldComponent(field.field)), vue.mergeProps(getComponentProps(field), {
|
|
3153
|
+
onClick: $event => (removeValidationError(field.field)),
|
|
3154
|
+
"onUpdate:modelValue": [$event => (removeValidationError(field.field)), $event => ((formFields.value[index].value) = $event)],
|
|
3155
|
+
modelValue: formFields.value[index].value,
|
|
3156
|
+
placeholder: vue.unref(isFloating) ? field.label:field.placeholder,
|
|
3157
|
+
class: getComponentClass(field.field)
|
|
3158
|
+
}), null, 16 /* FULL_PROPS */, ["onClick", "onUpdate:modelValue", "modelValue", "placeholder", "class"])),
|
|
3159
|
+
(vue.unref(isFloating) && field.label)
|
|
3160
|
+
? (vue.openBlock(), vue.createElementBlock("label", {
|
|
3161
|
+
key: 1,
|
|
3162
|
+
class: vue.normalizeClass(getElementClass('formLabel')),
|
|
3163
|
+
innerHTML: field.label
|
|
3164
|
+
}, null, 10 /* CLASS, PROPS */, _hoisted_3$8))
|
|
3165
|
+
: vue.createCommentVNode("v-if", true),
|
|
3166
|
+
(field.helper)
|
|
3167
|
+
? (vue.openBlock(), vue.createElementBlock("div", {
|
|
3168
|
+
key: 2,
|
|
3169
|
+
class: vue.normalizeClass(getElementClass('helperText')),
|
|
3170
|
+
innerHTML: field.helper
|
|
3171
|
+
}, null, 10 /* CLASS, PROPS */, _hoisted_4$8))
|
|
3172
|
+
: vue.createCommentVNode("v-if", true),
|
|
3173
|
+
(validationErrors.value[field.field])
|
|
3174
|
+
? (vue.openBlock(), vue.createElementBlock("div", {
|
|
3175
|
+
key: 3,
|
|
3176
|
+
class: vue.normalizeClass(getElementClass('invalidFeedback'))
|
|
3177
|
+
}, vue.toDisplayString(validationErrors.value[field.field]), 3 /* TEXT, CLASS */))
|
|
3178
|
+
: vue.createCommentVNode("v-if", true)
|
|
3179
|
+
], 2 /* CLASS */))
|
|
3180
|
+
}), 128 /* KEYED_FRAGMENT */)),
|
|
3181
|
+
vue.createElementVNode("div", {
|
|
3182
|
+
class: vue.normalizeClass(getElementClass('formGroup'))
|
|
3183
|
+
}, [
|
|
3184
|
+
vue.createElementVNode("button", {
|
|
3185
|
+
style: vue.normalizeStyle({width: submitBtnWidth.value}),
|
|
3186
|
+
ref_key: "submitBtn",
|
|
3187
|
+
ref: submitBtn,
|
|
3188
|
+
disabled: loading.value,
|
|
3189
|
+
class: vue.normalizeClass(getElementClass('actionBtn'))
|
|
3190
|
+
}, [
|
|
3191
|
+
(loading.value)
|
|
3192
|
+
? (vue.openBlock(), vue.createElementBlock("span", _hoisted_6$5))
|
|
3193
|
+
: vue.createCommentVNode("v-if", true),
|
|
3194
|
+
(!loading.value)
|
|
3195
|
+
? (vue.openBlock(), vue.createElementBlock("span", _hoisted_7$3, "Submit"))
|
|
3196
|
+
: vue.createCommentVNode("v-if", true)
|
|
3197
|
+
], 14 /* CLASS, STYLE, PROPS */, _hoisted_5$6)
|
|
3198
|
+
], 2 /* CLASS */)
|
|
3199
|
+
], 544 /* HYDRATE_EVENTS, NEED_PATCH */)
|
|
3200
|
+
], 64 /* STABLE_FRAGMENT */))
|
|
3201
|
+
}
|
|
3202
|
+
}
|
|
3203
|
+
|
|
3204
|
+
};
|
|
3205
|
+
|
|
3206
|
+
script$d.__file = "src/lib/components/ShAutoForm.vue";
|
|
2868
3207
|
|
|
2869
3208
|
const _hoisted_1$b = /*#__PURE__*/vue.createElementVNode("h5", { class: "d-none" }, "To prevent default class", -1 /* HOISTED */);
|
|
2870
3209
|
const _hoisted_2$8 = { class: "dropdown" };
|
|
@@ -2916,7 +3255,7 @@ return (_ctx, _cache) => {
|
|
|
2916
3255
|
class: "dropdown-menu px-2 py-1",
|
|
2917
3256
|
"aria-labelledby": dropdownId
|
|
2918
3257
|
}, [
|
|
2919
|
-
vue.createVNode(script$
|
|
3258
|
+
vue.createVNode(script$i, vue.normalizeProps(vue.guardReactiveProps(props)), null, 16 /* FULL_PROPS */)
|
|
2920
3259
|
])
|
|
2921
3260
|
])
|
|
2922
3261
|
], 64 /* STABLE_FRAGMENT */))
|
|
@@ -3020,7 +3359,7 @@ return (_ctx, _cache) => {
|
|
|
3020
3359
|
"modal-title": __props.modalTitle
|
|
3021
3360
|
}, {
|
|
3022
3361
|
default: vue.withCtx(() => [
|
|
3023
|
-
vue.createVNode(script$
|
|
3362
|
+
vue.createVNode(script$i, vue.mergeProps({ onSuccess: success }, props), null, 16 /* FULL_PROPS */)
|
|
3024
3363
|
]),
|
|
3025
3364
|
_: 1 /* STABLE */
|
|
3026
3365
|
}, 8 /* PROPS */, ["modal-title"])
|
|
@@ -4686,7 +5025,7 @@ return (_ctx, _cache) => {
|
|
|
4686
5025
|
"modal-title": "Department Form"
|
|
4687
5026
|
}, {
|
|
4688
5027
|
default: vue.withCtx(() => [
|
|
4689
|
-
vue.createVNode(script$
|
|
5028
|
+
vue.createVNode(script$i, {
|
|
4690
5029
|
"success-callback": "departmentAdded",
|
|
4691
5030
|
onDepartmentAdded: departmentAdded,
|
|
4692
5031
|
action: "admin/departments/store",
|
|
@@ -4845,7 +5184,7 @@ return (_ctx, _cache) => {
|
|
|
4845
5184
|
"modal-title": "Add Module Department"
|
|
4846
5185
|
}, {
|
|
4847
5186
|
default: vue.withCtx(() => [
|
|
4848
|
-
vue.createVNode(script$
|
|
5187
|
+
vue.createVNode(script$i, {
|
|
4849
5188
|
"reload-select-items": vue.unref(reload),
|
|
4850
5189
|
"success-callback": moduleAdded,
|
|
4851
5190
|
"fill-selects": {
|
|
@@ -4982,7 +5321,7 @@ return (_ctx, _cache) => {
|
|
|
4982
5321
|
: (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
4983
5322
|
(section.value === 'login')
|
|
4984
5323
|
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [
|
|
4985
|
-
vue.createVNode(script$
|
|
5324
|
+
vue.createVNode(script$i, {
|
|
4986
5325
|
class: "sh-login-form",
|
|
4987
5326
|
fields: ['email','password'],
|
|
4988
5327
|
"action-label": "Login",
|
|
@@ -5007,7 +5346,7 @@ return (_ctx, _cache) => {
|
|
|
5007
5346
|
(vue.unref(registerSubTitle))
|
|
5008
5347
|
? (vue.openBlock(), vue.createElementBlock("span", _hoisted_8, vue.toDisplayString(vue.unref(registerSubTitle)), 1 /* TEXT */))
|
|
5009
5348
|
: vue.createCommentVNode("v-if", true),
|
|
5010
|
-
vue.createVNode(script$
|
|
5349
|
+
vue.createVNode(script$i, {
|
|
5011
5350
|
class: "sh-login-form",
|
|
5012
5351
|
fields: vue.unref(registrationFields),
|
|
5013
5352
|
"action-label": "Sign Up",
|
|
@@ -5053,7 +5392,7 @@ const ShFrontend = {
|
|
|
5053
5392
|
const registerTitle = options.registerTitle ?? 'Create a new account';
|
|
5054
5393
|
const registerSubTitle = options.registerSubTitle ?? `It's quick and easy`;
|
|
5055
5394
|
const logoutApiEndpoint = options.logoutApiEndpoint ?? `auth/logout`;
|
|
5056
|
-
options.formTextInput ?? script$
|
|
5395
|
+
options.formTextInput ?? script$f;
|
|
5057
5396
|
const loginUrl = options.loginUrl ?? `/login`;
|
|
5058
5397
|
const redirectLogin = options.redirectLogin ?? `/`;
|
|
5059
5398
|
const redirectRegister = options.redirectRegister ?? `/`;
|
|
@@ -5094,15 +5433,16 @@ const ShFrontend = {
|
|
|
5094
5433
|
}
|
|
5095
5434
|
};
|
|
5096
5435
|
|
|
5436
|
+
exports.ShAutoForm = script$d;
|
|
5097
5437
|
exports.ShCanvas = script$9;
|
|
5098
5438
|
exports.ShConfirmAction = script$7;
|
|
5099
5439
|
exports.ShDropDownForm = script$c;
|
|
5100
5440
|
exports.ShDynamicTabs = script$3;
|
|
5101
|
-
exports.ShForm = script$
|
|
5441
|
+
exports.ShForm = script$i;
|
|
5102
5442
|
exports.ShFrontend = ShFrontend;
|
|
5103
5443
|
exports.ShModal = script$b;
|
|
5104
5444
|
exports.ShModalForm = script$a;
|
|
5105
|
-
exports.ShPhone = script$
|
|
5445
|
+
exports.ShPhone = script$l;
|
|
5106
5446
|
exports.ShSilentAction = script$6;
|
|
5107
5447
|
exports.ShTable = script$5;
|
|
5108
5448
|
exports.ShTabs = script$4;
|