-
-
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
Feat/custom icon components #489
Changes from 3 commits
35536ea
2f4f1ea
105c33f
0a8ef44
494f4d0
daa657e
a8e93a1
2e2faf9
a149f96
7975553
d89ae12
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,9 @@ | |
{{component column.component column=column table=table tableActions=tableActions extra=extra sortIcons=sortIcons}} | ||
{{else}} | ||
{{label}} | ||
{{#if sortIconProperty}} | ||
{{#if (and sortIcons.iconComponent sortIconProperty)}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't remember, if we talked about that. but this way the I don't have strong feelings either way, since I can't come up with a scenario where you would want to render an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember I ran into this issue in the demo where the avatar column was displaying the sort component when sortable: 'false'. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, but some users might argue that they'd want their For instance: {{#if sortIconProperty}}
<i class="lt-sort-icon material-icons" style="height:0px;">{{get sortIcons sortIconProperty}}</i>
{{else}}
<i class="lt-sort-icon material-icons" style="height:0px; color: red;">not_sortable</i>
{{/if}} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Understood, I see the use case now. Because you have no strong feelings I guess I'll leave the base.hbs as is for now but feel free to let me know otherwise. |
||
{{component sortIcons.iconComponent sortIcons=sortIcons sortIconProperty=sortIconProperty}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would you mind adding a test to verify the arguments ( + {{t.head
+ onColumnClick=(action 'onColumnClick')
+ iconSortable='unfold_more'
+ iconAscending='keyboard_arrow_up'
+ iconDescending='keyboard_arrow_down'
+ iconComponent='materialize-icon'
+ fixed=true
+ }} You can steal some ideas from |
||
{{else if sortIconProperty}} | ||
<i class="lt-sort-icon {{get sortIcons sortIconProperty}}"></i> | ||
{{/if}} | ||
{{/if}} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// BEGIN-SNIPPET custom-sort-icon-table | ||
import Component from '@ember/component'; | ||
import TableCommon from '../../mixins/table-common'; | ||
import { computed } from '@ember/object'; | ||
|
||
export default Component.extend(TableCommon, { | ||
columns: computed(function() { | ||
return [{ | ||
label: 'Avatar', | ||
valuePath: 'avatar', | ||
width: '60px', | ||
sortable: false, | ||
cellComponent: 'user-avatar' | ||
}, { | ||
label: 'First Name', | ||
valuePath: 'firstName', | ||
width: '150px' | ||
}, { | ||
label: 'Last Name', | ||
valuePath: 'lastName', | ||
width: '150px' | ||
}, { | ||
label: 'Address', | ||
valuePath: 'address' | ||
}, { | ||
label: 'State', | ||
valuePath: 'state' | ||
}, { | ||
label: 'Country', | ||
valuePath: 'country' | ||
}]; | ||
}) | ||
}); | ||
// END-SNIPPET |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// BEGIN-SNIPPET materialize-icon | ||
import Component from '@ember/component'; | ||
import layout from '../templates/components/materialize-icon'; | ||
|
||
export default Component.extend({ | ||
tagName: 'span', | ||
layout | ||
}); | ||
// END-SNIPPET |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from '../table-route'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{{!-- BEGIN-SNIPPET custom-sort-icon-table --}} | ||
{{#light-table table height='65vh' as |t|}} | ||
|
||
{{t.head | ||
onColumnClick=(action 'onColumnClick') | ||
iconSortable='unfold_more' | ||
iconAscending='keyboard_arrow_up' | ||
iconDescending='keyboard_arrow_down' | ||
iconComponent='materialize-icon' | ||
fixed=true | ||
}} | ||
|
||
{{#t.body | ||
canSelect=false | ||
onScrolledToBottom=(action 'onScrolledToBottom') | ||
as |body| | ||
}} | ||
{{#if isLoading}} | ||
{{#body.loader}} | ||
{{table-loader}} | ||
{{/body.loader}} | ||
{{/if}} | ||
{{/t.body}} | ||
|
||
{{/light-table}} | ||
{{!-- END-SNIPPET --}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{{!-- BEGIN-SNIPPET materialize-icon --}} | ||
<i class="lt-sort-icon material-icons" style="height:0px;">{{get sortIcons sortIconProperty}}</i> | ||
{{!-- END-SNIPPET --}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{{#code-panel | ||
title="Custom Sort Icon" | ||
snippets=(array | ||
"custom-sort-icon-table.js" | ||
"table-common.js" | ||
"custom-sort-icon-table.hbs" | ||
"user-avatar.hbs" | ||
"table-loader.hbs" | ||
"materialize-icon.hbs" | ||
)}} | ||
{{cookbook/custom-sort-icon-table model=model}} | ||
{{/code-panel}} |
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.
I would change the order
It's unclear what you mean by this sure what you mean by this