8000 Fix #115 children className · andrewvmail/react-sortablejs@2d520fc · GitHub
[go: up one dir, main page]

Skip to content

Commit 2d520fc

Browse files
author
EONIX\lbe
committed
Fix SortableJS#115 children className
1 parent 8681c50 commit 2d520fc

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

dist/index.es.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,15 @@ var ReactSortable = /** @class */ (function (_super) {
210210
ref: this.ref }, classicProps), this.getChildren());
211211
};
212212
ReactSortable.prototype.getChildren = function () {
213-
var _a = this.props, children = _a.children, dataIdAttr = _a.dataIdAttr, prevClassName = _a.className, _b = _a.selectedClass, selectedClass = _b === void 0 ? "sortable-selected" : _b, _c = _a.chosenClass, chosenClass = _c === void 0 ? "sortable-chosen" : _c, _d = _a.dragClass, _e = _a.fallbackClass, _f = _a.ghostClass, _g = _a.swapClass, _h = _a.filter, filter = _h === void 0 ? "sortable-filter" : _h, list = _a.list;
213+
var _a = this.props, children = _a.children, dataIdAttr = _a.dataIdAttr, _b = _a.selectedClass, selectedClass = _b === void 0 ? "sortable-selected" : _b, _c = _a.chosenClass, chosenClass = _c === void 0 ? "sortable-chosen" : _c, _d = _a.dragClass, _e = _a.fallbackClass, _f = _a.ghostClass, _g = _a.swapClass, _h = _a.filter, filter = _h === void 0 ? "sortable-filter" : _h, list = _a.list;
214214
// if no children, don't do anything.
215215
if (!children || children == null)
216216
return null;
217217
var dataid = dataIdAttr || "data-id";
218218
return Children.map(children, function (child, index) {
219219
var _a, _b, _c;
220220
var item = list[index];
221+
var prevClassName = child.props.className;
221222
// @todo - handle the function if avalable. I don't think anyone will be doing this soon.
222223
var filtered = typeof filter === "string" && (_a = {},
223224
_a[filter.replace(".", "")] = !!item.filtered,

dist/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,15 @@ var ReactSortable = /** @class */ (function (_super) {
216216
ref: this.ref }, classicProps), this.getChildren());
217217
};
218218
ReactSortable.prototype.getChildren = function () {
219-
var _a = this.props, children = _a.children, dataIdAttr = _a.dataIdAttr, prevClassName = _a.className, _b = _a.selectedClass, selectedClass = _b === void 0 ? "sortable-selected" : _b, _c = _a.chosenClass, chosenClass = _c === void 0 ? "sortable-chosen" : _c, _d = _a.dragClass, _e = _a.fallbackClass, _f = _a.ghostClass, _g = _a.swapClass, _h = _a.filter, filter = _h === void 0 ? "sortable-filter" : _h, list = _a.list;
219+
var _a = this.props, children = _a.children, dataIdAttr = _a.dataIdAttr, _b = _a.selectedClass, selectedClass = _b === void 0 ? "sortable-selected" : _b, _c = _a.chosenClass, chosenClass = _c === void 0 ? "sortable-chosen" : _c, _d = _a.dragClass, _e = _a.fallbackClass, _f = _a.ghostClass, _g = _a.swapClass, _h = _a.filter, filter = _h === void 0 ? "sortable-filter" : _h, list = _a.list;
220220
// if no children, don't do anything.
221221
if (!children || children == null)
222222
return null;
223223
var dataid = dataIdAttr || "data-id";
224224
return react.Children.map(children, function (child, index) {
225225
var _a, _b, _c;
226226
var item = list[index];
227+
var prevClassName = child.props.className;
227228
// @todo - handle the function if avalable. I don't think anyone will be doing this soon.
228229
var filtered = typeof filter === "string" && (_a = {},
229230
_a[filter.replace(".", "")] = !!item.filtered,

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.

src/react-sortable.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
9191
const {
9292
children,
9393
dataIdAttr,
94-
className: prevClassName,
9594
selectedClass = "sortable-selected",
9695
chosenClass = "sortable-chosen",
9796
dragClass = "sortable-drag",
@@ -107,6 +106,9 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
107106
const dataid = dataIdAttr || "data-id";
108107
return Children.map(children as ReactElement<any>[], (child, index) => {
109108
const item = list[index];
109+
const {
110+
className: prevClassName,
111+
} = child.props;
110112

111113
// @todo - handle the function if avalable. I don't think anyone will be doing this soon.
112114
const filtered = typeof filter === "string" && {
@@ -316,7 +318,7 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
316318
`"${evt.type}" had indice of "${curr.index}", which is probably -1 and doesn't usually happen here.`
317319
);
318320
console.log(evt)
319-
return
321+
return
320322
}
321323
newList[index].selected = true;
322324
});

0 commit comments

Comments
 (0)
0