반응형
반응형

[React] DnD - Drag andDrop for React 

https://react-dnd.github.io/react-dnd/about

 

React DnD

 

react-dnd.github.io

React DnD is a set of React utilities to help you build complex drag and drop interfaces while keeping your components decoupled. It is a perfect fit for apps like Trello and Storify, where dragging transfers data between different parts of the application, and the components change their appearance and the application state in response to the drag and drop events.

Installation

npm install react-dnd react-dnd-html5-backend

The second package will allow React DnD the HTML5 drag and drop API under the hood. You may choose to use a third-party backend instead, such as the touch backend.

// Let's make <Card text='Write the docs' /> draggable!

import React from 'react'
import { useDrag } from 'react-dnd'
import { ItemTypes } from './Constants'

/**
 * Your Component
 */
export default function Card({ isDragging, text }) {
  const [{ opacity }, dragRef] = useDrag(
    () => ({
      type: ItemTypes.CARD,
      item: { text },
      collect: (monitor) => ({
        opacity: monitor.isDragging() ? 0.5 : 1
      })
    }),
    []
  )
  return (
    <div ref={dragRef} style={{ opacity }}>
      {text}
    </div>
  )
}

 

 

https://codesandbox.io/s/github/react-dnd/react-dnd/tree/gh-pages/examples_js/01-dustbin/multiple-targets?from-embed=&file=/package.json 

 

react-dnd-example-3 - CodeSandbox

auto-generated package for codesandbox import

codesandbox.io

Backends

HTML5
Touch
Test
반응형
반응형

Drag and Drop. HTML5 

 

colorlib.com/wp/bootstrap-drag-and-drop/

 

20 Best Bootstrap Drag and Drop to Amp up Your Website - Colorlib

Are you looking for bootstrap drag and drop templates to amp up your website functionality? Take a look on these layouts and try them out..

colorlib.com

 

codepen.io/trzmaxim/pen/GppXGE

 

nested drag and drop used dragula.js

...

codepen.io

codepen.io/ElijahFowler/full/Lpgwxq

 

Native HTML5 Drag and Drop

Taken from HTML5Rocks's Drag And Drop Basics, and edited to use the classList API. No IE support as it does not support the DataTransfer API....

codepen.io

codepen.io/istavros/pen/XJXMRJ

 

Drag 'n' Drop assignment

...

codepen.io

 

web.dev/drag-and-drop/

 

Using the HTML5 Drag and Drop API

The HTML5 Drag and Drop (DnD) API means that we can make almost any element on our page draggable. In this post we’ll explain the basics of Drag and Drop.

web.dev

 

반응형
반응형

Scrum board with drag and drop

 

Scrum board with drag and drop

...

codepen.io

codepen.io/erikdevos/pen/ZYNWoR

 

Scrum board with drag and drop

...

codepen.io

See the Pen Scrum board with drag and drop by Erik de Vos (@erikdevos) on CodePen.

 

반응형
반응형

1. 테이블 컬럼 추가하기(ALTER TABLE ADD)

[문법] ALTER TABLE 테이블명 ADD(컬럼명 데이타타입(사이즈));

( EX ) USER라는 테이블에 USER_NAME이라는 컬럼을 VARCHAR2(13) 타입으로 추가할 때

-> ALTER TABLE USER ADD(USER_NAME VARCAHR2(13)); 

 

2. 테이블 컬럼 수정하기(ALTER TABLE MODIFY)

[문법] ALTER TABLE 테이블명 MODIFY(컬럼명 테이타타입(사이즈));

( EX ) USER라는 테이블에 USER_AGE 라는 컬럼을 NUNBER(3) 타입으로 수정할 때

-> ALTER TABLE USER MODIFY(USER_AGE NUMBER(3));

 

3. 테이블 컬럼 삭제하기(ALTER TABLE DROP)

[문법] ALTER TABLE 테이블명 DROP COLUMN 컬럼명

( EX ) USER라는 테이블에 USER_NAME 이라는 컬럼을 삭제할 때

-> ALTER TABLE USER DROP COLUMN USER_NAME;

 

4. 테이블 컬럼 이름 변경하기(ALTER TABLE RENAME)

[문법] ALTER TABLE 테이블명 RENAME COLUMN 원래컬럼명 TO 바꿀컬럼명;

( EX ) USER라는 테이블에 USER_NAME 이라는 컬럼을 USER_FIRST_NAME으로 변경할 때

-> ALTER TABLE USER RENAME COLUMN USER_NAME TO USER_FIRST_NAME;

반응형
반응형

Drag and drop a folder onto Chrome now available

As web apps evolve, you might have found it handy to let users drag and drop files from the desktop onto the browser to edit, upload, share, etc. But unfortunately, we’ve been unable to drag and drop folders onto web pages. Luckily, beginning with Chrome 21, this issue will be addressed (already available in the Chrome dev channel).

Passing multiple files with drag and drop

Let’s look at a code sample of existing drag and drop.

<div id=”dropzone”></div>

var dropzone = document.getElementById('dropzone');
dropzone.ondrop = function(e) {
  var length = e.dataTransfer.files.length;
  for (var i = 0; i < length; i++) {
    var file = e.dataTransfer.files[i];
    ... // do whatever you want
  }
};

In this example, you can actually drag and drop a file or files from the desktop to your browser, but when you try to pass a folder, notice that it will be either rejected or treated as a File object resulting in a failure.

How to handle dropped folders

Chrome 21 allows you to drop a folder or multiple folders into the browser window. To handle these, you need to change the way you handle dropped objects.

<div id=”dropzone”></div>

var dropzone = document.getElementById('dropzone');
dropzone.ondrop = function(e) {
  var length = e.dataTransfer.items.length;
  for (var i = 0; i < length; i++) {
    var entry = e.dataTransfer.items[i].webkitGetAsEntry();
    if (entry.isFile) {
      ... // do whatever you want
    } else if (entry.isDirectory) {
      ... // do whatever you want
    }
  }
};

Notice that a big difference here is that you can treat a dropped object as Entry (FileEntry or DirectoryEntry) by using new function called getAsEntry (webkitGetAsEntry).
After obtaining access to the Entry object, you can use standard file handling methods that were introduced in the FileSystem API specification. For example, this example shows how you can detect if a dropped object is a file or a directory by examining the .isFile (or the .isDirectory) field.

For further information regarding the FileSystem API, read Exploring the FileSystem APIs, regarding new drag and drop capability, read this document. Of course, these features are open standards or are waiting to become one soon.

반응형

+ Recent posts