react-checkbox-tree
Advanced tools
Comparing version 0.5.0 to 0.5.1
# CHANGELOG | ||
## [v0.5.1](https://github.com/jakezatecky/react-checkbox-tree/compare/v0.5.0...v0.5.1) (2017-03-21) | ||
### New Features | ||
* [#27]: Add `rct-node-leaf` and `rct-node-parent` classes to the TreeNode `<li>` element | ||
## [v0.5.0](https://github.com/jakezatecky/react-checkbox-tree/compare/v0.4.2...v0.5.0) (2017-03-12) | ||
@@ -4,0 +10,0 @@ |
113
lib/index.js
@@ -1,2 +0,2 @@ | ||
/*! react-checkbox-tree - v0.5.0 | 2017 */ | ||
/*! react-checkbox-tree - v0.5.1 | 2017 */ | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
@@ -77,3 +77,3 @@ if(typeof exports === 'object' && typeof module === 'object') | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 13); | ||
/******/ return __webpack_require__(__webpack_require__.s = 14); | ||
/******/ }) | ||
@@ -88,3 +88,3 @@ /************************************************************************/ | ||
var randomFromSeed = __webpack_require__(11); | ||
var randomFromSeed = __webpack_require__(12); | ||
@@ -244,3 +244,3 @@ var ORIGINAL = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-'; | ||
var _shortid = __webpack_require__(5); | ||
var _shortid = __webpack_require__(6); | ||
@@ -529,2 +529,6 @@ var _shortid2 = _interopRequireDefault(_shortid); | ||
var _classnames = __webpack_require__(5); | ||
var _classnames2 = _interopRequireDefault(_classnames); | ||
var _react = __webpack_require__(1); | ||
@@ -589,2 +593,7 @@ | ||
}, { | ||
key: 'hasChildren', | ||
value: function hasChildren() { | ||
return this.props.rawChildren !== null; | ||
} | ||
}, { | ||
key: 'renderCollapseIcon', | ||
@@ -601,3 +610,3 @@ value: function renderCollapseIcon() { | ||
value: function renderCollapseButton() { | ||
if (this.props.rawChildren === null) { | ||
if (!this.hasChildren()) { | ||
return _react2.default.createElement( | ||
@@ -636,3 +645,3 @@ 'span', | ||
if (this.props.rawChildren === null) { | ||
if (!this.hasChildren()) { | ||
return _react2.default.createElement('i', { className: 'rct-icon rct-icon-leaf' }); | ||
@@ -666,6 +675,11 @@ } | ||
var inputId = treeId + '-' + value; | ||
var nodeClass = (0, _classnames2.default)({ | ||
'rct-node': true, | ||
'rct-node-parent': this.hasChildren(), | ||
'rct-node-leaf': !this.hasChildren() | ||
}); | ||
return _react2.default.createElement( | ||
'li', | ||
{ className: 'rct-node' }, | ||
{ className: nodeClass }, | ||
_react2.default.createElement( | ||
@@ -721,3 +735,3 @@ 'span', | ||
icon: null, | ||
rawChildren: undefined | ||
rawChildren: null | ||
}; | ||
@@ -730,7 +744,53 @@ exports.default = TreeNode; | ||
"use strict"; | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! | ||
Copyright (c) 2016 Jed Watson. | ||
Licensed under the MIT License (MIT), see | ||
http://jedwatson.github.io/classnames | ||
*/ | ||
/* global define */ | ||
module.exports = __webpack_require__(8); | ||
(function () { | ||
'use strict'; | ||
var hasOwn = {}.hasOwnProperty; | ||
function classNames () { | ||
var classes = []; | ||
for (var i = 0; i < arguments.length; i++) { | ||
var arg = arguments[i]; | ||
if (!arg) continue; | ||
var argType = typeof arg; | ||
if (argType === 'string' || argType === 'number') { | ||
classes.push(arg); | ||
} else if (Array.isArray(arg)) { | ||
classes.push(classNames.apply(null, arg)); | ||
} else if (argType === 'object') { | ||
for (var key in arg) { | ||
if (hasOwn.call(arg, key) && arg[key]) { | ||
classes.push(key); | ||
} | ||
} | ||
} | ||
} | ||
return classes.join(' '); | ||
} | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = classNames; | ||
} else if (true) { | ||
// register as 'classnames', consistent with npm package name | ||
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () { | ||
return classNames; | ||
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), | ||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | ||
} else { | ||
window.classNames = classNames; | ||
} | ||
}()); | ||
/***/ }), | ||
@@ -742,2 +802,11 @@ /* 6 */ | ||
module.exports = __webpack_require__(9); | ||
/***/ }), | ||
/* 7 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
var alphabet = __webpack_require__(0); | ||
@@ -762,3 +831,3 @@ | ||
/***/ }), | ||
/* 7 */ | ||
/* 8 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -769,3 +838,3 @@ | ||
var randomByte = __webpack_require__(10); | ||
var randomByte = __webpack_require__(11); | ||
@@ -790,3 +859,3 @@ function encode(lookup, number) { | ||
/***/ }), | ||
/* 8 */ | ||
/* 9 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -798,5 +867,5 @@ | ||
var alphabet = __webpack_require__(0); | ||
var encode = __webpack_require__(7); | ||
var decode = __webpack_require__(6); | ||
var isValid = __webpack_require__(9); | ||
var encode = __webpack_require__(8); | ||
var decode = __webpack_require__(7); | ||
var isValid = __webpack_require__(10); | ||
@@ -816,3 +885,3 @@ // Ignore all milliseconds before a certain time to reduce the size of the date entropy without sacrificing uniqueness. | ||
// party cluster solutions such as pm2. | ||
var clusterWorkerId = __webpack_require__(12) || 0; | ||
var clusterWorkerId = __webpack_require__(13) || 0; | ||
@@ -900,3 +969,3 @@ // Counter is used when shortid is called multiple times in one second. | ||
/***/ }), | ||
/* 9 */ | ||
/* 10 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -927,3 +996,3 @@ | ||
/***/ }), | ||
/* 10 */ | ||
/* 11 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -949,3 +1018,3 @@ | ||
/***/ }), | ||
/* 11 */ | ||
/* 12 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -982,3 +1051,3 @@ | ||
/***/ }), | ||
/* 12 */ | ||
/* 13 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -993,3 +1062,3 @@ | ||
/***/ }), | ||
/* 13 */ | ||
/* 14 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -996,0 +1065,0 @@ |
{ | ||
"name": "react-checkbox-tree", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "A simple and elegant checkbox tree for React.", | ||
@@ -58,4 +58,5 @@ "author": "Jake Zatecky", | ||
"dependencies": { | ||
"classnames": "^2.2.5", | ||
"shortid": "^2.2.6" | ||
} | ||
} |
@@ -0,1 +1,2 @@ | ||
import classNames from 'classnames'; | ||
import React from 'react'; | ||
@@ -24,3 +25,3 @@ | ||
icon: null, | ||
rawChildren: undefined, | ||
rawChildren: null, | ||
}; | ||
@@ -62,2 +63,6 @@ | ||
hasChildren() { | ||
return this.props.rawChildren !== null; | ||
} | ||
renderCollapseIcon() { | ||
@@ -72,3 +77,3 @@ if (!this.props.expanded) { | ||
renderCollapseButton() { | ||
if (this.props.rawChildren === null) { | ||
if (!this.hasChildren()) { | ||
return ( | ||
@@ -105,3 +110,3 @@ <span className="rct-collapse"> | ||
if (this.props.rawChildren === null) { | ||
if (!this.hasChildren()) { | ||
return <i className="rct-icon rct-icon-leaf" />; | ||
@@ -128,5 +133,10 @@ } | ||
const inputId = `${treeId}-${value}`; | ||
const nodeClass = classNames({ | ||
'rct-node': true, | ||
'rct-node-parent': this.hasChildren(), | ||
'rct-node-leaf': !this.hasChildren(), | ||
}); | ||
return ( | ||
<li className="rct-node"> | ||
<li className={nodeClass}> | ||
<span className="rct-text"> | ||
@@ -133,0 +143,0 @@ {this.renderCollapseButton()} |
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
118963
1371
3
+ Addedclassnames@^2.2.5
+ Addedclassnames@2.5.1(transitive)