Giter Site home page Giter Site logo

foveluy / dragact Goto Github PK

View Code? Open in Web Editor NEW
765.0 23.0 189.0 27.5 MB

a dragger layout system with React style .

License: MIT License

JavaScript 4.16% CSS 1.49% HTML 0.31% TypeScript 94.04%
react reactjs drag-and-drop drag-drop draggable grid grid-layout grid-system sortable sortable-lists

dragact's People

Contributors

emibcn avatar foveluy avatar leeeeeem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dragact's Issues

Dragact嵌套图片问题

Dragact嵌套图片,图片宽高是100%,点击图片拖拽就出现BUG了
<Dragact className="plant-layout" //必填项 col={16} //必填项 layout={fakeData} //必填项 margin={[5, 5]} //必填项 placeholder //必填项 rowHeight={300} //必填项 style={{ background: '#333' }} //非必填项 width={800} > {(item, provided) => ( <div {...provided.props} {...provided.dragHandle} style={{ ...provided.props.style, ...getblockStyle(provided.isDragging), }} > {/*provided.isDragging ? '正在抓取' : '停放'*/} <img alt="" src="https://img.alicdn.com/imgextra/i3/1928865133/O1CN011nmxSUvVK566HsW_!!1928865133.jpg" style={{ width: "50px", height: "50px", }} /> </div> )} </Dragact>

How to run

在浏览器访问的时候,提示“Uncaught SyntaxError: Unexpected token *”
请教一下,这个库需要引入特殊的解释器么?

报错了

main.js?1552287600v47:39477 Uncaught TypeError: (0 , _typeof4.default) is not a function
这一行
var _typeof = typeof _symbol2.default === "function" && (0, _typeof4.default)(_iterator2.default) === "symbol" ? function (obj) {

babelrc 的一点点小建议

  1. 似乎 babel-preset-es2015 是一个比较过期的解决方案,也许可以考虑 babel-preset-env
    2.似乎可以考虑在默认的情况下不添加 react-hot-loader, transform-runtime,把这两个放在 test 和 webpack 两个 env 似乎比较适合;因为这两个会在 prod 的 bundle 中加入一些不必要的东西

下个月我可能会研究一下 rollup + ts 然后过来提 pr

保存布局重新加载后布局混乱

Demo界面的存储布局示例挂掉了,我按照LayoutRestor示例自己编写了一段代码进行测试,但是恢复布局后布局是错乱的,不是保存时的样子。

有没有dragOver事件

我看到api中没有dragOver事件,现在有一种需求就是跟手机桌面app一样,有一些应用和大小不一的小部件,不想拖拽排版,这个插件可以满足,但是手机桌面还有一种是应用之间拖拽可以创建文件夹。
--------------------
看了下until里面的源码和React-Grid-Layout的源码,发现原来用的是碰撞检测。

区块能否绝对px 大小

您的这个插件和reacr-grid-layout 十分相似 都是栅格化网格布局 大致思路都是对外部进行分割成N列 这样的话等于说是按最外层百分比控制区块宽度 那么我现在有个疑问 能不能做成区块大小是固定的 比如说一个区块是400px*600px 那么外面的大小不影响区块的大小 外部最小宽度由内部区块最大宽度决定

自由度不够 无法任意层级嵌套使用

BI图要实现这个随意拖放的效果 但是这个嵌套其实是比较深的 所以他并不一定是在children里面的 这就会导致你这个拖放的效果会导致整个布局出错 希望在这个基础上能独立出来一个item 让不管在哪一级 那一层都可以直接进行使用

ie11兼容性问题

请问兼容ie11吗?这边ie11打开控制台报错,有什么解决方案

ts接口定义

<Dragact
col={8}
width={800}
margin={[5, 5]}
rowHeight={40}
className='plant-layout'
>报错
node_modules/dragact/src/lib/dragger/index.tsx
(377,17): Type 'string | number' is not assignable to type 'number'.
Type 'string' is not assignable to type 'number'.
是因为ts有一些接口定义不对么

English Doc?

I have seen some react-dnd libraries, and I really like the look and feel of the examples of this package, but: Language its a problem, is there a chance of an English doc for this repo?

全部删除报错

将全部的数据删除掉,layout中数据为[] 空数组的时候报错!大神解决一下呗

求水平交换功能

看到了这个组件,很顺滑,但是子集貌似没有水平拖拽,都需要向下挤出一个单位的空间,这样需要操作两次,很难受

在ie11浏览器上控制台报错

The above error occurred in one of your React components:
in div (at Dragact.js:43)
in Unknown
in Unknown
in div
in Unknown (at Dragact.js:27)
in Unknown (at App.js:48)
in div (at App.js:35)
in Unknown (at index.js:7)

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://fb.me/react-error-boundaries to learn more about error boundaries.

'use strict'
import React from 'react';

import {Dragact} from 'dragact'

import styles from './Dragact.scss';

class DragactDemo extends React.Component {
  constructor(props) {
    super(props);

  }

  getblockStyle = (isDragging) => {
    console.log("isDragging", isDragging)
    return {
      background: isDragging ? '#ccc' : 'wheat'
    }
  }

  getLayout = (item, provided) => {
    console.log('item', item, provided)
  };

  render() {
    return (
      <Dragact
        layout={fakeData}
        col={1}
        rowHeight={40}
        margin={[15, 5]}
        padding={10}
        className='plant-layout'
        style={{background: "rgb(247, 221, 255)"}}
        canResize={true}
        onDragEnd={(item, provided) => this.getLayout(item, provided)}
      >
        {(item, provided) => {
          const blockStyle = this.getblockStyle(provided.isDragging);
          const styleDiv = Object.assign({}, provided.props.style, blockStyle, {width: ` calc(100% - 30px)`});
          console.log('styleDiv', provided, blockStyle, styleDiv)
          return (
            <div {...provided.props} {...provided.dragHandle} style={styleDiv}>
              {provided.isDragging ? '正在抓取' : '停放'}{item.key}
            </div>
          )
        }}
      </Dragact>
    );
  }
}

export default DragactDemo;


const fakeData = [
  {GridX: 0, GridY: 0, w: 1, h: 2, key: "0"},
  {GridX: 0, GridY: 0, w: 1, h: 2, key: "1"},
  {GridX: 0, GridY: 0, w: 1, h: 2, key: "2"},
  {GridX: 0, GridY: 0, w: 1, h: 2, key: "3"},
];

layout.map遍历出错

dragact.js文件 this.props中并没有layout属性,请问这个layout是做什么用的

在dragend事件中修改layout的问题

想做一个拖拽merge两个子组件的东西,所以需要在dragend中修改layout。

假设拖拽A到B内,生成一个merge后的B。无非是移除layout 中的A,以及修改layout中的B。

这个时候存在两个问题:
1、react报一个在unmount的组件上调用setstate的警告
2、此后getLayout api拿到的layout中B的信息是就旧的

求水平交换功能

类似支付宝首页-更多页里,编辑我的应用的交互方式,在插入到dropdown的位置,不影响其他组件的原来顺序

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.