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 { MDCLinearProgressFoundation } from './foundation';
|
26 | var MDCLinearProgress = (function (_super) {
|
27 | __extends(MDCLinearProgress, _super);
|
28 | function MDCLinearProgress() {
|
29 | return _super !== null && _super.apply(this, arguments) || this;
|
30 | }
|
31 | MDCLinearProgress.attachTo = function (root) {
|
32 | return new MDCLinearProgress(root);
|
33 | };
|
34 | Object.defineProperty(MDCLinearProgress.prototype, "determinate", {
|
35 | set: function (value) {
|
36 | this.foundation.setDeterminate(value);
|
37 | },
|
38 | enumerable: false,
|
39 | configurable: true
|
40 | });
|
41 | Object.defineProperty(MDCLinearProgress.prototype, "progress", {
|
42 | set: function (value) {
|
43 | this.foundation.setProgress(value);
|
44 | },
|
45 | enumerable: false,
|
46 | configurable: true
|
47 | });
|
48 | Object.defineProperty(MDCLinearProgress.prototype, "buffer", {
|
49 | set: function (value) {
|
50 | this.foundation.setBuffer(value);
|
51 | },
|
52 | enumerable: false,
|
53 | configurable: true
|
54 | });
|
55 | MDCLinearProgress.prototype.open = function () {
|
56 | this.foundation.open();
|
57 | };
|
58 | MDCLinearProgress.prototype.close = function () {
|
59 | this.foundation.close();
|
60 | };
|
61 | MDCLinearProgress.prototype.initialSyncWithDOM = function () {
|
62 | var _this = this;
|
63 | this.root.addEventListener('transitionend', function () {
|
64 | _this.foundation.handleTransitionEnd();
|
65 | });
|
66 | };
|
67 | MDCLinearProgress.prototype.getDefaultFoundation = function () {
|
68 | var _this = this;
|
69 |
|
70 |
|
71 |
|
72 | var adapter = {
|
73 | addClass: function (className) {
|
74 | _this.root.classList.add(className);
|
75 | },
|
76 | forceLayout: function () {
|
77 | _this.root.getBoundingClientRect();
|
78 | },
|
79 | setBufferBarStyle: function (styleProperty, value) {
|
80 | var bufferBar = _this.root.querySelector(MDCLinearProgressFoundation.strings.BUFFER_BAR_SELECTOR);
|
81 | if (bufferBar) {
|
82 | bufferBar.style.setProperty(styleProperty, value);
|
83 | }
|
84 | },
|
85 | setPrimaryBarStyle: function (styleProperty, value) {
|
86 | var primaryBar = _this.root.querySelector(MDCLinearProgressFoundation.strings.PRIMARY_BAR_SELECTOR);
|
87 | if (primaryBar) {
|
88 | primaryBar.style.setProperty(styleProperty, value);
|
89 | }
|
90 | },
|
91 | hasClass: function (className) { return _this.root.classList.contains(className); },
|
92 | removeAttribute: function (attributeName) {
|
93 | _this.root.removeAttribute(attributeName);
|
94 | },
|
95 | removeClass: function (className) {
|
96 | _this.root.classList.remove(className);
|
97 | },
|
98 | setAttribute: function (attributeName, value) {
|
99 | _this.root.setAttribute(attributeName, value);
|
100 | },
|
101 | setStyle: function (name, value) {
|
102 | _this.root.style.setProperty(name, value);
|
103 | },
|
104 | attachResizeObserver: function (callback) {
|
105 | var RO = window.ResizeObserver;
|
106 | if (RO) {
|
107 | var ro = new RO(callback);
|
108 | ro.observe(_this.root);
|
109 | return ro;
|
110 | }
|
111 | return null;
|
112 | },
|
113 | getWidth: function () { return _this.root.offsetWidth; },
|
114 | };
|
115 | return new MDCLinearProgressFoundation(adapter);
|
116 | };
|
117 | return MDCLinearProgress;
|
118 | }(MDCComponent));
|
119 | export { MDCLinearProgress };
|
120 |
|
\ | No newline at end of file |