Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert positional params to named params #809

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions addon/components/cells/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { htmlSafe } from '@ember/template';
* @class Base Cell
*/

const Cell = Component.extend({
export default Component.extend({
tagName: 'td',
classNames: ['lt-cell'],
attributeBindings: ['style'],
Expand Down Expand Up @@ -92,9 +92,3 @@ const Cell = Component.extend({
return rawValue;
}),
});

Cell.reopenClass({
positionalParams: ['column', 'row'],
});

export default Cell;
8 changes: 1 addition & 7 deletions addon/components/columns/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import cssStyleify from 'ember-light-table/utils/css-styleify';
* @class Base Column
*/

const Column = Component.extend(DraggableColumnMixin, {
export default Component.extend(DraggableColumnMixin, {
tagName: 'th',
classNames: ['lt-column'],
attributeBindings: ['style', 'colspan', 'rowspan'],
Expand Down Expand Up @@ -129,9 +129,3 @@ const Column = Component.extend(DraggableColumnMixin, {
},
}),
});

Column.reopenClass({
positionalParams: ['column'],
});

export default Column;
8 changes: 1 addition & 7 deletions addon/components/light-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function intersections(array1, array2) {
* @main Components
*/

const LightTable = Component.extend({
export default Component.extend({
tagName: '',

media: service(),
Expand Down Expand Up @@ -385,9 +385,3 @@ const LightTable = Component.extend({
},
},
});

LightTable.reopenClass({
positionalParams: ['table'],
});

export default LightTable;
10 changes: 5 additions & 5 deletions addon/components/lt-body.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
{{yield this.columns this.rows}}
{{else}}
{{#vertical-collection
this.rows
items=this.rows
tagName="vertical-collection"
estimateHeight=this.sharedOptions.estimatedRowHeight
shouldRecycle=this.sharedOptions.shouldRecycle
Expand All @@ -43,8 +43,8 @@
lastReached=(action "lastReached") as |row|
}}
{{lt.row
row
this.columns
row=row
columns=this.columns
data-row-id=row.rowId
table=this.table
tableActions=this.tableActions
Expand Down Expand Up @@ -120,8 +120,8 @@
) as |row|
}}
{{lt.row
row
this.columns
row=row
columns=this.columns
data-row-id=row.rowId
table=this.table
tableActions=this.tableActions
Expand Down
2 changes: 1 addition & 1 deletion addon/components/lt-foot.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{{#each this.columns as |column|}}
{{component
(concat "light-table/columns/" column.type)
column
column=column
table=this.table
tableActions=this.tableActions
extra=this.extra
Expand Down
4 changes: 2 additions & 2 deletions addon/components/lt-head.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{{#each this.columnGroups as |column|}}
{{component
(concat "light-table/columns/" column.type)
column
column=column
table=this.table
tableActions=this.tableActions
extra=this.extra
Expand All @@ -40,7 +40,7 @@
{{#each this.subColumns as |column|}}
{{component
(concat "light-table/columns/" column.type)
column
column=column
table=this.table
rowspan=1
classNames="lt-sub-column"
Expand Down
4 changes: 2 additions & 2 deletions addon/components/lt-row.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{#each this.columns as |column|}}
{{component
(concat 'light-table/cells/' column.cellType)
column
this.row
column=column
row=this.row
table=this.table
rawValue=(get this.row column.valuePath)
tableActions=this.tableActions
Expand Down
8 changes: 1 addition & 7 deletions addon/components/lt-row.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Component from '@ember/component';
import { readOnly } from '@ember/object/computed';

const Row = Component.extend({
export default Component.extend({
tagName: 'tr',
classNames: ['lt-row'],
classNameBindings: [
Expand All @@ -24,9 +24,3 @@ const Row = Component.extend({
isSelected: readOnly('row.selected'),
isExpanded: readOnly('row.expanded'),
});

Row.reopenClass({
positionalParams: ['row', 'columns'],
});

export default Row;
22 changes: 11 additions & 11 deletions tests/integration/components/light-table-occlusion-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module('Integration | Component | light table | occlusion', function (hooks) {
test('it renders', async function (assert) {
this.set('table', Table.create());
await render(
hbs`{{light-table this.table height="40vh" occlusion=true estimatedRowHeight=30}}`
hbs`{{light-table table=this.table height="40vh" occlusion=true estimatedRowHeight=30}}`
);

assert.dom('*').hasText('');
Expand All @@ -54,7 +54,7 @@ module('Integration | Component | light table | occlusion', function (hooks) {
});

await render(hbs`
{{#light-table this.table height='40vh' occlusion=true estimatedRowHeight=30 as |t|}}
{{#light-table table=this.table height='40vh' occlusion=true estimatedRowHeight=30 as |t|}}
{{t.head fixed=true}}
{{t.body onScrolledToBottom=this.onScrolledToBottom}}
{{/light-table}}
Expand Down Expand Up @@ -90,7 +90,7 @@ module('Integration | Component | light table | occlusion', function (hooks) {
);

await render(hbs`
{{#light-table this.table height='500px' id='lightTable' occlusion=true estimatedRowHeight=30 as |t|}}
{{#light-table table=this.table height='500px' id='lightTable' occlusion=true estimatedRowHeight=30 as |t|}}
{{t.head fixed=true}}
{{t.body}}
{{/light-table}}
Expand All @@ -99,7 +99,7 @@ module('Integration | Component | light table | occlusion', function (hooks) {
assert.dom('#lightTable_inline_head thead').doesNotExist();

await render(hbs`
{{#light-table this.table height='500px' id='lightTable' occlusion=true estimatedRowHeight=30 as |t|}}
{{#light-table table=this.table height='500px' id='lightTable' occlusion=true estimatedRowHeight=30 as |t|}}
{{t.head fixed=false}}
{{t.body}}
{{/light-table}}
Expand All @@ -119,7 +119,7 @@ module('Integration | Component | light table | occlusion', function (hooks) {
);

await render(hbs`
{{#light-table this.table height='500px' id='lightTable' occlusion=true estimatedRowHeight=30 as |t|}}
{{#light-table table=this.table height='500px' id='lightTable' occlusion=true estimatedRowHeight=30 as |t|}}
{{t.body}}
{{t.foot fixed=true}}
{{/light-table}}
Expand All @@ -128,7 +128,7 @@ module('Integration | Component | light table | occlusion', function (hooks) {
assert.dom('#lightTable_inline_foot tfoot').doesNotExist();

await render(hbs`
{{#light-table this.table height='500px' id='lightTable' occlusion=true estimatedRowHeight=30 as |t|}}
{{#light-table table=this.table height='500px' id='lightTable' occlusion=true estimatedRowHeight=30 as |t|}}
{{t.body}}
{{t.foot fixed=false}}
{{/light-table}}
Expand All @@ -149,7 +149,7 @@ module('Integration | Component | light table | occlusion', function (hooks) {

await render(hbs`
<div style="height: 500px">
{{#light-table this.table id='lightTable' occlusion=true estimatedRowHeight=30 as |t|}}
{{#light-table table=this.table id='lightTable' occlusion=true estimatedRowHeight=30 as |t|}}
{{t.body}}
{{t.foot fixed=this.fixed}}
{{/light-table}}
Expand All @@ -175,7 +175,7 @@ module('Integration | Component | light table | occlusion', function (hooks) {

await render(hbs`
<div style="height: 500px">
{{#light-table this.table id='lightTable' occlusion=true estimatedRowHeight=30 as |t|}}
{{#light-table table=this.table id='lightTable' occlusion=true estimatedRowHeight=30 as |t|}}
{{t.head fixed=true}}
{{t.body}}
{{#t.foot fixed=true}}
Expand Down Expand Up @@ -209,7 +209,7 @@ module('Integration | Component | light table | occlusion', function (hooks) {
);

await render(hbs`
{{#light-table this.table occlusion=true estimatedRowHeight=30 as |t|}}
{{#light-table table=this.table occlusion=true estimatedRowHeight=30 as |t|}}
{{t.body rowComponent=(component "custom-row" classNames="custom-row")}}
{{/light-table}}
`);
Expand All @@ -235,7 +235,7 @@ module('Integration | Component | light table | occlusion', function (hooks) {
this.set('table', Table.create({ columns: Columns, rows: users }));

await render(hbs`
{{#light-table this.table height='500px' occlusion=true estimatedRowHeight=30 as |t|}}
{{#light-table table=this.table height='500px' occlusion=true estimatedRowHeight=30 as |t|}}
{{t.body
rowComponent=(component "custom-row" classNames="custom-row" current=this.current)
}}
Expand Down Expand Up @@ -307,7 +307,7 @@ module('Integration | Component | light table | occlusion', function (hooks) {
};

await render(hbs`
{{#light-table this.table
{{#light-table table=this.table
occlusion=true
estimatedRowHeight=30
extra=(hash someData="someValue")
Expand Down
30 changes: 15 additions & 15 deletions tests/integration/components/light-table-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module('Integration | Component | light table', function (hooks) {

test('it renders', async function (assert) {
this.set('table', Table.create());
await render(hbs`{{light-table this.table}}`);
await render(hbs`{{light-table table=this.table}}`);

assert.dom('*').hasText('');
});
Expand All @@ -49,7 +49,7 @@ module('Integration | Component | light table', function (hooks) {
});

await render(hbs`
{{#light-table this.table height='40vh' as |t|}}
{{#light-table table=this.table height='40vh' as |t|}}
{{t.head fixed=true}}
{{t.body onScrolledToBottom=this.onScrolledToBottom}}
{{/light-table}}
Expand Down Expand Up @@ -90,12 +90,12 @@ module('Integration | Component | light table', function (hooks) {
});

await render(hbs`
{{#light-table this.table height='40vh' id='table-1' as |t|}}
{{#light-table table=this.table height='40vh' id='table-1' as |t|}}
{{t.head fixed=true}}
{{t.body onScrolledToBottom=this.onScrolledToBottomTable1}}
{{/light-table}}

{{#light-table this.table height='40vh' id='table-2' as |t|}}
{{#light-table table=this.table height='40vh' id='table-2' as |t|}}
{{t.head fixed=true}}
{{t.body onScrolledToBottom=this.onScrolledToBottomTable2}}
{{/light-table}}
Expand Down Expand Up @@ -129,7 +129,7 @@ module('Integration | Component | light table', function (hooks) {
);

await render(hbs`
{{#light-table this.table height='500px' id='lightTable' as |t|}}
{{#light-table table=this.table height='500px' id='lightTable' as |t|}}
{{t.head fixed=true}}
{{t.body}}
{{/light-table}}
Expand All @@ -138,7 +138,7 @@ module('Integration | Component | light table', function (hooks) {
assert.dom('#lightTable_inline_head thead').doesNotExist();

await render(hbs`
{{#light-table this.table height='500px' id='lightTable' as |t|}}
{{#light-table table=this.table height='500px' id='lightTable' as |t|}}
{{t.head fixed=false}}
{{t.body}}
{{/light-table}}
Expand All @@ -158,7 +158,7 @@ module('Integration | Component | light table', function (hooks) {
);

await render(hbs`
{{#light-table this.table height='500px' id='lightTable' as |t|}}
{{#light-table table=this.table height='500px' id='lightTable' as |t|}}
{{t.body}}
{{t.foot fixed=true}}
{{/light-table}}
Expand All @@ -167,7 +167,7 @@ module('Integration | Component | light table', function (hooks) {
assert.dom('#lightTable_inline_foot tfoot').doesNotExist();

await render(hbs`
{{#light-table this.table height='500px' id='lightTable' as |t|}}
{{#light-table table=this.table height='500px' id='lightTable' as |t|}}
{{t.body}}
{{t.foot fixed=false}}
{{/light-table}}
Expand All @@ -188,7 +188,7 @@ module('Integration | Component | light table', function (hooks) {

await render(hbs`
<div style="height: 500px">
{{#light-table this.table id='lightTable' as |t|}}
{{#light-table table=this.table id='lightTable' as |t|}}
{{t.body}}
{{t.foot fixed=this.fixed}}
{{/light-table}}
Expand All @@ -214,7 +214,7 @@ module('Integration | Component | light table', function (hooks) {

await render(hbs`
<div style="height: 500px">
{{#light-table this.table id='lightTable' as |t|}}
{{#light-table table=this.table id='lightTable' as |t|}}
{{t.head fixed=true}}
{{t.body}}
{{#t.foot fixed=true}}
Expand Down Expand Up @@ -248,7 +248,7 @@ module('Integration | Component | light table', function (hooks) {
);

await render(hbs`
{{#light-table this.table as |t|}}
{{#light-table table=this.table as |t|}}
{{t.body rowComponent=(component "custom-row" classNames="custom-row")}}
{{/light-table}}
`);
Expand All @@ -274,7 +274,7 @@ module('Integration | Component | light table', function (hooks) {
this.set('table', Table.create({ columns: Columns, rows: users }));

await render(hbs`
{{#light-table this.table as |t|}}
{{#light-table table=this.table as |t|}}
{{t.body
rowComponent=(component "custom-row" classNames="custom-row" current=this.current)
}}
Expand Down Expand Up @@ -323,7 +323,7 @@ module('Integration | Component | light table', function (hooks) {
});

await render(hbs`
{{#light-table this.table height='40vh' as |t|}}
{{#light-table table=this.table height='40vh' as |t|}}
{{t.head fixed=true}}
{{t.body
useVirtualScrollbar=true
Expand Down Expand Up @@ -374,7 +374,7 @@ module('Integration | Component | light table', function (hooks) {
};

await render(hbs`
{{#light-table this.table
{{#light-table table=this.table
extra=(hash someData="someValue")
tableActions=(hash
someAction=(action "someAction")
Expand All @@ -399,7 +399,7 @@ module('Integration | Component | light table', function (hooks) {
});
this.setProperties({ table });
await render(hbs`
{{#light-table this.table height='40vh' as |t|}}
{{#light-table table=this.table height='40vh' as |t|}}
{{t.head fixed=true}}
{{t.body}}
{{/light-table}}
Expand Down
Loading