|
1 | 1 | # ember-sortable
|
2 | 2 |
|
3 | 3 | [](http://badge.fury.io/js/ember-sortable)
|
4 |
| -[](https://github.com/adopted-ember-addons/ember-sortable/actions?query=branch%3Amaster+workflow%3A%22build%22) |
| 4 | +[](https://github.com/adopted-ember-addons/ember-sortable/actions?query=branch%3Amaster) |
5 | 5 | [](http://badge.fury.io/js/ember-sortable)
|
6 | 6 | [](http://emberobserver.com/addons/ember-sortable)
|
7 | 7 | [](https://codeclimate.com/github/jgwhite/ember-sortable)
|
8 | 8 |
|
9 | 9 | Sortable UI primitives for Ember.
|
10 | 10 |
|
11 |
| - |
12 |
| - |
13 | 11 | [Check out the demo](https://ember-sortable.netlify.app/)
|
14 | 12 |
|
15 | 13 | ## Requirements
|
@@ -82,18 +80,22 @@ The modifier version does not support `groupModel`, use the currying of `action`
|
82 | 80 |
|
83 | 81 | ### Changing sort direction
|
84 | 82 |
|
85 |
| -To change sort direction, define `direction` on `sortable-group` (default is `y`): |
| 83 | +To change sort direction, define `direction` on `sortable-group` |
| 84 | +Possible values are: |
| 85 | +- `y` (default): allowes to move items up/down |
| 86 | +- `x`: allowes to move items left/right |
| 87 | +- `grid`: items can be moved in all directions inside a group |
86 | 88 |
|
87 | 89 | ```hbs
|
88 |
| -<ol {{sortable-group direction="x" onChange=(action "reorderItems")}> |
| 90 | +<ol {{sortable-group direction="x" onChange=this.reorderItems}}> |
89 | 91 | ```
|
90 | 92 |
|
91 | 93 | ### Changing spacing between currently dragged element and the rest of the group
|
92 | 94 |
|
93 |
| -When user starts to drag element, other elements jump back. Works both for the `x` and `y` direction option. |
| 95 | +When user starts to drag element, other elements jump back. Works for all direction option. |
94 | 96 |
|
95 | 97 | In `y` case: elements above current one jump up, and elements below current one - jump down.
|
96 |
| -In `x` case: elements before current one jump to the left, and elements after current one - jump to the right. |
| 98 | +In `x` / `grid` case: elements before current one jump to the left, and elements after current one - jump to the right. |
97 | 99 |
|
98 | 100 | To change this property, define `spacing` on `sortable-item` (default is `0`):
|
99 | 101 |
|
@@ -135,7 +137,7 @@ The classes look like this:
|
135 | 137 | <li class="sortable-item is-activated">...</li>
|
136 | 138 | ```
|
137 | 139 |
|
138 |
| -In our [example app.css](tests/dummy/app/styles/app.css) we apply a |
| 140 | +In our [example app.css](docs/app/styles/app.css) we apply a |
139 | 141 | transition of `.125s` in the default case:
|
140 | 142 |
|
141 | 143 | ```css
|
@@ -174,7 +176,7 @@ removed. Use this class to add a visual indicator that the item is selected and
|
174 | 176 | ### Drag Actions
|
175 | 177 |
|
176 | 178 | The `onDragStart` and `onDragStop` actions are available for the
|
177 |
| -`sortable-item`s. You can provide an action name to listen to these actions to |
| 179 | +`sortable-item`s. You can provide an action to listen to these actions to |
178 | 180 | be notified when an item is being dragged or not.
|
179 | 181 |
|
180 | 182 | When the action is called, the item's model will be provided as the only
|
@@ -402,24 +404,30 @@ For modifiers, please read this [migration guide](/MIGRATION_GUIDE_MODIFIERS.md)
|
402 | 404 |
|
403 | 405 | ## Developing
|
404 | 406 |
|
| 407 | +### Requirement |
| 408 | + |
| 409 | +You need to install nodejs and [pnpm](https://pnpm.io/installation). |
| 410 | +The specific versions you need, you can find [here](package.json#L19-L22) |
| 411 | + |
405 | 412 | ### Setup
|
406 | 413 |
|
407 | 414 | ```sh
|
408 | 415 | $ git clone [email protected]:adopted-ember-addons/ember-sortable
|
409 | 416 | $ cd ember-sortable
|
410 |
| -$ ember install |
| 417 | +$ pnpm install |
411 | 418 | ```
|
412 | 419 |
|
413 | 420 | ### Dev Server
|
414 | 421 |
|
415 | 422 | ```sh
|
| 423 | +$ cd test-app |
416 | 424 | $ ember serve
|
417 | 425 | ```
|
418 | 426 |
|
419 | 427 | ### Running Tests
|
420 | 428 |
|
421 | 429 | ```sh
|
422 |
| -$ npm test |
| 430 | +$ pnpm run test |
423 | 431 | ```
|
424 | 432 |
|
425 | 433 | ### Publishing Demo
|
|
0 commit comments