Allow deleting the entry while creating/adding new label to enumeration type. #8208

This commit is contained in:
Yogesh Mahajan 2024-12-16 14:54:24 +05:30 committed by GitHub
parent 776e092a89
commit a0cd6c6a88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -209,7 +209,7 @@ class EnumerationSchema extends BaseUISchema {
return [
{
id: 'label', label: gettext('Label'),
type: 'text', cell: 'text', minWidth: 640,
type: 'text', cell: 'text', minWidth: 620,
editable: (state) => {
return _.isUndefined(obj.isNew) ? true : obj.isNew(state);
}
@ -1301,6 +1301,7 @@ export default class TypeSchema extends BaseUISchema {
},
{
id: 'enum', label: gettext('Enumeration type'),
editable: true,
schema: new EnumerationSchema(),
type: 'collection',
group: gettext('Definition'), mode: ['edit', 'create'],
@ -1308,14 +1309,12 @@ export default class TypeSchema extends BaseUISchema {
return !obj.isInvalidColumnAdded(state);
},
canEdit: false,
canDeleteRow: function(state) {
// We will disable it if it's in 'edit' mode
return obj.isNew(state);
},
canEditRow: false,
canDelete: true,
canReorder: (state)=>(this.isNew(state)),
canDeleteRow: (state)=>(_.isUndefined(state.label)),
canEditRow: true,
disabled: () => obj.inCatalog(),
deps: ['typtype'],
uniqueCol : ['label'],
visible: (state) => isVisible(state, 'e'),
}, {
type: 'nested-fieldset',