-
Notifications
You must be signed in to change notification settings - Fork 332
/
paper-backdrop.js
50 lines (42 loc) · 1.23 KB
/
paper-backdrop.js
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
41
42
43
44
45
46
47
48
49
50
/**
* @module ember-paper
*/
import { bool } from '@ember/object/computed';
import Component from '@ember/component';
import { computed } from '@ember/object';
import { htmlSafe } from '@ember/string';
import TransitionMixin from 'ember-css-transitions/mixins/transition-mixin';
import { invokeAction } from 'ember-invoke-action';
/**
* @class PaperBackdrop
* @extends Ember.Component
* @uses TransitionMixin
*/
export default Component.extend(TransitionMixin, {
tagName: 'md-backdrop',
classNames: ['md-default-theme'],
classNameBindings: ['opaque:md-opaque', 'isLockedOpen:md-locked-open'],
attributeBindings: ['backdropStyle:style'],
// TransitionMixin:
transitionName: 'ng',
shouldTransition: bool('opaque'),
backdropStyle: computed('fixed', function() {
return this.get('fixed') ? htmlSafe('position:fixed;') : null;
}),
addDestroyedElementClone(original, clone) {
original.parentNode.appendChild(clone);
},
sendClickAction(e) {
e.preventDefault();
invokeAction(this, 'onClick', e);
},
click(e) {
this.sendClickAction(e);
},
// needed for iOS
// iOS doesn't trigger a click event on normal divs
// unless we use `cursor: pointer` css
touchEnd(e) {
this.sendClickAction(e);
}
});