mithril-material
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -7,14 +7,8 @@ Object.defineProperty(exports, "__esModule", { | ||
var _mithril = require('mithril'); | ||
var _mithril = require("mithril"); | ||
var _mithril2 = _interopRequireDefault(_mithril); | ||
var _Checkbox = require('../form/checkbox/Checkbox'); | ||
var _Checkbox2 = _interopRequireDefault(_Checkbox); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** @jsx m */ | ||
exports.default = { | ||
@@ -31,37 +25,13 @@ | ||
selectSingleRow: function selectSingleRow(row, value) { | ||
row._selected = value; | ||
this.vnode.attrs.onselect && this.vnode.attrs.onselect([row]); | ||
}, | ||
selectAll: function selectAll(state) { | ||
var self = this; | ||
for (var i = 0; i < self.rows.length; i++) { | ||
self.rows[i]._selected = state; | ||
} | ||
this.vnode.attrs.onselect && this.vnode.attrs.onselect(self.rows.filter(function (row) { | ||
return row._selected == true; | ||
})); | ||
}, | ||
view: function view(vnode) { | ||
var self = this; | ||
return (0, _mithril2.default)( | ||
'table', | ||
{ className: 'bordered highlight striped' }, | ||
"table", | ||
{ className: "bordered highlight striped" }, | ||
(0, _mithril2.default)( | ||
'thead', | ||
"thead", | ||
null, | ||
(0, _mithril2.default)( | ||
'tr', | ||
"tr", | ||
null, | ||
(0, _mithril2.default)( | ||
'th', | ||
null, | ||
(0, _mithril2.default)(_Checkbox2.default, { | ||
onchange: self.selectAll.bind(self) }) | ||
), | ||
self.columns.map(function (column) { | ||
@@ -76,3 +46,3 @@ | ||
return (0, _mithril2.default)( | ||
'th', | ||
"th", | ||
null, | ||
@@ -85,19 +55,11 @@ columnName | ||
(0, _mithril2.default)( | ||
'tbody', | ||
"tbody", | ||
null, | ||
self.rows.map(function (row) { | ||
return (0, _mithril2.default)( | ||
'tr', | ||
"tr", | ||
null, | ||
(0, _mithril2.default)( | ||
'td', | ||
null, | ||
(0, _mithril2.default)(_Checkbox2.default, { | ||
key: "" + row._selected, | ||
onchange: self.selectSingleRow.bind(self, row), | ||
checked: row._selected }) | ||
), | ||
self.columns.map(function (column) { | ||
return (0, _mithril2.default)( | ||
'td', | ||
"td", | ||
null, | ||
@@ -113,2 +75,2 @@ row[column.key] | ||
}; | ||
}; /** @jsx m */ |
{ | ||
"name": "mithril-material", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Material Design components for MithrilJs Applications", | ||
"main": "index.js", | ||
"main": "dist/index.js", | ||
"keywords": ["mithril", "material", "design"], | ||
@@ -7,0 +7,0 @@ "scripts": { |
76285
35
837