1
0
Fork 0

Only clear mapped properties if the field id remains the same

Dieser Commit ist enthalten in:
Angus McLeod 2020-04-14 16:06:02 +10:00
Ursprung d128565979
Commit 303c79be1f

Datei anzeigen

@ -19,11 +19,21 @@ export default Component.extend({
showMinLength: or('isText', 'isTextarea', 'isUrl', 'isComposer'), showMinLength: or('isText', 'isTextarea', 'isUrl', 'isComposer'),
categoryPropertyTypes: selectKitContent(['id', 'slug']), categoryPropertyTypes: selectKitContent(['id', 'slug']),
@observes('field.type') // clearMapped only clears mapped fields if the field type of a specific field
clearMapped() { // changes, and not when switching between fields. Switching between fields also
schema.field.mapped.forEach(property => { // changes the field.type property in this component
this.set(`field.${property}`, null);
}); @observes('field.id', 'field.type')
clearMapped(ctx, changed) {
if (this.field.id === this.bufferedFieldId) {
schema.field.mapped.forEach(property => {
this.set(`field.${property}`, null);
});
}
if (changed === 'field.type') {
this.set('bufferedFieldId', this.field.id);
}
}, },
setupTypeOutput(fieldType, options) { setupTypeOutput(fieldType, options) {