Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix: disableFields option #508

Merged
merged 1 commit into from
May 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion demo/assets/js/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ jQuery(function($) {
typeUserDisabledAttrs: typeUserDisabledAttrs,
typeUserAttrs: typeUserAttrs,
disableInjectedStyle: false,
actionButtons: actionButtons
actionButtons: actionButtons,
disableFields: ['autocomplete']
// controlPosition: 'left'
// disabledAttrs
};
Expand Down
2 changes: 1 addition & 1 deletion demo/assets/js/form-builder.min.js

Large diffs are not rendered by default.

Binary file modified demo/assets/js/form-builder.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/form-builder.min.js

Large diffs are not rendered by default.

Binary file modified dist/form-builder.min.js.gz
Binary file not shown.
5 changes: 0 additions & 5 deletions src/js/form-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,6 @@ const FormBuilder = function(opts, element) {
});
}

// remove disableFields
if (opts.disableFields) {
controls = controls.filter(type => opts.disableFields.indexOf(type) == -1);
}

// append controls to list
h.orderFields(controlList).forEach(control => {
if (allControls[control]) {
Expand Down
5 changes: 5 additions & 0 deletions src/js/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,11 @@ export default class Helpers {
}
});

// remove disableFields
if (opts.disableFields.length) {
fieldOrder = fieldOrder.filter(type => opts.disableFields.indexOf(type) == -1);
}

return fieldOrder.filter(Boolean);
}

Expand Down