diff --git a/test-app/app/controllers/index.js b/test-app/app/controllers/index.js index 484b63e8..c362738a 100644 --- a/test-app/app/controllers/index.js +++ b/test-app/app/controllers/index.js @@ -15,6 +15,8 @@ export default class ModifierController extends Controller { { fruit: 'lemon', day: 'Sunday' }, ]; + @tracked mutableRecords = ['Zero', 'One', 'Two', 'Three', 'Four']; + @action handleDragChange(reordered) { this.records = reordered; } @@ -76,4 +78,24 @@ export default class ModifierController extends Controller { set(this, 'model.itemsGrid2', newOrder); set(this, 'model.dragged', draggedModel); } + + @action + updateMutable(newOrder, draggedMode) { + this.mutableRecords = newOrder; + } + + @action + removeItemHorizontal(item) { + this.mutableRecords = this.mutableRecords.filter( + (record) => record !== item, + ); + } + + @action + addItemToHorizontal() { + this.mutableRecords = [ + ...this.mutableRecords, + `Item ${this.mutableRecords.length + 1}`, + ]; + } } diff --git a/test-app/app/styles/app.css b/test-app/app/styles/app.css index 5fba0d8a..022a817c 100644 --- a/test-app/app/styles/app.css +++ b/test-app/app/styles/app.css @@ -295,3 +295,39 @@ .word-break { word-wrap: break-word; } + +.flex { + display: flex; +} + +.flex-1 { + flex: 1; +} + +.inline-flex { + display: inline-flex; +} + +.align-items-center { + align-items: center; +} + +.space-between { + justify-content: space-between; +} + +.flex-column { + flex-direction: column; +} + +.flex-row { + flex-direction: row; +} + +.full-width { + width: 100%; +} + +.mr-5 { + margin-right: 5px; +} \ No newline at end of file diff --git a/test-app/app/templates/index.hbs b/test-app/app/templates/index.hbs index d3fcad84..3605f35b 100644 --- a/test-app/app/templates/index.hbs +++ b/test-app/app/templates/index.hbs @@ -67,7 +67,51 @@ {{~/each}} - + +
+

Horizontal Mutable +     +

+ +
+
    + {{#each this.mutableRecords as |item|~}} +
  1. + + +
  2. + {{~/each}} +
+
    + {{#each this.mutableRecords as |item|~}} +
  1. + + +
  2. + {{~/each}} +
+
+
+
@@ -77,13 +121,13 @@
+ {{sortable-group + direction='grid' + onChange=this.updateGrid + itemVisualClass=this.itemVisualClass + handleVisualClass=this.handleVisualClass + groupName='grid' + }}> {{#each @model.itemsGrid as |item|~}}
@@ -123,18 +167,18 @@ {{! template-lint-disable table-groups}} - - - - + + + + - {{#each @model.items as |item|}} - - - - - {{/each}} + {{#each @model.items as |item|}} + + + + + {{/each}}
Item
Item
{{item}}
{{item}}
@@ -225,4 +269,4 @@ - + \ No newline at end of file