penambahan list icon

This commit is contained in:
2024-06-21 14:25:14 +07:00
parent b9012f5544
commit 1ebe1acc12
15 changed files with 1456 additions and 775 deletions

View File

@@ -0,0 +1,4 @@
:host ::ng-deep .ng-select .ng-select-container {
color: #ffffff !important;
background-color: #252525 !important;
}

View File

@@ -0,0 +1,11 @@
<ng-select
[items]="icons"
bindLabel="name"
(change)="onSelect($event)"
bindValue="icon"
placeholder="Select an icon"
>
<ng-template ng-option-tmp let-item="item">
<i [ngClass]="item.icon"></i> {{ item.name }}
</ng-template>
</ng-select>

View File

@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SelectIconComponent } from './select-icon.component';
describe('SelectIconComponent', () => {
let component: SelectIconComponent;
let fixture: ComponentFixture<SelectIconComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ SelectIconComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(SelectIconComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,25 @@
import { Component, EventEmitter, Output } from "@angular/core";
import { MasterService } from "../../service/master-api.service";
interface Icon {
name: string;
icon: string;
}
@Component({
selector: "app-select-icon",
templateUrl: "./select-icon.component.html",
styleUrls: ["./select-icon.component.css"],
})
export class SelectIconComponent {
@Output() iconSelected: EventEmitter<string> = new EventEmitter<string>();
icons: any[] = [];
constructor(private masterService: MasterService) {}
ngOnInit(): void {
this.masterService.getIconData().subscribe((res) => {
this.icons = res.rows;
});
}
onSelect(icon: Icon): void {
this.iconSelected.emit(icon.icon);
}
}

View File

@@ -0,0 +1,15 @@
import { NgModule } from "@angular/core";
import { CommonModule } from "@angular/common";
import { SelectIconComponent } from "./select-icon.component";
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
import { NgSelectModule } from "@ng-select/ng-select";
import { FormsModule } from "@angular/forms";
@NgModule({
declarations: [SelectIconComponent],
imports: [CommonModule, NgbModule, NgSelectModule, FormsModule],
exports: [
SelectIconComponent
]
})
export class SelectIconModule {}