Fix ambigious clearing behaviour on SelectButton (#4107)
parent
0a08c56d3b
commit
b666789c8a
|
@ -51,6 +51,12 @@ const SelectButtonProps = [
|
||||||
name: 'unselectable',
|
name: 'unselectable',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
default: 'false',
|
default: 'false',
|
||||||
|
description: 'Whether selection can not be cleared.'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'allowEmpty',
|
||||||
|
type: 'boolean',
|
||||||
|
default: 'true',
|
||||||
description: 'Whether selection can be cleared.'
|
description: 'Whether selection can be cleared.'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,6 +16,10 @@ export default {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
allowEmpty: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
dataKey: null,
|
dataKey: null,
|
||||||
'aria-labelledby': {
|
'aria-labelledby': {
|
||||||
|
|
|
@ -155,10 +155,16 @@ export interface SelectButtonProps {
|
||||||
*/
|
*/
|
||||||
dataKey?: string | undefined;
|
dataKey?: string | undefined;
|
||||||
/**
|
/**
|
||||||
* Whether selection can be cleared.
|
* Whether selection can not be cleared.
|
||||||
* @defaultValue false
|
* @defaultValue false
|
||||||
|
* @deprecated Use 'allowEmpty' property instead.
|
||||||
*/
|
*/
|
||||||
unselectable?: boolean | undefined;
|
unselectable?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* Whether selection can be cleared.
|
||||||
|
* @defaultValue true
|
||||||
|
*/
|
||||||
|
allowEmpty?: boolean | undefined;
|
||||||
/**
|
/**
|
||||||
* Identifier of the underlying element.
|
* Identifier of the underlying element.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -81,7 +81,7 @@ export default {
|
||||||
|
|
||||||
let selected = this.isSelected(option);
|
let selected = this.isSelected(option);
|
||||||
|
|
||||||
if (selected && this.unselectable) {
|
if (selected && (this.unselectable || !this.allowEmpty)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42662,6 +42662,15 @@
|
||||||
"readonly": false,
|
"readonly": false,
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": "false",
|
"default": "false",
|
||||||
|
"description": "Whether selection can not be cleared.",
|
||||||
|
"deprecated": "Use 'allowEmpty' property instead."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "allowEmpty",
|
||||||
|
"optional": true,
|
||||||
|
"readonly": false,
|
||||||
|
"type": "boolean",
|
||||||
|
"default": "true",
|
||||||
"description": "Whether selection can be cleared."
|
"description": "Whether selection can be cleared."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue