diff options
author | 2019-04-11 12:00:07 +0200 | |
---|---|---|
committer | 2019-04-11 12:00:07 +0200 | |
commit | e43d6bd80b3d76aae627fa8174eea98c14016549 (patch) | |
tree | de1d0a3ba10100ce68d0cb1ed618095e362fe573 /packages/forms/src/input/index.tsx | |
parent | implements basic release announcement feature (diff) | |
parent | handle deleted services that are attached to workspaces (diff) | |
download | ferdium-app-e43d6bd80b3d76aae627fa8174eea98c14016549.tar.gz ferdium-app-e43d6bd80b3d76aae627fa8174eea98c14016549.tar.zst ferdium-app-e43d6bd80b3d76aae627fa8174eea98c14016549.zip |
merge-in workspace feature
Diffstat (limited to 'packages/forms/src/input/index.tsx')
-rw-r--r-- | packages/forms/src/input/index.tsx | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/packages/forms/src/input/index.tsx b/packages/forms/src/input/index.tsx index 478738cad..a2d7c62d5 100644 --- a/packages/forms/src/input/index.tsx +++ b/packages/forms/src/input/index.tsx | |||
@@ -25,6 +25,7 @@ interface IProps extends React.InputHTMLAttributes<HTMLInputElement>, IFormField | |||
25 | showPasswordToggle?: boolean; | 25 | showPasswordToggle?: boolean; |
26 | data: IData; | 26 | data: IData; |
27 | inputClassName?: string; | 27 | inputClassName?: string; |
28 | onEnterKey?: Function; | ||
28 | } | 29 | } |
29 | 30 | ||
30 | interface IState { | 31 | interface IState { |
@@ -33,7 +34,7 @@ interface IState { | |||
33 | } | 34 | } |
34 | 35 | ||
35 | class InputComponent extends Component<IProps, IState> { | 36 | class InputComponent extends Component<IProps, IState> { |
36 | public static defaultProps = { | 37 | static defaultProps = { |
37 | focus: false, | 38 | focus: false, |
38 | onChange: () => {}, | 39 | onChange: () => {}, |
39 | onBlur: () => {}, | 40 | onBlur: () => {}, |
@@ -81,6 +82,13 @@ class InputComponent extends Component<IProps, IState> { | |||
81 | } | 82 | } |
82 | } | 83 | } |
83 | 84 | ||
85 | onInputKeyPress(e: React.KeyboardEvent) { | ||
86 | if (e.key === "Enter") { | ||
87 | const { onEnterKey } = this.props; | ||
88 | onEnterKey && onEnterKey(); | ||
89 | } | ||
90 | } | ||
91 | |||
84 | render() { | 92 | render() { |
85 | const { | 93 | const { |
86 | classes, | 94 | classes, |
@@ -102,6 +110,10 @@ class InputComponent extends Component<IProps, IState> { | |||
102 | spellCheck, | 110 | spellCheck, |
103 | onBlur, | 111 | onBlur, |
104 | onFocus, | 112 | onFocus, |
113 | min, | ||
114 | max, | ||
115 | step, | ||
116 | required, | ||
105 | } = this.props; | 117 | } = this.props; |
106 | 118 | ||
107 | const { | 119 | const { |
@@ -120,6 +132,8 @@ class InputComponent extends Component<IProps, IState> { | |||
120 | title={label} | 132 | title={label} |
121 | showLabel={showLabel} | 133 | showLabel={showLabel} |
122 | htmlFor={id} | 134 | htmlFor={id} |
135 | className={classes.label} | ||
136 | isRequired={required} | ||
123 | > | 137 | > |
124 | <div | 138 | <div |
125 | className={classnames({ | 139 | className={classnames({ |
@@ -147,6 +161,10 @@ class InputComponent extends Component<IProps, IState> { | |||
147 | onFocus={onFocus} | 161 | onFocus={onFocus} |
148 | onBlur={onBlur} | 162 | onBlur={onBlur} |
149 | disabled={disabled} | 163 | disabled={disabled} |
164 | onKeyPress={this.onInputKeyPress.bind(this)} | ||
165 | min={min} | ||
166 | max={max} | ||
167 | step={step} | ||
150 | /> | 168 | /> |
151 | {suffix && ( | 169 | {suffix && ( |
152 | <span className={classes.suffix}> | 170 | <span className={classes.suffix}> |