linkmore-design
Version:
🌈 🚀lm组件库。🚀
23 lines (22 loc) • 781 B
JavaScript
import React from 'react';
import { SortableContext, rectSortingStrategy } from '@dnd-kit/sortable';
import SortableItem from "./sortableItem";
// rectSortingStrategy 可交换策略
var SortableBox = function SortableBox(_ref) {
var instance = _ref.instance;
var items = instance.items,
rowKey = instance.rowKey,
options = instance.options;
return /*#__PURE__*/React.createElement(SortableContext, {
items: items,
strategy: rectSortingStrategy
}, options === null || options === void 0 ? void 0 : options.map(function (item, idx) {
return /*#__PURE__*/React.createElement(SortableItem, {
instance: instance,
index: idx,
key: item[rowKey] || idx,
item: item
});
}));
};
export default /*#__PURE__*/React.memo(SortableBox);