Adding filter banner component and filtering activated message #4426
Adding filter banner component and filtering activated message #4426gabriel-bolbotina wants to merge 2 commits intodev/filteringfrom
Conversation
Pull Request Test Coverage Report for Build 23648308057Details
💛 - Coveralls |
📦 Build Artifacts Ready
|
Added extra small MMButton size Added function to check if the referencing layer is filtered Added info message in gallery and relation editor pages
Simplified Filter banner component Added banner in the linked features corrected position according to figma design
8f4d1be to
de09c4b
Compare
📦 Build Artifacts Ready
|
|
|
||
| property string errorMsg: "" | ||
| property string warningMsg: "" | ||
| property string hintMsg: "" |
There was a problem hiding this comment.
| property string hintMsg: "" | |
| property string infoMsg: "" |
| Item { | ||
| // hint message | ||
|
|
||
| width: parent.width | ||
| height: hintMessageGroup.implicitHeight | ||
|
|
||
| visible: root.hintMsg !== "" | ||
|
|
||
| RowLayout { | ||
| id: hintMessageGroup | ||
|
|
||
| width: parent.width | ||
|
|
||
| MMComponents.MMIcon { | ||
| source: __style.infoFilledIcon | ||
| size: __style.icon16 | ||
| color: __style.informativeColor | ||
| } | ||
|
|
||
| MMComponents.MMText { | ||
| Layout.fillWidth: true | ||
|
|
||
| text: root.hintMsg | ||
| color: __style.deepOceanColor | ||
| font: __style.t4 | ||
|
|
||
| wrapMode: Text.Wrap | ||
| maximumLineCount: 10 | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
I would reuse the validation component below and just add new state where necessary. Validation info has priority over info message.
| if ( root.size === MMButton.Sizes.ExtraSmall ) return row.paintedChildrenWidth + 2 * __style.margin8 | ||
| return row.paintedChildrenWidth + 2 * ( root.size === MMButton.Sizes.Small ? __style.margin16 : __style.margin20 ) |
There was a problem hiding this comment.
| if ( root.size === MMButton.Sizes.ExtraSmall ) return row.paintedChildrenWidth + 2 * __style.margin8 | |
| return row.paintedChildrenWidth + 2 * ( root.size === MMButton.Sizes.Small ? __style.margin16 : __style.margin20 ) | |
| let margin = __style.margin20 | |
| if ( root.size === MMButton.Sizes.ExtraSmall ) margin = __style.margin8 | |
| else if ( root.size === MMButton.Sizes.Small ) margin = __style.margin16 | |
| return row.paintedChildrenWidth + 2 * margin |
this is more readable
| implicitHeight: { | ||
| if ( root.type === MMButton.Types.Tertiary && root.size !== MMButton.Sizes.ExtraSmall ) | ||
| return buttonContent.height | ||
| else | ||
| return buttonContent.height + topPadding + bottomPadding | ||
| } |
There was a problem hiding this comment.
after checking the padding values there is no reason to differentiate here as tertiary button sets it to 0
| property real maxWidth: { | ||
| if ( root.size === MMButton.Sizes.ExtraSmall ) return parent.width - 2 * __style.margin8 | ||
| return parent.width - 2 * ( root.size === MMButton.Sizes.Small ? __style.margin16 : __style.margin20 ) | ||
| } |
There was a problem hiding this comment.
same readability refactor as above would be nice
| hintMsg: root._fieldAssociatedRelation && globalFilterController.hasActiveFilters | ||
| ? qsTr( "Some features may be hidden by active filters" ) | ||
| : "" | ||
|
|
There was a problem hiding this comment.
| hintMsg: root._fieldAssociatedRelation && globalFilterController.hasActiveFilters | |
| ? qsTr( "Some features may be hidden by active filters" ) | |
| : "" | |
| infoMsg: root._fieldAssociatedRelation && __activeProject.filterController.hasActiveFilters | |
| ? qsTr( "Some features may be hidden by active filters" ) | |
| : "" | |
| hintMsg: root._fieldAssociatedRelation && globalFilterController.hasActiveFilters | ||
| ? qsTr( "Some features may be hidden by active filters" ) | ||
| : "" | ||
|
|
There was a problem hiding this comment.
| hintMsg: root._fieldAssociatedRelation && globalFilterController.hasActiveFilters | |
| ? qsTr( "Some features may be hidden by active filters" ) | |
| : "" | |
| infoMsg: root._fieldAssociatedRelation && __activeProject..filterController.hasActiveFilters | |
| ? qsTr( "Some features may be hidden by active filters" ) | |
| : "" | |
|
|
||
| delayedSearch: true | ||
| onSearchTextChanged: featuresModel.searchExpression = searchBar.text | ||
| visible: root.selectedLayer && globalFilterController.filteredLayerIds.indexOf(root.selectedLayer.id) >= 0 |
There was a problem hiding this comment.
| visible: root.selectedLayer && globalFilterController.filteredLayerIds.indexOf(root.selectedLayer.id) >= 0 | |
| visible: root.selectedLayer && __activeProject.filterController.filteredLayerIds.indexOf(root.selectedLayer.id) >= 0 |
| onActionClicked: { | ||
| globalFilterController.clearAllFilters() | ||
| globalFilterController.applyFiltersToAllLayers() | ||
| featuresModel.reloadFeatures() | ||
| } |
There was a problem hiding this comment.
| onActionClicked: { | |
| globalFilterController.clearAllFilters() | |
| globalFilterController.applyFiltersToAllLayers() | |
| featuresModel.reloadFeatures() | |
| } | |
| onActionClicked: { | |
| __activeProject.filterController.clearAllFilters() | |
| __activeProject.filterController.applyFiltersToAllLayers() | |
| featuresModel.reloadFeatures() | |
| } |
There was a problem hiding this comment.
Looks like this is never used, so let's remove it
In this PR:
Below some visuals:
filter-banner-info.MP4