diff --git a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st index 09dd397d..5cef3144 100644 --- a/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterItemsElement.class.st @@ -17,6 +17,7 @@ GtFilterItemsElement >> addElementForFilterViewModel: aFilterViewModel [ c flow horizontal alignLeft ]. self addNavigationShortcutsTo: anElement. + self addRemoveButtonIconTo: anElement. self addChild: anElement ] @@ -53,6 +54,27 @@ GtFilterItemsElement >> addNewFilterElement [ self addChild: self newAddFilterButton as: #add ] +{ #category : #'private - updating' } +GtFilterItemsElement >> addRemoveButtonIconTo: anElement [ + | aRemoveButton aKeyMap | + aKeyMap := 'Backspace | Delete'. + anElement clipChildren: false. + aRemoveButton := self newRemoveButton. + aRemoveButton visibility: BlVisibility gone. + aRemoveButton addAptitude: (BrGlamorousWithLabelTooltipAptitude + text: 'Remove' + keymap: aKeyMap). + aRemoveButton action: [ :aButton | + self onRemoveFilterViewModelOfElement: anElement from: aButton ]. + anElement + when: BlMouseEnterEvent + do: [ :anEvent | aRemoveButton visibility: BlVisibility visible ]. + anElement + when: BlMouseLeaveEvent + do: [ :anEvent | aRemoveButton visibility: BlVisibility gone ]. + anElement addChild: aRemoveButton +] + { #category : #'private - updating' } GtFilterItemsElement >> createDropdownContent [ ^ BrSimpleList new @@ -97,6 +119,7 @@ GtFilterItemsElement >> initialize [ self hFitContentLimited. self vFitContent. self padding: (BlInsets all: 2). + self clipChildren: false. self initializeEventHandlers. ] @@ -147,6 +170,18 @@ GtFilterItemsElement >> newAddFilterHandleElement [ hExact: 20 ] +{ #category : #'private - updating' } +GtFilterItemsElement >> newRemoveButton [ + ^ GtInspectorRoundButtonStencil mini asElement + icon: (BrPlusIconStencil close radius: 3) asElement; + zIndex: 10; + id: GtPagerClosePageButtonElementId; + constraintsDo: [ :c | + c ignoreByLayout. + c ignored horizontal alignCenterAt: 1.0. + c ignored vertical alignCenterAt: 0.0 ] +] + { #category : #'api - filter view model' } GtFilterItemsElement >> onFiltersViewModelChanged [ self updateItemsElement @@ -157,6 +192,14 @@ GtFilterItemsElement >> onItemsChanged: anAnnouncement [ BlTaskAction enqueueElement: self action: [ self updateItemsElement ] ] +{ #category : #'private - updating' } +GtFilterItemsElement >> onRemoveFilterViewModelOfElement: anElement from: aButton [ + anElement hasFilterViewModel ifFalse: [ ^ self ]. + self hasFiltersViewModel ifFalse: [ ^ self ]. + + self filtersViewModel removeFilterViewModel: anElement filterViewModel +] + { #category : #'event handling' } GtFilterItemsElement >> onRemoveFilterViewModelWish: anEvent [ anEvent filterViewModel ifNil: [ ^ self ]. diff --git a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st index 5015daae..369d8433 100644 --- a/src/GToolkit-Coder-UI/GtFilterNameElement.class.st +++ b/src/GToolkit-Coder-UI/GtFilterNameElement.class.st @@ -68,7 +68,7 @@ GtFilterNameElement >> initializeSettingsContainer [ GtFilterNameElement >> initializeShortcuts [ self addShortcut: (BlShortcutWithAction new - combination: BlKeyCombination backspace; + combination: (BlKeyCombination backspace or: BlKeyCombination delete); action: [ self requestRemoveFilter ]) ]