@wulperstudio/cms
Version:
Wulper Studio Library Components CMS
62 lines • 2.43 kB
JavaScript
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["items", "children", "EntryProps"];
/* eslint-disable react/jsx-no-useless-fragment */
import React from 'react';
import { Droppable, Draggable } from 'react-beautiful-dnd';
import { Wrapper, WrapperInner } from './styled';
import { Entry } from '../../../../components/Entry';
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
var InnerItemListW = function InnerItemListW(_ref) {
var items = _ref.items,
_children = _ref.children;
return /*#__PURE__*/_jsx(_Fragment, {
children: items == null ? void 0 : items.map(function (item, index) {
return /*#__PURE__*/_jsx(Draggable, {
draggableId: item.id,
index: index,
children: function children(_ref2) {
var draggableProps = _ref2.draggableProps,
innerRef = _ref2.innerRef,
dragHandleProps = _ref2.dragHandleProps;
return /*#__PURE__*/_jsx("div", Object.assign({
ref: innerRef
}, draggableProps, dragHandleProps, {
style: Object.assign({}, draggableProps.style, {
marginBottom: '12px'
}),
children: _children && _children(item, index)
}));
}
}, item.id);
})
});
};
export var ItemsList = function ItemsList(_ref3) {
var _InnerItemListW;
var items = _ref3.items,
_children2 = _ref3.children,
EntryProps = _ref3.EntryProps,
props = _objectWithoutProperties(_ref3, _excluded);
var _props$listId = props.listId,
listId = _props$listId === void 0 ? 'LIST' : _props$listId;
return /*#__PURE__*/_jsx(Droppable, {
droppableId: listId,
type: "ITEM",
children: function children(_ref4) {
var innerRef = _ref4.innerRef,
placeholder = _ref4.placeholder,
droppableProps = _ref4.droppableProps;
return /*#__PURE__*/_jsx(Wrapper, Object.assign({}, droppableProps, {
className: "items__list",
children: /*#__PURE__*/_jsxs(WrapperInner, {
ref: innerRef,
className: "wrapper__inner__list",
children: [_InnerItemListW || (_InnerItemListW = /*#__PURE__*/_jsx(InnerItemListW, {
items: items,
children: _children2
})), /*#__PURE__*/_jsx(Entry, Object.assign({}, EntryProps)), placeholder]
})
}));
}
});
};