materialize-sass 1.0.0.beta → 1.0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitattributes +1 -0
- data/README.md +2 -2
- data/Rakefile +1 -1
- data/assets/javascripts/materialize/autocomplete.js +94 -37
- data/assets/javascripts/materialize/buttons.js +4 -6
- data/assets/javascripts/materialize/carousel.js +9 -9
- data/assets/javascripts/materialize/chips.js +2 -2
- data/assets/javascripts/materialize/collapsible.js +13 -10
- data/assets/javascripts/materialize/datepicker.js +27 -44
- data/assets/javascripts/materialize/dropdown.js +38 -15
- data/assets/javascripts/materialize/extras/nouislider.js +1 -1
- data/assets/javascripts/materialize/extras/nouislider.min.js +1 -1
- data/assets/javascripts/materialize/forms.js +7 -8
- data/assets/javascripts/materialize/global.js +28 -11
- data/assets/javascripts/materialize/materialbox.js +12 -7
- data/assets/javascripts/materialize/modal.js +8 -4
- data/assets/javascripts/materialize/parallax.js +1 -1
- data/assets/javascripts/materialize/pushpin.js +8 -3
- data/assets/javascripts/materialize/range.js +2 -19
- data/assets/javascripts/materialize/select.js +57 -33
- data/assets/javascripts/materialize/sidenav.js +5 -3
- data/assets/javascripts/materialize/slider.js +2 -1
- data/assets/javascripts/materialize/tabs.js +13 -8
- data/assets/javascripts/materialize/timepicker.js +22 -5
- data/assets/javascripts/materialize/toasts.js +4 -3
- data/assets/javascripts/materialize/tooltip.js +14 -8
- data/assets/javascripts/materialize.js +804 -685
- data/assets/stylesheets/materialize/components/_buttons.scss +2 -1
- data/assets/stylesheets/materialize/components/_collapsible.scss +8 -1
- data/assets/stylesheets/materialize/components/_datepicker.scss +5 -1
- data/assets/stylesheets/materialize/components/_dropdown.scss +10 -1
- data/assets/stylesheets/materialize/components/_global.scss +2 -0
- data/assets/stylesheets/materialize/components/_modal.scss +4 -0
- data/assets/stylesheets/materialize/components/_sidenav.scss +9 -17
- data/assets/stylesheets/materialize/components/_toast.scss +0 -1
- data/assets/stylesheets/materialize/components/_variables.scss +1 -0
- data/assets/stylesheets/materialize/components/forms/_input-fields.scss +2 -0
- data/assets/stylesheets/materialize/components/forms/_range.scss +3 -3
- data/assets/stylesheets/materialize/components/forms/_select.scss +19 -7
- data/assets/stylesheets/materialize/extras/nouislider.css +1 -1
- data/lib/materialize-sass/engine.rb +4 -1
- data/lib/materialize-sass/version.rb +1 -1
- data/lib/materialize-sass.rb +3 -8
- data/materialize-sass.gemspec +4 -5
- metadata +18 -32
@@ -59,7 +59,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
59
59
|
_this.originalWidth = 0;
|
60
60
|
_this.originalHeight = 0;
|
61
61
|
_this.originInlineStyles = _this.$el.attr('style');
|
62
|
-
_this.caption = _this.el.getAttribute('data-caption') ||
|
62
|
+
_this.caption = _this.el.getAttribute('data-caption') || '';
|
63
63
|
|
64
64
|
// Wrap
|
65
65
|
_this.$el.before(_this.placeholder);
|
@@ -79,6 +79,11 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
79
79
|
value: function destroy() {
|
80
80
|
this._removeEventHandlers();
|
81
81
|
this.el.M_Materialbox = undefined;
|
82
|
+
|
83
|
+
// Unwrap image
|
84
|
+
$(this.placeholder).after(this.el).remove();
|
85
|
+
|
86
|
+
this.$el.removeAttr('style');
|
82
87
|
}
|
83
88
|
|
84
89
|
/**
|
@@ -254,7 +259,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
254
259
|
}
|
255
260
|
|
256
261
|
_this3.$el.removeAttr('style');
|
257
|
-
_this3.$el.attr('style', _this3.originInlineStyles);
|
262
|
+
_this3.originInlineStyles && _this3.$el.attr('style', _this3.originInlineStyles);
|
258
263
|
|
259
264
|
// Remove class
|
260
265
|
_this3.$el.removeClass('active');
|
@@ -284,7 +289,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
284
289
|
value: function _updateVars() {
|
285
290
|
this.windowWidth = window.innerWidth;
|
286
291
|
this.windowHeight = window.innerHeight;
|
287
|
-
this.caption = this.el.getAttribute('data-caption') ||
|
292
|
+
this.caption = this.el.getAttribute('data-caption') || '';
|
288
293
|
}
|
289
294
|
|
290
295
|
/**
|
@@ -373,14 +378,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
373
378
|
});
|
374
379
|
|
375
380
|
// Add and animate caption if it exists
|
376
|
-
if (this.caption !==
|
381
|
+
if (this.caption !== '') {
|
377
382
|
if (this.$photocaption) {
|
378
383
|
anim.remove(this.$photoCaption[0]);
|
379
384
|
}
|
380
385
|
this.$photoCaption = $('<div class="materialbox-caption"></div>');
|
381
386
|
this.$photoCaption.text(this.caption);
|
382
387
|
$('body').append(this.$photoCaption);
|
383
|
-
this.$photoCaption.css({
|
388
|
+
this.$photoCaption.css({ display: 'inline' });
|
384
389
|
|
385
390
|
anim({
|
386
391
|
targets: this.$photoCaption[0],
|
@@ -439,7 +444,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
439
444
|
anim.remove(this.el);
|
440
445
|
anim.remove(this.$overlay[0]);
|
441
446
|
|
442
|
-
if (this.caption !==
|
447
|
+
if (this.caption !== '') {
|
443
448
|
anim.remove(this.$photoCaption[0]);
|
444
449
|
}
|
445
450
|
|
@@ -462,7 +467,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
462
467
|
this._animateImageOut();
|
463
468
|
|
464
469
|
// Remove Caption + reset css settings on image
|
465
|
-
if (this.caption !==
|
470
|
+
if (this.caption !== '') {
|
466
471
|
anim({
|
467
472
|
targets: this.$photoCaption[0],
|
468
473
|
opacity: 0,
|
@@ -72,6 +72,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
72
72
|
_this._openingTrigger = undefined;
|
73
73
|
_this.$overlay = $('<div class="modal-overlay"></div>');
|
74
74
|
_this.el.tabIndex = 0;
|
75
|
+
_this._nthModalOpened = 0;
|
75
76
|
|
76
77
|
Modal._count++;
|
77
78
|
_this._setupEventHandlers();
|
@@ -191,7 +192,8 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
191
192
|
}, {
|
192
193
|
key: '_handleFocus',
|
193
194
|
value: function _handleFocus(e) {
|
194
|
-
if
|
195
|
+
// Only trap focus if this modal is the last model opened (prevents loops in nested modals).
|
196
|
+
if (!this.el.contains(e.target) && this._nthModalOpened === Modal._modalsOpen) {
|
195
197
|
this.el.focus();
|
196
198
|
}
|
197
199
|
}
|
@@ -249,8 +251,8 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
249
251
|
$.extend(enterAnimOptions, {
|
250
252
|
top: [this.options.startingTop, this.options.endingTop],
|
251
253
|
opacity: 1,
|
252
|
-
scaleX: [.8, 1],
|
253
|
-
scaleY: [.8, 1]
|
254
|
+
scaleX: [0.8, 1],
|
255
|
+
scaleY: [0.8, 1]
|
254
256
|
});
|
255
257
|
anim(enterAnimOptions);
|
256
258
|
}
|
@@ -324,6 +326,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
324
326
|
|
325
327
|
this.isOpen = true;
|
326
328
|
Modal._modalsOpen++;
|
329
|
+
this._nthModalOpened = Modal._modalsOpen;
|
327
330
|
|
328
331
|
// Set Z-Index based on number of currently open modals
|
329
332
|
this.$overlay[0].style.zIndex = 1000 + Modal._modalsOpen * 2;
|
@@ -374,6 +377,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
374
377
|
|
375
378
|
this.isOpen = false;
|
376
379
|
Modal._modalsOpen--;
|
380
|
+
this._nthModalOpened = 0;
|
377
381
|
|
378
382
|
// Call onCloseStart callback
|
379
383
|
if (typeof this.options.onCloseStart === 'function') {
|
@@ -389,7 +393,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
389
393
|
|
390
394
|
if (this.options.dismissible) {
|
391
395
|
document.removeEventListener('keydown', this._handleKeydownBound);
|
392
|
-
document.removeEventListener('focus', this._handleFocusBound);
|
396
|
+
document.removeEventListener('focus', this._handleFocusBound, true);
|
393
397
|
}
|
394
398
|
|
395
399
|
anim.remove(this.el);
|
@@ -36,7 +36,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
36
36
|
_this.$img = _this.$el.find('img').first();
|
37
37
|
_this.$img.each(function () {
|
38
38
|
var el = this;
|
39
|
-
if (el.complete) $(el).trigger(
|
39
|
+
if (el.complete) $(el).trigger('load');
|
40
40
|
});
|
41
41
|
|
42
42
|
_this._updateParallax();
|
@@ -62,11 +62,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
62
62
|
value: function destroy() {
|
63
63
|
this.el.style.top = null;
|
64
64
|
this._removePinClasses();
|
65
|
-
this._removeEventHandlers();
|
66
65
|
|
67
66
|
// Remove pushpin Inst
|
68
67
|
var index = Pushpin._pushpins.indexOf(this);
|
69
68
|
Pushpin._pushpins.splice(index, 1);
|
69
|
+
if (Pushpin._pushpins.length === 0) {
|
70
|
+
this._removeEventHandlers();
|
71
|
+
}
|
72
|
+
this.el.M_Pushpin = undefined;
|
70
73
|
}
|
71
74
|
}, {
|
72
75
|
key: '_setupEventHandlers',
|
@@ -85,7 +88,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
85
88
|
|
86
89
|
if (this.options.top <= scrolled && this.options.bottom >= scrolled && !this.el.classList.contains('pinned')) {
|
87
90
|
this._removePinClasses();
|
88
|
-
|
89
91
|
this.el.style.top = this.options.offset + 'px';
|
90
92
|
this.el.classList.add('pinned');
|
91
93
|
|
@@ -122,7 +124,10 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
122
124
|
}, {
|
123
125
|
key: '_removePinClasses',
|
124
126
|
value: function _removePinClasses() {
|
125
|
-
|
127
|
+
// IE 11 bug (can't remove multiple classes in one line)
|
128
|
+
this.el.classList.remove('pin-top');
|
129
|
+
this.el.classList.remove('pinned');
|
130
|
+
this.el.classList.remove('pin-bottom');
|
126
131
|
}
|
127
132
|
}], [{
|
128
133
|
key: 'init',
|
@@ -70,14 +70,12 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
70
70
|
key: '_setupEventHandlers',
|
71
71
|
value: function _setupEventHandlers() {
|
72
72
|
this._handleRangeChangeBound = this._handleRangeChange.bind(this);
|
73
|
-
this._handleRangeFocusBound = this._handleRangeFocus.bind(this);
|
74
73
|
this._handleRangeMousedownTouchstartBound = this._handleRangeMousedownTouchstart.bind(this);
|
75
74
|
this._handleRangeInputMousemoveTouchmoveBound = this._handleRangeInputMousemoveTouchmove.bind(this);
|
76
75
|
this._handleRangeMouseupTouchendBound = this._handleRangeMouseupTouchend.bind(this);
|
77
76
|
this._handleRangeBlurMouseoutTouchleaveBound = this._handleRangeBlurMouseoutTouchleave.bind(this);
|
78
77
|
|
79
78
|
this.el.addEventListener('change', this._handleRangeChangeBound);
|
80
|
-
this.el.addEventListener('focus', this._handleRangeFocusBound);
|
81
79
|
|
82
80
|
this.el.addEventListener('mousedown', this._handleRangeMousedownTouchstartBound);
|
83
81
|
this.el.addEventListener('touchstart', this._handleRangeMousedownTouchstartBound);
|
@@ -102,7 +100,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
102
100
|
key: '_removeEventHandlers',
|
103
101
|
value: function _removeEventHandlers() {
|
104
102
|
this.el.removeEventListener('change', this._handleRangeChangeBound);
|
105
|
-
this.el.removeEventListener('focus', this._handleRangeFocusBound);
|
106
103
|
|
107
104
|
this.el.removeEventListener('mousedown', this._handleRangeMousedownTouchstartBound);
|
108
105
|
this.el.removeEventListener('touchstart', this._handleRangeMousedownTouchstartBound);
|
@@ -137,19 +134,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
137
134
|
$(this.thumb).addClass('active').css('left', offsetLeft + 'px');
|
138
135
|
}
|
139
136
|
|
140
|
-
/**
|
141
|
-
* Handle Range Focus
|
142
|
-
* @param {Event} e
|
143
|
-
*/
|
144
|
-
|
145
|
-
}, {
|
146
|
-
key: '_handleRangeFocus',
|
147
|
-
value: function _handleRangeFocus() {
|
148
|
-
if (M.tabPressed) {
|
149
|
-
this.$el.addClass('focused');
|
150
|
-
}
|
151
|
-
}
|
152
|
-
|
153
137
|
/**
|
154
138
|
* Handle Range Mousedown and Touchstart
|
155
139
|
* @param {Event} e
|
@@ -211,7 +195,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
211
195
|
key: '_handleRangeBlurMouseoutTouchleave',
|
212
196
|
value: function _handleRangeBlurMouseoutTouchleave() {
|
213
197
|
if (!this._mousedown) {
|
214
|
-
this.$el.removeClass('focused');
|
215
198
|
var paddingLeft = parseInt(this.$el.css('padding-left'));
|
216
199
|
var marginLeft = 7 + paddingLeft + 'px';
|
217
200
|
|
@@ -286,8 +269,8 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
286
269
|
key: '_calcRangeOffset',
|
287
270
|
value: function _calcRangeOffset() {
|
288
271
|
var width = this.$el.width() - 15;
|
289
|
-
var max = parseFloat(this.$el.attr('max'));
|
290
|
-
var min = parseFloat(this.$el.attr('min'));
|
272
|
+
var max = parseFloat(this.$el.attr('max')) || 100; // Range default max
|
273
|
+
var min = parseFloat(this.$el.attr('min')) || 0; // Range default min
|
291
274
|
var percent = (parseFloat(this.$el.val()) - min) / (max - min);
|
292
275
|
return percent * width;
|
293
276
|
}
|
@@ -142,19 +142,21 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
142
142
|
placeholderOption.find('input[type="checkbox"]').prop('checked', false);
|
143
143
|
this._toggleEntryFromArray(placeholderOption[0].id);
|
144
144
|
}
|
145
|
-
|
146
|
-
var checkbox = $(option).find('input[type="checkbox"]');
|
147
|
-
checkbox.prop('checked', !checkbox.prop('checked'));
|
148
145
|
selected = this._toggleEntryFromArray(key);
|
149
146
|
} else {
|
150
|
-
$(this.dropdownOptions).find('li').removeClass('
|
151
|
-
$(option).toggleClass('
|
152
|
-
this.
|
147
|
+
$(this.dropdownOptions).find('li').removeClass('selected');
|
148
|
+
$(option).toggleClass('selected', selected);
|
149
|
+
this._keysSelected = {};
|
150
|
+
this._keysSelected[option.id] = true;
|
153
151
|
}
|
154
152
|
|
155
|
-
|
156
|
-
|
157
|
-
this
|
153
|
+
// Set selected on original select option
|
154
|
+
// Only trigger if selected state changed
|
155
|
+
var prevSelected = $(this._valueDict[key].el).prop('selected');
|
156
|
+
if (prevSelected !== selected) {
|
157
|
+
$(this._valueDict[key].el).prop('selected', selected);
|
158
|
+
this.$el.trigger('change');
|
159
|
+
}
|
158
160
|
}
|
159
161
|
|
160
162
|
e.stopPropagation();
|
@@ -183,9 +185,12 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
183
185
|
var _this4 = this;
|
184
186
|
|
185
187
|
this.wrapper = document.createElement('div');
|
186
|
-
$(this.wrapper).addClass('select-wrapper
|
188
|
+
$(this.wrapper).addClass('select-wrapper ' + this.options.classes);
|
187
189
|
this.$el.before($(this.wrapper));
|
188
|
-
|
190
|
+
// Move actual select element into overflow hidden wrapper
|
191
|
+
var $hideSelect = $('<div class="hide-select"></div>');
|
192
|
+
$(this.wrapper).append($hideSelect);
|
193
|
+
$hideSelect[0].appendChild(this.el);
|
189
194
|
|
190
195
|
if (this.el.disabled) {
|
191
196
|
this.wrapper.classList.add('disabled');
|
@@ -223,7 +228,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
223
228
|
});
|
224
229
|
}
|
225
230
|
|
226
|
-
this
|
231
|
+
$(this.wrapper).append(this.dropdownOptions);
|
227
232
|
|
228
233
|
// Add input dropdown
|
229
234
|
this.input = document.createElement('input');
|
@@ -235,24 +240,40 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
235
240
|
$(this.input).prop('disabled', 'true');
|
236
241
|
}
|
237
242
|
|
238
|
-
this
|
243
|
+
$(this.wrapper).prepend(this.input);
|
239
244
|
this._setValueToInput();
|
240
245
|
|
241
246
|
// Add caret
|
242
247
|
var dropdownIcon = $('<svg class="caret" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
|
243
|
-
this
|
248
|
+
$(this.wrapper).prepend(dropdownIcon[0]);
|
244
249
|
|
245
250
|
// Initialize dropdown
|
246
251
|
if (!this.el.disabled) {
|
247
252
|
var dropdownOptions = $.extend({}, this.options.dropdownOptions);
|
253
|
+
var userOnOpenEnd = dropdownOptions.onOpenEnd;
|
248
254
|
|
249
255
|
// Add callback for centering selected option when dropdown content is scrollable
|
250
256
|
dropdownOptions.onOpenEnd = function (el) {
|
251
257
|
var selectedOption = $(_this4.dropdownOptions).find('.selected').first();
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
258
|
+
|
259
|
+
if (selectedOption.length) {
|
260
|
+
// Focus selected option in dropdown
|
261
|
+
M.keyDown = true;
|
262
|
+
_this4.dropdown.focusedIndex = selectedOption.index();
|
263
|
+
_this4.dropdown._focusFocusedItem();
|
264
|
+
M.keyDown = false;
|
265
|
+
|
266
|
+
// Handle scrolling to selected option
|
267
|
+
if (_this4.dropdown.isScrollable) {
|
268
|
+
var scrollOffset = selectedOption[0].getBoundingClientRect().top - _this4.dropdownOptions.getBoundingClientRect().top; // scroll to selected option
|
269
|
+
scrollOffset -= _this4.dropdownOptions.clientHeight / 2; // center in dropdown
|
270
|
+
_this4.dropdownOptions.scrollTop = scrollOffset;
|
271
|
+
}
|
272
|
+
}
|
273
|
+
|
274
|
+
// Handle user declared onOpenEnd if needed
|
275
|
+
if (userOnOpenEnd && typeof userOnOpenEnd === 'function') {
|
276
|
+
userOnOpenEnd.call(_this4.dropdown, _this4.el);
|
256
277
|
}
|
257
278
|
};
|
258
279
|
|
@@ -322,7 +343,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
322
343
|
|
323
344
|
// add icons
|
324
345
|
var iconUrl = option.getAttribute('data-icon');
|
325
|
-
var classes = option.getAttribute('class');
|
326
346
|
if (!!iconUrl) {
|
327
347
|
var imgEl = $('<img alt="" src="' + iconUrl + '">');
|
328
348
|
liEl.prepend(imgEl);
|
@@ -343,49 +363,54 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
343
363
|
key: '_toggleEntryFromArray',
|
344
364
|
value: function _toggleEntryFromArray(key) {
|
345
365
|
var notAdded = !this._keysSelected.hasOwnProperty(key);
|
366
|
+
var $optionLi = $(this._valueDict[key].optionEl);
|
367
|
+
|
346
368
|
if (notAdded) {
|
347
369
|
this._keysSelected[key] = true;
|
348
370
|
} else {
|
349
371
|
delete this._keysSelected[key];
|
350
372
|
}
|
351
373
|
|
352
|
-
$
|
374
|
+
$optionLi.toggleClass('selected', notAdded);
|
375
|
+
|
376
|
+
// Set checkbox checked value
|
377
|
+
$optionLi.find('input[type="checkbox"]').prop('checked', notAdded);
|
353
378
|
|
354
379
|
// use notAdded instead of true (to detect if the option is selected or not)
|
355
|
-
$
|
380
|
+
$optionLi.prop('selected', notAdded);
|
356
381
|
|
357
382
|
return notAdded;
|
358
383
|
}
|
359
384
|
|
360
385
|
/**
|
361
|
-
* Set value to input
|
386
|
+
* Set text value to input
|
362
387
|
*/
|
363
388
|
|
364
389
|
}, {
|
365
390
|
key: '_setValueToInput',
|
366
391
|
value: function _setValueToInput() {
|
367
|
-
var
|
392
|
+
var values = [];
|
368
393
|
var options = this.$el.find('option');
|
369
394
|
|
370
395
|
options.each(function (el) {
|
371
396
|
if ($(el).prop('selected')) {
|
372
397
|
var text = $(el).text();
|
373
|
-
|
398
|
+
values.push(text);
|
374
399
|
}
|
375
400
|
});
|
376
401
|
|
377
|
-
if (
|
402
|
+
if (!values.length) {
|
378
403
|
var firstDisabled = this.$el.find('option:disabled').eq(0);
|
379
|
-
if (firstDisabled.length) {
|
380
|
-
|
404
|
+
if (firstDisabled.length && firstDisabled[0].value === '') {
|
405
|
+
values.push(firstDisabled.text());
|
381
406
|
}
|
382
407
|
}
|
383
408
|
|
384
|
-
this.input.value =
|
409
|
+
this.input.value = values.join(', ');
|
385
410
|
}
|
386
411
|
|
387
412
|
/**
|
388
|
-
* Set selected state of dropdown
|
413
|
+
* Set selected state of dropdown to match actual select element
|
389
414
|
*/
|
390
415
|
|
391
416
|
}, {
|
@@ -395,12 +420,12 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
395
420
|
|
396
421
|
for (var key in this._valueDict) {
|
397
422
|
var option = this._valueDict[key];
|
398
|
-
|
399
|
-
|
423
|
+
var optionIsSelected = $(option.el).prop('selected');
|
424
|
+
$(option.optionEl).find('input[type="checkbox"]').prop('checked', optionIsSelected);
|
425
|
+
if (optionIsSelected) {
|
400
426
|
this._activateOption($(this.dropdownOptions), $(option.optionEl));
|
401
427
|
this._keysSelected[key] = true;
|
402
428
|
} else {
|
403
|
-
$(option.optionEl).find('input[type="checkbox"]').prop("checked", false);
|
404
429
|
$(option.optionEl).removeClass('selected');
|
405
430
|
}
|
406
431
|
}
|
@@ -419,7 +444,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
419
444
|
if (!this.isMultiple) {
|
420
445
|
collection.find('li.selected').removeClass('selected');
|
421
446
|
}
|
422
|
-
|
423
447
|
var option = $(newOption);
|
424
448
|
option.addClass('selected');
|
425
449
|
}
|
@@ -99,9 +99,11 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
99
99
|
*/
|
100
100
|
value: function destroy() {
|
101
101
|
this._removeEventHandlers();
|
102
|
+
this._enableBodyScrolling();
|
102
103
|
this._overlay.parentNode.removeChild(this._overlay);
|
103
104
|
this.dragTarget.parentNode.removeChild(this.dragTarget);
|
104
105
|
this.el.M_Sidenav = undefined;
|
106
|
+
this.el.style.transform = '';
|
105
107
|
|
106
108
|
var index = Sidenav._sidenavs.indexOf(this);
|
107
109
|
if (index >= 0) {
|
@@ -290,7 +292,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
290
292
|
key: '_handleDragTargetRelease',
|
291
293
|
value: function _handleDragTargetRelease() {
|
292
294
|
if (this.isDragged) {
|
293
|
-
if (this.percentOpen > .
|
295
|
+
if (this.percentOpen > 0.2) {
|
294
296
|
this.open();
|
295
297
|
} else {
|
296
298
|
this._animateOut();
|
@@ -357,7 +359,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
357
359
|
key: '_handleCloseRelease',
|
358
360
|
value: function _handleCloseRelease() {
|
359
361
|
if (this.isOpen && this.isDragged) {
|
360
|
-
if (this.percentOpen > .
|
362
|
+
if (this.percentOpen > 0.8) {
|
361
363
|
this._animateIn();
|
362
364
|
} else {
|
363
365
|
this.close();
|
@@ -645,7 +647,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
645
647
|
|
646
648
|
Sidenav._sidenavs = [];
|
647
649
|
|
648
|
-
|
650
|
+
M.Sidenav = Sidenav;
|
649
651
|
|
650
652
|
if (M.jQueryLoaded) {
|
651
653
|
M.initializeJqueryWrapper(Sidenav, 'sidenav', 'M_Sidenav');
|