How to use react-beautiful-dnd - 10 common examples

To help you get started, weโ€™ve selected a few react-beautiful-dnd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github iuap-design / bee.tinper.org / tinper-bee / bee-transfer / build / list.js View on Github external
renderedEl = _renderItem.renderedEl;

      if (filter && filter.trim() && !_this4.matchFilter(renderedText, item)) {
        return null;
      }

      // all show items
      totalDataSource.push(item);

      if (!item.disabled) {
        filteredDataSource.push(item);
      }

      var checked = checkedKeys.indexOf(item.key) >= 0;
      return _react2["default"].createElement(
        _reactBeautifulDnd.Draggable,
        { key: item.key, index: index, draggableId: '' + item.key, isDragDisabled: draggable ? item.disabled : !draggable },
        function (provided, snapshot) {
          return _react2["default"].createElement(
            'div',
            _extends({
              ref: provided.innerRef
            }, provided.draggableProps, provided.dragHandleProps, {
              // onClick={(event) =>this.handleDrag(event, provided, snapshot, item)}
              onKeyDown: function onKeyDown(event) {
                return _this4.onKeyDown(event, provided, snapshot, item);
              }
              // className={classnames({
              //     ...getClass(this.props,snapshot.isDragging).drag
              //   })}
              , style: _extends({}, provided.draggableProps.style) }),
            _react2["default"].createElement(_item2["default"]
github olymp / olymp / external / fela / menu / dnd / item.js View on Github external
exports.default = function (_ref) {
  var children = _ref.children,
      id = _ref.id,
      onClick = _ref.onClick,
      props = _objectWithoutProperties(_ref, ['children', 'id', 'onClick']);

  return _react2.default.createElement(
    _reactBeautifulDnd.Draggable,
    { draggableId: id },
    function (provided, snapshot) {
      var onClickNew = onClick ? function () {
        // dragHandleProps might be null
        if (!provided.dragHandleProps) {
          return onClick;
        }
        return function (event) {
          provided.dragHandleProps.onClick(event);
          onClick(event);
        };
      }() : provided.dragHandleProps.onClickDrag;
      return _react2.default.createElement(
        'div',
        null,
        _react2.default.createElement(
github iuap-design / bee.tinper.org / tinper-bee / bee-transfer / build / Transfer.js View on Github external
rightDataSource = _state3.rightDataSource,
        droppableId = _state3.droppableId;

    // const { leftDataSource, rightDataSource } = this.splitDataSource(this.props);

    var leftActive = targetSelectedKeys.length > 0;
    var rightActive = sourceSelectedKeys.length > 0;

    var cls = (0, _classnames2["default"])(className, prefixCls);

    var titles = this.getTitles();
    return _react2["default"].createElement(
      'div',
      { className: cls },
      _react2["default"].createElement(
        _reactBeautifulDnd.DragDropContext,
        { onDragEnd: this.onDragEnd, onDragStart: this.onDragStart },
        _react2["default"].createElement(_list2["default"], {
          titleText: titles[0] //ๅทฆไพงๆ ‡้ข˜
          , dataSource: leftDataSource //ๅทฆไพงๆ•ฐๆฎๆบ
          , filter: leftFilter //ๆœ็ดขๆก†ไธญ่พ“ๅ…ฅ็š„ๅ†…ๅฎน
          , filterOption: filterOption //ๆœ็ดข่ฟ‡ๆปคๆ–นๆณ• ๅ‚ๆ•ฐ(inputValue, option)
          , style: listStyle //่‡ชๅฎšไน‰็š„columns็š„ๆ ทๅผ่กจ
          , checkedKeys: sourceSelectedKeys //ๅทฆไพงๅทฒๅ‹พ้€‰็š„item็š„keys
          , handleFilter: this.handleLeftFilter //ๅทฆไพงๆœ็ดขๆก†ๅ€ผๆ›ดๆ”นไบ‹ไปถ
          , handleClear: this.handleLeftClear //ๆธ…็ฉบๅทฆไพงๆœ็ดขๆก†ๅ†…ๅฎน
          , handleSelect: this.handleLeftSelect //็‚นๅ‡ปๅทฆไพงๅˆ—่กจไธญ็š„item๏ผŒๆ”นๅ˜้€‰ไธญๆˆ–ๅ–ๆถˆ้€‰ไธญ็Šถๆ€
          , handleSelectAll: this.handleLeftSelectAll //็‚นๅ‡ปๅทฆไพงๅ…จ้€‰
          , render: render,
          showSearch: showSearch //ๆ˜ฏๅฆๆ˜พ็คบๆœ็ดขๆก†
          , searchPlaceholder: searchPlaceholder //ๆœ็ดขๆก†placeholder
          , notFoundContent: notFoundContent //ๅฝ“ๆฒกๆœ‰็›ธๅ…ณๅ†…ๅฎน็š„ๆ˜พ็คบๅ†…ๅฎน
github exced / react-file-manager / lib / Column.js View on Github external
data.map(function (item, index) {
            return _react2.default.createElement(
              _reactBeautifulDnd.Draggable,
              { key: item.id, draggableId: item.id, type: listType },
              function (dragProvided, dragSnapshot) {
                return _react2.default.createElement(
                  'div',
                  null,
                  _react2.default.createElement(_Item2.default, {
                    key: item.id,
                    index: index,
                    item: item,
                    isDragging: dragSnapshot.isDragging,
                    provided: dragProvided,
                    autoFocus: _this.props.autoFocusId === item.id,
                    selected: selectedId && selectedId === item.id,
                    onClick: function onClick() {
                      return onClickItem(item, index);
                    },
github iuap-design / bee.tinper.org / tinper-bee / bee-dnd / build / Between.js View on Github external
_this2.state.items.map(function (item, index) {
                                return _react2["default"].createElement(
                                    _reactBeautifulDnd.Draggable,
                                    {
                                        key: '1' + index,
                                        draggableId: '1' + index,
                                        index: index },
                                    function (provided, snapshot) {
                                        return _react2["default"].createElement(
                                            'div',
                                            _extends({
                                                ref: provided.innerRef
                                            }, provided.draggableProps, provided.dragHandleProps, {
                                                className: (0, _classnames2["default"])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDragging).drag)),
                                                style: _extends({}, provided.draggableProps.style) }),
                                            showKey ? item[showKey] : item
                                        );
                                    }
                                );
github iuap-design / bee.tinper.org / tinper-bee / bee-dnd / build / Between.js View on Github external
_this2.state.selected.map(function (item, index) {
                                return _react2["default"].createElement(
                                    _reactBeautifulDnd.Draggable,
                                    {
                                        key: '2' + index,
                                        draggableId: '2' + index,
                                        index: index },
                                    function (provided, snapshot) {
                                        return _react2["default"].createElement(
                                            'div',
                                            _extends({
                                                ref: provided.innerRef
                                            }, provided.draggableProps, provided.dragHandleProps, {
                                                className: (0, _classnames2["default"])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDragging).drag)),
                                                style: _extends({}, provided.draggableProps.style) }),
                                            showKey ? item[showKey] : item
                                        );
                                    }
                                );
github iuap-design / bee.tinper.org / tinper-bee / bee-dnd / build / SortList.js View on Github external
_this2.state.items.map(function (item, index) {
              return _react2["default"].createElement(
                _reactBeautifulDnd.Draggable,
                { key: index, draggableId: '' + index, index: index },
                function (provided, snapshot) {
                  return _react2["default"].createElement(
                    'div',
                    _extends({
                      ref: provided.innerRef
                    }, provided.draggableProps, provided.dragHandleProps, {
                      className: (0, _classnames2["default"])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDragging).drag)),
                      style: _extends({}, provided.draggableProps.style)
                    }),
                    showKey ? item[showKey] : item
                  );
                }
              );
            }),
            provided.placeholder
github iuap-design / bee.tinper.org / tinper-bee / bee-dnd / build / Dnd.js View on Github external
defaultClassNameDragged: this.props.draggedClass
                }, this.props),
                self.props.children
            )
        );
    };

    return Dnd;
}(_react.Component);

Dnd.propTypes = propTypes;
Dnd.defaultProps = defaultProps;
Dnd.Drag = _reactDraggable2["default"];
Dnd.DragDropContext = _reactBeautifulDnd.DragDropContext;
Dnd.Droppable = _reactBeautifulDnd.Droppable;
Dnd.Draggable = _reactBeautifulDnd.Draggable;
Dnd.GridLayout = _GridLayout2["default"];
exports["default"] = Dnd;
module.exports = exports['default'];
github openequella / openEQUELLA / Source / Plugins / Core / com.equella.core / js / src / ExtUI / DragNDrop / Beautiful.js View on Github external
const DND = require('react-beautiful-dnd');

exports.dragDropContextClass = DND.DragDropContext;
exports.draggableClass = DND.Draggable;
exports.droppableClass = DND.Droppable;
github iuap-design / bee.tinper.org / tinper-bee / bee-dnd / build / SortList.js View on Github external
onDrag = _props.onDrag,
        onStop = _props.onStop,
        onDragUpdate = _props.onDragUpdate,
        dropClass = _props.dropClass,
        dropOverClass = _props.dropOverClass,
        dragClass = _props.dragClass,
        dragingClass = _props.dragingClass,
        showKey = _props.showKey,
        type = _props.type;


    return _react2["default"].createElement(
      _reactBeautifulDnd.DragDropContext,
      { onDragEnd: this.onDragEnd, onDragStart: this.onDragStart, onDragUpdate: onDragUpdate },
      _react2["default"].createElement(
        _reactBeautifulDnd.Droppable,
        { droppableId: 'droppable', direction: type },
        function (provided, snapshot) {
          return _react2["default"].createElement(
            'div',
            {
              ref: provided.innerRef,
              className: (0, _classnames2["default"])(_extends({}, (0, _util.getClass)(_this2.props, snapshot.isDraggingOver).drop))
            },
            _this2.state.items.map(function (item, index) {
              return _react2["default"].createElement(
                _reactBeautifulDnd.Draggable,
                { key: index, draggableId: '' + index, index: index },
                function (provided, snapshot) {
                  return _react2["default"].createElement(
                    'div',
                    _extends({