.kavitaignore no more (#2442)
This commit is contained in:
parent
cd27efecdd
commit
7221501c4d
91 changed files with 5968 additions and 1026 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { HttpParams } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Chapter } from 'src/app/_models/chapter';
|
||||
import { LibraryType } from 'src/app/_models/library';
|
||||
import { LibraryType } from 'src/app/_models/library/library';
|
||||
import { MangaFormat } from 'src/app/_models/manga-format';
|
||||
import { PaginatedResult } from 'src/app/_models/pagination';
|
||||
import { Series } from 'src/app/_models/series';
|
||||
|
|
@ -70,6 +70,7 @@ export class UtilityService {
|
|||
return this.translocoService.translate('common.issue-hash-num');
|
||||
}
|
||||
return this.translocoService.translate('common.issue-num') + (includeSpace ? ' ' : '');
|
||||
case LibraryType.Images:
|
||||
case LibraryType.Manga:
|
||||
return this.translocoService.translate('common.chapter-num') + (includeSpace ? ' ' : '');
|
||||
}
|
||||
|
|
|
|||
24
UI/Web/src/app/shared/edit-list/edit-list.component.html
Normal file
24
UI/Web/src/app/shared/edit-list/edit-list.component.html
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<form [formGroup]="form" *transloco="let t">
|
||||
|
||||
@for(item of Items; let i = $index; track item) {
|
||||
<div class="row g-0 mb-3">
|
||||
<div class="col-lg-10 col-md-12 pe-2">
|
||||
<div class="mb-3">
|
||||
<label for="item--{{i}}" class="visually-hidden">{{label}}</label>
|
||||
<input type="text" class="form-control" formControlName="link{{i}}" attr.id="item--{{i}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<button class="btn btn-secondary me-1" (click)="add()">
|
||||
<i class="fa-solid fa-plus" aria-hidden="true"></i>
|
||||
<span class="visually-hidden">{{t('common.add')}}</span>
|
||||
</button>
|
||||
<button class="btn btn-secondary" (click)="remove(i)">
|
||||
<i class="fa-solid fa-xmark" aria-hidden="true"></i>
|
||||
<span class="visually-hidden">{{t('common.remove')}}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
</form>
|
||||
0
UI/Web/src/app/shared/edit-list/edit-list.component.scss
Normal file
0
UI/Web/src/app/shared/edit-list/edit-list.component.scss
Normal file
82
UI/Web/src/app/shared/edit-list/edit-list.component.ts
Normal file
82
UI/Web/src/app/shared/edit-list/edit-list.component.ts
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
import {
|
||||
ChangeDetectionStrategy,
|
||||
ChangeDetectorRef,
|
||||
Component, DestroyRef,
|
||||
EventEmitter,
|
||||
inject,
|
||||
Input,
|
||||
OnInit,
|
||||
Output
|
||||
} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {FormControl, FormGroup, ReactiveFormsModule} from "@angular/forms";
|
||||
import {Select2Module} from "ng-select2-component";
|
||||
import {TranslocoDirective} from "@ngneat/transloco";
|
||||
import {takeUntilDestroyed} from "@angular/core/rxjs-interop";
|
||||
import {debounceTime, distinctUntilChanged, tap} from "rxjs/operators";
|
||||
|
||||
@Component({
|
||||
selector: 'app-edit-list',
|
||||
standalone: true,
|
||||
imports: [CommonModule, ReactiveFormsModule, Select2Module, TranslocoDirective],
|
||||
templateUrl: './edit-list.component.html',
|
||||
styleUrl: './edit-list.component.scss',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class EditListComponent implements OnInit {
|
||||
|
||||
private readonly cdRef = inject(ChangeDetectorRef);
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
|
||||
@Input({required: true}) items: Array<string> = [];
|
||||
@Input({required: true}) label = '';
|
||||
@Output() updateItems = new EventEmitter<Array<string>>();
|
||||
|
||||
form: FormGroup = new FormGroup({});
|
||||
private combinedItems: string = '';
|
||||
|
||||
get Items() {
|
||||
return this.combinedItems.split(',') || [''];
|
||||
}
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
this.items.forEach((link, index) => {
|
||||
this.form.addControl('link' + index, new FormControl(link, []));
|
||||
});
|
||||
|
||||
this.combinedItems = this.items.join(',');
|
||||
|
||||
this.form.valueChanges.pipe(
|
||||
debounceTime(100),
|
||||
distinctUntilChanged(),
|
||||
tap(data => this.emit()),
|
||||
takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe();
|
||||
this.cdRef.markForCheck();
|
||||
}
|
||||
|
||||
add() {
|
||||
this.combinedItems += ',';
|
||||
this.form.addControl('link' + (this.Items.length - 1), new FormControl('', []));
|
||||
this.emit();
|
||||
this.cdRef.markForCheck();
|
||||
}
|
||||
|
||||
remove(index: number) {
|
||||
const tokens = this.combinedItems.split(',');
|
||||
const tokenToRemove = tokens[index];
|
||||
|
||||
this.combinedItems = tokens.filter(t => t != tokenToRemove).join(',');
|
||||
this.form.removeControl('link' + index, {emitEvent: true});
|
||||
this.emit();
|
||||
this.cdRef.markForCheck();
|
||||
}
|
||||
|
||||
emit() {
|
||||
this.updateItems.emit(Object.keys(this.form.controls)
|
||||
.filter(key => key.startsWith('link'))
|
||||
.map(key => this.form.get(key)?.value)
|
||||
.filter(v => v !== null && v !== ''));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue