Skip to content

Commit

Permalink
#79 :: Filter With Overlay.
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksandr-korchak committed May 19, 2021
1 parent d49a5ee commit 1a29b29
Show file tree
Hide file tree
Showing 15 changed files with 298 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

<ng-container *ngIf="state$ | async as state">

<spline-inline-filter [icon]="icon" [matMenuTriggerFor]="popover"
<spline-inline-filter [icon]="icon"
[matMenuTriggerFor]="popover"
[label]="label">
{{ state.valueString?.length ? state.valueString : (emptyValueString | translate) }}
</spline-inline-filter>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<!--
~ Copyright 2021 ABSA Group Limited
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->


<spline-inline-filter [icon]="icon"
[matMenuTriggerFor]="overlay"
[label]="label">
{{ filterStringValues }}
</spline-inline-filter>

<mat-menu #overlay="matMenu" class="spline-inline-filter-overlay">
<ng-template matMenuContent>
<div (click)="$event.stopPropagation()">
<div class="spline-inline-filter-overlay__content-wrapper">
<!-- VALUE CONTROL -->
<ng-content></ng-content>
<!-- VALUE CONTROL -->
</div>

<!-- ACTIONS -->
<div class="spline-inline-filter-overlay__footer-wrapper">
<div class="spline-inline-filter-overlay__actions">

<div class="spline-inline-filter-overlay__actions-left">
<!-- CLEAR -->
<button mat-button
size="md"
(click)="onClearBtnClicked()">
{{ 'COMMON.CLEAR' | translate }}
</button>
<!-- ./CLEAR -->
</div>
<div class="spline-inline-filter-overlay__actions-right">
<!-- CANCEL -->
<button mat-button
mat-raised-button
size="md"
(click)="onCancelBtnClicked($event)">
{{ 'COMMON.CANCEL' | translate }}
</button>
<!-- ./CANCEL -->

<!-- APPLY -->
<button mat-button
mat-raised-button
color="primary"
size="md"
[disabled]="applyBtnDisabled"
(click)="onApplyBtnClicked($event)">
{{ 'COMMON.APPLY' | translate }}
</button>
<!-- ./APPLY -->
</div>
</div>
</div>
<!-- ./ACTIONS -->
</div>
</ng-template>
</mat-menu>
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright 2021 ABSA Group Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core'
import { MatMenuTrigger } from '@angular/material/menu'

import { SplineInlineFilterWithOverlay } from './spline-inline-filter-with-overlay.models'


@Component({
selector: 'spline-inline-filter-with-overlay',
templateUrl: './spline-inline-filter-with-overlay.component.html'
})
export class SplineInlineFilterWithOverlayComponent {

@Input() icon: string
@Input() label: string
@Input() filterStringValues: string[] = []

@Input() showActions = true
@Input() applyBtnDisabled = false
@Input() options: SplineInlineFilterWithOverlay.Options = SplineInlineFilterWithOverlay.getDefaultOptions()

@Output() apply$ = new EventEmitter<void>()
@Output() cancel$ = new EventEmitter<void>()
@Output() reset$ = new EventEmitter<void>()
@Output() panelClosed$ = new EventEmitter<void>()
@Output() panelOpened$ = new EventEmitter<void>()

@ViewChild(MatMenuTrigger, { static: false }) matMenuTrigger: MatMenuTrigger


onClearBtnClicked(): void {
this.reset$.emit()
this.closePanel()
}

onCancelBtnClicked($event: MouseEvent): void {
this.cancel$.emit()
this.closePanel()
}

onApplyBtnClicked($event: MouseEvent): void {
this.apply$.emit()
this.closePanel()
}

private closePanel(): void {
this.matMenuTrigger.closeMenu()
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2021 ABSA Group Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


export namespace SplineInlineFilterWithOverlay {

export type Options = {}

export function getDefaultOptions(): Options {
return {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright 2021 ABSA Group Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { SplineInlineFilterWithOverlayComponent } from './filter-with-overlay/spline-inline-filter-with-overlay.component'
import { SplineInlineFilterComponent } from './inline-filter/spline-inline-filter.component'


export * from './public-api'

export const splineInlineFiltersComponents = [
SplineInlineFilterWithOverlayComponent,
SplineInlineFilterComponent
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright 2021 ABSA Group Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export * from './filter-with-overlay/spline-inline-filter-with-overlay.component'
export * from './filter-with-overlay/spline-inline-filter-with-overlay.models'

export * from './inline-filter/spline-inline-filter.component'
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
* limitations under the License.
*/

export * from './spline-inline-filter.component'
export * from './components/public-api'
export * from './spline-inline-filter.module'
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,29 @@ import { CommonModule } from '@angular/common'
import { NgModule } from '@angular/core'
import { MatButtonModule } from '@angular/material/button'
import { MatIconModule } from '@angular/material/icon'
import { MatMenuModule } from '@angular/material/menu'
import { SplineTranslateModule } from 'spline-utils/translate'

import { SplineIconModule } from '../icon'

import { SplineInlineFilterComponent } from './spline-inline-filter.component'
import { splineInlineFiltersComponents } from './components'



@NgModule({
declarations: [
SplineInlineFilterComponent,
...splineInlineFiltersComponents,
],
imports: [
CommonModule,
MatIconModule,
MatButtonModule,
SplineIconModule,
MatMenuModule,
SplineTranslateModule,
],
exports: [
SplineInlineFilterComponent
...splineInlineFiltersComponents
],
})
export class SplineInlineFilterModule {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
@import './sort-header.component';
@import './no-result.component';
@import './tabs-nav-bar';
@import './inline-filter.component';
@import './inline-filter/index';
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*!
* Copyright 2021 ABSA Group Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@import 'vars';
@import 'mixins';

$min-width: 280px;


.spline-inline-filter-overlay {
&__content-wrapper {
min-width: $min-width;
padding: 8px;
}

&__footer-wrapper {

}

&__actions {
display: flex;
padding: 8px;
width: 100%;


&-right {
flex-grow: 1;
text-align: right;

button {
margin-left: 8px;
}
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright 2021 ABSA Group Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@import './inline-filter.component';
@import './inline-filter-with-overlay.component';
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ <h1 class="page-title">
[dataMap]="dataMap"
[dataSource]="dataSource">

<div class="d-flex">

<spline-date-filter *ngIf="!!state.dateRangeFilter?.bounds"
label="Executed At"
[showIcon]="false"
Expand All @@ -33,6 +35,14 @@ <h1 class="page-title">

</spline-date-filter>

<spline-inline-filter-with-overlay
label="Write Mode"
[icon]="'save'"
[filterStringValues]="'All'">
Some filter will be here.
</spline-inline-filter-with-overlay>

</div>

</spline-search-dynamic-table>
</div>

0 comments on commit 1a29b29

Please sign in to comment.