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

fix: search config dialog #164

Merged
merged 2 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class ButtonDialogComponent implements OnInit {

//populate container
Object.keys(this.dialogData.componentData).forEach((k) => {
componentRef.instance[k] = this.dialogData.componentData[k]
componentRef.setInput(k, this.dialogData.componentData[k])
})
this.componentRef = componentRef
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
</div>

<div>
<p-checkbox formControlName="saveInputValues" [value]="saveInputValues" [binary]="true" inputId="saveInputValuesId">
<p-checkbox formControlName="saveInputValues" [binary]="true" inputId="saveInputValuesId">
</p-checkbox>
<label for="saveInputValuesId">{{ ("OCX_SEARCH_CONFIG.SAVE_INPUT_FIELDS_OPTION" | translate) }}</label>
</div>

<div>
<p-checkbox
formControlName="saveColumns"
[value]="saveColumns"
[binary]="true"
inputId="saveColumnsId"
></p-checkbox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,40 @@ export class CreateOrEditSearchConfigDialogComponent
DialogResult<CreateOrEditSearchDialogContent>,
DialogButtonClicked<CreateOrEditSearchConfigDialogComponent>
{
@Input() searchConfigName: string | undefined
@Input() saveInputValues: boolean | undefined
@Input() saveColumns: boolean | undefined
placeHolderKey = 'OCX_SEARCH_CONFIG.PLACEHOLDER'
@Input()
set searchConfigName(value: string | undefined){
this.searchConfigFormGroup.controls['searchConfigName'].setValue(value)
}
get searchConfigName(): string | undefined {
return this.searchConfigFormGroup.controls['searchConfigName'].value
}

@Input()
set saveInputValues(value: boolean | undefined) {
this.searchConfigFormGroup.controls['saveInputValues'].setValue(value)
}
get saveInputValues(): boolean | undefined {
return this.searchConfigFormGroup.controls['saveInputValues'].value
}

@Input()
set saveColumns(value: boolean | undefined) {
this.searchConfigFormGroup.controls['saveColumns'].setValue(value)
}
get saveColumns(): boolean | undefined {
return this.searchConfigFormGroup.controls['saveColumns'].value
}

@Output() primaryButtonEnabled: EventEmitter<boolean> = new EventEmitter()

searchConfigFormGroup: FormGroup = new FormGroup({
searchConfigName: new FormControl<string>(''),
saveInputValues: new FormControl<boolean>(false),
saveColumns: new FormControl<boolean>(false),
})
placeHolderKey = 'OCX_SEARCH_CONFIG.PLACEHOLDER'
dialogResult: CreateOrEditSearchDialogContent = { searchConfigName: '', saveInputValues: false, saveColumns: false }

constructor() {
this.searchConfigFormGroup.valueChanges
.pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ <h2 *ngIf="!!subheader">{{ subheader }}</h2>
</div>
</div>
<div class="action-items-wrap mt-2 md:mt-0">
<ng-container *ngIf="additionalToolbarContentLeft" [ngTemplateOutlet]="additionalToolbarContentLeft"> </ng-container>

<ng-container *ngIf="!disableDefaultActions"> </ng-container>
<ng-template #skeletonActions>
<div class="flex">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ export class PageHeaderComponent implements OnInit, OnChanges {
@ContentChild('additionalToolbarContent')
additionalToolbarContent: TemplateRef<any> | undefined

@ContentChild('additionalToolbarContentLeft')
additionalToolbarContentLeft: TemplateRef<any> | undefined

overflowActions: MenuItem[] = []
inlineActions: Action[] | undefined
dd = new Date()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class SearchConfigComponent implements OnInit {
})
}

onSearchConfigChange(searchConfig: SearchConfigInfo) {
this.selectedSearchConfigChanged?.emit(searchConfig)
onSearchConfigChange(event: { value: SearchConfigInfo }) {
this.selectedSearchConfigChanged?.emit(event.value)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
[manualBreadcrumbs]="manualBreadcrumbs"
[actions]="headerActions"
>
<ng-template #additionalToolbarContent>
<ng-template #additionalToolbarContentLeft>
<ocx-search-config [searchConfigs]="searchConfigs" (selectedSearchConfigChanged)="confirmSearchConfig($event)">
</ocx-search-config>
<ng-container *ngIf="_additionalToolbarContentLeft" [ngTemplateOutlet]="_additionalToolbarContentLeft"></ng-container>
</ng-template>
<ng-template #additionalToolbarContent>
<ng-container *ngIf="_additionalToolbarContent" [ngTemplateOutlet]="_additionalToolbarContent"></ng-container>
</ng-template>
<div class="search-criteria-container">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,19 @@ export class SearchHeaderComponent implements AfterViewInit {
@Output() searched: EventEmitter<any> = new EventEmitter()
@Output() resetted: EventEmitter<any> = new EventEmitter()
@Output() selectedSearchConfigChanged: EventEmitter<SearchConfigInfo> = new EventEmitter()
@Output() viewModeChanged: EventEmitter<string> = new EventEmitter()
@Output() viewModeChanged: EventEmitter<'basic' | 'advanced'> = new EventEmitter()
@ContentChild('additionalToolbarContent')
additionalToolbarContent: TemplateRef<any> | undefined

get _additionalToolbarContent(): TemplateRef<any> | undefined {
return this.additionalToolbarContent
}
@ContentChild('additionalToolbarContentLeft')
additionalToolbarContentLeft: TemplateRef<any> | undefined

get _additionalToolbarContentLeft(): TemplateRef<any> | undefined {
return this.additionalToolbarContentLeft
}

@ViewChild('searchParameterFields') searchParameterFields: ElementRef | undefined

Expand Down
Loading