Comparing version 0.4.1 to 0.4.2
@@ -30,2 +30,3 @@ import AppBar from 'material/src/appbar' | ||
import Tree from 'material/src/tree' | ||
import emitter from 'material/src/module/emitter' | ||
@@ -61,3 +62,4 @@ export { | ||
Snackbar, | ||
Progress | ||
Progress, | ||
emitter | ||
} |
{ | ||
"name": "material", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "A lightweight implementation of Material Design Components - ES6", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -16,2 +16,3 @@ 'use strict' | ||
tag: 'button', | ||
ripple: false, | ||
events: [ | ||
@@ -61,8 +62,10 @@ ['root.click', 'handleClick'], | ||
this.options = Object.assign({}, defaults, options || {}) | ||
Object.assign(this, control, emitter, attach, ripple) | ||
Object.assign(this, control, emitter, attach) | ||
this.element = this.element || {} | ||
// init module | ||
ripple(this) | ||
// init module$ | ||
if (this.options.ripple) { | ||
ripple(this) | ||
} | ||
@@ -69,0 +72,0 @@ this.emit('init') |
@@ -24,3 +24,3 @@ import css from '../module/css' | ||
if (options.type) { | ||
//css.add(element, options.class + '-' + options.type) | ||
// css.add(element, options.class + '-' + options.type) | ||
css.add(element, 'type-' + options.type) | ||
@@ -57,2 +57,10 @@ } | ||
if (options.data) { | ||
for (var property in options.data) { | ||
if (options.data.hasOwnProperty(property)) { | ||
element.dataset[property] = options.data[property] | ||
} | ||
} | ||
} | ||
if (options.theme) { | ||
@@ -59,0 +67,0 @@ element.classList.add(options.theme + '-theme') |
@@ -12,8 +12,6 @@ 'use strict' | ||
import { | ||
Text, | ||
Button, | ||
Toolbar, | ||
Layout | ||
} from 'material' | ||
import Text from './text' | ||
import Button from './button' | ||
import Toolbar from './toolbar' | ||
import Layout from './layout' | ||
@@ -20,0 +18,0 @@ let defaults = { |
@@ -37,2 +37,6 @@ | ||
if (options.id) { | ||
element.setAttribute('id', options.id) | ||
} | ||
delete this.options.tag | ||
@@ -39,0 +43,0 @@ delete this.options.text |
'use strict' | ||
import { Item, Divider } from '../index' | ||
import Item from './item' | ||
import Divider from './divider' | ||
import init from './component/init' | ||
// import init from './component/init' | ||
import emitter from './module/emitter' | ||
@@ -126,2 +127,3 @@ import insert from './element/insert' | ||
// console.log('handleSelect-', e.currentTarget, this.options.target) | ||
e.stopPropagation() | ||
@@ -128,0 +130,0 @@ if (e.target === e.currentTarget) { |
@@ -40,5 +40,10 @@ 'use strict' | ||
// console.log('on', e.name) | ||
e.element.on(e.name, f.bind(bound)) | ||
if (!f) { | ||
console.log('can\'t attach event', e.name, 'to', def[1]) | ||
} else { | ||
e.element.on(e.name, f.bind(bound)) | ||
} | ||
} else { | ||
console.log('can\'t attach', e.name) | ||
console.log('can\'t attach', def[0], def[1]) | ||
// console.log('--', e, f) | ||
} | ||
@@ -45,0 +50,0 @@ }) |
@@ -106,2 +106,6 @@ 'use strict' | ||
if (this.options.options) { | ||
this.setOptions(this.options.options) | ||
} | ||
// if (!this.options.value) { | ||
@@ -119,2 +123,8 @@ // this.root.classList.add('is-empty') | ||
setOptions (options) { | ||
for (var i = 0; i < options.length; i++) { | ||
this.add(options[i], options[i]) | ||
} | ||
} | ||
/** | ||
@@ -228,2 +238,3 @@ * _initUnderline | ||
setValue (value) { | ||
// console.log('setValue', this.options.name, value) | ||
this.input.value = value | ||
@@ -230,0 +241,0 @@ |
@@ -113,6 +113,6 @@ 'use strict' | ||
*/ | ||
set (prop, value) { | ||
set (prop, value, silent) { | ||
switch (prop) { | ||
case 'value': | ||
this.setValue(value) | ||
this.setValue(value, silent) | ||
break | ||
@@ -127,3 +127,3 @@ case 'disabled': | ||
default: | ||
this.setValue(prop) | ||
this.setValue(prop, silent) | ||
} | ||
@@ -152,3 +152,3 @@ | ||
// console.log('setValue', value) | ||
this.check(value) | ||
this.check(value, silent) | ||
} | ||
@@ -185,3 +185,5 @@ | ||
this.value = true | ||
this.emit('change', this.checked) | ||
if (!silent) { | ||
this.emit('change', this.checked) | ||
} | ||
} else { | ||
@@ -192,3 +194,5 @@ this.root.classList.remove('is-checked') | ||
this.value = false | ||
this.emit('change', this.checked) | ||
if (!silent) { | ||
this.emit('change', this.checked) | ||
} | ||
} | ||
@@ -195,0 +199,0 @@ return this |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
667662
181
11822
6