Skip to content

Commit

Permalink
Merge branch 'master' into FIO-8575-fix-google-maps-provider
Browse files Browse the repository at this point in the history
  • Loading branch information
roma-formio committed Jul 9, 2024
2 parents aaac4af + d19792c commit 61b6c22
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/Formio.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,5 @@ if (typeof window !== 'undefined') {
FormioCore.addToGlobal(window);
}

FormioEmbed._formioReady(FormioCore);
export { FormioCore as Formio };
6 changes: 4 additions & 2 deletions src/Webform.js
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ export default class Webform extends NestedDataComponent {
* Sets the submission value
* @param {object|null|undefined} submission - The submission to set.
* @param {object|null|undefined} flags - Any flags to apply when setting the submission.
* @return {void}
* @returns {void}
*/
onSetSubmission(submission, flags = {}) {
this.submissionSet = true;
Expand Down Expand Up @@ -998,7 +998,9 @@ export default class Webform extends NestedDataComponent {
"submitButton",
(options) => {
this.submit(false, options).catch((e) => {
options.instance.loading = false;
if (options?.instance) {
options.instance.loading = false;
}
return e !== false && e !== undefined && console.log(e);
});
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/_classes/component/Component.js
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,7 @@ export default class Component extends Element {
/**
* Renders a modal preview template and returns the markup as a string
* @param {object|null|undefined} ctx - The rendering context
* @return {string} - The modal preview markup
* @returns {string} - The modal preview markup
*/
renderModalPreview(ctx) {
return this.renderTemplate('modalPreview', ctx || {});
Expand Down Expand Up @@ -1272,7 +1272,7 @@ export default class Component extends Element {
* Creates the tooltip instance using tippy.js and returns it
* @param {HTMLElement} tooltipEl - HTML element to attach the tooltip
* @param {object|null|undefined} settings - tippy.js options
* @return {import('tippy.js').Tippy} - tippy.js instance
* @returns {import('tippy.js').Tippy} - tippy.js instance
*/
createTooltip(tooltipEl, settings = {}) {
const tooltipAttribute = tooltipEl.getAttribute('data-tooltip');
Expand Down
25 changes: 24 additions & 1 deletion src/components/_classes/input/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,30 @@ export default class Input extends Multivalue {
if (key === 13) {
event.preventDefault();
event.stopPropagation();
this.emit('submitButton');
let submitButton = null;
if (this.root?.everyComponent) {
this.root.everyComponent((component) => {
if (
component?.component.type === 'button' &&
component?.component.action === 'submit'
) {
submitButton = component;
return false;
}
});
}
const options = {};
if (submitButton) {
options.instance = submitButton;
options.component = submitButton.component;
options.noValidate = this.component.state === 'draft';
options.state = this.component.state || 'submitted';
submitButton.loading = true;
this.emit('submitButton', options);
}
else {
this.emit('submitButton', options);
}
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/form/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ export default class FormComponent extends Component {
* Sets the subform value
* @param {object|null|undefined} submission - The submission to set.
* @param {object|null|undefined} flags - Any flags to apply when setting the submission.
* @return {void}
* @returns {void}
*/
onSetSubFormValue(submission, flags) {
this.subForm.setValue(submission, flags);
Expand Down

0 comments on commit 61b6c22

Please sign in to comment.