forked from p15670423/monkey
ui: remove disabled/readonly from AdvancedMultiSelect
This commit is contained in:
parent
9f12702c3e
commit
09a8415aec
|
@ -11,7 +11,6 @@ import {getFullDefinitionByKey} from './JsonSchemaHelpers';
|
||||||
function AdvancedMultiSelectHeader(props) {
|
function AdvancedMultiSelectHeader(props) {
|
||||||
const {
|
const {
|
||||||
title,
|
title,
|
||||||
disabled,
|
|
||||||
onCheckboxClick,
|
onCheckboxClick,
|
||||||
checkboxState,
|
checkboxState,
|
||||||
hideReset,
|
hideReset,
|
||||||
|
@ -20,7 +19,7 @@ function AdvancedMultiSelectHeader(props) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card.Header className="d-flex justify-content-between">
|
<Card.Header className="d-flex justify-content-between">
|
||||||
<MasterCheckbox title={title} disabled={disabled} onClick={onCheckboxClick} checkboxState={checkboxState}/>
|
<MasterCheckbox title={title} onClick={onCheckboxClick} checkboxState={checkboxState}/>
|
||||||
<Button className={'reset-safe-defaults'} type={'reset'} variant={'warning'}
|
<Button className={'reset-safe-defaults'} type={'reset'} variant={'warning'}
|
||||||
hidden={hideReset} onClick={onResetClick}>
|
hidden={hideReset} onClick={onResetClick}>
|
||||||
Reset to safe defaults
|
Reset to safe defaults
|
||||||
|
@ -165,8 +164,6 @@ class AdvancedMultiSelect extends React.Component {
|
||||||
schema,
|
schema,
|
||||||
id,
|
id,
|
||||||
required,
|
required,
|
||||||
disabled,
|
|
||||||
readonly,
|
|
||||||
multiple,
|
multiple,
|
||||||
autofocus
|
autofocus
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
@ -174,12 +171,12 @@ class AdvancedMultiSelect extends React.Component {
|
||||||
return (
|
return (
|
||||||
<div className={'advanced-multi-select'}>
|
<div className={'advanced-multi-select'}>
|
||||||
<AdvancedMultiSelectHeader title={schema.title}
|
<AdvancedMultiSelectHeader title={schema.title}
|
||||||
disabled={disabled} onCheckboxClick={this.onMasterCheckboxClick}
|
onCheckboxClick={this.onMasterCheckboxClick}
|
||||||
checkboxState={this.state.masterCheckboxState}
|
checkboxState={this.state.masterCheckboxState}
|
||||||
hideReset={this.state.hideReset} onResetClick={this.onResetClick}/>
|
hideReset={this.state.hideReset} onResetClick={this.onResetClick}/>
|
||||||
|
|
||||||
<ChildCheckboxContainer id={id} multiple={multiple} required={required}
|
<ChildCheckboxContainer id={id} multiple={multiple} required={required}
|
||||||
disabled={disabled || readonly} autoFocus={autofocus} isSafe={this.isSafe}
|
autoFocus={autofocus} isSafe={this.isSafe}
|
||||||
onPaneClick={this.setPaneInfo} onCheckboxClick={this.onChildCheckboxClick}
|
onPaneClick={this.setPaneInfo} onCheckboxClick={this.onChildCheckboxClick}
|
||||||
selectedValues={this.props.value} enumOptions={this.enumOptions}/>
|
selectedValues={this.props.value} enumOptions={this.enumOptions}/>
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ function ChildCheckboxContainer(props) {
|
||||||
id,
|
id,
|
||||||
multiple,
|
multiple,
|
||||||
required,
|
required,
|
||||||
disabled,
|
|
||||||
autofocus,
|
autofocus,
|
||||||
onPaneClick,
|
onPaneClick,
|
||||||
onCheckboxClick,
|
onCheckboxClick,
|
||||||
|
@ -26,13 +25,13 @@ function ChildCheckboxContainer(props) {
|
||||||
<Form.Group
|
<Form.Group
|
||||||
style={{height: `${getComponentHeight(enumOptions.length)}px`}}
|
style={{height: `${getComponentHeight(enumOptions.length)}px`}}
|
||||||
id={id} multiple={multiple} className='choice-block form-control'
|
id={id} multiple={multiple} className='choice-block form-control'
|
||||||
required={required} disabled={disabled} autoFocus={autofocus}>
|
required={required} autoFocus={autofocus}>
|
||||||
{
|
{
|
||||||
enumOptions.map(({value, label}, i) => {
|
enumOptions.map(({value, label}, i) => {
|
||||||
return (
|
return (
|
||||||
<ChildCheckbox key={i} onPaneClick={onPaneClick}
|
<ChildCheckbox key={i} onPaneClick={onPaneClick}
|
||||||
onClick={onCheckboxClick} value={value}
|
onClick={onCheckboxClick} value={value}
|
||||||
disabled={disabled} label={label} checkboxState={selectedValues.includes(value)}
|
label={label} checkboxState={selectedValues.includes(value)}
|
||||||
safe={isSafe(value)}/>
|
safe={isSafe(value)}/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +45,6 @@ function ChildCheckbox(props) {
|
||||||
onPaneClick,
|
onPaneClick,
|
||||||
onClick,
|
onClick,
|
||||||
value,
|
value,
|
||||||
disabled,
|
|
||||||
label,
|
label,
|
||||||
checkboxState,
|
checkboxState,
|
||||||
safe
|
safe
|
||||||
|
@ -54,7 +52,7 @@ function ChildCheckbox(props) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form.Group onClick={() => onPaneClick(value)}>
|
<Form.Group onClick={() => onPaneClick(value)}>
|
||||||
<Button value={value} variant={'link'} disabled={disabled} onClick={() => onClick(value)}>
|
<Button value={value} variant={'link'} onClick={() => onClick(value)}>
|
||||||
<FontAwesomeIcon icon={checkboxState ? faCheckSquare : faSquare}/>
|
<FontAwesomeIcon icon={checkboxState ? faCheckSquare : faSquare}/>
|
||||||
</Button>
|
</Button>
|
||||||
<span key={'label'} className={'option-text'}>{label}</span>
|
<span key={'label'} className={'option-text'}>{label}</span>
|
||||||
|
|
|
@ -15,7 +15,6 @@ const MasterCheckboxState = {
|
||||||
function MasterCheckbox(props) {
|
function MasterCheckbox(props) {
|
||||||
const {
|
const {
|
||||||
title,
|
title,
|
||||||
disabled,
|
|
||||||
onClick,
|
onClick,
|
||||||
checkboxState
|
checkboxState
|
||||||
} = props;
|
} = props;
|
||||||
|
@ -30,7 +29,7 @@ function MasterCheckbox(props) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={'master-checkbox'}>
|
<div className={'master-checkbox'}>
|
||||||
<Button key={`${title}-button`} variant={'link'} disabled={disabled} onClick={onClick}>
|
<Button key={`${title}-button`} variant={'link'} onClick={onClick}>
|
||||||
<FontAwesomeIcon icon={newCheckboxIcon}/>
|
<FontAwesomeIcon icon={newCheckboxIcon}/>
|
||||||
</Button>
|
</Button>
|
||||||
<span className={'header-title'}>{title}</span>
|
<span className={'header-title'}>{title}</span>
|
||||||
|
|
Loading…
Reference in New Issue