Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit e3e0548

Browse files
committed
Merge branch 'master' into v0.14.x-dev
Conflicts: README.md
2 parents 728c724 + a462388 commit e3e0548

File tree

7 files changed

+55
-14
lines changed

7 files changed

+55
-14
lines changed

Diff for: .npmignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
bower_components/
2+
node_modules/
3+
coverage/
4+
junit/
5+
# dist/
6+
out/

Diff for: API.md

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Properties
44

5+
**Note:**
6+
The properties of `ui.item.sortable` object are cleared right after the stop callback fires. If you need to access them after the sorting ends, you should keep references in separate variables in your code.
7+
58
### dropindex
69
Type: [Integer](http://api.jquery.com/Types/#Integer)
710
Holds the index of the drop target that the dragged item was dropped.

Diff for: CONTRIBUTING.md

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ Feel free to edit any of them for your needs (don't forget to also update the li
77

88
* [Simple Demo](http://codepen.io/thgreasi/pen/jlkhr)
99
* [Connected Lists](http://codepen.io/thgreasi/pen/uFile)
10+
11+
Since some issues may be caused by jquery-ui-sortable and not by the wrapping that angular-ui-sortable does,
12+
please try your use case using [this plain jquery-ui sortable example](http://codepen.io/thgreasi/pen/rarQvR) before opening a new issue in the repositry.

Diff for: README.md

+25-5
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,30 @@
11
# UI.Sortable directive
2-
[![Build Status](https://travis-ci.org/angular-ui/ui-sortable.svg)](https://travis-ci.org/angular-ui/ui-sortable)
2+
[![Build Status](https://travis-ci.org/angular-ui/ui-sortable.svg?branch=master)](https://travis-ci.org/angular-ui/ui-sortable)
33
[![Coverage Status](https://coveralls.io/repos/angular-ui/ui-sortable/badge.svg?branch=master)](https://coveralls.io/r/angular-ui/ui-sortable?branch=master)
44
[![debugInfoEnabled(false) Ready Badge](https://rawgit.com/thgreasi/ng-debugInfoDisabled-badges/master/badge1.svg)](https://docs.angularjs.org/guide/production#disabling-debug-data)
5+
[![Join the chat at https://gitter.im/angular-ui/ui-sortable](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/angular-ui/ui-sortable?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
56

67
This directive allows you to sort an array with drag & drop.
78

89
## Requirements
910

1011
- JQuery
1112
- JQueryUI 1.9+
12-
- AngularJS 1.2+
13+
- AngularJS v1.2+
1314

1415
[Single minified cdn link](http://cdn.jsdelivr.net/g/jquery@1,[email protected]%28jquery.ui.core.min.js+jquery.ui.widget.min.js+jquery.ui.mouse.min.js+jquery.ui.sortable.min.js%29,[email protected],angular.ui-sortable) ~245kB and [example](http://codepen.io/thgreasi/pen/olDJi) with JQuery v1.x, required parts of JQueryUI v1.10, AngularJS v1.2 & latest angular-ui-sortable.
1516

1617
**Notes:**
1718
> * JQuery must be included before AngularJS.
1819
> * JQueryUI dependecies include [core](http://api.jqueryui.com/category/ui-core/), [widget](http://api.jqueryui.com/jQuery.widget/), [mouse](http://api.jqueryui.com/mouse/) & [sortable](http://api.jqueryui.com/sortable/). Creating a [custom build](http://jqueryui.com/download/#!version=1.10&components=1110000010000000000000000000000000) will [greatly reduce](https://github.com/angular-ui/ui-sortable/issues/154#issuecomment-40279430) the required file size. ([CDN](http://www.jsdelivr.com/) links for comparison: [full](http://cdn.jsdelivr.net/g/[email protected]) vs [minimal](http://cdn.jsdelivr.net/g/[email protected]%28jquery.ui.core.min.js+jquery.ui.widget.min.js+jquery.ui.mouse.min.js+jquery.ui.sortable.min.js%29))
19-
> * User of AngularJS pre v1.2 can use the [$watchcollection polyfill](https://github.com/thgreasi/ng-watchcollection-polyfill).
20+
> * Users of AngularJS pre v1.2 can use [v0.10.x](https://github.com/angular-ui/ui-sortable/tree/v0.10.x-stable) or [v0.12.x](https://github.com/angular-ui/ui-sortable/tree/v0.12.x-stable) branches.
21+
> * Early adopters of [Angular2](https://angular.io/) can use the [ng2 branch](https://github.com/angular-ui/ui-sortable/tree/ng2).
22+
23+
## Installation
24+
25+
* Install with Bower `bower install -S angular-ui-sortable`
26+
* Install with npm `npm install -S angular-ui-sortable`
27+
* Download one of the [Releases](https://github.com/angular-ui/ui-sortable/releases) or the [latest Master branch](https://github.com/angular-ui/ui-sortable/archive/master.zip)
2028

2129
## Usage
2230

@@ -46,13 +54,19 @@ Apply the directive to your form elements:
4654
* `ui-sortable` element should contain only one `ng-repeat`, but other non-repeater elements above or below may still exist.
4755
Otherwise the index matching of the `ng-model`'s items and the DOM elements generated by the `ng-repeat` will break.
4856
**In other words: The items of `ng-model` must match the indexes of the DOM elements generated by the `ng-repeat`.**
57+
* [`Filters`](https://docs.angularjs.org/guide/filter) that manipulate the model (like [filter](https://docs.angularjs.org/api/ng/filter/filter), [orderBy](https://docs.angularjs.org/api/ng/filter/orderBy), [limitTo](https://docs.angularjs.org/api/ng/filter/limitTo),...) should be applied in the `controller` instead of the `ng-repeat` (refer to [the provided examples](#examples)).
58+
This is the preferred way since it:
59+
- is performance wise better
60+
- reduces the chance of code duplication
61+
- [is suggested by the angularJS team](https://www.youtube.com/watch?feature=player_detailpage&v=ZhfUv0spHCY#t=3048)
62+
- it does not break the matching of the generated DOM elements and the `ng-model`'s items
4963
* `ui-sortable` lists containing many 'types' of items can be implemented by using dynamic template loading [with ng-include](http://stackoverflow.com/questions/14607879/angularjs-load-dynamic-template-html-within-directive/14621927#14621927) or a [loader directive](https://github.com/thgreasi/tg-dynamic-directive), to determine how each model item should be rendered. Also take a look at the [Tree with dynamic template](http://codepen.io/thgreasi/pen/uyHFC) example.
5064

5165
### Options
5266

5367
All the [jQueryUI Sortable options](http://api.jqueryui.com/sortable/) can be passed through the directive.
5468
Additionally, the `ui` argument of the available callbacks gets enriched with some extra properties as specified to the [API.md file](API.md#uiitemsortable-api-documentation).
55-
69+
Any model changes that happen inside the available callbacks, are applied right after the stop event. We are not wrapping callbacks like `start`/`change`/... with `$apply`, in order to minimize the number of digest loops and avoid possible modifications of the model (eg: by watchers) before the drop takes place.
5670

5771
```js
5872
myAppModule.controller('MyController', function($scope) {
@@ -174,6 +188,8 @@ For more details about the events check the [jQueryUI API documentation](http://
174188
## Examples
175189

176190
- [Simple Demo](http://codepen.io/thgreasi/pen/jlkhr)
191+
- [Simple RequireJS Demo](http://codepen.io/thgreasi/pen/bNaxRq)
192+
- [Simple Touch-Enabled Demo](http://codepen.io/thgreasi/pen/rOevyv) using [jQuery UI Touch Punch](https://github.com/furf/jquery-ui-touch-punch/)
177193
- [Connected Lists](http://codepen.io/thgreasi/pen/uFile)
178194
- [Filtering](http://codepen.io/thgreasi/pen/mzGbq) ([details](https://github.com/angular-ui/ui-sortable/issues/113))
179195
- [Ordering 1](http://codepen.io/thgreasi/pen/iKEHd) & [Ordering 2](http://plnkr.co/edit/XPUzJjdvwE0QWQ6py6mQ?p=preview) ([details](https://github.com/angular-ui/ui-sortable/issues/70))
@@ -183,12 +199,16 @@ For more details about the events check the [jQueryUI API documentation](http://
183199
- Canceling
184200
- [Connected Lists With Max Size](http://codepen.io/thgreasi/pen/IdvFc)
185201
- [Connected Lists Without Duplicates](http://codepen.io/thgreasi/pen/NPaJyb)
202+
- [Promised Reverting](http://codepen.io/thgreasi/pen/MwQqdg)
203+
- [Locked Items](http://codepen.io/thgreasi/pen/GgdeEO)
186204
- [Draggable Handle](http://codepen.io/thgreasi/pen/ihAyr)
187-
- [Drop Zone](http://codepen.io/anon/pen/JorbqZ)
205+
- [Drop Zone](http://codepen.io/thgreasi/pen/LVXWeO)
206+
- [Draggable-Sortable like interaction](http://codepen.io/thgreasi/pen/LVVJgK)
188207
- [Static HTML Sorting](http://codepen.io/thgreasi/pen/qdmjwy)
189208

190209
## Integrations
191210
- [ui.bootstrap.accordion](http://plnkr.co/edit/TGIeeEbbvJwpJ3WRqo2z?p=preview)
211+
- [Asynchronous loading jQuery+jQueryUI with crisbeto/angular-ui-sortable-loader](https://github.com/crisbeto/angular-ui-sortable-loader)
192212

193213
## Reporting Issues
194214

Diff for: bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-ui-sortable",
3-
"version": "0.13.3",
3+
"version": "0.13.4",
44
"description": "This directive allows you to jQueryUI Sortable.",
55
"author": "https://github.com/angular-ui/ui-sortable/graphs/contributors",
66
"license": "MIT",

Diff for: gruntFile.js

+16-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = function(grunt) {
1010
grunt.registerTask('default', ['test']);
1111
grunt.registerTask('test', ['jshint', 'karma:unit']);
1212
grunt.registerTask('serve', ['karma:continuous', 'dist', 'build:gh-pages', 'connect:continuous', 'watch']);
13-
grunt.registerTask('dist', ['ngmin', 'surround', 'uglify' ]);
13+
grunt.registerTask('dist', ['ngmin', 'surround:main', 'uglify', 'surround:banner' ]);
1414
grunt.registerTask('coverage', ['jshint', 'karma:coverage']);
1515
grunt.registerTask('junit', ['jshint', 'karma:junit']);
1616

@@ -142,16 +142,25 @@ module.exports = function(grunt) {
142142
},
143143

144144
surround: {
145-
options: {
146-
prepend: ['(function(window, angular, undefined) {',
147-
'\'use strict\';'].join('\n'),
148-
append: '})(window, window.angular);'
149-
},
150145
main: {
151146
expand: true,
152147
cwd: 'src',
153148
src: ['*.js'],
154-
dest: 'dist'
149+
dest: 'dist',
150+
options: {
151+
prepend: ['(function(window, angular, undefined) {',
152+
'\'use strict\';'].join('\n'),
153+
append: '})(window, window.angular);'
154+
}
155+
},
156+
banner: {
157+
expand: true,
158+
cwd: 'dist',
159+
src: ['*.js'],
160+
dest: 'dist',
161+
options: {
162+
prepend: '<%= meta.banner %>'
163+
}
155164
}
156165
},
157166

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-ui-sortable",
3-
"version": "0.13.3",
3+
"version": "0.13.4",
44
"description": "This directive allows you to jQueryUI Sortable.",
55
"author": "https://github.com/angular-ui/ui-sortable/graphs/contributors",
66
"license": "MIT",

0 commit comments

Comments
 (0)