-
-
Notifications
You must be signed in to change notification settings - Fork 131
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
WIP: Create v3 upgrade guide #813
Draft
maxwondercorn
wants to merge
2
commits into
adopted-ember-addons:master
Choose a base branch
from
maxwondercorn:upgrade-guide
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
## Upgrading to V3 | ||
|
||
1. BREAKING: `ember-light-table` components no longer support positional parameters, use named parameters instead. | ||
|
||
1. BREAKING: A custom icon component is now required for sorting icons | ||
|
||
In prior versions, the lt-head `iconComponent` parameter was optional if Font Awesome icons were used. Font Awesome and the ember-fontawesome addon no longer provide the class based icons used in ember-light-table. | ||
|
||
If the host app uses the default Font Awesome icons duplicate the `fa-wrapper-component` used in the dummy app. The `sort`, `sort-down`, and `sort-up` Font Awesome icons are imported with the addon. <sup>1</sup> | ||
|
||
```hbs | ||
<!-- fa-icon-wrapper.hbs --> | ||
<FaIcon @icon={{get @sortIcons @sortIconProperty}}/> | ||
``` | ||
|
||
```hbs | ||
<!-- table componnent --> | ||
<LightTable @table={{this.table}} as |t|> | ||
<t.head | ||
@iconSortable="sort" | ||
@iconAscending="sort-up" | ||
@iconDescending="sort-down" | ||
@iconComponent="fa-icon-wrapper" | ||
/> | ||
|
||
<!-- remaing template... --> | ||
|
||
</LightTable> | ||
``` | ||
The `iconSortable`, `iconAscending` and `iconDescending` properties are now the icon names used by the icon component, not class names. | ||
|
||
To use other Font Awesome icons add the appropiate icon pacakge (i.e. @fortawesome/free-solid-svg-icons) to your devDependencies. Depending on the icon paccage, the `FaIcon` component may need the `prefix` parameter. See `ember-fontawesome` [dcoumentation](https://www.npmjs.com/package/@fortawesome/ember-fontawesome#template). | ||
|
||
If the comsuming app does not use the `ember-font-awesonme` addon, it can be removed from `package.json`. | ||
|
||
<sup>1</sup> Icons are tree-shaken to minimize the package size | ||
|
||
1. The `ember-composable-helpers` dependency has been removed | ||
|
||
See issue [#524](https://github.com/adopted-ember-addons/ember-light-table/issues/524). This is a breaking change if your host app depends on composable helpers and `ember-composable-helpers` is not defined in your devDependencies. | ||
|
||
If the host app `package.json` has a yarn resolution or npm override for `ember-composable-helpers` to resolve the `'attemped to overwrite the built-in helper array'` [error](https://github.com/adopted-ember-addons/ember-light-table/issues/731), it can be removed. | ||
|
||
1. `ember-responsive` is now an addon dependency | ||
|
||
If the host app is not using `ember-repsonsive` functionality, it can be removed from `package.json`. | ||
|
||
|
||
|
||
1. Mixins for common table functions (i.e. scrollToBottom, data loading, etc) should be converted to components. | ||
|
||
OLD: | ||
|
||
```js | ||
// table-common mixin | ||
import Mixin from '@ember/object/mixin'; | ||
import Table from 'ember-light-table'; | ||
import { inject as service } from '@ember/service'; | ||
|
||
export default Mixin.create({ | ||
store: service(), | ||
|
||
page: 0, | ||
limit: 10, | ||
dir: 'asc', | ||
sort: 'firstName', | ||
... | ||
}) | ||
``` | ||
|
||
NEW: | ||
|
||
```js | ||
// base table component | ||
import Component from '@glimmer/component'; | ||
import Table from 'ember-light-table'; | ||
import { inject as service } from '@ember/service'; | ||
import { tracked } from '@glimmer/tracking'; | ||
|
||
export default class BaseTable extends Component { | ||
@service store; | ||
|
||
@tracked page = 0; | ||
@tracked limit = 10; | ||
@tracked dir = 'asc'; | ||
@tracked sort = 'firstName'; | ||
... | ||
} | ||
``` | ||
The `BaseTable` component in the dummy application shows a complete example. | ||
|
||
<br> | ||
|
||
## Upgrading to v2 | ||
|
||
1. The API for initializing new tables, rows and columns has changed. | ||
|
||
```js | ||
// old methods | ||
new Table(columns, rows) | ||
new Row(content, options) | ||
new Column(opts) | ||
``` | ||
|
||
```js | ||
// new methods | ||
Table.create(columns: columns, rows: rows) | ||
Row.create({ content: content }) | ||
Column.create(opts) | ||
``` | ||
Positional arguments are also no longer supported. See [this pull request](https://github.com/adopted-ember-addons/ember-light-table/pull/701) for more information. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ember-repsonsive => ember-responsive