Upgrade primeng to 20.0.1 (#903)
* build(npm): add missed packages * build(npm): upgrade primeng to 20.0.1 * feat(ui): upgrade ui to support 20 primeng https://primeng.org/migration/v19#compatible * fix(ui): p-input value max requires value * refactor(ui): remove unused component imports * build(npm): allow common js dependencies * style(ui): fix some warnings * fix(ui): replace chips with autoComplete --------- Co-authored-by: Aditya Chandel <8075870+adityachandelgit@users.noreply.github.com>
This commit is contained in:
co-authored by
Aditya Chandel
parent
77e02ac7f9
commit
60f8442514
+21
-3
@@ -4,13 +4,13 @@ import {CommonModule} from '@angular/common';
|
||||
import {InputText} from 'primeng/inputtext';
|
||||
import {Button} from 'primeng/button';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {Chips} from 'primeng/chips';
|
||||
import {DatePicker} from 'primeng/datepicker';
|
||||
import {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {BookService} from '../../book/service/book.service';
|
||||
import {Book, BulkMetadataUpdateRequest} from '../../book/model/book.model';
|
||||
import {Checkbox} from 'primeng/checkbox';
|
||||
import {AutoComplete} from 'primeng/autocomplete';
|
||||
import {ProgressSpinner} from 'primeng/progressspinner';
|
||||
|
||||
@Component({
|
||||
@@ -23,10 +23,10 @@ import {ProgressSpinner} from 'primeng/progressspinner';
|
||||
InputText,
|
||||
Button,
|
||||
Tooltip,
|
||||
Chips,
|
||||
DatePicker,
|
||||
Checkbox,
|
||||
ProgressSpinner
|
||||
ProgressSpinner,
|
||||
AutoComplete
|
||||
],
|
||||
providers: [MessageService],
|
||||
templateUrl: './bulk-metadata-update-component.html',
|
||||
@@ -83,6 +83,24 @@ export class BulkMetadataUpdateComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
// Handle blur event for AutoComplete to add custom values
|
||||
onAutoCompleteBlur(fieldName: string, event: any) {
|
||||
const inputValue = event.target.value?.trim();
|
||||
if (inputValue) {
|
||||
const currentValue = this.metadataForm.get(fieldName)?.value || [];
|
||||
const values = Array.isArray(currentValue) ? currentValue :
|
||||
typeof currentValue === 'string' && currentValue ? currentValue.split(',').map((v: string) => v.trim()) : [];
|
||||
|
||||
// Add the new value if it's not already in the array
|
||||
if (!values.includes(inputValue)) {
|
||||
values.push(inputValue);
|
||||
this.metadataForm.get(fieldName)?.setValue(values);
|
||||
}
|
||||
// Clear the input
|
||||
event.target.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
onSubmit(): void {
|
||||
if (!this.metadataForm.valid) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user