Comparing version 0.9.11 to 0.9.12
{ | ||
"name": "material", | ||
"version": "0.9.11", | ||
"version": "0.9.12", | ||
"description": "A lightweight implementation of Material Design Components for the web - ES6", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -107,3 +107,3 @@ export default { | ||
*/ | ||
showSearch () { | ||
showSearch (doNotEmpty) { | ||
if (this.hideFilter) { | ||
@@ -127,3 +127,3 @@ this.hideFilter() | ||
this.ui.body.innerHTML = '' | ||
if (!doNotEmpty) this.ui.body.innerHTML = '' | ||
@@ -130,0 +130,0 @@ // this.ui['search-list'].classList.add('show') |
@@ -201,2 +201,17 @@ import passiveEvents from '../module/passive' | ||
VirtualList.prototype.setCount = function (count) { | ||
console.log('setCount', count) | ||
this.count = count | ||
const height = this.itemHeight * this.count | ||
console.log('scroller height', height) | ||
this.scroller.style.height = height + 'px' | ||
} | ||
VirtualList.prototype.getCount = function () { | ||
// console.log('getCount') | ||
return this.count | ||
} | ||
VirtualList.prototype.setOffset = function (info) { | ||
@@ -224,8 +239,2 @@ // console.log('setOffset', info) | ||
VirtualList.prototype.getCount = function () { | ||
// console.log('getCount') | ||
return this.count | ||
} | ||
VirtualList.createScroller = function () { | ||
@@ -232,0 +241,0 @@ const scroller = document.createElement('div') |
@@ -1,2 +0,1 @@ | ||
const is = (object) => { | ||
@@ -3,0 +2,0 @@ return object && |
@@ -1,8 +0,3 @@ | ||
// base class | ||
import EventEmitter from './mixin/emitter' | ||
// related modules | ||
import build from './mixin/build' | ||
import events from './module/events' | ||
import Control from './class/control' | ||
import display from './mixin/display' | ||
// ui element | ||
import Element from './element' | ||
@@ -12,5 +7,6 @@ import Text from './text' | ||
class Snackbar extends EventEmitter { | ||
class Snackbar extends Control { | ||
static defaults = { | ||
class: 'snackbar', | ||
mixins: [display], | ||
transition: 225, | ||
@@ -34,8 +30,5 @@ duration: 4000, | ||
constructor (options) { | ||
super() | ||
super(options) | ||
this.init(options) | ||
this.build(this.constructor) | ||
this.render() | ||
events.attach(this.options.events, this) | ||
this.show() | ||
@@ -51,5 +44,2 @@ | ||
init (options) { | ||
this.options = Object.assign({}, Snackbar.defaults, options || {}) | ||
Object.assign(this, build, display) | ||
this.buildSnackbarContainer(this.options.container) | ||
@@ -59,8 +49,4 @@ } | ||
buildSnackbarContainer (container = document.body) { | ||
// console.log('buildSnackbarContainer', container) | ||
const snackbarContainer = container.querySelector('.snackbars') | ||
// console.log('snackbarContainer', snackbarContainer) | ||
if (!snackbarContainer) { | ||
@@ -74,21 +60,37 @@ this.options.container = document.createElement('div') | ||
} | ||
this.options.container.appendChild(this.element) | ||
} | ||
render () { | ||
this.ui.message.set(this.options.message) | ||
if (!this.ui) { | ||
console.error('UI elements not initialized properly.') | ||
return | ||
} | ||
if (this.options.action) { | ||
this.ui.callback.set(this.options.action) | ||
this.ui.callback.element.classList.add('show') | ||
this.ui.action.classList.add('show') | ||
const { message, callback, close, action } = this.ui | ||
if (message) { | ||
message.set(this.options.message) | ||
} else { | ||
console.error('Message UI element not initialized.') | ||
} | ||
if (this.options.close) { | ||
this.ui.close.element.classList.add('show') | ||
this.ui.action.classList.add('show') | ||
if (this.options.action && callback && callback.element) { | ||
callback.set(this.options.action) | ||
callback.element.classList.add('show') | ||
if (action) { | ||
action.classList.add('show') | ||
} | ||
} | ||
if (this.options.close && close && close.element) { | ||
close.element.classList.add('show') | ||
if (action) { | ||
action.classList.add('show') | ||
} | ||
} | ||
} | ||
action () { | ||
// console.log('action') | ||
this.emit('action') | ||
@@ -99,3 +101,2 @@ this.destroy() | ||
close () { | ||
// console.log('close') | ||
this.destroy() | ||
@@ -102,0 +103,0 @@ } |
@@ -113,3 +113,3 @@ // base | ||
default: | ||
this.setValue(prop, value) | ||
this.setValue(prop, silent) | ||
} | ||
@@ -116,0 +116,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
453412
222
10433