@iankibetsh/shframework 5.6.9 → 5.7.0
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 +261 -0
- package/dist/library.js +619 -269
- package/dist/library.mjs +620 -270
- package/package.json +2 -2
package/dist/library.js
CHANGED
|
@@ -2221,7 +2221,7 @@ const _hoisted_9$7 = {
|
|
|
2221
2221
|
key: 1,
|
|
2222
2222
|
class: "dropdown-item sh-suggest-no-results"
|
|
2223
2223
|
};
|
|
2224
|
-
const _hoisted_10$
|
|
2224
|
+
const _hoisted_10$6 = {
|
|
2225
2225
|
key: 2,
|
|
2226
2226
|
class: "dropdown-item sh-suggest-no-input"
|
|
2227
2227
|
};
|
|
@@ -2433,7 +2433,7 @@ return (_ctx, _cache) => {
|
|
|
2433
2433
|
}), 128 /* KEYED_FRAGMENT */))
|
|
2434
2434
|
: (vue.unref(searchText))
|
|
2435
2435
|
? (vue.openBlock(), vue.createElementBlock("li", _hoisted_9$7, " No results found "))
|
|
2436
|
-
: (vue.openBlock(), vue.createElementBlock("li", _hoisted_10$
|
|
2436
|
+
: (vue.openBlock(), vue.createElementBlock("li", _hoisted_10$6, " Type to search... "))
|
|
2437
2437
|
], 10 /* CLASS, PROPS */, _hoisted_7$8)
|
|
2438
2438
|
]))
|
|
2439
2439
|
: vue.createCommentVNode("v-if", true)
|
|
@@ -2815,23 +2815,23 @@ const _hoisted_6$8 = { class: "fg-label control-label text-capitalize control-be
|
|
|
2815
2815
|
const _hoisted_7$7 = { class: "col-md-12" };
|
|
2816
2816
|
const _hoisted_8$6 = ["data-cy", "placeholder", "name", "onFocus", "onChange"];
|
|
2817
2817
|
const _hoisted_9$6 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
|
|
2818
|
-
const _hoisted_10$
|
|
2819
|
-
const _hoisted_11$
|
|
2820
|
-
const _hoisted_12$
|
|
2821
|
-
const _hoisted_13$
|
|
2822
|
-
const _hoisted_14$
|
|
2823
|
-
const _hoisted_15$
|
|
2824
|
-
const _hoisted_16$
|
|
2825
|
-
const _hoisted_17$
|
|
2818
|
+
const _hoisted_10$5 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
|
|
2819
|
+
const _hoisted_11$4 = ["data-cy", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
|
|
2820
|
+
const _hoisted_12$4 = ["data-cy", "name", "onFocus", "onUpdate:modelValue"];
|
|
2821
|
+
const _hoisted_13$4 = ["disabled", "placeholder", "name", "onFocus", "onUpdate:modelValue"];
|
|
2822
|
+
const _hoisted_14$4 = ["name", "onFocus", "onUpdate:modelValue"];
|
|
2823
|
+
const _hoisted_15$4 = ["name", "onFocus", "onUpdate:modelValue"];
|
|
2824
|
+
const _hoisted_16$2 = ["value"];
|
|
2825
|
+
const _hoisted_17$2 = {
|
|
2826
2826
|
key: 11,
|
|
2827
2827
|
class: "invalid-feedback"
|
|
2828
2828
|
};
|
|
2829
|
-
const _hoisted_18$
|
|
2830
|
-
const _hoisted_19$
|
|
2831
|
-
const _hoisted_20$
|
|
2832
|
-
const _hoisted_21$
|
|
2833
|
-
const _hoisted_22$
|
|
2834
|
-
const _hoisted_23$
|
|
2829
|
+
const _hoisted_18$2 = { class: "form-check me-1" };
|
|
2830
|
+
const _hoisted_19$2 = ["value", "disabled", "checked"];
|
|
2831
|
+
const _hoisted_20$2 = { class: "form-check-label" };
|
|
2832
|
+
const _hoisted_21$2 = { class: "form-check me-1" };
|
|
2833
|
+
const _hoisted_22$2 = ["name", "value"];
|
|
2834
|
+
const _hoisted_23$2 = { class: "form-check-label" };
|
|
2835
2835
|
const _hoisted_24$1 = {
|
|
2836
2836
|
key: 1,
|
|
2837
2837
|
class: "row"
|
|
@@ -2919,7 +2919,7 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2919
2919
|
class: vue.normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
|
|
2920
2920
|
"onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
|
|
2921
2921
|
type: "password"
|
|
2922
|
-
}, null, 42 /* CLASS, PROPS, NEED_HYDRATION */, _hoisted_10$
|
|
2922
|
+
}, null, 42 /* CLASS, PROPS, NEED_HYDRATION */, _hoisted_10$5)), [
|
|
2923
2923
|
[vue.vModelText, _ctx.form_elements[field]]
|
|
2924
2924
|
])
|
|
2925
2925
|
: vue.createCommentVNode("v-if", true),
|
|
@@ -2934,7 +2934,7 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2934
2934
|
"onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
|
|
2935
2935
|
type: "email",
|
|
2936
2936
|
required: ""
|
|
2937
|
-
}, null, 42 /* CLASS, PROPS, NEED_HYDRATION */, _hoisted_11$
|
|
2937
|
+
}, null, 42 /* CLASS, PROPS, NEED_HYDRATION */, _hoisted_11$4)), [
|
|
2938
2938
|
[vue.vModelText, _ctx.form_elements[field]]
|
|
2939
2939
|
])
|
|
2940
2940
|
: vue.createCommentVNode("v-if", true),
|
|
@@ -2947,7 +2947,7 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2947
2947
|
onFocus: $event => ($options.removeErrors(field)),
|
|
2948
2948
|
class: vue.normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control active"]),
|
|
2949
2949
|
"onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event)
|
|
2950
|
-
}, null, 42 /* CLASS, PROPS, NEED_HYDRATION */, _hoisted_12$
|
|
2950
|
+
}, null, 42 /* CLASS, PROPS, NEED_HYDRATION */, _hoisted_12$4)), [
|
|
2951
2951
|
[vue.vModelText, _ctx.form_elements[field]]
|
|
2952
2952
|
])
|
|
2953
2953
|
: vue.createCommentVNode("v-if", true),
|
|
@@ -2986,7 +2986,7 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2986
2986
|
class: vue.normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
|
|
2987
2987
|
"onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event),
|
|
2988
2988
|
type: "text"
|
|
2989
|
-
}, null, 42 /* CLASS, PROPS, NEED_HYDRATION */, _hoisted_13$
|
|
2989
|
+
}, null, 42 /* CLASS, PROPS, NEED_HYDRATION */, _hoisted_13$4)), [
|
|
2990
2990
|
[vue.vModelText, _ctx.form_elements[field]]
|
|
2991
2991
|
])
|
|
2992
2992
|
: vue.createCommentVNode("v-if", true),
|
|
@@ -2997,7 +2997,7 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2997
2997
|
onFocus: $event => ($options.removeErrors(field)),
|
|
2998
2998
|
class: vue.normalizeClass([_ctx.form_errors[field] == null ? ' field_' + field:'is-invalid ' + field, "form-control"]),
|
|
2999
2999
|
"onUpdate:modelValue": $event => ((_ctx.form_elements[field]) = $event)
|
|
3000
|
-
}, null, 42 /* CLASS, PROPS, NEED_HYDRATION */, _hoisted_14$
|
|
3000
|
+
}, null, 42 /* CLASS, PROPS, NEED_HYDRATION */, _hoisted_14$4)), [
|
|
3001
3001
|
[vue.vModelText, _ctx.form_elements[field]]
|
|
3002
3002
|
])
|
|
3003
3003
|
: vue.createCommentVNode("v-if", true),
|
|
@@ -3013,28 +3013,28 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3013
3013
|
return (vue.openBlock(), vue.createElementBlock("option", {
|
|
3014
3014
|
key: $props.fillSelects[field].value ? item[$props.fillSelects[field].value]:item.id,
|
|
3015
3015
|
value: $props.fillSelects[field].value ? item[$props.fillSelects[field].value]:item.id
|
|
3016
|
-
}, vue.toDisplayString($props.fillSelects[field].column ? item[$props.fillSelects[field].column]:item.name), 9 /* TEXT, PROPS */, _hoisted_16$
|
|
3016
|
+
}, vue.toDisplayString($props.fillSelects[field].column ? item[$props.fillSelects[field].column]:item.name), 9 /* TEXT, PROPS */, _hoisted_16$2))
|
|
3017
3017
|
}), 128 /* KEYED_FRAGMENT */))
|
|
3018
|
-
], 42 /* CLASS, PROPS, NEED_HYDRATION */, _hoisted_15$
|
|
3018
|
+
], 42 /* CLASS, PROPS, NEED_HYDRATION */, _hoisted_15$4)), [
|
|
3019
3019
|
[vue.vModelSelect, _ctx.form_elements[field]]
|
|
3020
3020
|
])
|
|
3021
3021
|
: vue.createCommentVNode("v-if", true),
|
|
3022
3022
|
(_ctx.form_errors[field] != null )
|
|
3023
|
-
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_17$
|
|
3023
|
+
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_17$2, vue.toDisplayString(_ctx.form_errors[field][0]), 1 /* TEXT */))
|
|
3024
3024
|
: vue.createCommentVNode("v-if", true),
|
|
3025
3025
|
vue.createElementVNode("div", {
|
|
3026
3026
|
class: vue.normalizeClass($props.checkBoxes?.display ? ($props.checkBoxes.display =='row' ? 'd-flex': '' ) : '' )
|
|
3027
3027
|
}, [
|
|
3028
3028
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.checkboxData[field], (item) => {
|
|
3029
|
-
return (vue.openBlock(), vue.createElementBlock("div", _hoisted_18$
|
|
3029
|
+
return (vue.openBlock(), vue.createElementBlock("div", _hoisted_18$2, [
|
|
3030
3030
|
vue.createElementVNode("input", {
|
|
3031
3031
|
class: "form-check-input",
|
|
3032
3032
|
type: "checkbox",
|
|
3033
3033
|
value: item.id,
|
|
3034
3034
|
disabled: item.disabled,
|
|
3035
3035
|
checked: item.checked
|
|
3036
|
-
}, null, 8 /* PROPS */, _hoisted_19$
|
|
3037
|
-
vue.createElementVNode("label", _hoisted_20$
|
|
3036
|
+
}, null, 8 /* PROPS */, _hoisted_19$2),
|
|
3037
|
+
vue.createElementVNode("label", _hoisted_20$2, vue.toDisplayString(item.label), 1 /* TEXT */)
|
|
3038
3038
|
]))
|
|
3039
3039
|
}), 256 /* UNKEYED_FRAGMENT */))
|
|
3040
3040
|
], 2 /* CLASS */),
|
|
@@ -3042,14 +3042,14 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3042
3042
|
class: vue.normalizeClass($props.radioBoxes?.display ? ($props.radioBoxes.display =='row' ? 'd-flex': '' ) : '' )
|
|
3043
3043
|
}, [
|
|
3044
3044
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.radioboxData[field], (item) => {
|
|
3045
|
-
return (vue.openBlock(), vue.createElementBlock("div", _hoisted_21$
|
|
3045
|
+
return (vue.openBlock(), vue.createElementBlock("div", _hoisted_21$2, [
|
|
3046
3046
|
vue.createElementVNode("input", {
|
|
3047
3047
|
class: "form-check-input",
|
|
3048
3048
|
type: "radio",
|
|
3049
3049
|
name: field,
|
|
3050
3050
|
value: item.value
|
|
3051
|
-
}, null, 8 /* PROPS */, _hoisted_22$
|
|
3052
|
-
vue.createElementVNode("label", _hoisted_23$
|
|
3051
|
+
}, null, 8 /* PROPS */, _hoisted_22$2),
|
|
3052
|
+
vue.createElementVNode("label", _hoisted_23$2, vue.toDisplayString(item.label), 1 /* TEXT */)
|
|
3053
3053
|
]))
|
|
3054
3054
|
}), 256 /* UNKEYED_FRAGMENT */))
|
|
3055
3055
|
], 2 /* CLASS */)
|
|
@@ -3416,74 +3416,193 @@ return (_ctx, _cache) => {
|
|
|
3416
3416
|
|
|
3417
3417
|
script$r.__file = "src/lib/components/form-components/DateInput.vue";
|
|
3418
3418
|
|
|
3419
|
-
const _hoisted_1$l =
|
|
3420
|
-
|
|
3419
|
+
const _hoisted_1$l = {
|
|
3420
|
+
key: 0,
|
|
3421
|
+
class: "sh-form-steps-container"
|
|
3422
|
+
};
|
|
3423
|
+
const _hoisted_2$f = { class: "sh-form-steps-wrapper" };
|
|
3421
3424
|
const _hoisted_3$c = {
|
|
3425
|
+
key: 0,
|
|
3426
|
+
class: "sh-step-connector"
|
|
3427
|
+
};
|
|
3428
|
+
const _hoisted_4$c = { class: "sh-step-indicator" };
|
|
3429
|
+
const _hoisted_5$a = { class: "sh-step-number" };
|
|
3430
|
+
const _hoisted_6$7 = {
|
|
3431
|
+
key: 0,
|
|
3432
|
+
class: "sh-step-check"
|
|
3433
|
+
};
|
|
3434
|
+
const _hoisted_7$6 = { key: 1 };
|
|
3435
|
+
const _hoisted_8$5 = { class: "sh-step-content" };
|
|
3436
|
+
const _hoisted_9$5 = ["innerHTML"];
|
|
3437
|
+
const _hoisted_10$4 = ["innerHTML"];
|
|
3438
|
+
const _hoisted_11$3 = { class: "sh-current-step-info d-none" };
|
|
3439
|
+
const _hoisted_12$3 = { class: "sh-step-counter" };
|
|
3440
|
+
const _hoisted_13$3 = { class: "sh-step-name" };
|
|
3441
|
+
const _hoisted_14$3 = ["name", "onUpdate:modelValue"];
|
|
3442
|
+
const _hoisted_15$3 = ["innerHTML"];
|
|
3443
|
+
const _hoisted_16$1 = {
|
|
3422
3444
|
key: 0,
|
|
3423
3445
|
class: "text-danger sh-required"
|
|
3424
3446
|
};
|
|
3425
|
-
const
|
|
3426
|
-
const
|
|
3447
|
+
const _hoisted_17$1 = ["innerHTML"];
|
|
3448
|
+
const _hoisted_18$1 = {
|
|
3427
3449
|
key: 2,
|
|
3428
3450
|
class: "form-notch"
|
|
3429
3451
|
};
|
|
3430
|
-
const
|
|
3431
|
-
const
|
|
3432
|
-
const
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
role: "status",
|
|
3436
|
-
"aria-hidden": "true"
|
|
3437
|
-
};
|
|
3438
|
-
const _hoisted_9$5 = { key: 1 };
|
|
3439
|
-
|
|
3452
|
+
const _hoisted_19$1 = ["innerHTML"];
|
|
3453
|
+
const _hoisted_20$1 = ["disabled"];
|
|
3454
|
+
const _hoisted_21$1 = ["disabled"];
|
|
3455
|
+
const _hoisted_22$1 = ["disabled"];
|
|
3456
|
+
const _hoisted_23$1 = { key: 1 };
|
|
3440
3457
|
|
|
3441
3458
|
var script$q = {
|
|
3442
3459
|
__name: 'ShAutoForm',
|
|
3443
|
-
props:
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3460
|
+
props: {
|
|
3461
|
+
action: {
|
|
3462
|
+
type: String,
|
|
3463
|
+
required: false
|
|
3464
|
+
},
|
|
3465
|
+
successCallback: {
|
|
3466
|
+
type: Function,
|
|
3467
|
+
required: false
|
|
3468
|
+
},
|
|
3469
|
+
retainDataAfterSubmission: {
|
|
3470
|
+
type: Boolean,
|
|
3471
|
+
default: false
|
|
3472
|
+
},
|
|
3473
|
+
successMessage: {
|
|
3474
|
+
type: String,
|
|
3475
|
+
required: false
|
|
3476
|
+
},
|
|
3477
|
+
fields: {
|
|
3478
|
+
type: Array,
|
|
3479
|
+
required: true
|
|
3480
|
+
},
|
|
3481
|
+
customComponents: {
|
|
3482
|
+
type: Object,
|
|
3483
|
+
required: false
|
|
3484
|
+
},
|
|
3485
|
+
placeHolders: {
|
|
3486
|
+
type: Object,
|
|
3487
|
+
required: false
|
|
3488
|
+
},
|
|
3489
|
+
formClasses: {
|
|
3490
|
+
type: Object,
|
|
3491
|
+
required: false
|
|
3492
|
+
},
|
|
3493
|
+
helperTexts: {
|
|
3494
|
+
type: Object,
|
|
3495
|
+
required: false
|
|
3496
|
+
},
|
|
3497
|
+
labels: {
|
|
3498
|
+
type: Object,
|
|
3499
|
+
required: false
|
|
3500
|
+
},
|
|
3501
|
+
data: {
|
|
3502
|
+
type: Object,
|
|
3503
|
+
required: false
|
|
3504
|
+
},
|
|
3505
|
+
preSubmitCallback: {
|
|
3506
|
+
type: Function,
|
|
3507
|
+
required: false
|
|
3508
|
+
},
|
|
3509
|
+
fillSelects: {
|
|
3510
|
+
type: Object,
|
|
3511
|
+
required: false
|
|
3512
|
+
},
|
|
3513
|
+
formClass: {
|
|
3514
|
+
type: String,
|
|
3515
|
+
required: false
|
|
3516
|
+
},
|
|
3517
|
+
actionLabel: {
|
|
3518
|
+
type: String,
|
|
3519
|
+
default: 'Submit'
|
|
3520
|
+
},
|
|
3521
|
+
textAreas: {
|
|
3522
|
+
type: Array,
|
|
3523
|
+
required: false
|
|
3524
|
+
},
|
|
3525
|
+
currentData: {
|
|
3526
|
+
type: Object,
|
|
3527
|
+
required: false
|
|
3528
|
+
},
|
|
3529
|
+
emails: {
|
|
3530
|
+
type: Array,
|
|
3531
|
+
required: false
|
|
3532
|
+
},
|
|
3533
|
+
method: {
|
|
3534
|
+
type: String,
|
|
3535
|
+
default: 'post',
|
|
3536
|
+
validator: (value) => ['post', 'put', 'delete'].includes(value)
|
|
3537
|
+
},
|
|
3538
|
+
phones: {
|
|
3539
|
+
type: Array,
|
|
3540
|
+
required: false
|
|
3541
|
+
},
|
|
3542
|
+
numbers: {
|
|
3543
|
+
type: Array,
|
|
3544
|
+
required: false
|
|
3545
|
+
},
|
|
3546
|
+
selects: {
|
|
3547
|
+
type: Array,
|
|
3548
|
+
required: false
|
|
3549
|
+
},
|
|
3550
|
+
dates: {
|
|
3551
|
+
type: Array,
|
|
3552
|
+
required: false
|
|
3553
|
+
},
|
|
3554
|
+
gqlMutation: {
|
|
3555
|
+
type: String,
|
|
3556
|
+
required: false
|
|
3557
|
+
},
|
|
3558
|
+
required: {
|
|
3559
|
+
type: Array,
|
|
3560
|
+
required: false
|
|
3561
|
+
},
|
|
3562
|
+
retainModal: {
|
|
3563
|
+
type: Boolean,
|
|
3564
|
+
default: false
|
|
3565
|
+
},
|
|
3566
|
+
steps: {
|
|
3567
|
+
type: Array,
|
|
3568
|
+
required: false
|
|
3569
|
+
}
|
|
3570
|
+
},
|
|
3571
|
+
emits: ['success', 'preSubmit', 'fieldChanged', 'formSubmitted', 'formError'],
|
|
3459
3572
|
setup(__props, { emit: __emit }) {
|
|
3460
3573
|
|
|
3461
3574
|
const props = __props;
|
|
3462
3575
|
const emit = __emit;
|
|
3576
|
+
|
|
3577
|
+
// Default field type configurations
|
|
3578
|
+
const DEFAULT_FIELD_TYPES = {
|
|
3579
|
+
textareas: ['message', 'meta_description', 'comment', 'call_response', 'comments', 'description'],
|
|
3580
|
+
selects: ['gender', 'payment_method', 'allow_view_mode', 'reasons_name', 'has_free_tier', 'payment_period', 'role', 'register_as', 'account_type'],
|
|
3581
|
+
numbers: ['age'],
|
|
3582
|
+
dates: ['free_tier_days', 'recurring_date', 'date', 'paid_at'],
|
|
3583
|
+
passwords: ['password', 'password_confirmation', 'pin'],
|
|
3584
|
+
phones: ['phone'],
|
|
3585
|
+
emails: ['email']
|
|
3586
|
+
};
|
|
3587
|
+
|
|
3463
3588
|
const formFields = vue.ref([]);
|
|
3589
|
+
const formComponents = vue.inject('formComponents', {});
|
|
3590
|
+
|
|
3464
3591
|
const getFieldComponent = (fieldObj) => {
|
|
3592
|
+
// Return custom component if specified
|
|
3465
3593
|
if (fieldObj.component) {
|
|
3466
3594
|
return fieldObj.component
|
|
3467
3595
|
}
|
|
3596
|
+
|
|
3468
3597
|
const field = fieldObj.field ?? fieldObj.name;
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
const passwords = ['password', 'password_confirmation', 'pin'];
|
|
3473
|
-
const defaultPhones = ['phone'];
|
|
3474
|
-
const defaultEmails = ['email'];
|
|
3475
|
-
const formComponents = vue.inject('formComponents');
|
|
3476
|
-
const TextComponent = formComponents.text ?? script$v;
|
|
3477
|
-
const TextAreaComponent = formComponents.textArea ?? script$u;
|
|
3478
|
-
const EmailComponent = formComponents.email ?? script$x;
|
|
3479
|
-
const PhoneComponent = formComponents.phone ?? script$A;
|
|
3480
|
-
const NumberComponent = formComponents.number ?? script$w;
|
|
3481
|
-
const SelectComponent = formComponents.select ?? script$t;
|
|
3482
|
-
const PasswordComponent = formComponents.password ?? script$s;
|
|
3483
|
-
if (props.customComponents && props.customComponents[field]) {
|
|
3598
|
+
|
|
3599
|
+
// Check for custom components in props
|
|
3600
|
+
if (props.customComponents?.[field]) {
|
|
3484
3601
|
return props.customComponents[field]
|
|
3485
3602
|
}
|
|
3486
|
-
|
|
3603
|
+
|
|
3604
|
+
// Handle fillSelects configuration
|
|
3605
|
+
if (props.fillSelects?.[field]) {
|
|
3487
3606
|
Object.assign(fieldObj, props.fillSelects[field]);
|
|
3488
3607
|
if (fieldObj.suggests || fieldObj.suggest) {
|
|
3489
3608
|
fieldObj.type = 'suggests';
|
|
@@ -3491,114 +3610,173 @@ const getFieldComponent = (fieldObj) => {
|
|
|
3491
3610
|
fieldObj.type = 'select';
|
|
3492
3611
|
}
|
|
3493
3612
|
}
|
|
3494
|
-
|
|
3613
|
+
|
|
3614
|
+
// Handle suggests type
|
|
3615
|
+
if (fieldObj.suggests || fieldObj.suggest) {
|
|
3495
3616
|
fieldObj.type = 'suggests';
|
|
3496
3617
|
}
|
|
3497
3618
|
|
|
3619
|
+
// Get component mappings
|
|
3620
|
+
const componentMap = {
|
|
3621
|
+
text: formComponents.text ?? script$v,
|
|
3622
|
+
textarea: formComponents.textArea ?? script$u,
|
|
3623
|
+
email: formComponents.email ?? script$x,
|
|
3624
|
+
phone: formComponents.phone ?? script$A,
|
|
3625
|
+
number: formComponents.number ?? script$w,
|
|
3626
|
+
select: formComponents.select ?? script$t,
|
|
3627
|
+
password: formComponents.password ?? script$s,
|
|
3628
|
+
date: formComponents.date ?? script$r
|
|
3629
|
+
};
|
|
3630
|
+
|
|
3631
|
+
// Return component based on explicit type
|
|
3498
3632
|
if (fieldObj.type) {
|
|
3499
3633
|
if (fieldObj.type === 'suggest' || fieldObj.type === 'suggests') {
|
|
3500
3634
|
return script$z
|
|
3501
3635
|
}
|
|
3502
|
-
return fieldObj.type
|
|
3503
|
-
}
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
return formComponents.email ?? script$x
|
|
3509
|
-
} else if ((props.phones && props.phones.includes(field)) || defaultPhones.includes(field)) {
|
|
3510
|
-
return formComponents.phone ?? script$A
|
|
3511
|
-
} else if ((props.numbers && props.numbers.includes(field)) || defaultNumbers.includes(field)) {
|
|
3512
|
-
return formComponents.number ?? script$w
|
|
3636
|
+
return componentMap[fieldObj.type] ?? componentMap.text
|
|
3637
|
+
}
|
|
3638
|
+
|
|
3639
|
+
// Infer component from field name patterns
|
|
3640
|
+
if (DEFAULT_FIELD_TYPES.passwords.includes(field)) {
|
|
3641
|
+
return componentMap.password
|
|
3513
3642
|
}
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
// return formComponents.select ?? SelectInput
|
|
3517
|
-
// } else
|
|
3518
|
-
if((props.dates && props.dates.includes(field)) || defaultDates.includes(field)){
|
|
3519
|
-
return formComponents.date ?? script$r
|
|
3643
|
+
if ((props.textAreas?.includes(field)) || DEFAULT_FIELD_TYPES.textareas.includes(field)) {
|
|
3644
|
+
return componentMap.textarea
|
|
3520
3645
|
}
|
|
3521
|
-
|
|
3646
|
+
if ((props.emails?.includes(field)) || DEFAULT_FIELD_TYPES.emails.includes(field)) {
|
|
3647
|
+
return componentMap.email
|
|
3648
|
+
}
|
|
3649
|
+
if ((props.phones?.includes(field)) || DEFAULT_FIELD_TYPES.phones.includes(field)) {
|
|
3650
|
+
return componentMap.phone
|
|
3651
|
+
}
|
|
3652
|
+
if ((props.numbers?.includes(field)) || DEFAULT_FIELD_TYPES.numbers.includes(field)) {
|
|
3653
|
+
return componentMap.number
|
|
3654
|
+
}
|
|
3655
|
+
if ((props.dates?.includes(field)) || DEFAULT_FIELD_TYPES.dates.includes(field)) {
|
|
3656
|
+
return componentMap.date
|
|
3657
|
+
}
|
|
3658
|
+
|
|
3659
|
+
return componentMap.text
|
|
3522
3660
|
};
|
|
3523
|
-
const shFormElementClasses = vue.
|
|
3524
|
-
shFormElementClasses.value = vue.inject('shFormElementClasses');
|
|
3661
|
+
const shFormElementClasses = vue.inject('shFormElementClasses', {});
|
|
3525
3662
|
const shAutoForm = vue.useTemplateRef('shAutoForm');
|
|
3526
|
-
const
|
|
3663
|
+
const loading = vue.ref(false);
|
|
3664
|
+
const submitBtn = vue.ref(false);
|
|
3665
|
+
const validationErrors = vue.ref({});
|
|
3666
|
+
const formError = vue.ref(null);
|
|
3667
|
+
const submitBtnWidth = vue.ref(null);
|
|
3668
|
+
|
|
3669
|
+
// Helper functions
|
|
3670
|
+
const closeModal = () => {
|
|
3527
3671
|
setTimeout(() => {
|
|
3528
|
-
if(!shAutoForm.value){
|
|
3529
|
-
//
|
|
3672
|
+
if (!shAutoForm.value) {
|
|
3673
|
+
// Form not available, most probably after redirection
|
|
3530
3674
|
return
|
|
3531
3675
|
}
|
|
3532
3676
|
const modal = shAutoForm.value.closest('.modal-dialog');
|
|
3533
3677
|
if (modal) {
|
|
3534
3678
|
const closeBtn = modal.querySelector('[data-bs-dismiss="modal"]');
|
|
3535
|
-
closeBtn
|
|
3679
|
+
closeBtn?.click();
|
|
3536
3680
|
}
|
|
3537
3681
|
}, 1500);
|
|
3538
3682
|
};
|
|
3539
|
-
|
|
3540
|
-
const
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3683
|
+
|
|
3684
|
+
const getLabel = field =>
|
|
3685
|
+
props.labels?.[field] !== undefined
|
|
3686
|
+
? props.labels[field]
|
|
3687
|
+
: ___default["default"].startCase(___default["default"].camelCase(field));
|
|
3688
|
+
|
|
3689
|
+
const getElementClass = section =>
|
|
3690
|
+
props.formClasses?.[section] ??
|
|
3691
|
+
shFormElementClasses[section] ??
|
|
3692
|
+
___default["default"].snakeCase(section).replace(/_/gi, '-');
|
|
3693
|
+
|
|
3694
|
+
const getComponentClass = field => {
|
|
3695
|
+
const baseClass = getElementClass('formControl');
|
|
3696
|
+
return validationErrors.value[field] ? `${baseClass} is-invalid` : baseClass
|
|
3697
|
+
};
|
|
3698
|
+
|
|
3699
|
+
const getHelperText = field => props.helperTexts?.[field] || false;
|
|
3700
|
+
|
|
3701
|
+
const getPlaceholder = field => props.placeHolders?.[field] || '';
|
|
3702
|
+
|
|
3703
|
+
const getFormData = () => {
|
|
3546
3704
|
const data = {};
|
|
3547
|
-
formFields.value.
|
|
3705
|
+
formFields.value.forEach(field => {
|
|
3548
3706
|
data[field.field] = field.value;
|
|
3549
3707
|
});
|
|
3708
|
+
return data
|
|
3709
|
+
};
|
|
3710
|
+
|
|
3711
|
+
const fieldChanged = field => {
|
|
3712
|
+
delete validationErrors.value[field];
|
|
3713
|
+
const data = getFormData();
|
|
3714
|
+
const fieldValue = formFields.value.find(f => f.field === field)?.value;
|
|
3550
3715
|
setTimeout(() => {
|
|
3551
|
-
emit('fieldChanged', field,
|
|
3716
|
+
emit('fieldChanged', field, fieldValue, data);
|
|
3552
3717
|
}, 300);
|
|
3553
3718
|
};
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3719
|
+
|
|
3720
|
+
const getComponentProps = (field) => {
|
|
3721
|
+
const { component, value, ...props } = field;
|
|
3722
|
+
// remove required
|
|
3723
|
+
delete props.required;
|
|
3724
|
+
return props
|
|
3559
3725
|
};
|
|
3560
3726
|
const isFloating = getElementClass('formGroup').includes('form-floating');
|
|
3561
|
-
|
|
3562
|
-
const
|
|
3563
|
-
const validationErrors = vue.ref({});
|
|
3564
|
-
const formError = vue.ref(null);
|
|
3565
|
-
const submitForm = async (e) => {
|
|
3566
|
-
submitBtnWidth.value = submitBtn.value.getBoundingClientRect().width + 'px !important';
|
|
3567
|
-
validationErrors.value = {};
|
|
3727
|
+
|
|
3728
|
+
const submitForm = async (e) => {
|
|
3568
3729
|
e.preventDefault();
|
|
3730
|
+
|
|
3731
|
+
if (submitBtn.value) {
|
|
3732
|
+
submitBtnWidth.value = `${submitBtn.value.getBoundingClientRect().width}px`;
|
|
3733
|
+
}
|
|
3734
|
+
|
|
3735
|
+
validationErrors.value = {};
|
|
3569
3736
|
loading.value = true;
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3737
|
+
|
|
3738
|
+
const data = getFormData();
|
|
3739
|
+
|
|
3740
|
+
// Pre-submit callback
|
|
3574
3741
|
if (props.preSubmitCallback) {
|
|
3575
|
-
const
|
|
3576
|
-
if (
|
|
3742
|
+
const callbackRes = await props.preSubmitCallback(data);
|
|
3743
|
+
if (callbackRes !== true) {
|
|
3577
3744
|
loading.value = false;
|
|
3578
3745
|
return false
|
|
3579
3746
|
}
|
|
3580
3747
|
}
|
|
3748
|
+
|
|
3749
|
+
emit('preSubmit', data);
|
|
3750
|
+
|
|
3751
|
+
// Handle GraphQL mutation
|
|
3581
3752
|
if (props.gqlMutation) {
|
|
3582
|
-
|
|
3583
|
-
let
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
args = args.replace(',)', ')');
|
|
3591
|
-
if (args === '()') {
|
|
3592
|
-
args = '';
|
|
3753
|
+
const selectFields = Object.keys(data);
|
|
3754
|
+
let args = selectFields
|
|
3755
|
+
.filter(key => data[key])
|
|
3756
|
+
.map(key => `${key}: "${data[key]}"`)
|
|
3757
|
+
.join(', ');
|
|
3758
|
+
|
|
3759
|
+
if (args) {
|
|
3760
|
+
args = `(${args})`;
|
|
3593
3761
|
}
|
|
3594
|
-
emit('preSubmit', data);
|
|
3595
3762
|
|
|
3596
|
-
const mutation = `{\n${props.gqlMutation}
|
|
3597
|
-
shApis.graphQlMutate(mutation)
|
|
3763
|
+
const mutation = `{\n${props.gqlMutation}${args} {\n${selectFields.join('\n')}\n}\n}`;
|
|
3764
|
+
shApis.graphQlMutate(mutation)
|
|
3765
|
+
.then(handleSuccessRequest)
|
|
3766
|
+
.catch(handleFailedRequest);
|
|
3598
3767
|
} else {
|
|
3599
|
-
|
|
3600
|
-
method
|
|
3768
|
+
// Handle REST API
|
|
3769
|
+
const method = props.method === 'put'
|
|
3770
|
+
? shApis.doPut
|
|
3771
|
+
: props.method === 'delete'
|
|
3772
|
+
? shApis.doDelete
|
|
3773
|
+
: shApis.doPost;
|
|
3774
|
+
|
|
3775
|
+
method(props.action, data)
|
|
3776
|
+
.then(handleSuccessRequest)
|
|
3777
|
+
.catch(handleFailedRequest);
|
|
3601
3778
|
}
|
|
3779
|
+
|
|
3602
3780
|
return false
|
|
3603
3781
|
};
|
|
3604
3782
|
|
|
@@ -3606,174 +3784,345 @@ const handleSuccessRequest = res => {
|
|
|
3606
3784
|
loading.value = false;
|
|
3607
3785
|
emit('formSubmitted', res.data);
|
|
3608
3786
|
emit('success', res.data);
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3787
|
+
|
|
3788
|
+
if (props.successMessage) {
|
|
3789
|
+
shRepo.showToast(props.successMessage);
|
|
3790
|
+
}
|
|
3791
|
+
|
|
3792
|
+
if (props.successCallback) {
|
|
3793
|
+
props.successCallback(res.data);
|
|
3794
|
+
}
|
|
3795
|
+
|
|
3796
|
+
if (!props.retainDataAfterSubmission) {
|
|
3797
|
+
formFields.value.forEach(field => field.value = null);
|
|
3798
|
+
}
|
|
3799
|
+
|
|
3800
|
+
if (!props.retainModal) {
|
|
3801
|
+
closeModal();
|
|
3802
|
+
}
|
|
3613
3803
|
};
|
|
3614
3804
|
|
|
3615
|
-
const
|
|
3805
|
+
const handleFailedRequest = reason => {
|
|
3616
3806
|
loading.value = false;
|
|
3617
|
-
const httpStatus = reason.response
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3807
|
+
const httpStatus = reason.response?.status || 0;
|
|
3808
|
+
|
|
3809
|
+
formError.value = httpStatus === 422 ? null : reason.message ?? null;
|
|
3810
|
+
|
|
3811
|
+
// Handle validation errors
|
|
3812
|
+
if (httpStatus === 422 && typeof reason.response?.data?.errors === 'object') {
|
|
3813
|
+
const httpErrors = reason.response.data.errors;
|
|
3814
|
+
Object.keys(httpErrors).forEach(key => {
|
|
3815
|
+
validationErrors.value[key] = typeof httpErrors[key] === 'string'
|
|
3816
|
+
? httpErrors[key]
|
|
3817
|
+
: httpErrors[key][0];
|
|
3818
|
+
});
|
|
3819
|
+
|
|
3820
|
+
// Navigate to the step containing the first error
|
|
3821
|
+
if (formSteps.value.length > 1) {
|
|
3822
|
+
const errorFields = Object.keys(httpErrors);
|
|
3823
|
+
|
|
3824
|
+
// Find the first step that contains any error field
|
|
3825
|
+
for (let i = 0; i < formSteps.value.length; i++) {
|
|
3826
|
+
const stepFieldNames = formSteps.value[i].fields.map(f => f.field);
|
|
3827
|
+
const hasError = errorFields.some(errorField => stepFieldNames.includes(errorField));
|
|
3828
|
+
|
|
3829
|
+
if (hasError) {
|
|
3830
|
+
currentStep.value = i;
|
|
3831
|
+
break
|
|
3832
|
+
}
|
|
3833
|
+
}
|
|
3834
|
+
}
|
|
3835
|
+
}
|
|
3836
|
+
|
|
3837
|
+
if (httpStatus !== 422 && formError.value) {
|
|
3838
|
+
shRepo.showToast(formError.value, 'error');
|
|
3623
3839
|
}
|
|
3624
|
-
|
|
3625
|
-
|
|
3840
|
+
|
|
3841
|
+
emit('formError', reason);
|
|
3626
3842
|
};
|
|
3627
|
-
const submitBtnWidth = vue.ref(null);
|
|
3628
3843
|
const setExistingData = (existingData) => {
|
|
3629
|
-
if (existingData)
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
}
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
// existingData[field.field] && (field.value = existingData[field.field])
|
|
3638
|
-
});
|
|
3639
|
-
formFields.value = null;
|
|
3640
|
-
formFields.value = newFields;
|
|
3641
|
-
}
|
|
3844
|
+
if (!existingData) return
|
|
3845
|
+
|
|
3846
|
+
formFields.value = formFields.value.map(field => {
|
|
3847
|
+
if (existingData[field.field] !== undefined) {
|
|
3848
|
+
return { ...field, value: existingData[field.field] }
|
|
3849
|
+
}
|
|
3850
|
+
return field
|
|
3851
|
+
});
|
|
3642
3852
|
};
|
|
3853
|
+
|
|
3643
3854
|
vue.watch(() => props.currentData, (newData) => {
|
|
3644
3855
|
setExistingData(newData);
|
|
3645
3856
|
});
|
|
3646
|
-
vue.onMounted((ev) => {
|
|
3647
3857
|
|
|
3648
|
-
|
|
3649
|
-
|
|
3858
|
+
const currentStep = vue.ref(0);
|
|
3859
|
+
const formSteps = vue.ref([]);
|
|
3860
|
+
const isLastStep = vue.computed(() => currentStep.value === formSteps.value.length - 1);
|
|
3861
|
+
const currentStepObject = vue.computed(() => formSteps.value[currentStep.value] || {});
|
|
3862
|
+
|
|
3863
|
+
vue.onMounted(() => {
|
|
3864
|
+
// Initialize form fields
|
|
3865
|
+
props.fields?.forEach(field => {
|
|
3866
|
+
let fieldObj;
|
|
3867
|
+
|
|
3650
3868
|
if (typeof field === 'object') {
|
|
3651
|
-
fieldObj = {...field};
|
|
3869
|
+
fieldObj = { ...field };
|
|
3652
3870
|
fieldObj.field = fieldObj.field ?? fieldObj.name;
|
|
3653
|
-
|
|
3654
|
-
fieldObj.helper = fieldObj.helperText ?? fieldObj.helper;
|
|
3655
|
-
// !fieldObj.helper && fieldObj.helperText ? fieldObj.helper = fieldObj.helperText : fieldObj.helper = getHelperText(fieldObj.field)
|
|
3656
|
-
// fieldObj.helperText === undefined && ()
|
|
3871
|
+
fieldObj.helper = fieldObj.helperText ?? getHelperText(fieldObj.field);
|
|
3657
3872
|
fieldObj.label = fieldObj.label ?? getLabel(fieldObj.field ?? fieldObj.name);
|
|
3658
|
-
|
|
3873
|
+
fieldObj.placeholder = fieldObj.placeholder ?? fieldObj.placeHolder ?? getPlaceholder(fieldObj.field);
|
|
3659
3874
|
fieldObj.value = null;
|
|
3660
3875
|
} else {
|
|
3661
3876
|
fieldObj = {
|
|
3662
|
-
field: field,
|
|
3877
|
+
field: field,
|
|
3878
|
+
label: getLabel(field),
|
|
3663
3879
|
helper: getHelperText(field),
|
|
3664
3880
|
placeholder: getPlaceholder(field),
|
|
3665
3881
|
value: null
|
|
3666
3882
|
};
|
|
3667
3883
|
|
|
3668
|
-
|
|
3884
|
+
// Apply fillSelects configuration
|
|
3885
|
+
if (props.fillSelects?.[fieldObj.field]) {
|
|
3669
3886
|
Object.assign(fieldObj, props.fillSelects[fieldObj.field]);
|
|
3670
3887
|
}
|
|
3671
3888
|
}
|
|
3672
|
-
|
|
3889
|
+
|
|
3890
|
+
// Mark as required if in required array
|
|
3891
|
+
if (props.required?.includes(fieldObj.field)) {
|
|
3673
3892
|
fieldObj.required = true;
|
|
3674
3893
|
}
|
|
3894
|
+
|
|
3675
3895
|
formFields.value.push(fieldObj);
|
|
3676
|
-
formFields.value.push({
|
|
3677
|
-
field: 'id',
|
|
3678
|
-
type: 'hidden'
|
|
3679
|
-
// label: 'IF'
|
|
3680
|
-
});
|
|
3681
3896
|
});
|
|
3897
|
+
|
|
3898
|
+
// Add hidden ID field
|
|
3899
|
+
formFields.value.push({
|
|
3900
|
+
field: 'id',
|
|
3901
|
+
type: 'hidden'
|
|
3902
|
+
});
|
|
3903
|
+
|
|
3682
3904
|
setExistingData(props.currentData);
|
|
3683
|
-
});
|
|
3684
3905
|
|
|
3906
|
+
// Initialize steps
|
|
3907
|
+
if (!props.steps || props.steps.length === 0) {
|
|
3908
|
+
// Single step form - all fields in one step
|
|
3909
|
+
formSteps.value = [{
|
|
3910
|
+
name: 'Form',
|
|
3911
|
+
label: 'Form',
|
|
3912
|
+
fields: formFields.value
|
|
3913
|
+
}];
|
|
3914
|
+
} else {
|
|
3915
|
+
// Multi-step form - map fields to steps
|
|
3916
|
+
formSteps.value = props.steps.map(step => {
|
|
3917
|
+
const stepFields = step.fields.map(fieldName => {
|
|
3918
|
+
return formFields.value.find(f => f.field === fieldName)
|
|
3919
|
+
}).filter(f => f !== undefined);
|
|
3920
|
+
|
|
3921
|
+
return {
|
|
3922
|
+
...step,
|
|
3923
|
+
fields: stepFields
|
|
3924
|
+
}
|
|
3925
|
+
});
|
|
3926
|
+
}
|
|
3927
|
+
});
|
|
3685
3928
|
|
|
3686
3929
|
return (_ctx, _cache) => {
|
|
3687
3930
|
return (vue.openBlock(), vue.createElementBlock("form", {
|
|
3688
3931
|
class: vue.normalizeClass([__props.formClass, "sh-auto-form"]),
|
|
3689
3932
|
ref_key: "shAutoForm",
|
|
3690
3933
|
ref: shAutoForm,
|
|
3691
|
-
onSubmit: _cache[
|
|
3934
|
+
onSubmit: _cache[2] || (_cache[2] = e => submitForm(e))
|
|
3692
3935
|
}, [
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3936
|
+
vue.createCommentVNode(" Step Indicator "),
|
|
3937
|
+
(formSteps.value.length > 1)
|
|
3938
|
+
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
|
|
3939
|
+
vue.createElementVNode("div", _hoisted_2$f, [
|
|
3940
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(formSteps.value, (step, index) => {
|
|
3941
|
+
return (vue.openBlock(), vue.createElementBlock("div", {
|
|
3942
|
+
key: `step-${index}`,
|
|
3943
|
+
class: vue.normalizeClass([
|
|
3944
|
+
'sh-form-step',
|
|
3945
|
+
getElementClass('formStep'),
|
|
3946
|
+
{
|
|
3947
|
+
'active': index === currentStep.value,
|
|
3948
|
+
'completed': index < currentStep.value,
|
|
3949
|
+
'upcoming': index > currentStep.value
|
|
3950
|
+
}
|
|
3951
|
+
])
|
|
3952
|
+
}, [
|
|
3953
|
+
(index > 0)
|
|
3954
|
+
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$c))
|
|
3955
|
+
: vue.createCommentVNode("v-if", true),
|
|
3956
|
+
vue.createElementVNode("div", _hoisted_4$c, [
|
|
3957
|
+
vue.createElementVNode("div", _hoisted_5$a, [
|
|
3958
|
+
(index < currentStep.value)
|
|
3959
|
+
? (vue.openBlock(), vue.createElementBlock("span", _hoisted_6$7, "✓"))
|
|
3960
|
+
: (vue.openBlock(), vue.createElementBlock("span", _hoisted_7$6, vue.toDisplayString(index + 1), 1 /* TEXT */))
|
|
3961
|
+
]),
|
|
3962
|
+
vue.createElementVNode("div", _hoisted_8$5, [
|
|
3963
|
+
vue.createElementVNode("div", {
|
|
3964
|
+
class: "sh-step-title",
|
|
3965
|
+
innerHTML: step.title || step.label || step.name
|
|
3966
|
+
}, null, 8 /* PROPS */, _hoisted_9$5),
|
|
3967
|
+
(step.description)
|
|
3968
|
+
? (vue.openBlock(), vue.createElementBlock("div", {
|
|
3969
|
+
key: 0,
|
|
3970
|
+
class: "sh-step-description",
|
|
3971
|
+
innerHTML: step.description
|
|
3972
|
+
}, null, 8 /* PROPS */, _hoisted_10$4))
|
|
3719
3973
|
: vue.createCommentVNode("v-if", true)
|
|
3720
|
-
]
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
(
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3974
|
+
])
|
|
3975
|
+
])
|
|
3976
|
+
], 2 /* CLASS */))
|
|
3977
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
3978
|
+
]),
|
|
3979
|
+
vue.createElementVNode("div", _hoisted_11$3, [
|
|
3980
|
+
vue.createElementVNode("span", _hoisted_12$3, "Step " + vue.toDisplayString(currentStep.value + 1) + " of " + vue.toDisplayString(formSteps.value.length), 1 /* TEXT */),
|
|
3981
|
+
vue.createElementVNode("span", _hoisted_13$3, vue.toDisplayString(currentStepObject.value.title || currentStepObject.value.label || currentStepObject.value.name), 1 /* TEXT */)
|
|
3982
|
+
])
|
|
3983
|
+
]))
|
|
3984
|
+
: vue.createCommentVNode("v-if", true),
|
|
3985
|
+
vue.createCommentVNode(" Form Fields "),
|
|
3986
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(formSteps.value, (stepData, stepIndex) => {
|
|
3987
|
+
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
|
|
3988
|
+
key: `step-${stepIndex}`,
|
|
3989
|
+
class: "sh-step-fields"
|
|
3990
|
+
}, [
|
|
3991
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(stepData.fields, (field, fieldIndex) => {
|
|
3992
|
+
return (vue.openBlock(), vue.createElementBlock("div", {
|
|
3993
|
+
key: `field-${field.field}-${fieldIndex}`,
|
|
3994
|
+
class: vue.normalizeClass(getElementClass('formGroup') + ' sh-field-' + field.field)
|
|
3995
|
+
}, [
|
|
3996
|
+
(field.type === 'hidden')
|
|
3997
|
+
? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
|
|
3998
|
+
key: 0,
|
|
3999
|
+
type: "hidden",
|
|
4000
|
+
name: field.field,
|
|
4001
|
+
"onUpdate:modelValue": $event => ((field.value) = $event)
|
|
4002
|
+
}, null, 8 /* PROPS */, _hoisted_14$3)), [
|
|
4003
|
+
[vue.vModelText, field.value]
|
|
4004
|
+
])
|
|
4005
|
+
: (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
4006
|
+
(!vue.unref(isFloating) && field.label)
|
|
4007
|
+
? (vue.openBlock(), vue.createElementBlock("label", {
|
|
4008
|
+
key: 0,
|
|
4009
|
+
class: vue.normalizeClass(getElementClass('formLabel'))
|
|
4010
|
+
}, [
|
|
4011
|
+
vue.createElementVNode("span", {
|
|
4012
|
+
innerHTML: field.label,
|
|
4013
|
+
class: "sh-label"
|
|
4014
|
+
}, null, 8 /* PROPS */, _hoisted_15$3),
|
|
4015
|
+
(field.required)
|
|
4016
|
+
? (vue.openBlock(), vue.createElementBlock("span", _hoisted_16$1, "*"))
|
|
4017
|
+
: vue.createCommentVNode("v-if", true)
|
|
4018
|
+
], 2 /* CLASS */))
|
|
4019
|
+
: vue.createCommentVNode("v-if", true),
|
|
4020
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(getFieldComponent(field)), vue.mergeProps({ ref_for: true }, getComponentProps(field), {
|
|
4021
|
+
isInvalid: typeof validationErrors.value[field.field] !== 'undefined',
|
|
4022
|
+
onClick: $event => (fieldChanged(field.field)),
|
|
4023
|
+
"onUpdate:modelValue": [$event => (fieldChanged(field.field)), $event => ((field.value) = $event)],
|
|
4024
|
+
modelValue: field.value,
|
|
4025
|
+
class: getComponentClass(field.field)
|
|
4026
|
+
}), null, 16 /* FULL_PROPS */, ["isInvalid", "onClick", "onUpdate:modelValue", "modelValue", "class"])),
|
|
4027
|
+
(vue.unref(isFloating) && field.label)
|
|
4028
|
+
? (vue.openBlock(), vue.createElementBlock("label", {
|
|
4029
|
+
key: 1,
|
|
4030
|
+
class: vue.normalizeClass(getElementClass('formLabel')),
|
|
4031
|
+
innerHTML: field.label
|
|
4032
|
+
}, null, 10 /* CLASS, PROPS */, _hoisted_17$1))
|
|
4033
|
+
: vue.createCommentVNode("v-if", true),
|
|
4034
|
+
(vue.unref(isFloating))
|
|
4035
|
+
? (vue.openBlock(), vue.createElementBlock("div", _hoisted_18$1, [...(_cache[3] || (_cache[3] = [
|
|
4036
|
+
vue.createElementVNode("div", { class: "form-notch-leading" }, null, -1 /* CACHED */),
|
|
4037
|
+
vue.createElementVNode("div", { class: "form-notch-middle" }, null, -1 /* CACHED */),
|
|
4038
|
+
vue.createElementVNode("div", { class: "form-notch-trailing" }, null, -1 /* CACHED */)
|
|
4039
|
+
]))]))
|
|
4040
|
+
: vue.createCommentVNode("v-if", true),
|
|
4041
|
+
(field.helper)
|
|
4042
|
+
? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4043
|
+
key: 3,
|
|
4044
|
+
class: vue.normalizeClass(getElementClass('helperText')),
|
|
4045
|
+
innerHTML: field.helper
|
|
4046
|
+
}, null, 10 /* CLASS, PROPS */, _hoisted_19$1))
|
|
4047
|
+
: vue.createCommentVNode("v-if", true),
|
|
4048
|
+
(validationErrors.value[field.field])
|
|
4049
|
+
? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4050
|
+
key: 4,
|
|
4051
|
+
class: vue.normalizeClass(getElementClass('invalidFeedback'))
|
|
4052
|
+
}, vue.toDisplayString(validationErrors.value[field.field]), 3 /* TEXT, CLASS */))
|
|
4053
|
+
: vue.createCommentVNode("v-if", true)
|
|
4054
|
+
], 64 /* STABLE_FRAGMENT */))
|
|
4055
|
+
], 2 /* CLASS */))
|
|
4056
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
4057
|
+
], 512 /* NEED_PATCH */)), [
|
|
4058
|
+
[vue.vShow, currentStep.value === stepIndex]
|
|
4059
|
+
])
|
|
3758
4060
|
}), 128 /* KEYED_FRAGMENT */)),
|
|
3759
4061
|
vue.renderSlot(_ctx.$slots, "default"),
|
|
4062
|
+
vue.createCommentVNode(" Navigation Buttons "),
|
|
3760
4063
|
vue.createElementVNode("div", {
|
|
3761
|
-
class: vue.normalizeClass(
|
|
4064
|
+
class: vue.normalizeClass(["sh-form-navigation", formSteps.value.length > 1 ? 'd-flex':''])
|
|
3762
4065
|
}, [
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
4066
|
+
(currentStep.value > 0)
|
|
4067
|
+
? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4068
|
+
key: 0,
|
|
4069
|
+
class: vue.normalizeClass(getElementClass('formGroup'))
|
|
4070
|
+
}, [
|
|
4071
|
+
vue.createElementVNode("button", {
|
|
4072
|
+
type: "button",
|
|
4073
|
+
class: vue.normalizeClass([getElementClass('actionBtn'), 'sh-btn-previous']),
|
|
4074
|
+
onClick: _cache[0] || (_cache[0] = $event => (currentStep.value -= 1)),
|
|
4075
|
+
disabled: loading.value
|
|
4076
|
+
}, [
|
|
4077
|
+
_cache[4] || (_cache[4] = vue.createElementVNode("span", { class: "sh-btn-icon" }, "←", -1 /* CACHED */)),
|
|
4078
|
+
vue.createElementVNode("span", null, vue.toDisplayString(currentStepObject.value.labels?.previous || 'Previous'), 1 /* TEXT */)
|
|
4079
|
+
], 10 /* CLASS, PROPS */, _hoisted_20$1)
|
|
4080
|
+
], 2 /* CLASS */))
|
|
4081
|
+
: vue.createCommentVNode("v-if", true),
|
|
4082
|
+
(!isLastStep.value)
|
|
4083
|
+
? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4084
|
+
key: 1,
|
|
4085
|
+
class: vue.normalizeClass(getElementClass('formGroup') + ' ms-auto')
|
|
4086
|
+
}, [
|
|
4087
|
+
vue.createElementVNode("button", {
|
|
4088
|
+
type: "button",
|
|
4089
|
+
class: vue.normalizeClass([getElementClass('actionBtn'), 'sh-btn-next']),
|
|
4090
|
+
onClick: _cache[1] || (_cache[1] = $event => (currentStep.value += 1)),
|
|
4091
|
+
disabled: loading.value
|
|
4092
|
+
}, [
|
|
4093
|
+
vue.createElementVNode("span", null, vue.toDisplayString(currentStepObject.value.labels?.next || 'Next'), 1 /* TEXT */),
|
|
4094
|
+
_cache[5] || (_cache[5] = vue.createElementVNode("span", { class: "sh-btn-icon" }, "→", -1 /* CACHED */))
|
|
4095
|
+
], 10 /* CLASS, PROPS */, _hoisted_21$1)
|
|
4096
|
+
], 2 /* CLASS */))
|
|
4097
|
+
: vue.createCommentVNode("v-if", true),
|
|
4098
|
+
(isLastStep.value)
|
|
4099
|
+
? (vue.openBlock(), vue.createElementBlock("div", {
|
|
4100
|
+
key: 2,
|
|
4101
|
+
class: vue.normalizeClass(getElementClass('formGroup') + ' ms-auto')
|
|
4102
|
+
}, [
|
|
4103
|
+
vue.createElementVNode("button", {
|
|
4104
|
+
style: vue.normalizeStyle({width: submitBtnWidth.value}),
|
|
4105
|
+
ref_key: "submitBtn",
|
|
4106
|
+
ref: submitBtn,
|
|
4107
|
+
disabled: loading.value,
|
|
4108
|
+
class: vue.normalizeClass([getElementClass('actionBtn'), 'sh-btn-submit'])
|
|
4109
|
+
}, [
|
|
4110
|
+
(loading.value)
|
|
4111
|
+
? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
4112
|
+
_cache[6] || (_cache[6] = vue.createElementVNode("span", {
|
|
4113
|
+
class: "spinner-border spinner-border-sm",
|
|
4114
|
+
role: "status",
|
|
4115
|
+
"aria-hidden": "true"
|
|
4116
|
+
}, null, -1 /* CACHED */)),
|
|
4117
|
+
_cache[7] || (_cache[7] = vue.createElementVNode("span", { class: "ms-2 d-none" }, "Processing...", -1 /* CACHED */))
|
|
4118
|
+
], 64 /* STABLE_FRAGMENT */))
|
|
4119
|
+
: vue.createCommentVNode("v-if", true),
|
|
4120
|
+
(!loading.value)
|
|
4121
|
+
? (vue.openBlock(), vue.createElementBlock("span", _hoisted_23$1, vue.toDisplayString(__props.actionLabel), 1 /* TEXT */))
|
|
4122
|
+
: vue.createCommentVNode("v-if", true)
|
|
4123
|
+
], 14 /* CLASS, STYLE, PROPS */, _hoisted_22$1)
|
|
4124
|
+
], 2 /* CLASS */))
|
|
4125
|
+
: vue.createCommentVNode("v-if", true)
|
|
3777
4126
|
], 2 /* CLASS */)
|
|
3778
4127
|
], 34 /* CLASS, NEED_HYDRATION */))
|
|
3779
4128
|
}
|
|
@@ -3781,6 +4130,7 @@ return (_ctx, _cache) => {
|
|
|
3781
4130
|
|
|
3782
4131
|
};
|
|
3783
4132
|
|
|
4133
|
+
script$q.__scopeId = "data-v-9443b7a4";
|
|
3784
4134
|
script$q.__file = "src/lib/components/ShAutoForm.vue";
|
|
3785
4135
|
|
|
3786
4136
|
const _hoisted_1$k = ["id", "data-bs-backdrop"];
|