react-virtual-kanban
Advanced tools
Comparing version 0.0.6 to 0.0.7
Changelog | ||
--------- | ||
### 0.0.7 | ||
Use generated lib for demo application | ||
### 0.0.6 | ||
@@ -5,0 +8,0 @@ Added jest test runner :green_apple:. Also added tests for `updateList` module. |
@@ -102,3 +102,5 @@ 'use strict'; | ||
this.setState({ lists: (0, _updateLists.updateLists)(this.state.lists, { from: from, to: to }) }, function () { | ||
this.setState(function (prevState) { | ||
return { lists: (0, _updateLists.updateLists)(prevState.lists, { from: from, to: to }) }; | ||
}, function () { | ||
return _this2.props.onMoveList(from, to); | ||
@@ -112,3 +114,5 @@ }); | ||
this.setState({ lists: (0, _updateLists.updateLists)(this.state.lists, { from: from, to: to }) }, function () { | ||
this.setState(function (prevState) { | ||
return { lists: (0, _updateLists.updateLists)(prevState.lists, { from: from, to: to }) }; | ||
}, function () { | ||
return _this3.props.onMoveRow(from, to); | ||
@@ -120,5 +124,6 @@ }); | ||
value: function onDropList(_ref) { | ||
var listId = _ref.listId; | ||
var listId = _ref.listId, | ||
listIndex = _ref.listIndex; | ||
this.props.onDropList({ listId: listId, lists: this.state.lists }); | ||
this.props.onDropList({ listId: listId, listIndex: listIndex, lists: this.state.lists }); | ||
} | ||
@@ -129,5 +134,7 @@ }, { | ||
var rowId = _ref2.rowId, | ||
listId = _ref2.listId; | ||
listId = _ref2.listId, | ||
rowIndex = _ref2.rowIndex, | ||
listIndex = _ref2.listIndex; | ||
this.props.onDropRow({ rowId: rowId, listId: listId, lists: this.state.lists }); | ||
this.props.onDropRow({ rowId: rowId, listId: listId, rowIndex: rowIndex, listIndex: listIndex, lists: this.state.lists }); | ||
} | ||
@@ -134,0 +141,0 @@ }, { |
@@ -50,14 +50,12 @@ 'use strict'; | ||
to = _ref2.to; | ||
var _from$dragIndex = from.dragIndex, | ||
dragIndex = _from$dragIndex === undefined ? -1 : _from$dragIndex, | ||
dragListIndex = from.dragListIndex; | ||
var _to$hoverIndex = to.hoverIndex, | ||
hoverIndex = _to$hoverIndex === undefined ? -1 : _to$hoverIndex, | ||
hoverListIndex = to.hoverListIndex; | ||
var fromRowIndex = from.rowIndex, | ||
fromListIndex = from.listIndex; | ||
var toRowIndex = to.rowIndex, | ||
toListIndex = to.listIndex; | ||
// Move lists | ||
if (dragListIndex !== hoverListIndex && dragIndex === -1 && hoverIndex === -1) { | ||
if (fromListIndex !== toListIndex && fromRowIndex === void 0 && toRowIndex === void 0) { | ||
return (0, _reactAddonsUpdate2.default)(lists, { | ||
$splice: [[dragListIndex, 1], [hoverListIndex, 0, lists[dragListIndex]]] | ||
$splice: [[fromListIndex, 1], [toListIndex, 0, lists[fromListIndex]]] | ||
}); | ||
@@ -67,12 +65,20 @@ } | ||
// Move rows between different lists | ||
if (dragListIndex !== hoverListIndex) { | ||
if (fromListIndex !== toListIndex) { | ||
var _update; | ||
return (0, _reactAddonsUpdate2.default)(lists, (_update = {}, (0, _defineProperty3.default)(_update, dragListIndex, { | ||
var row = lists[fromListIndex].rows[fromRowIndex]; | ||
if (!row) { | ||
// TODO: Review edge case with out of bounds fromRowIndex | ||
// Just return a clone of initial lists | ||
return lists.concat(); | ||
} | ||
return (0, _reactAddonsUpdate2.default)(lists, (_update = {}, (0, _defineProperty3.default)(_update, fromListIndex, { | ||
rows: { | ||
$splice: [[dragIndex, 1]] | ||
$splice: [[fromRowIndex, 1]] | ||
} | ||
}), (0, _defineProperty3.default)(_update, hoverListIndex, { | ||
}), (0, _defineProperty3.default)(_update, toListIndex, { | ||
rows: { | ||
$splice: [[hoverIndex, 0, lists[dragListIndex].rows[dragIndex]]] | ||
$splice: [[toRowIndex, 0, row]] | ||
} | ||
@@ -83,7 +89,7 @@ }), _update)); | ||
// Move rows inside same list | ||
return (0, _reactAddonsUpdate2.default)(lists, (0, _defineProperty3.default)({}, dragListIndex, { | ||
return (0, _reactAddonsUpdate2.default)(lists, (0, _defineProperty3.default)({}, fromListIndex, { | ||
rows: { | ||
$splice: [buildUpdateOperation(lists[dragListIndex].rows, { from: dragIndex, to: hoverIndex })] | ||
$splice: [buildUpdateOperation(lists[fromListIndex].rows, { from: fromRowIndex, to: toRowIndex })] | ||
} | ||
})); | ||
} |
@@ -36,3 +36,3 @@ 'use strict'; | ||
if (hoverBoundingRect.left < clientOffset.x && clientOffset.x < hoverBoundingRect.right && dragListIndex !== hoverListIndex) { | ||
props.moveRow({ dragIndex: dragIndex, dragListIndex: dragListIndex }, { hoverIndex: hoverIndex, hoverListIndex: hoverListIndex }); | ||
props.moveRow({ rowIndex: dragIndex, listIndex: dragListIndex }, { rowIndex: hoverIndex, listIndex: hoverListIndex }); | ||
item.rowIndex = hoverIndex; | ||
@@ -53,3 +53,3 @@ item.listIndex = hoverListIndex; | ||
props.moveRow({ dragIndex: dragIndex, dragListIndex: dragListIndex }, { hoverIndex: hoverIndex, hoverListIndex: hoverListIndex }); | ||
props.moveRow({ rowIndex: dragIndex, listIndex: dragListIndex }, { rowIndex: hoverIndex, listIndex: hoverListIndex }); | ||
@@ -61,6 +61,9 @@ item.rowIndex = hoverIndex; | ||
function drop(props) { | ||
var rowId = props.rowId; | ||
var listId = props.listId; | ||
var rowId = props.rowId, | ||
listId = props.listId, | ||
rowIndex = props.rowIndex, | ||
listIndex = props.listIndex; | ||
props.dropRow({ rowId: rowId, listId: listId }); | ||
props.dropRow({ rowId: rowId, listId: listId, rowIndex: rowIndex, listIndex: listIndex }); | ||
} |
@@ -28,3 +28,3 @@ 'use strict'; | ||
props.moveList({ dragListIndex: _dragListIndex }, { hoverListIndex: hoverListIndex }); | ||
props.moveList({ listIndex: _dragListIndex }, { listIndex: hoverListIndex }); | ||
@@ -41,3 +41,3 @@ item.listIndex = hoverListIndex; | ||
props.moveRow({ dragIndex: dragIndex, dragListIndex: _dragListIndex2 }, { hoverIndex: hoverIndex, hoverListIndex: hoverListIndex }); | ||
props.moveRow({ rowIndex: dragIndex, listIndex: _dragListIndex2 }, { rowIndex: hoverIndex, listIndex: hoverListIndex }); | ||
@@ -64,5 +64,7 @@ item.rowIndex = hoverIndex; | ||
function drop(props) { | ||
var listId = props.listId; | ||
var listId = props.listId, | ||
listIndex = props.listIndex; | ||
props.dropList({ listId: listId }); | ||
props.dropList({ listId: listId, listIndex: listIndex }); | ||
} |
{ | ||
"name": "react-virtual-kanban", | ||
"description": "A Kanban component in React", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"author": "Eduardo Lanchares <eduardo@elanchares.com>", | ||
"homepage": "https://github.com/edulan/react-virtual-kanban", | ||
"homepage": "https://edulan.github.io/react-virtual-kanban/", | ||
"main": "lib/index.js", | ||
@@ -53,2 +53,3 @@ "repository": { | ||
"fs-extra": "0.30.0", | ||
"gh-pages": "^0.12.0", | ||
"gzip-size": "3.0.0", | ||
@@ -100,4 +101,7 @@ "html-webpack-plugin": "2.22.0", | ||
"build:css": "postcss --use autoprefixer --use postcss-import src/styles.css > lib/styles.css", | ||
"build": "npm run build:clean && npm run build:umd && npm run build:lib && npm run build:css", | ||
"start": "node ./scripts/start.js", | ||
"build": "npm run build:clean && npm run build:umd && npm run build:lib && npm run build:css && npm run build:demo", | ||
"deploy": "gh-pages -d build", | ||
"prepublish": "npm run build", | ||
"postpublish": "npm run deploy", | ||
"start": "npm run build:lib && node ./scripts/start.js", | ||
"test": "jest" | ||
@@ -104,0 +108,0 @@ }, |
Sorry, the diff of this file is too big to display
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
2200800
25
12982
61