@iankibetsh/shframework 5.1.7 → 5.1.9
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 +12 -4
- package/dist/library.mjs +12 -4
- package/package.json +1 -1
package/dist/library.js
CHANGED
|
@@ -3383,7 +3383,7 @@ var script$q = {
|
|
|
3383
3383
|
'action', 'successCallback', 'retainDataAfterSubmission',
|
|
3384
3384
|
'successMessage', 'fields', 'customComponents', 'placeHolders',
|
|
3385
3385
|
'formClasses',
|
|
3386
|
-
'helperTexts', 'labels', 'data',
|
|
3386
|
+
'helperTexts', 'labels', 'data','preSubmitCallback',
|
|
3387
3387
|
'fillSelects',
|
|
3388
3388
|
'formClass',
|
|
3389
3389
|
'actionLabel',
|
|
@@ -3486,7 +3486,7 @@ const fieldChanged = field => {
|
|
|
3486
3486
|
emit('fieldChanged', field, formFields.value.filter(f => f.field === field)[0].value, data);
|
|
3487
3487
|
}, 300);
|
|
3488
3488
|
};
|
|
3489
|
-
const getComponentProps =
|
|
3489
|
+
const getComponentProps = (field) => {
|
|
3490
3490
|
const newField = {...field};
|
|
3491
3491
|
delete newField.component;
|
|
3492
3492
|
delete newField.value;
|
|
@@ -3497,7 +3497,7 @@ const loading = vue.ref(false);
|
|
|
3497
3497
|
const submitBtn = vue.ref(false);
|
|
3498
3498
|
const validationErrors = vue.ref({});
|
|
3499
3499
|
const formError = vue.ref(null);
|
|
3500
|
-
const submitForm = e => {
|
|
3500
|
+
const submitForm = async (e) => {
|
|
3501
3501
|
submitBtnWidth.value = submitBtn.value.getBoundingClientRect().width + 'px !important';
|
|
3502
3502
|
validationErrors.value = {};
|
|
3503
3503
|
e.preventDefault();
|
|
@@ -3506,6 +3506,13 @@ const submitForm = e => {
|
|
|
3506
3506
|
formFields.value.map(field => {
|
|
3507
3507
|
data[field.field] = field.value;
|
|
3508
3508
|
});
|
|
3509
|
+
if (props.preSubmitCallback) {
|
|
3510
|
+
const callbackkRes = await props.preSubmitCallback(data);
|
|
3511
|
+
if (callbackkRes !== true) {
|
|
3512
|
+
loading.value = false;
|
|
3513
|
+
return false
|
|
3514
|
+
}
|
|
3515
|
+
}
|
|
3509
3516
|
if (props.gqlMutation) {
|
|
3510
3517
|
let args = `(`;
|
|
3511
3518
|
let selectFields = Object.keys(data);
|
|
@@ -3520,6 +3527,7 @@ const submitForm = e => {
|
|
|
3520
3527
|
args = '';
|
|
3521
3528
|
}
|
|
3522
3529
|
emit('preSubmit', data);
|
|
3530
|
+
|
|
3523
3531
|
const mutation = `{\n${props.gqlMutation} ${args} {\n${selectFields.join(`\n`)}\n}\n}`;
|
|
3524
3532
|
shApis.graphQlMutate(mutation).then(res => handleSuccessRequest(res)).catch(reason => handlefailedRequest(reason));
|
|
3525
3533
|
} else {
|
|
@@ -4532,7 +4540,7 @@ return (_ctx, _cache) => {
|
|
|
4532
4540
|
? (vue.openBlock(), vue.createElementBlock("button", {
|
|
4533
4541
|
key: 3,
|
|
4534
4542
|
title: __props.action.title,
|
|
4535
|
-
class: vue.normalizeClass(__props.action.class ? __props.action.class:'btn btn-default ' + __props.actionClass),
|
|
4543
|
+
class: vue.normalizeClass(__props.action.class ? __props.action.class+' btn':'btn btn-default ' + __props.actionClass),
|
|
4536
4544
|
onClick: _cache[6] || (_cache[6] = $event => (doEmitAction(__props.action.emits, __props.record)))
|
|
4537
4545
|
}, [
|
|
4538
4546
|
(__props.action.icon)
|
package/dist/library.mjs
CHANGED
|
@@ -3371,7 +3371,7 @@ var script$q = {
|
|
|
3371
3371
|
'action', 'successCallback', 'retainDataAfterSubmission',
|
|
3372
3372
|
'successMessage', 'fields', 'customComponents', 'placeHolders',
|
|
3373
3373
|
'formClasses',
|
|
3374
|
-
'helperTexts', 'labels', 'data',
|
|
3374
|
+
'helperTexts', 'labels', 'data','preSubmitCallback',
|
|
3375
3375
|
'fillSelects',
|
|
3376
3376
|
'formClass',
|
|
3377
3377
|
'actionLabel',
|
|
@@ -3474,7 +3474,7 @@ const fieldChanged = field => {
|
|
|
3474
3474
|
emit('fieldChanged', field, formFields.value.filter(f => f.field === field)[0].value, data);
|
|
3475
3475
|
}, 300);
|
|
3476
3476
|
};
|
|
3477
|
-
const getComponentProps =
|
|
3477
|
+
const getComponentProps = (field) => {
|
|
3478
3478
|
const newField = {...field};
|
|
3479
3479
|
delete newField.component;
|
|
3480
3480
|
delete newField.value;
|
|
@@ -3485,7 +3485,7 @@ const loading = ref(false);
|
|
|
3485
3485
|
const submitBtn = ref(false);
|
|
3486
3486
|
const validationErrors = ref({});
|
|
3487
3487
|
const formError = ref(null);
|
|
3488
|
-
const submitForm = e => {
|
|
3488
|
+
const submitForm = async (e) => {
|
|
3489
3489
|
submitBtnWidth.value = submitBtn.value.getBoundingClientRect().width + 'px !important';
|
|
3490
3490
|
validationErrors.value = {};
|
|
3491
3491
|
e.preventDefault();
|
|
@@ -3494,6 +3494,13 @@ const submitForm = e => {
|
|
|
3494
3494
|
formFields.value.map(field => {
|
|
3495
3495
|
data[field.field] = field.value;
|
|
3496
3496
|
});
|
|
3497
|
+
if (props.preSubmitCallback) {
|
|
3498
|
+
const callbackkRes = await props.preSubmitCallback(data);
|
|
3499
|
+
if (callbackkRes !== true) {
|
|
3500
|
+
loading.value = false;
|
|
3501
|
+
return false
|
|
3502
|
+
}
|
|
3503
|
+
}
|
|
3497
3504
|
if (props.gqlMutation) {
|
|
3498
3505
|
let args = `(`;
|
|
3499
3506
|
let selectFields = Object.keys(data);
|
|
@@ -3508,6 +3515,7 @@ const submitForm = e => {
|
|
|
3508
3515
|
args = '';
|
|
3509
3516
|
}
|
|
3510
3517
|
emit('preSubmit', data);
|
|
3518
|
+
|
|
3511
3519
|
const mutation = `{\n${props.gqlMutation} ${args} {\n${selectFields.join(`\n`)}\n}\n}`;
|
|
3512
3520
|
shApis.graphQlMutate(mutation).then(res => handleSuccessRequest(res)).catch(reason => handlefailedRequest(reason));
|
|
3513
3521
|
} else {
|
|
@@ -4520,7 +4528,7 @@ return (_ctx, _cache) => {
|
|
|
4520
4528
|
? (openBlock(), createElementBlock("button", {
|
|
4521
4529
|
key: 3,
|
|
4522
4530
|
title: __props.action.title,
|
|
4523
|
-
class: normalizeClass(__props.action.class ? __props.action.class:'btn btn-default ' + __props.actionClass),
|
|
4531
|
+
class: normalizeClass(__props.action.class ? __props.action.class+' btn':'btn btn-default ' + __props.actionClass),
|
|
4524
4532
|
onClick: _cache[6] || (_cache[6] = $event => (doEmitAction(__props.action.emits, __props.record)))
|
|
4525
4533
|
}, [
|
|
4526
4534
|
(__props.action.icon)
|