1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | import { __extends } from "tslib";
|
24 | import { MDCComponent } from '@material/base/component';
|
25 | import { MDCRipple } from '@material/ripple/component';
|
26 | import { MDCRippleFoundation } from '@material/ripple/foundation';
|
27 | import { strings } from './constants';
|
28 | import { MDCChipTrailingActionFoundation } from './foundation';
|
29 | var MDCChipTrailingAction = (function (_super) {
|
30 | __extends(MDCChipTrailingAction, _super);
|
31 | function MDCChipTrailingAction() {
|
32 | return _super !== null && _super.apply(this, arguments) || this;
|
33 | }
|
34 | Object.defineProperty(MDCChipTrailingAction.prototype, "ripple", {
|
35 | get: function () {
|
36 | return this.rippleSurface;
|
37 | },
|
38 | enumerable: false,
|
39 | configurable: true
|
40 | });
|
41 | MDCChipTrailingAction.attachTo = function (root) {
|
42 | return new MDCChipTrailingAction(root);
|
43 | };
|
44 | MDCChipTrailingAction.prototype.initialize = function (rippleFactory) {
|
45 | if (rippleFactory === void 0) { rippleFactory = function (el, foundation) {
|
46 | return new MDCRipple(el, foundation);
|
47 | }; }
|
48 |
|
49 |
|
50 |
|
51 | var rippleAdapter = MDCRipple.createAdapter(this);
|
52 | this.rippleSurface =
|
53 | rippleFactory(this.root, new MDCRippleFoundation(rippleAdapter));
|
54 | };
|
55 | MDCChipTrailingAction.prototype.initialSyncWithDOM = function () {
|
56 | var _this = this;
|
57 | this.handleClick = function (evt) {
|
58 | _this.foundation.handleClick(evt);
|
59 | };
|
60 | this.handleKeydown = function (evt) {
|
61 | _this.foundation.handleKeydown(evt);
|
62 | };
|
63 | this.listen('click', this.handleClick);
|
64 | this.listen('keydown', this.handleKeydown);
|
65 | };
|
66 | MDCChipTrailingAction.prototype.destroy = function () {
|
67 | this.rippleSurface.destroy();
|
68 | this.unlisten('click', this.handleClick);
|
69 | this.unlisten('keydown', this.handleKeydown);
|
70 | _super.prototype.destroy.call(this);
|
71 | };
|
72 | MDCChipTrailingAction.prototype.getDefaultFoundation = function () {
|
73 | var _this = this;
|
74 |
|
75 |
|
76 |
|
77 | var adapter = {
|
78 | focus: function () {
|
79 |
|
80 | _this.root.focus();
|
81 | },
|
82 | getAttribute: function (attr) { return _this.root.getAttribute(attr); },
|
83 | notifyInteraction: function (trigger) {
|
84 | return _this.emit(strings.INTERACTION_EVENT, { trigger: trigger }, true );
|
85 | },
|
86 | notifyNavigation: function (key) {
|
87 | _this.emit(strings.NAVIGATION_EVENT, { key: key }, true );
|
88 | },
|
89 | setAttribute: function (attr, value) {
|
90 | _this.root.setAttribute(attr, value);
|
91 | },
|
92 | };
|
93 | return new MDCChipTrailingActionFoundation(adapter);
|
94 | };
|
95 | MDCChipTrailingAction.prototype.isNavigable = function () {
|
96 | return this.foundation.isNavigable();
|
97 | };
|
98 | MDCChipTrailingAction.prototype.focus = function () {
|
99 | this.foundation.focus();
|
100 | };
|
101 | MDCChipTrailingAction.prototype.removeFocus = function () {
|
102 | this.foundation.removeFocus();
|
103 | };
|
104 | return MDCChipTrailingAction;
|
105 | }(MDCComponent));
|
106 | export { MDCChipTrailingAction };
|
107 |
|
\ | No newline at end of file |