material_design_lite-sass 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/material_design_lite/sass/version.rb +1 -1
- data/vendor/assets/javascripts/material.js +166 -71
- data/vendor/assets/javascripts/material/button.js +11 -0
- data/vendor/assets/javascripts/material/checkbox.js +11 -0
- data/vendor/assets/javascripts/material/data-table.js +10 -10
- data/vendor/assets/javascripts/material/icon-toggle.js +11 -0
- data/vendor/assets/javascripts/material/layout.js +32 -42
- data/vendor/assets/javascripts/material/mdlComponentHandler.js +1 -1
- data/vendor/assets/javascripts/material/menu.js +24 -10
- data/vendor/assets/javascripts/material/progress.js +11 -0
- data/vendor/assets/javascripts/material/radio.js +38 -5
- data/vendor/assets/javascripts/material/ripple.js +11 -0
- data/vendor/assets/javascripts/material/slider.js +11 -0
- data/vendor/assets/javascripts/material/switch.js +11 -0
- data/vendor/assets/javascripts/material/textfield.js +23 -10
- data/vendor/assets/javascripts/material/tooltip.js +12 -1
- data/vendor/assets/stylesheets/material/_button.scss +1 -1
- data/vendor/assets/stylesheets/material/_card.scss +1 -1
- data/vendor/assets/stylesheets/material/_layout.scss +6 -1
- data/vendor/assets/stylesheets/material/_mega_footer.scss +27 -15
- data/vendor/assets/stylesheets/material/_slider.scss +5 -5
- data/vendor/assets/stylesheets/material/_variables.scss +6 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 780cd10b6fd459c71a17f8fd2e9cce2a04a6c957
|
4
|
+
data.tar.gz: c099663211c4864b517d865bbbfd01e191370dfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb55fb7e2ceb605d00e0e035ad68468f01f18160239199535f19808a7d2fd3ad5fa946835f4a9fe4644880c38197ee08df591d77d8030750551f8372a57a0f68
|
7
|
+
data.tar.gz: fa9874e0c315e1a07dadd2d607a9e469388ecc9da987bd883d4a5086aaa3c8815d1435893dc5d610debda0359a8ac112acd044a7cc71539be642d3923b9fad05
|
data/CHANGELOG.md
CHANGED
@@ -94,7 +94,7 @@ componentHandler = (function() {
|
|
94
94
|
/** @type {!Array<componentHandler.Component>} */
|
95
95
|
var createdComponents_ = [];
|
96
96
|
|
97
|
-
var downgradeMethod_ = '
|
97
|
+
var downgradeMethod_ = 'mdlDowngrade';
|
98
98
|
var componentConfigProperty_ = 'mdlComponentConfigInternal_';
|
99
99
|
|
100
100
|
/**
|
@@ -654,6 +654,13 @@ MaterialButton.prototype.mdlDowngrade_ = function () {
|
|
654
654
|
this.element_.removeEventListener('mouseup', this.boundButtonBlurHandler);
|
655
655
|
this.element_.removeEventListener('mouseleave', this.boundButtonBlurHandler);
|
656
656
|
};
|
657
|
+
/**
|
658
|
+
* Public alias for the downgrade method.
|
659
|
+
*
|
660
|
+
* @public
|
661
|
+
*/
|
662
|
+
MaterialButton.prototype.mdlDowngrade = MaterialButton.prototype.mdlDowngrade_;
|
663
|
+
MaterialButton.prototype['mdlDowngrade'] = MaterialButton.prototype.mdlDowngrade;
|
657
664
|
// The component registers itself. It can assume componentHandler is available
|
658
665
|
// in the global scope.
|
659
666
|
componentHandler.register({
|
@@ -900,6 +907,13 @@ MaterialCheckbox.prototype.mdlDowngrade_ = function () {
|
|
900
907
|
this.inputElement_.removeEventListener('blur', this.boundInputOnBlur);
|
901
908
|
this.element_.removeEventListener('mouseup', this.boundElementMouseUp);
|
902
909
|
};
|
910
|
+
/**
|
911
|
+
* Public alias for the downgrade method.
|
912
|
+
*
|
913
|
+
* @public
|
914
|
+
*/
|
915
|
+
MaterialCheckbox.prototype.mdlDowngrade = MaterialCheckbox.prototype.mdlDowngrade_;
|
916
|
+
MaterialCheckbox.prototype['mdlDowngrade'] = MaterialCheckbox.prototype.mdlDowngrade;
|
903
917
|
// The component registers itself. It can assume componentHandler is available
|
904
918
|
// in the global scope.
|
905
919
|
componentHandler.register({
|
@@ -1133,6 +1147,13 @@ MaterialIconToggle.prototype.mdlDowngrade_ = function () {
|
|
1133
1147
|
this.inputElement_.removeEventListener('blur', this.boundInputOnBlur);
|
1134
1148
|
this.element_.removeEventListener('mouseup', this.boundElementOnMouseUp);
|
1135
1149
|
};
|
1150
|
+
/**
|
1151
|
+
* Public alias for the downgrade method.
|
1152
|
+
*
|
1153
|
+
* @public
|
1154
|
+
*/
|
1155
|
+
MaterialIconToggle.prototype.mdlDowngrade = MaterialIconToggle.prototype.mdlDowngrade_;
|
1156
|
+
MaterialIconToggle.prototype['mdlDowngrade'] = MaterialIconToggle.prototype.mdlDowngrade;
|
1136
1157
|
// The component registers itself. It can assume componentHandler is available
|
1137
1158
|
// in the global scope.
|
1138
1159
|
componentHandler.register({
|
@@ -1256,15 +1277,15 @@ MaterialMenu.prototype.init = function () {
|
|
1256
1277
|
}
|
1257
1278
|
}
|
1258
1279
|
var items = this.element_.querySelectorAll('.' + this.CssClasses_.ITEM);
|
1259
|
-
this.
|
1260
|
-
this.
|
1280
|
+
this.boundItemKeydown_ = this.handleItemKeyboardEvent_.bind(this);
|
1281
|
+
this.boundItemClick_ = this.handleItemClick_.bind(this);
|
1261
1282
|
for (var i = 0; i < items.length; i++) {
|
1262
1283
|
// Add a listener to each menu item.
|
1263
|
-
items[i].addEventListener('click', this.
|
1284
|
+
items[i].addEventListener('click', this.boundItemClick_);
|
1264
1285
|
// Add a tab index to each menu item.
|
1265
1286
|
items[i].tabIndex = '-1';
|
1266
1287
|
// Add a keyboard listener to each menu item.
|
1267
|
-
items[i].addEventListener('keydown', this.
|
1288
|
+
items[i].addEventListener('keydown', this.boundItemKeydown_);
|
1268
1289
|
}
|
1269
1290
|
// Add ripple classes to each item, if the user has enabled ripples.
|
1270
1291
|
if (this.element_.classList.contains(this.CssClasses_.RIPPLE_EFFECT)) {
|
@@ -1399,7 +1420,7 @@ MaterialMenu.prototype.handleItemKeyboardEvent_ = function (evt) {
|
|
1399
1420
|
* @private
|
1400
1421
|
*/
|
1401
1422
|
MaterialMenu.prototype.handleItemClick_ = function (evt) {
|
1402
|
-
if (evt.target.
|
1423
|
+
if (evt.target.hasAttribute('disabled')) {
|
1403
1424
|
evt.stopPropagation();
|
1404
1425
|
} else {
|
1405
1426
|
// Wait some time before closing menu, so the user can see the ripple.
|
@@ -1497,7 +1518,9 @@ MaterialMenu.prototype.show = function (evt) {
|
|
1497
1518
|
// displayed the menu in the first place. If so, do nothing.
|
1498
1519
|
// Also check to see if the menu is in the process of closing itself, and
|
1499
1520
|
// do nothing in that case.
|
1500
|
-
if
|
1521
|
+
// Also check if the clicked element is a menu item
|
1522
|
+
// if so, do nothing.
|
1523
|
+
if (e !== evt && !this.closing_ && e.target.parentNode !== this.element_) {
|
1501
1524
|
document.removeEventListener('click', callback);
|
1502
1525
|
this.hide();
|
1503
1526
|
}
|
@@ -1519,8 +1542,9 @@ MaterialMenu.prototype.hide = function () {
|
|
1519
1542
|
items[i].style.transitionDelay = null;
|
1520
1543
|
}
|
1521
1544
|
// Measure the inner element.
|
1522
|
-
var
|
1523
|
-
var
|
1545
|
+
var rect = this.element_.getBoundingClientRect();
|
1546
|
+
var height = rect.height;
|
1547
|
+
var width = rect.width;
|
1524
1548
|
// Turn on animation, and apply the final clip. Also make invisible.
|
1525
1549
|
// This triggers the transitions.
|
1526
1550
|
this.element_.classList.add(this.CssClasses_.IS_ANIMATING);
|
@@ -1552,10 +1576,17 @@ MaterialMenu.prototype['toggle'] = MaterialMenu.prototype.toggle;
|
|
1552
1576
|
MaterialMenu.prototype.mdlDowngrade_ = function () {
|
1553
1577
|
var items = this.element_.querySelectorAll('.' + this.CssClasses_.ITEM);
|
1554
1578
|
for (var i = 0; i < items.length; i++) {
|
1555
|
-
items[i].removeEventListener('click', this.
|
1556
|
-
items[i].removeEventListener('keydown', this.
|
1579
|
+
items[i].removeEventListener('click', this.boundItemClick_);
|
1580
|
+
items[i].removeEventListener('keydown', this.boundItemKeydown_);
|
1557
1581
|
}
|
1558
1582
|
};
|
1583
|
+
/**
|
1584
|
+
* Public alias for the downgrade method.
|
1585
|
+
*
|
1586
|
+
* @public
|
1587
|
+
*/
|
1588
|
+
MaterialMenu.prototype.mdlDowngrade = MaterialMenu.prototype.mdlDowngrade_;
|
1589
|
+
MaterialMenu.prototype['mdlDowngrade'] = MaterialMenu.prototype.mdlDowngrade;
|
1559
1590
|
// The component registers itself. It can assume componentHandler is available
|
1560
1591
|
// in the global scope.
|
1561
1592
|
componentHandler.register({
|
@@ -1667,6 +1698,13 @@ MaterialProgress.prototype.mdlDowngrade_ = function () {
|
|
1667
1698
|
this.element_.removeChild(this.element_.firstChild);
|
1668
1699
|
}
|
1669
1700
|
};
|
1701
|
+
/**
|
1702
|
+
* Public alias for the downgrade method.
|
1703
|
+
*
|
1704
|
+
* @public
|
1705
|
+
*/
|
1706
|
+
MaterialProgress.prototype.mdlDowngrade = MaterialProgress.prototype.mdlDowngrade_;
|
1707
|
+
MaterialProgress.prototype['mdlDowngrade'] = MaterialProgress.prototype.mdlDowngrade;
|
1670
1708
|
// The component registers itself. It can assume componentHandler is available
|
1671
1709
|
// in the global scope.
|
1672
1710
|
componentHandler.register({
|
@@ -1874,6 +1912,10 @@ MaterialRadio.prototype['uncheck'] = MaterialRadio.prototype.uncheck;
|
|
1874
1912
|
MaterialRadio.prototype.init = function () {
|
1875
1913
|
if (this.element_) {
|
1876
1914
|
this.btnElement_ = this.element_.querySelector('.' + this.CssClasses_.RADIO_BTN);
|
1915
|
+
this.boundChangeHandler_ = this.onChange_.bind(this);
|
1916
|
+
this.boundFocusHandler_ = this.onChange_.bind(this);
|
1917
|
+
this.boundBlurHandler_ = this.onBlur_.bind(this);
|
1918
|
+
this.boundMouseUpHandler_ = this.onMouseup_.bind(this);
|
1877
1919
|
var outerCircle = document.createElement('span');
|
1878
1920
|
outerCircle.classList.add(this.CssClasses_.RADIO_OUTER_CIRCLE);
|
1879
1921
|
var innerCircle = document.createElement('span');
|
@@ -1887,20 +1929,43 @@ MaterialRadio.prototype.init = function () {
|
|
1887
1929
|
rippleContainer.classList.add(this.CssClasses_.RIPPLE_CONTAINER);
|
1888
1930
|
rippleContainer.classList.add(this.CssClasses_.RIPPLE_EFFECT);
|
1889
1931
|
rippleContainer.classList.add(this.CssClasses_.RIPPLE_CENTER);
|
1890
|
-
rippleContainer.addEventListener('mouseup', this.
|
1932
|
+
rippleContainer.addEventListener('mouseup', this.boundMouseUpHandler_);
|
1891
1933
|
var ripple = document.createElement('span');
|
1892
1934
|
ripple.classList.add(this.CssClasses_.RIPPLE);
|
1893
1935
|
rippleContainer.appendChild(ripple);
|
1894
1936
|
this.element_.appendChild(rippleContainer);
|
1895
1937
|
}
|
1896
|
-
this.btnElement_.addEventListener('change', this.
|
1897
|
-
this.btnElement_.addEventListener('focus', this.
|
1898
|
-
this.btnElement_.addEventListener('blur', this.
|
1899
|
-
this.element_.addEventListener('mouseup', this.
|
1938
|
+
this.btnElement_.addEventListener('change', this.boundChangeHandler_);
|
1939
|
+
this.btnElement_.addEventListener('focus', this.boundFocusHandler_);
|
1940
|
+
this.btnElement_.addEventListener('blur', this.boundBlurHandler_);
|
1941
|
+
this.element_.addEventListener('mouseup', this.boundMouseUpHandler_);
|
1900
1942
|
this.updateClasses_();
|
1901
1943
|
this.element_.classList.add(this.CssClasses_.IS_UPGRADED);
|
1902
1944
|
}
|
1903
1945
|
};
|
1946
|
+
/**
|
1947
|
+
* Downgrade the element.
|
1948
|
+
*
|
1949
|
+
* @private
|
1950
|
+
*/
|
1951
|
+
MaterialRadio.prototype.mdlDowngrade_ = function () {
|
1952
|
+
var rippleContainer = this.element_.querySelector('.' + this.CssClasses_.RIPPLE_CONTAINER);
|
1953
|
+
this.btnElement_.removeEventListener('change', this.boundChangeHandler_);
|
1954
|
+
this.btnElement_.removeEventListener('focus', this.boundFocusHandler_);
|
1955
|
+
this.btnElement_.removeEventListener('blur', this.boundBlurHandler_);
|
1956
|
+
this.element_.removeEventListener('mouseup', this.boundMouseUpHandler_);
|
1957
|
+
if (rippleContainer) {
|
1958
|
+
rippleContainer.removeEventListener('mouseup', this.boundMouseUpHandler_);
|
1959
|
+
this.element_.removeChild(rippleContainer);
|
1960
|
+
}
|
1961
|
+
};
|
1962
|
+
/**
|
1963
|
+
* Public alias for the downgrade method.
|
1964
|
+
*
|
1965
|
+
* @public
|
1966
|
+
*/
|
1967
|
+
MaterialRadio.prototype.mdlDowngrade = MaterialRadio.prototype.mdlDowngrade_;
|
1968
|
+
MaterialRadio.prototype['mdlDowngrade'] = MaterialRadio.prototype.mdlDowngrade;
|
1904
1969
|
// The component registers itself. It can assume componentHandler is available
|
1905
1970
|
// in the global scope.
|
1906
1971
|
componentHandler.register({
|
@@ -2127,6 +2192,13 @@ MaterialSlider.prototype.mdlDowngrade_ = function () {
|
|
2127
2192
|
this.element_.removeEventListener('mouseup', this.boundMouseUpHandler);
|
2128
2193
|
this.element_.parentElement.removeEventListener('mousedown', this.boundContainerMouseDownHandler);
|
2129
2194
|
};
|
2195
|
+
/**
|
2196
|
+
* Public alias for the downgrade method.
|
2197
|
+
*
|
2198
|
+
* @public
|
2199
|
+
*/
|
2200
|
+
MaterialSlider.prototype.mdlDowngrade = MaterialSlider.prototype.mdlDowngrade_;
|
2201
|
+
MaterialSlider.prototype['mdlDowngrade'] = MaterialSlider.prototype.mdlDowngrade;
|
2130
2202
|
// The component registers itself. It can assume componentHandler is available
|
2131
2203
|
// in the global scope.
|
2132
2204
|
componentHandler.register({
|
@@ -2498,6 +2570,13 @@ MaterialSwitch.prototype.mdlDowngrade_ = function () {
|
|
2498
2570
|
this.inputElement_.removeEventListener('blur', this.boundBlurHandler);
|
2499
2571
|
this.element_.removeEventListener('mouseup', this.boundMouseUpHandler);
|
2500
2572
|
};
|
2573
|
+
/**
|
2574
|
+
* Public alias for the downgrade method.
|
2575
|
+
*
|
2576
|
+
* @public
|
2577
|
+
*/
|
2578
|
+
MaterialSwitch.prototype.mdlDowngrade = MaterialSwitch.prototype.mdlDowngrade_;
|
2579
|
+
MaterialSwitch.prototype['mdlDowngrade'] = MaterialSwitch.prototype.mdlDowngrade;
|
2501
2580
|
// The component registers itself. It can assume componentHandler is available
|
2502
2581
|
// in the global scope.
|
2503
2582
|
componentHandler.register({
|
@@ -2764,10 +2843,12 @@ MaterialTextfield.prototype['checkDisabled'] = MaterialTextfield.prototype.check
|
|
2764
2843
|
* @public
|
2765
2844
|
*/
|
2766
2845
|
MaterialTextfield.prototype.checkValidity = function () {
|
2767
|
-
if (this.input_.validity
|
2768
|
-
this.
|
2769
|
-
|
2770
|
-
|
2846
|
+
if (this.input_.validity) {
|
2847
|
+
if (this.input_.validity.valid) {
|
2848
|
+
this.element_.classList.remove(this.CssClasses_.IS_INVALID);
|
2849
|
+
} else {
|
2850
|
+
this.element_.classList.add(this.CssClasses_.IS_INVALID);
|
2851
|
+
}
|
2771
2852
|
}
|
2772
2853
|
};
|
2773
2854
|
MaterialTextfield.prototype['checkValidity'] = MaterialTextfield.prototype.checkValidity;
|
@@ -2811,11 +2892,7 @@ MaterialTextfield.prototype['enable'] = MaterialTextfield.prototype.enable;
|
|
2811
2892
|
* @public
|
2812
2893
|
*/
|
2813
2894
|
MaterialTextfield.prototype.change = function (value) {
|
2814
|
-
|
2815
|
-
this.input_.value = value;
|
2816
|
-
} else {
|
2817
|
-
this.input_.value = '';
|
2818
|
-
}
|
2895
|
+
this.input_.value = value || '';
|
2819
2896
|
this.updateClasses_();
|
2820
2897
|
};
|
2821
2898
|
MaterialTextfield.prototype['change'] = MaterialTextfield.prototype.change;
|
@@ -2845,8 +2922,12 @@ MaterialTextfield.prototype.init = function () {
|
|
2845
2922
|
this.boundKeyDownHandler = this.onKeyDown_.bind(this);
|
2846
2923
|
this.input_.addEventListener('keydown', this.boundKeyDownHandler);
|
2847
2924
|
}
|
2925
|
+
var invalid = this.element_.classList.contains(this.CssClasses_.IS_INVALID);
|
2848
2926
|
this.updateClasses_();
|
2849
2927
|
this.element_.classList.add(this.CssClasses_.IS_UPGRADED);
|
2928
|
+
if (invalid) {
|
2929
|
+
this.element_.classList.add(this.CssClasses_.IS_INVALID);
|
2930
|
+
}
|
2850
2931
|
}
|
2851
2932
|
}
|
2852
2933
|
};
|
@@ -2863,6 +2944,13 @@ MaterialTextfield.prototype.mdlDowngrade_ = function () {
|
|
2863
2944
|
this.input_.removeEventListener('keydown', this.boundKeyDownHandler);
|
2864
2945
|
}
|
2865
2946
|
};
|
2947
|
+
/**
|
2948
|
+
* Public alias for the downgrade method.
|
2949
|
+
*
|
2950
|
+
* @public
|
2951
|
+
*/
|
2952
|
+
MaterialTextfield.prototype.mdlDowngrade = MaterialTextfield.prototype.mdlDowngrade_;
|
2953
|
+
MaterialTextfield.prototype['mdlDowngrade'] = MaterialTextfield.prototype.mdlDowngrade;
|
2866
2954
|
// The component registers itself. It can assume componentHandler is available
|
2867
2955
|
// in the global scope.
|
2868
2956
|
componentHandler.register({
|
@@ -2963,7 +3051,7 @@ MaterialTooltip.prototype.init = function () {
|
|
2963
3051
|
}
|
2964
3052
|
if (this.forElement_) {
|
2965
3053
|
// Tabindex needs to be set for `blur` events to be emitted
|
2966
|
-
if (!this.forElement_.
|
3054
|
+
if (!this.forElement_.hasAttribute('tabindex')) {
|
2967
3055
|
this.forElement_.setAttribute('tabindex', '0');
|
2968
3056
|
}
|
2969
3057
|
this.boundMouseEnterHandler = this.handleMouseEnter_.bind(this);
|
@@ -2989,6 +3077,13 @@ MaterialTooltip.prototype.mdlDowngrade_ = function () {
|
|
2989
3077
|
this.forElement_.removeEventListener('mouseleave', this.boundMouseLeaveHandler);
|
2990
3078
|
}
|
2991
3079
|
};
|
3080
|
+
/**
|
3081
|
+
* Public alias for the downgrade method.
|
3082
|
+
*
|
3083
|
+
* @public
|
3084
|
+
*/
|
3085
|
+
MaterialTooltip.prototype.mdlDowngrade = MaterialTooltip.prototype.mdlDowngrade_;
|
3086
|
+
MaterialTooltip.prototype['mdlDowngrade'] = MaterialTooltip.prototype.mdlDowngrade;
|
2992
3087
|
// The component registers itself. It can assume componentHandler is available
|
2993
3088
|
// in the global scope.
|
2994
3089
|
componentHandler.register({
|
@@ -3127,6 +3222,7 @@ MaterialLayout.prototype.screenSizeHandler_ = function () {
|
|
3127
3222
|
// Collapse drawer (if any) when moving to a large screen size.
|
3128
3223
|
if (this.drawer_) {
|
3129
3224
|
this.drawer_.classList.remove(this.CssClasses_.IS_DRAWER_OPEN);
|
3225
|
+
this.obfuscator_.classList.remove(this.CssClasses_.IS_DRAWER_OPEN);
|
3130
3226
|
}
|
3131
3227
|
}
|
3132
3228
|
};
|
@@ -3137,6 +3233,7 @@ MaterialLayout.prototype.screenSizeHandler_ = function () {
|
|
3137
3233
|
*/
|
3138
3234
|
MaterialLayout.prototype.drawerToggleHandler_ = function () {
|
3139
3235
|
this.drawer_.classList.toggle(this.CssClasses_.IS_DRAWER_OPEN);
|
3236
|
+
this.obfuscator_.classList.toggle(this.CssClasses_.IS_DRAWER_OPEN);
|
3140
3237
|
};
|
3141
3238
|
/**
|
3142
3239
|
* Handles (un)setting the `is-animating` class
|
@@ -3188,7 +3285,8 @@ MaterialLayout.prototype.init = function () {
|
|
3188
3285
|
this.element_.parentElement.removeChild(this.element_);
|
3189
3286
|
container.appendChild(this.element_);
|
3190
3287
|
var directChildren = this.element_.childNodes;
|
3191
|
-
|
3288
|
+
var numChildren = directChildren.length;
|
3289
|
+
for (var c = 0; c < numChildren; c++) {
|
3192
3290
|
var child = directChildren[c];
|
3193
3291
|
if (child.classList && child.classList.contains(this.CssClasses_.HEADER)) {
|
3194
3292
|
this.header_ = child;
|
@@ -3204,11 +3302,6 @@ MaterialLayout.prototype.init = function () {
|
|
3204
3302
|
this.tabBar_ = this.header_.querySelector('.' + this.CssClasses_.TAB_BAR);
|
3205
3303
|
}
|
3206
3304
|
var mode = this.Mode_.STANDARD;
|
3207
|
-
// Keep an eye on screen size, and add/remove auxiliary class for styling
|
3208
|
-
// of small screens.
|
3209
|
-
this.screenSizeMediaQuery_ = window.matchMedia(this.Constant_.MAX_WIDTH);
|
3210
|
-
this.screenSizeMediaQuery_.addListener(this.screenSizeHandler_.bind(this));
|
3211
|
-
this.screenSizeHandler_();
|
3212
3305
|
if (this.header_) {
|
3213
3306
|
if (this.header_.classList.contains(this.CssClasses_.HEADER_SEAMED)) {
|
3214
3307
|
mode = this.Mode_.SEAMED;
|
@@ -3238,17 +3331,10 @@ MaterialLayout.prototype.init = function () {
|
|
3238
3331
|
this.contentScrollHandler_();
|
3239
3332
|
}
|
3240
3333
|
}
|
3241
|
-
/**
|
3242
|
-
* Prevents an event from triggering the default behaviour.
|
3243
|
-
* @param {Event} ev the event to eat.
|
3244
|
-
*/
|
3245
|
-
var eatEvent = function (ev) {
|
3246
|
-
ev.preventDefault();
|
3247
|
-
};
|
3248
3334
|
// Add drawer toggling button to our layout, if we have an openable drawer.
|
3249
3335
|
if (this.drawer_) {
|
3250
3336
|
var drawerButton = this.element_.querySelector('.' + this.CssClasses_.DRAWER_BTN);
|
3251
|
-
if (
|
3337
|
+
if (!drawerButton) {
|
3252
3338
|
drawerButton = document.createElement('div');
|
3253
3339
|
drawerButton.classList.add(this.CssClasses_.DRAWER_BTN);
|
3254
3340
|
var drawerButtonIcon = document.createElement('i');
|
@@ -3268,7 +3354,6 @@ MaterialLayout.prototype.init = function () {
|
|
3268
3354
|
// Adds the HAS_DRAWER to the elements since this.header_ may or may
|
3269
3355
|
// not be present.
|
3270
3356
|
this.element_.classList.add(this.CssClasses_.HAS_DRAWER);
|
3271
|
-
this.drawer_.addEventListener('mousewheel', eatEvent);
|
3272
3357
|
// If we have a fixed header, add the button to the header rather than
|
3273
3358
|
// the layout.
|
3274
3359
|
if (this.element_.classList.contains(this.CssClasses_.FIXED_HEADER)) {
|
@@ -3280,8 +3365,13 @@ MaterialLayout.prototype.init = function () {
|
|
3280
3365
|
obfuscator.classList.add(this.CssClasses_.OBFUSCATOR);
|
3281
3366
|
this.element_.appendChild(obfuscator);
|
3282
3367
|
obfuscator.addEventListener('click', this.drawerToggleHandler_.bind(this));
|
3283
|
-
|
3368
|
+
this.obfuscator_ = obfuscator;
|
3284
3369
|
}
|
3370
|
+
// Keep an eye on screen size, and add/remove auxiliary class for styling
|
3371
|
+
// of small screens.
|
3372
|
+
this.screenSizeMediaQuery_ = window.matchMedia(this.Constant_.MAX_WIDTH);
|
3373
|
+
this.screenSizeMediaQuery_.addListener(this.screenSizeHandler_.bind(this));
|
3374
|
+
this.screenSizeHandler_();
|
3285
3375
|
// Initialize tabs, if any.
|
3286
3376
|
if (this.header_ && this.tabBar_) {
|
3287
3377
|
this.element_.classList.add(this.CssClasses_.HAS_TABS);
|
@@ -3351,26 +3441,24 @@ MaterialLayout.prototype.init = function () {
|
|
3351
3441
|
* @param {MaterialLayout} layout The MaterialLayout object that owns the tab.
|
3352
3442
|
*/
|
3353
3443
|
function MaterialLayoutTab(tab, tabs, panels, layout) {
|
3354
|
-
if (
|
3355
|
-
|
3356
|
-
|
3357
|
-
|
3358
|
-
|
3359
|
-
|
3360
|
-
|
3361
|
-
|
3362
|
-
|
3363
|
-
|
3364
|
-
|
3365
|
-
|
3366
|
-
|
3367
|
-
|
3368
|
-
|
3369
|
-
|
3370
|
-
|
3371
|
-
|
3372
|
-
});
|
3373
|
-
}
|
3444
|
+
if (layout.tabBar_.classList.contains(layout.CssClasses_.JS_RIPPLE_EFFECT)) {
|
3445
|
+
var rippleContainer = document.createElement('span');
|
3446
|
+
rippleContainer.classList.add(layout.CssClasses_.RIPPLE_CONTAINER);
|
3447
|
+
rippleContainer.classList.add(layout.CssClasses_.JS_RIPPLE_EFFECT);
|
3448
|
+
var ripple = document.createElement('span');
|
3449
|
+
ripple.classList.add(layout.CssClasses_.RIPPLE);
|
3450
|
+
rippleContainer.appendChild(ripple);
|
3451
|
+
tab.appendChild(rippleContainer);
|
3452
|
+
}
|
3453
|
+
tab.addEventListener('click', function (e) {
|
3454
|
+
e.preventDefault();
|
3455
|
+
var href = tab.href.split('#')[1];
|
3456
|
+
var panel = layout.content_.querySelector('#' + href);
|
3457
|
+
layout.resetTabState_(tabs);
|
3458
|
+
layout.resetPanelState_(panels);
|
3459
|
+
tab.classList.add(layout.CssClasses_.IS_ACTIVE);
|
3460
|
+
panel.classList.add(layout.CssClasses_.IS_ACTIVE);
|
3461
|
+
});
|
3374
3462
|
}
|
3375
3463
|
// The component registers itself. It can assume componentHandler is available
|
3376
3464
|
// in the global scope.
|
@@ -3427,6 +3515,7 @@ MaterialDataTable.prototype.Constant_ = {};
|
|
3427
3515
|
MaterialDataTable.prototype.CssClasses_ = {
|
3428
3516
|
DATA_TABLE: 'mdl-data-table',
|
3429
3517
|
SELECTABLE: 'mdl-data-table--selectable',
|
3518
|
+
SELECT_ELEMENT: 'mdl-data-table__select',
|
3430
3519
|
IS_SELECTED: 'is-selected',
|
3431
3520
|
IS_UPGRADED: 'is-upgraded'
|
3432
3521
|
};
|
@@ -3479,18 +3568,17 @@ MaterialDataTable.prototype.selectRow_ = function (checkbox, row, opt_rows) {
|
|
3479
3568
|
*/
|
3480
3569
|
MaterialDataTable.prototype.createCheckbox_ = function (row, opt_rows) {
|
3481
3570
|
var label = document.createElement('label');
|
3482
|
-
|
3483
|
-
|
3484
|
-
|
3485
|
-
|
3571
|
+
var labelClasses = [
|
3572
|
+
'mdl-checkbox',
|
3573
|
+
'mdl-js-checkbox',
|
3574
|
+
'mdl-js-ripple-effect',
|
3575
|
+
this.CssClasses_.SELECT_ELEMENT
|
3576
|
+
];
|
3577
|
+
label.className = labelClasses.join(' ');
|
3486
3578
|
var checkbox = document.createElement('input');
|
3487
3579
|
checkbox.type = 'checkbox';
|
3488
3580
|
checkbox.classList.add('mdl-checkbox__input');
|
3489
|
-
|
3490
|
-
checkbox.addEventListener('change', this.selectRow_(checkbox, row));
|
3491
|
-
} else if (opt_rows) {
|
3492
|
-
checkbox.addEventListener('change', this.selectRow_(checkbox, null, opt_rows));
|
3493
|
-
}
|
3581
|
+
checkbox.addEventListener('change', this.selectRow_(checkbox, row, opt_rows));
|
3494
3582
|
label.appendChild(checkbox);
|
3495
3583
|
componentHandler.upgradeElement(label, 'MaterialCheckbox');
|
3496
3584
|
return label;
|
@@ -3759,6 +3847,13 @@ MaterialRipple.prototype.mdlDowngrade_ = function () {
|
|
3759
3847
|
this.element_.removeEventListener('touchend', this.boundUpHandler);
|
3760
3848
|
this.element_.removeEventListener('blur', this.boundUpHandler);
|
3761
3849
|
};
|
3850
|
+
/**
|
3851
|
+
* Public alias for the downgrade method.
|
3852
|
+
*
|
3853
|
+
* @public
|
3854
|
+
*/
|
3855
|
+
MaterialRipple.prototype.mdlDowngrade = MaterialRipple.prototype.mdlDowngrade_;
|
3856
|
+
MaterialRipple.prototype['mdlDowngrade'] = MaterialRipple.prototype.mdlDowngrade;
|
3762
3857
|
// The component registers itself. It can assume componentHandler is available
|
3763
3858
|
// in the global scope.
|
3764
3859
|
componentHandler.register({
|