Skip to content

Commit

Permalink
FIO-6370: Fixes issues with PasswordStrength Addon settings (#5158)
Browse files Browse the repository at this point in the history
* FIO-6370: Fixes issues with PasswordStrength Addon settings

* Removed redundant file

---------

Co-authored-by: Travis Tidwell <[email protected]>
  • Loading branch information
alexandraRamanenka and travist authored Oct 4, 2023
1 parent 3578c96 commit efe2abc
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/WebformBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -1588,8 +1588,15 @@ export default class WebformBuilder extends Component {
}
}

// If the edit form has any nested form inside, we get a partial data (nested form's data) in the
// event.data property
let editFormData;
if (event.changed.instance && event.changed.instance.root && event.changed.instance.root.id !== this.editForm.id) {
editFormData = this.editForm.data;
}

// Update the component.
this.updateComponent(event.data.componentJson || event.data, event.changed);
this.updateComponent(event.data.componentJson || editFormData || event.data, event.changed);
}
});

Expand Down
6 changes: 5 additions & 1 deletion src/addons/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ export const editForms = [
key: 'settings',
display: 'form',
input: true,
components,
components: components.map((comp) => {
comp.tableView = false;
return comp;
}),
tableView: false,
defaultValue: {
data: defaultSettings
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,33 @@ export default [
input: true,
key: 'addons',
label: 'Addons',
templates: {
// eslint-disable-next-line quotes
header: `<div class="row">
<div class="col-6">{{ t(components[0].label) }}</div>
<div class="col-4">Settings</div>
</div>`,
// eslint-disable-next-line quotes
row: `<div class="row">
<div class="col-6">
{{ row.name.label }}
</div>
<div class="col-4 text-muted">
Click Edit to see addon's settings
</div>
{% if (!instance.options.readOnly && !instance.disabled) { %}
<div class="col-2">
<div class="btn-group pull-right">
<button class="btn btn-default btn-light btn-sm editRow"><i class="{{ iconClass('edit') }}"></i></button>
{% if (!instance.hasRemoveButtons || instance.hasRemoveButtons()) { %}
<button class="btn btn-danger btn-sm removeRow"><i class="{{ iconClass('trash') }}"></i></button>
{% } %}
</div>
</div>
{% } %}
</div>`,
},
components: [
{
label: 'Name',
Expand All @@ -32,7 +59,10 @@ export default [
}));
},
},
input: true
input: true,
validate: {
required: true,
},
},
...editForms,
]
Expand Down
29 changes: 29 additions & 0 deletions src/components/file/fixtures/comp3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export default {
type: 'form',
display: 'form',
components: [
{
label: 'Upload',
tableView: false,
storage: 'base64',
webcam: false,
fileTypes: [
{
label: '',
value: ''
}
],
key: 'file',
type: 'file',
input: true
},
{
type: 'button',
label: 'Submit',
key: 'submit',
disableOnInvalid: true,
input: true,
tableView: false
}
],
};

0 comments on commit efe2abc

Please sign in to comment.