{"id":13475818,"url":"https://github.com/swimlane/ngx-dnd","last_synced_at":"2025-05-14T10:05:14.857Z","repository":{"id":18100376,"uuid":"83340267","full_name":"swimlane/ngx-dnd","owner":"swimlane","description":"🕶  Drag, Drop and Sorting Library for Angular2 and beyond!","archived":false,"fork":false,"pushed_at":"2025-02-19T15:00:18.000Z","size":24979,"stargazers_count":574,"open_issues_count":70,"forks_count":138,"subscribers_count":53,"default_branch":"master","last_synced_at":"2025-03-31T07:03:30.980Z","etag":null,"topics":["angular","angular2","drag-and-drop","hacktoberfest","ngx","sorting"],"latest_commit_sha":null,"homepage":"https://swimlane.github.io/ngx-dnd/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/swimlane.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-27T17:56:52.000Z","updated_at":"2025-02-19T12:30:55.000Z","dependencies_parsed_at":"2024-01-14T07:14:48.264Z","dependency_job_id":"c9918d38-022a-44a1-8791-5c42bb8fe9fc","html_url":"https://github.com/swimlane/ngx-dnd","commit_stats":{"total_commits":203,"total_committers":14,"mean_commits":14.5,"dds":"0.16256157635467983","last_synced_commit":"9400c118078820e3768287b97a0f1ba893601932"},"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swimlane%2Fngx-dnd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swimlane%2Fngx-dnd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swimlane%2Fngx-dnd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swimlane%2Fngx-dnd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swimlane","download_url":"https://codeload.github.com/swimlane/ngx-dnd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266562,"owners_count":20910836,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","angular2","drag-and-drop","hacktoberfest","ngx","sorting"],"created_at":"2024-07-31T16:01:23.835Z","updated_at":"2025-04-11T03:29:32.742Z","avatar_url":"https://github.com/swimlane.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# ngx-dnd\n\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/06120385a7c84f18801b7b7c36e9fc82)](https://www.codacy.com/app/hypercubed/ngx-dnd?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=swimlane/ngx-dnd\u0026utm_campaign=Badge_Grade) [![npm downloads](https://img.shields.io/npm/dm/@swimlane/ngx-dnd.svg)](https://npmjs.org/@swimlane/ngx-dnd)\n\n🕶 Drag, Drop and Sorting Library for Angular6 and beyond!\n\n_Note: The drag-and-drop directives in [angular/cdk](https://material.angular.io/cdk/drag-drop/overview) are great. Use that if you don't need nested DnD containers. We are investigating using angular/cdk directives internally_\n\n## Features\n\n- Drag and Drop\n- Sorting\n- Events (drag, drop, over, out)\n- Nesting\n- Touch support\n- Templating\n\n## Install\n\nTo use ngx-dnd in your project install it via [npm](https://www.npmjs.com/package/@swimlane/ngx-dnd):\n\n- `npm i @swimlane/ngx-dnd @swimlane/dragula @types/dragula --save`\n- Add `NgxDnDModule.forRoot()` to your application module.\n- If using directives you will need to BYO styles or include `@swimlane/ngx-dnd/release/index.css`.\n- You may need to add the following to your `polyfills.ts` file:\n\n```js\nif (typeof window['global'] === 'undefined') {\n  window['global'] = window;\n}\n```\n\n## Quick intro and examples\n\n### Directives\n\n`ngx-dnd` provides a base set of directives to enable drag-and-drop. By default all children of a `ngxDroppable` element may be dragged and dropped. Add the `ngxDraggable` to restrict drag-and-drop to the parent container. In general prefer using the base directives to the help components introduced later.\n\n```html\n\u003cdiv class=\"ngx-dnd-container\" ngxDroppable\u003e\n  \u003cdiv class=\"ngx-dnd-item\" ngxDraggable\u003eItem 1\u003c/div\u003e\n  \u003cdiv class=\"ngx-dnd-item\" ngxDraggable\u003eItem 2\u003c/div\u003e\n  \u003cdiv class=\"ngx-dnd-item\" ngxDraggable\u003eItem 3\u003c/div\u003e\n\u003c/div\u003e\n```\n\nGive multiple containers the same `dropZone` name to allow drag-and-drop between these containers.\n\n```html\n\u003cdiv class=\"ngx-dnd-container\" ngxDroppable=\"example\"\u003e\n  \u003cdiv class=\"ngx-dnd-item\" ngxDraggable\u003eItem 1a\u003c/div\u003e\n  \u003cdiv class=\"ngx-dnd-item\" ngxDraggable\u003eItem 2a\u003c/div\u003e\n  \u003cdiv class=\"ngx-dnd-item\" ngxDraggable\u003eItem 3a\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"ngx-dnd-container\" ngxDroppable=\"example\"\u003e\n  \u003cdiv class=\"ngx-dnd-item\" ngxDraggable\u003eItem 1b\u003c/div\u003e\n  \u003cdiv class=\"ngx-dnd-item\" ngxDraggable\u003eItem 2b\u003c/div\u003e\n  \u003cdiv class=\"ngx-dnd-item\" ngxDraggable\u003eItem 3b\u003c/div\u003e\n\u003c/div\u003e\n```\n\n`ngxDraggable` items can be restricted to specific containers:\n\n```html\n\u003cdiv class=\"ngx-dnd-container\" ngxDroppable\u003e\n  \u003cdiv class=\"ngx-dnd-item\" [ngxDraggable]=\"['example-target']\"\u003eItem 1a\u003c/div\u003e\n  \u003cdiv class=\"ngx-dnd-item\" [ngxDraggable]=\"['example-target']\"\u003eItem 2a\u003c/div\u003e\n  \u003cdiv class=\"ngx-dnd-item\" [ngxDraggable]=\"['example-target']\"\u003eItem 3a\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"ngx-dnd-container\" ngxDroppable=\"example-target\"\u003e\n  \u003cdiv class=\"ngx-dnd-item\" ngxDraggable\u003eItem 1b\u003c/div\u003e\n  \u003cdiv class=\"ngx-dnd-item\" ngxDraggable\u003eItem 2b\u003c/div\u003e\n  \u003cdiv class=\"ngx-dnd-item\" ngxDraggable\u003eItem 3b\u003c/div\u003e\n\u003c/div\u003e\n```\n\n### Components\n\n`ngx-dnd` provides a set of helper components that encapsulates the directives mentioned and adds capability for data driven structures. In general you should prefer directives to components.\n\n```js\norderableLists = [\n  ['Item 1a', 'Item 2a', 'Item 3a'],\n  ['Item 1b', 'Item 2b', 'Item 3b']\n];\n```\n\n```html\n\u003cngx-dnd-container [model]=\"orderableLists\"\u003e \u003c/ngx-dnd-container\u003e\n```\n\nThis component is effectively equivalent to:\n\n```html\n\u003cdiv class=\"ngx-dnd-container\" ngxDroppable [model]=\"orderableLists\"\u003e\n  \u003cdiv class=\"ngx-dnd-item\" ngxDraggable [model]=\"item\" *ngFor=\"let item of orderableLists\"\u003e{{item}}\u003c/div\u003e\n\u003c/div\u003e\n```\n\nIncluding nested containers:\n\n```html\n\u003cngx-dnd-container [model]=\"nestedLists\"\u003e \u003c/ngx-dnd-container\u003e\n```\n\n```js\nnestedLists = [\n  {\n    label: 'Item 1',\n    children: []\n  },\n  {\n    label: 'Item 2',\n    children: [\n      {\n        label: 'Item 2a',\n        children: []\n      },\n      {\n        label: 'Item 2b',\n        children: []\n      },\n      {\n        label: 'Item 2c',\n        children: []\n      }\n    ]\n  },\n  {\n    label: 'Item 3',\n    children: [\n      {\n        label: 'Item 3a',\n        children: []\n      },\n      {\n        label: 'Item 3b',\n        children: []\n      },\n      {\n        label: 'Item 3c',\n        children: []\n      }\n    ]\n  }\n];\n```\n\nSee [https://swimlane.github.io/ngx-dnd/](https://swimlane.github.io/ngx-dnd/) for more lives examples. Demo code is at [https://github.com/swimlane/ngx-dnd/tree/master/src/](https://github.com/swimlane/ngx-dnd/tree/master/src/).\n\n## Development\n\n- `git clone git@github.com:swimlane/ngx-dnd.git`\n- `cd ngx-dnd`\n- `ng build @swimlane/ngx-dnd`\n- `ng serve`\n- Browse to [http://localhost:4200](http://localhost:4200)\n\n### Development server\n\nRun `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.\n\n### Build\n\nRun `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.\n\n### Running unit tests\n\nRun `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).\n\n### Running end-to-end tests\n\nRun `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).\n\n### Further help\n\nTo get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).\n\n## [CHANGELOG](https://github.com/swimlane/ngx-dnd/blob/master/CHANGELOG.md)\n\nThis project uses [heff/chg](https://github.com/heff/chg), a simple changelog/release history manager. When contributing to this project please add change notes (manually or using the [heff/chg](https://github.com/heff/chg) cli) to the `## HEAD (Unreleased)` section.\n\n## Release\n\n- Checkout master (`git checkout master`)\n- Pull master (`git pull`)\n- Clean and test (Optional)\n  - Run `rm -rf node_modules`\n  - Run `npm i`\n  - Run tests (`npm run test:ci`)\n- Examine CHANGELOG.md to determine next version (X.Y.Z)\n- Run `git checkout -b release/X.Y.Z`\n- Update version using `npm version [\u003cnewversion\u003e | major | minor | patch]`\n  - This will update `package.json` versions and `changelog.md`.\n- Run `git push origin HEAD --tags`\n- Run `npm run publish:lib`\n- Run `npm run deploy`\n- Submit PR\n\n## Credits\n\n`ngx-dnd` is a [Swimlane](http://swimlane.com) open-source project; we believe in giving back to the open-source community by sharing some of the projects we build for our application. Swimlane is an automated cyber security operations and incident response platform that enables cyber security teams to leverage threat intelligence, speed up incident response and automate security operations.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswimlane%2Fngx-dnd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswimlane%2Fngx-dnd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswimlane%2Fngx-dnd/lists"}