diff --git a/libs/portal-integration-angular/src/index.ts b/libs/portal-integration-angular/src/index.ts index 55151a9f..6e0e905c 100644 --- a/libs/portal-integration-angular/src/index.ts +++ b/libs/portal-integration-angular/src/index.ts @@ -103,7 +103,7 @@ export * from './lib/model/data-action' export * from './lib/model/button-dialog' export * from './lib/model/diagram-type' export * from './lib/model/config-key.model' -export * from './lib/model/search-config' +export * from './lib/model/search-config-info' // core export * from './lib/api/iauth.service' diff --git a/libs/portal-integration-angular/src/lib/core/components/search-config/search-config.component.spec.ts b/libs/portal-integration-angular/src/lib/core/components/search-config/search-config.component.spec.ts index 55df9b2a..081d4c9d 100644 --- a/libs/portal-integration-angular/src/lib/core/components/search-config/search-config.component.spec.ts +++ b/libs/portal-integration-angular/src/lib/core/components/search-config/search-config.component.spec.ts @@ -6,50 +6,29 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations' import { TranslateService } from '@ngx-translate/core' import { MessageModule } from 'primeng/message' import { MockAuthModule } from '../../../mock-auth/mock-auth.module' -import { SearchConfigPrimitive, SearchConfig } from '../../../model/search-config' import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed' import { SearchConfigHarness } from '../../../../../testing' import { PrimeNgModule } from '../../primeng.module' import { ReactiveFormsModule } from '@angular/forms' +import { SearchConfigInfo } from '../../../model/search-config-info' describe('SearchConfigComponent', () => { let translateService: TranslateService let component: SearchConfigComponent let fixture: ComponentFixture - const searchConfigurations: Record[] = [ - { - name: 'test', - startDate: undefined, - endDate: undefined, - }, - { - name: 'example', - startDate: new Date(2023, 0, 15, 12, 30, 45), - endDate: new Date(2023, 0, 19, 12, 30, 45), - }, - ] - - const searchConfigs: SearchConfig[] = [ + const searchConfigs: SearchConfigInfo[] = [ { id: '01', name: 'Simple search config', - fieldListVersion: 1, - isReadonly: true, - isAdvanced: true, - values: searchConfigurations[0], }, { id: '02', name: 'Adapted search config', - fieldListVersion: 1, - isReadonly: true, - isAdvanced: true, - values: searchConfigurations[1], }, ] - const emptySearchConfigEntry: SearchConfig[] = [] + const emptySearchConfigEntry: SearchConfigInfo[] = [] const placeholderKey = 'OCX_SEARCH_HEADER.OCX_SEARCH_CONFIG.DROPDOWN_DEFAULT' diff --git a/libs/portal-integration-angular/src/lib/core/components/search-config/search-config.component.ts b/libs/portal-integration-angular/src/lib/core/components/search-config/search-config.component.ts index 884af52c..056c0113 100644 --- a/libs/portal-integration-angular/src/lib/core/components/search-config/search-config.component.ts +++ b/libs/portal-integration-angular/src/lib/core/components/search-config/search-config.component.ts @@ -1,6 +1,6 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' -import { SearchConfig } from '../../../model/search-config' import { FormControl, FormGroup } from '@angular/forms' +import { SearchConfigInfo } from '../../../model/search-config-info' @Component({ selector: 'ocx-search-config', @@ -9,21 +9,21 @@ import { FormControl, FormGroup } from '@angular/forms' }) export class SearchConfigComponent implements OnInit { @Input() - searchConfigs: SearchConfig[] | [] | undefined + searchConfigs: SearchConfigInfo[] | [] | undefined @Input() placeholderKey = 'OCX_SEARCH_HEADER.OCX_SEARCH_CONFIG.DROPDOWN_DEFAULT' @Output() - selectedSearchConfigChanged: EventEmitter = new EventEmitter() + selectedSearchConfigChanged: EventEmitter = new EventEmitter() formGroup: FormGroup | undefined ngOnInit(): void { this.formGroup = new FormGroup({ - searchConfigForm: new FormControl(null), + searchConfigForm: new FormControl(null), }) } - onSearchConfigChange(searchConfig: SearchConfig) { + onSearchConfigChange(searchConfig: SearchConfigInfo) { this.selectedSearchConfigChanged?.emit(searchConfig) } } diff --git a/libs/portal-integration-angular/src/lib/core/components/search-header/search-header.component.ts b/libs/portal-integration-angular/src/lib/core/components/search-header/search-header.component.ts index e93520af..546d28f8 100644 --- a/libs/portal-integration-angular/src/lib/core/components/search-header/search-header.component.ts +++ b/libs/portal-integration-angular/src/lib/core/components/search-header/search-header.component.ts @@ -10,7 +10,7 @@ import { ViewChild, } from '@angular/core' import { Action } from '../page-header/page-header.component' -import { SearchConfig } from '../../../model/search-config' +import { SearchConfigInfo } from '../../../model/search-config-info' /** * To trigger the search when Enter key is pressed inside a search parameter field, @@ -24,7 +24,7 @@ import { SearchConfig } from '../../../model/search-config' styleUrls: ['./search-header.component.scss'], }) export class SearchHeaderComponent implements AfterViewInit { - @Input() searchConfigs: SearchConfig[] | undefined + @Input() searchConfigs: SearchConfigInfo[] | undefined @Input() header = '' /** @@ -52,7 +52,7 @@ export class SearchHeaderComponent implements AfterViewInit { @Output() searched: EventEmitter = new EventEmitter() @Output() resetted: EventEmitter = new EventEmitter() - @Output() selectedSearchConfigChanged: EventEmitter = new EventEmitter() + @Output() selectedSearchConfigChanged: EventEmitter = new EventEmitter() @Output() viewModeChanged: EventEmitter = new EventEmitter() @ContentChild('additionalToolbarContent') additionalToolbarContent: TemplateRef | undefined @@ -121,7 +121,7 @@ export class SearchHeaderComponent implements AfterViewInit { } } - confirmSearchConfig(searchConfig: SearchConfig) { + confirmSearchConfig(searchConfig: SearchConfigInfo) { this.selectedSearchConfigChanged?.emit(searchConfig) } } diff --git a/libs/portal-integration-angular/src/lib/model/search-config-info.ts b/libs/portal-integration-angular/src/lib/model/search-config-info.ts new file mode 100644 index 00000000..693a6522 --- /dev/null +++ b/libs/portal-integration-angular/src/lib/model/search-config-info.ts @@ -0,0 +1,4 @@ +export interface SearchConfigInfo { + id: string + name: string +} diff --git a/libs/portal-integration-angular/src/lib/model/search-config.ts b/libs/portal-integration-angular/src/lib/model/search-config.ts deleted file mode 100644 index 95c35bb3..00000000 --- a/libs/portal-integration-angular/src/lib/model/search-config.ts +++ /dev/null @@ -1,9 +0,0 @@ -export type SearchConfigPrimitive = string | number | bigint | boolean | Date | undefined -export interface SearchConfig { - id: string - name: string - fieldListVersion: number - isReadonly: boolean - isAdvanced: boolean - values: Record -}