-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
337 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...ecordEdition/EditRecord/uiElements/StandardField/StandardFieldValue/Inputs/ColorInput.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright LEAV Solutions 2017 | ||
// This file is released under LGPL V3 | ||
// License text available at https://www.gnu.org/licenses/lgpl-3.0.txt | ||
import {ColorPicker} from 'antd'; | ||
import {Color} from 'antd/es/color-picker'; | ||
import {IStandardInputProps} from 'components/RecordEdition/EditRecord/_types'; | ||
|
||
function ColorInput({state, fieldValue, onChange, onFocus}: IStandardInputProps): JSX.Element { | ||
const {editingValue} = fieldValue; | ||
const colorValue = '#' + editingValue.toString(); | ||
|
||
const _handleColorChange = (value: Color) => { | ||
onChange(value.toHex().toUpperCase()); | ||
}; | ||
const colorPickerStyle: React.CSSProperties = { | ||
height: fieldValue.index ? '44px' : '54px', | ||
width: '100%', | ||
justifyContent: 'left', | ||
paddingTop: fieldValue.index ? '4px' : '14px', | ||
paddingLeft: '15px' | ||
}; | ||
|
||
return ( | ||
<ColorPicker | ||
showText | ||
disabledAlpha | ||
disabled={state.isReadOnly} | ||
value={colorValue} | ||
style={colorPickerStyle} | ||
open={fieldValue.isEditing} | ||
size="small" | ||
onChangeComplete={_handleColorChange} | ||
onOpenChange={onFocus} | ||
/> | ||
); | ||
} | ||
|
||
export default ColorInput; |
Oops, something went wrong.