Skip to content

Commit 3461911

Browse files
author
Wayne Van Son
authored
Merge pull request #107 from waynevanson/master
closes #106
2 parents c6dd6e5 + 6289e87 commit 3461911

19 files changed

+53
-227
lines changed

dist/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export { ReactSortable } from "./react-sortable";
1+
export { default as Sortable, Direction, DOMRect, GroupOptions, MoveEvent, MultiDrag, Options, PullResult, PutResult, SortableEvent, SortableOptions, Swap, Utils } from "sortablejs";
2+
export { ReactSortable as default, ReactSortable } from "./react-sortable";
23
export * from "./types";
3-
export { default as Sortable, MultiDrag, Swap, DOMRect, Direction, GroupOptions, MoveEvent, Options, PullResult, PutResult, SortableEvent, SortableOptions, Utils } from "sortablejs";
44
//# sourceMappingURL=index.d.ts.map

dist/index.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.es.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import classNames from 'classnames';
2-
import { createElement, Children, cloneElement, createRef, Component } from 'react';
31
import Sortable from 'sortablejs';
42
export { MultiDrag, default as Sortable, Swap } from 'sortablejs';
3+
import classNames from 'classnames';
4+
import { createElement, Children, cloneElement, createRef, Component } from 'react';
55
import invariant from 'tiny-invariant';
66

77
/*! *****************************************************************************
@@ -392,15 +392,22 @@ var ReactSortable = /** @class */ (function (_super) {
392392
var newList = __spread(list).map(function (item) { return (__assign(__assign({}, item), { selected: false })); });
393393
evt.newIndicies.forEach(function (curr) {
394394
var index = curr.index;
395+
if (index === -1) {
396+
console.log("\"" + evt.type + "\" had indice of \"" + curr.index + "\", which is probably -1 and doesn't usually happen here.");
397+
console.log(evt);
398+
return;
399+
}
395400
newList[index].selected = true;
396401
});
397402
setList(newList, this.sortable, store);
398403
};
399404
ReactSortable.prototype.onDeselect = function (evt) {
400405
var _a = this.props, list = _a.list, setList = _a.setList;
401406
var newList = __spread(list).map(function (item) { return (__assign(__assign({}, item), { selected: false })); });
402-
evt.oldIndicies.forEach(function (curr) {
407+
evt.newIndicies.forEach(function (curr) {
403408
var index = curr.index;
409+
if (index === -1)
410+
return;
404411
newList[index].selected = true;
405412
});
406413
setList(newList, this.sortable, store);
@@ -411,4 +418,5 @@ var ReactSortable = /** @class */ (function (_super) {
411418
return ReactSortable;
412419
}(Component));
413420

421+
export default ReactSortable;
414422
export { ReactSortable };

dist/index.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
44

55
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
66

7-
var classNames = _interopDefault(require('classnames'));
8-
var react = require('react');
97
var Sortable = require('sortablejs');
108
var Sortable__default = _interopDefault(Sortable);
9+
var classNames = _interopDefault(require('classnames'));
10+
var react = require('react');
1111
var invariant = _interopDefault(require('tiny-invariant'));
1212

1313
/*! *****************************************************************************
@@ -398,15 +398,22 @@ var ReactSortable = /** @class */ (function (_super) {
398398
var newList = __spread(list).map(function (item) { return (__assign(__assign({}, item), { selected: false })); });
399399
evt.newIndicies.forEach(function (curr) {
400400
var index = curr.index;
401+
if (index === -1) {
402+
console.log("\"" + evt.type + "\" had indice of \"" + curr.index + "\", which is probably -1 and doesn't usually happen here.");
403+
console.log(evt);
404+
return;
405+
}
401406
newList[index].selected = true;
402407
});
403408
setList(newList, this.sortable, store);
404409
};
405410
ReactSortable.prototype.onDeselect = function (evt) {
406411
var _a = this.props, list = _a.list, setList = _a.setList;
407412
var newList = __spread(list).map(function (item) { return (__assign(__assign({}, item), { selected: false })); });
408-
evt.oldIndicies.forEach(function (curr) {
413+
evt.newIndicies.forEach(function (curr) {
409414
var index = curr.index;
415+
if (index === -1)
416+
return;
410417
newList[index].selected = true;
411418
});
412419
setList(newList, this.sortable, store);
@@ -431,3 +438,4 @@ Object.defineProperty(exports, 'Swap', {
431438
}
432439
});
433440
exports.ReactSortable = ReactSortable;
441+
exports.default = ReactSortable;

dist/react-sortable.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/util.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { PropsWithChildren } from "react";
22
import { Options } from "sortablejs";
3-
import { ItemInterface } from "../dist";
43
import { MultiDragEvent } from "./react-sortable";
5-
import { AllMethodNames, ReactSortableProps } from "./types";
4+
import { AllMethodNames, ItemInterface, ReactSortableProps } from "./types";
65
/**
76
* Removes the `node` from the DOM
87
* @param node

dist/util.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/examples.281a3919.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/examples.281a3919.js renamed to docs/examples.42ccc30d.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/examples.42ccc30d.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)