mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-06-04 10:28:05 +00:00

lots of churn and changes but will allow to enforce linting again in the build system. Also switch over from var to let. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
46 lines
1006 B
JavaScript
46 lines
1006 B
JavaScript
Ext.define('Proxmox.form.Checkbox', {
|
|
extend: 'Ext.form.field.Checkbox',
|
|
alias: ['widget.proxmoxcheckbox'],
|
|
|
|
config: {
|
|
defaultValue: undefined,
|
|
deleteDefaultValue: false,
|
|
deleteEmpty: false,
|
|
},
|
|
|
|
inputValue: '1',
|
|
|
|
getSubmitData: function() {
|
|
let me = this,
|
|
data = null,
|
|
val;
|
|
if (!me.disabled && me.submitValue) {
|
|
val = me.getSubmitValue();
|
|
if (val !== null) {
|
|
data = {};
|
|
if (val === me.getDefaultValue() && me.getDeleteDefaultValue()) {
|
|
data.delete = me.getName();
|
|
} else {
|
|
data[me.getName()] = val;
|
|
}
|
|
} else if (me.getDeleteEmpty()) {
|
|
data = {};
|
|
data.delete = me.getName();
|
|
}
|
|
}
|
|
return data;
|
|
},
|
|
|
|
// also accept integer 1 as true
|
|
setRawValue: function(value) {
|
|
let me = this;
|
|
|
|
if (value === 1) {
|
|
me.callParent([true]);
|
|
} else {
|
|
me.callParent([value]);
|
|
}
|
|
},
|
|
|
|
});
|