+++ /dev/null
-<div class="modal-header">
- <h4 class="modal-title" id="modal-basic-title">{{title}}</h4>
- <button type="button" class="btn-close" aria-label="Close" (click)="cancelClicked()">
- </button>
-</div>
-<div class="modal-body">
-
- <pngx-input-select [items]="objects" [title]="message" [(ngModel)]="selected"></pngx-input-select>
-
-</div>
-<div class="modal-footer">
- <button type="button" class="btn btn-outline-dark" (click)="cancelClicked()" i18n>Cancel</button>
- <button type="button" class="btn btn-primary" (click)="selectClicked.emit(selected)" i18n>Select</button>
-</div>
+++ /dev/null
-import { ComponentFixture, TestBed } from '@angular/core/testing'
-import { FormsModule, ReactiveFormsModule } from '@angular/forms'
-import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
-import { NgSelectModule } from '@ng-select/ng-select'
-import { SelectComponent } from '../input/select/select.component'
-import { SelectDialogComponent } from './select-dialog.component'
-
-describe('SelectDialogComponent', () => {
- let component: SelectDialogComponent
- let fixture: ComponentFixture<SelectDialogComponent>
- let modal: NgbActiveModal
-
- beforeEach(async () => {
- TestBed.configureTestingModule({
- providers: [NgbActiveModal],
- imports: [
- NgSelectModule,
- FormsModule,
- ReactiveFormsModule,
- SelectDialogComponent,
- SelectComponent,
- ],
- }).compileComponents()
-
- modal = TestBed.inject(NgbActiveModal)
- fixture = TestBed.createComponent(SelectDialogComponent)
- component = fixture.componentInstance
- fixture.detectChanges()
- })
-
- it('should close modal on cancel', () => {
- const closeSpy = jest.spyOn(modal, 'close')
- component.cancelClicked()
- expect(closeSpy).toHaveBeenCalled()
- })
-})
+++ /dev/null
-import { Component, EventEmitter, Input, Output } from '@angular/core'
-import { FormsModule, ReactiveFormsModule } from '@angular/forms'
-import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
-import { ObjectWithId } from 'src/app/data/object-with-id'
-import { SelectComponent } from '../input/select/select.component'
-
-@Component({
- selector: 'pngx-select-dialog',
- templateUrl: './select-dialog.component.html',
- styleUrls: ['./select-dialog.component.scss'],
- imports: [SelectComponent, FormsModule, ReactiveFormsModule],
-})
-export class SelectDialogComponent {
- constructor(public activeModal: NgbActiveModal) {}
-
- @Output()
- public selectClicked = new EventEmitter()
-
- @Input()
- title = $localize`Select`
-
- @Input()
- message = $localize`Please select an object`
-
- @Input()
- objects: ObjectWithId[] = []
-
- selected: number
-
- cancelClicked() {
- this.activeModal.close()
- }
-}
}
<div class="row">
<div class="col offset-sm-3">
- <button class="btn btn-sm btn-outline-dark" (click)="copyError(toast.error)">
+ <button class="btn btn-sm btn-outline-secondary" (click)="copyError(toast.error)">
@if (!copied) {
<i-bs name="clipboard"></i-bs>
}
}
</div>
<div class="modal-footer">
- <button type="button" class="btn btn-outline-dark" (click)="cancel()" i18n [disabled]="!buttonsEnabled">Cancel</button>
+ <button type="button" class="btn btn-outline-secondary" (click)="cancel()" i18n [disabled]="!buttonsEnabled">Cancel</button>
<button type="submit" class="btn btn-primary" i18n [disabled]="!buttonsEnabled">Save</button>
</div>
</form>
color: var(--pngx-primary-text-contrast);
}
- .toast .btn-outline-dark:hover {
- color: var(--bs-body-color)
- }
-
.dropdown-item {
--bs-dropdown-color: var(--bs-body-color);
--pngx-bg-darker: var(--pngx-bg-alt);