-
Notifications
You must be signed in to change notification settings - Fork 5
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
Dialog for hidden filters [issue-78] #90
Conversation
cosmoz-omnitable.html
Outdated
@@ -52,7 +54,15 @@ | |||
<paper-checkbox checked$="{{ _allSelected }}" on-change="_onAllCheckboxChange" hidden$="[[ !_dataIsValid ]]"> | |||
</paper-checkbox> | |||
</div> | |||
<cosmoz-omnitable-header-row columns="[[ visibleColumns ]]" group-on-column="[[ groupOnColumn ]]"></cosmoz-omnitable-header-row> | |||
<cosmoz-omnitable-header-row columns="[[ visibleColumns ]]" group-on-column="[[ groupOnColumn ]]"> | |||
<div slot="suffix" class="align-right" hidden$="[[allVisible]]"> |
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.
This breaks _adjustHeadersWidth
.
In _adjustHeadersWidth
, we reference individual header cell by their index in header row children (see https://github.com/Neovici/cosmoz-omnitable/blob/master/cosmoz-omnitable.js#L786)
But now, the suffix
div is the first children in header row, so we don't size the right element anymore
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.
Thanks, pls let me know if the changes work for you.
cosmoz-omnitable-filter-dialog.html
Outdated
is: 'cosmoz-omnitable-filter-dialog', | ||
|
||
behaviors: [ | ||
Polymer.PaperDialogBehavior, |
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.
We can't use paper-dialog, because it has stacking context issues (the dialog can appear below another element).
cosmoz-dialog
solves stacking context issues, but works differently.
Instead, you should use
<cosmoz-dialog>
<template>
dialog content
<template>
Regarding the dialog content, you should investigate using cosmoz-omnitable-repeater-behavior
, as this behavior already handles columns changes and instances creation/release.
See for example https://github.com/Neovici/cosmoz-omnitable/blob/master/cosmoz-omnitable-header-row.html
cosmoz-omnitable.html
Outdated
@@ -195,7 +205,13 @@ <h3 class="groupRow-label"> | |||
<div id="columns"> | |||
<slot></slot> | |||
</div> | |||
|
|||
|
|||
<cosmoz-omnitable-filter-dialog |
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.
So this should rather looks like (relating to other comments):
<cosmoz-dialog with-backdrop>
<template>
<cosmoz-omnitable-filters-dialog columns="[[disabledColumns]]">
<template>
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.
See code comments
@@ -297,6 +304,14 @@ | |||
return dataIsValid && hasActions; | |||
}, | |||
|
|||
_computeColumnsAllVisible(visibleColumnsChange, columns) { |
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.
This does not work for the groupOn column.
When grouping on a column, it is not removed from the visibleColumn
property, but the cells for the groupOn colunm are hidden.
The _computeColumnsAllVisible
function could also observe changes to the groupOnColumn
property, and If this is not null, then it should return false
@@ -196,6 +206,16 @@ <h3 class="groupRow-label"> | |||
<slot></slot> | |||
</div> | |||
|
|||
<cosmoz-dialog with-backdrop id="filterDialog"> |
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 think the dialog needs at least a "Close" button.
It's not always clear to the user that clicking somewhere outside the dialog will close it.
cosmoz-omnitable-headers-dialog.html
Outdated
return; | ||
} | ||
|
||
headers.innerHTML = ''; |
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.
This is not the right way to clear the content of the dialog.
cosmoz-omnitable-templatizer
keeps a reference to the instances it creates, so when an instance is not used anymore it needs to be "released", otherwise it will stay in memory.
This is also not very efficient, as we recreate new instances for all headers in the dialog when disabledColumns
is changing.
You should really try to use cosmoz-omnitable-repeater-behavior
, as it takes care of correctly releasing unused instances as well as creating only instances when needed.
cosmoz-omnitable-headers-dialog
could be implemented the same way as cosmoz-omnitable-header-row
.
Please check again. |
cosmoz-omnitable.js
Outdated
*/ | ||
allColumnsVisible: { | ||
type: Boolean, | ||
computed: '_computeColumnsAllVisible(visibleColumns.*, groupOnColumn.*, columns)' |
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.
This won't work correctly when groupOnColumn is undefined because complex observers are called only when all properties are defined.
So when groupOn
is not defined, groupOnColumn
is undefined and the computed function is not called.
Currently, the open filters dialog icon is always visible.
cosmoz-omnitable.js
Outdated
} | ||
}, | ||
|
||
observers: [ | ||
'_dataChanged(data.*)', | ||
'_debounceSortItems(sortOn, descending, filteredGroupedItems)', | ||
'_routeHashParamsChanged(_routeHashParams.*, hashParam, columns)', | ||
' _selectedItemsChanged(selectedItems.*)' | ||
'_selectedItemsChanged(selectedItems.*)', | ||
'_setFilterDialogColumns(disabledColumns.*, groupOnColumn.*)' |
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.
Same as for _computeColumnsAllVisible
.
_setFilterDialogColumns
will never be called as long as there is no group on column
cosmoz-omnitable-headers-dialog.html
Outdated
} | ||
</style> | ||
|
||
<paper-icon-button class="close-btn" icon="close" on-tap="_close"></paper-icon-button> |
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.
It does not feel natural to have to click top right.
I think a button inside the dialog, bottom right, would be better. Like in paper-dialog demos.
Not sure about the label though.
Let's use "Close" for now.
So the close button should move the cosmoz-dialog template in omnitable.html, a <div class="buttons>
to use paper-dialog default styling.
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.
Hmm, took the facebook approach here.. But I thinks you are right..
cosmoz-omnitable-headers-dialog.html
Outdated
--> | ||
<dom-module id="cosmoz-omnitable-headers-dialog"> | ||
<template> | ||
<style> |
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.
Styling of the dialog looks strange.
host might require a display block.
container should use a vertical flexbox.
cosmoz-omnitable-headers-dialog.html
Outdated
<paper-icon-button class="close-btn" icon="close" on-tap="_close"></paper-icon-button> | ||
|
||
<div class="container"> | ||
<div class="title">[[title]]</div> |
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.
Remove the title from here, and use <h2>...</h2>
in the dialog template in omnitable.html
That way, it will use paper-dialog default styling.
@@ -196,6 +208,17 @@ <h3 class="groupRow-label"> | |||
<slot></slot> | |||
</div> | |||
|
|||
<cosmoz-dialog with-backdrop id="filterDialog"> | |||
<template> |
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.
<h2>[[_('Filter', t)]]</h2>
cosmoz-omnitable.html
Outdated
columns="[[_filterDialogColumns]]" | ||
on-close-tapped="_closeFilterDialog" | ||
with-backdrop> | ||
</cosmoz-omnitable-headers-dialog> |
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.
<div class="buttons>
<paper-button>[[_("Close")]]</paper-button>
</div>
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.
_close()
function in headers-dialog not needed anymore ?- Thanks to this PR, we don't have to reset filters when groupon column changes (this was some sort of hack). See https://github.com/Neovici/cosmoz-omnitable/blob/master/cosmoz-omnitable.js#L536-L538
Code looks good, and the dialog works as expected.
Some UI/UX issues have to be fixed, though I'm not sure how:
- If the dialog contains only an autocomplete header, interaction with the dropdown is not possible (try grouping on "Group" column).
- The "filter' icon to open the dialog is overlaying the last header (not always. Try to group on Amount in the demo).
cosmoz-omnitable-headers-dialog.html
Outdated
this._forwardPropertiesFlush(instance); | ||
}, | ||
|
||
_close() { |
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.
Since the close button is now in omnitable.html, is this function still needed ?
The not-overlapping suggestions of autocomplete-chips is fixed with this PR Neovici/paper-autocomplete-chips#6 |
Hmm :( sorry for that - I cannot reproduce.. May you check again if you have integrated the PR Neovici/paper-autocomplete-chips#6 and pull also this PR again please. Thanks |
OK my bad. I was using bower link paper-autocomplete-chips, which links to |
Found an issue. To reproduce, follow these steps in the full demo:
=> the paper-autocomplete will have a width of 0 |
Found another issue, not related to paper-autocomplete:
=> the dialog is displayed without any filter |
cosmoz-omnitable-headers-dialog.html
Outdated
}, | ||
|
||
_onResize() { | ||
this.scopeSubtree(this.$.container); |
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.
What's the purpose of this ?
Actually, this seems to break styling of the suggestion wrapper, which does not overlap anymore (but it works if I remove the scopeSubtree
call)
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.
Added a clear button in PR #117 to apply styles correctly. |
* Added clear button element * Use clear button instead of iron-icon Currently needed to display the clear button in the filters-dialog (PR #90) without having to include the styles into the template.
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.
Found another issue, with autocomplete columns.
To reproduce in full-demo.html, update x-page
to set priority="-1"
to the group
column.
Then reduce the window width so that the group column is hidden. Open the filter dialog, and click in the group filter. The dropdown should open with possible group values.
Close the filter dialog.
Increase window size so that the group column is visible again.
Click in the Group filter => the available values dropdown does not show.
Solved issue, with autocomplete columns. To reproduce in full-demo.html, update x-page to set priority="-1" to the group column. Then reduce the window width so that the group column is hidden. Open the filter dialog, and click in the group filter. The dropdown should open with possible group values. Close the filter dialog. Increase window size so that the group column is visible again. Click in the Group filter => the available values dropdown does not show.
Please merge #135 first so building succeeds again. |
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.
Found another issue.
To reproduce in full-demo, group the table on the last column (Amount). The dialog filter icon does not appear, because we don't want to filter on the group on column.
Then reduce the window width to make the icon appear.
Open the dialog => Amount filter is visible, but it shouldn't.
Calling done() in an eventlistener => ensure that it will be called only once
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.
Found an issue when using cosmoz-omnitable-treenode-column
: for this column type, the header is using paper-autocomplete
, and the dropdown causing the dialog to scroll.
Actually, same issue as before with paper-autocomplete
.
You can try it in treenode column repository, and using bower link cosmoz-omnitable
.
Don't know if this can be solved in omnitable or in treenode-column.
See #78
Please merge #117 first