-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathmd-input.js
More file actions
40 lines (33 loc) · 804 Bytes
/
md-input.js
File metadata and controls
40 lines (33 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import Ember from 'ember';
import MaterializeInputField from './md-input-field';
import layout from '../templates/components/md-input';
const {
get,
} = Ember;
export default MaterializeInputField.extend({
layout,
type: 'text',
didInsertElement() {
this._super(...arguments);
// make sure the label moves when a value is bound.
this._setupLabel();
},
actions: {
enter(...args) {
this._sendAction('onEnter', ...args);
},
keyPress(...args) {
this._sendAction('onKeyPress', ...args);
},
keyUp(...args) {
this._sendAction('onKeyUp', ...args);
}
},
_sendAction(action, ...args) {
if (typeof get(this, action) === 'function') {
get(this, action)(...args);
} else {
this.sendAction(action, ...args);
}
}
});