Skip to content
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: search button order config #594

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<ng-content></ng-content>
</div>
</div>
<div class="flex flex-wrap gap-2">
<div class="flex flex-wrap gap-2" [ngClass]="searchButtonsReversed ? 'flex-row-reverse' : 'flex-row'">
<p-button
id="resetButton"
*ngIf="resetted.observed"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { Action } from '../page-header/page-header.component'
import { FormControlName, FormGroup, FormGroupDirective } from '@angular/forms'
import { Observable, combineLatest, debounceTime, map, of, startWith } from 'rxjs'
import { getLocation } from '@onecx/accelerator'
import { CONFIG_KEY, ConfigurationService } from '@onecx/angular-integration-interface'

export interface SearchHeaderComponentState {
activeViewMode?: 'basic' | 'advanced'
Expand Down Expand Up @@ -120,17 +121,19 @@ export class SearchHeaderComponent implements AfterContentInit, AfterViewInit {
show: 'always',
}
headerActions: Action[] = []

searchButtonsReversed = false
fieldValues$: Observable<{ [key: string]: unknown }> | undefined = of({})
searchConfigChangedSlotEmitter: EventEmitter<SearchConfigData | undefined> = new EventEmitter()

constructor() {
constructor(configurationService: ConfigurationService) {
this.searchConfigChangedSlotEmitter.subscribe((config) => {
this.componentStateChanged.emit({
selectedSearchConfig: config?.name ?? null,
})
this.selectedSearchConfigChanged.emit(config)
})
this.searchButtonsReversed =
configurationService.getProperty(CONFIG_KEY.ONECX_PORTAL_SEARCH_BUTTONS_REVERSED) === 'true'
}

ngAfterContentInit(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { StorybookTranslateModule } from '../../storybook-translate.module'
import { PageHeaderComponent } from '../page-header/page-header.component'
import { StorybookBreadcrumbModule } from './../../storybook-breadcrumb.module'
import { SearchHeaderComponent } from './search-header.component'
import { ConfigurationService } from '@onecx/angular-integration-interface'
import { provideHttpClient } from '@angular/common/http'

export default {
title: 'SearchHeaderComponent',
Expand All @@ -25,6 +27,8 @@ export default {
importProvidersFrom(BrowserModule),
importProvidersFrom(BrowserAnimationsModule),
importProvidersFrom(RouterModule.forRoot([], { useHash: true })),
importProvidersFrom(ConfigurationService),
provideHttpClient(),
],
}),
moduleMetadata({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export enum CONFIG_KEY {
ONECX_PORTAL_SETTINGS_DISABLED = 'ONECX_PORTAL_SETTINGS_DISABLED',
ONECX_PORTAL_MY_ROLES_PERMISSIONS_DISABLED = 'ONECX_PORTAL_MY_ROLES_PERMISSIONS_DISABLED',
ONECX_PORTAL_HELP_DISABLED = 'ONECX_PORTAL_HELP_DISABLED',
ONECX_PORTAL_SEARCH_BUTTONS_REVERSED = 'ONECX_PORTAL_SEARCH_BUTTONS_REVERSED',
APP_VERSION = 'APP_VERSION',
IS_SHELL = 'IS_SHELL',
AUTH_SERVICE = 'AUTH_SERVICE',
Expand Down
Loading