@abp/ng.components 10.0.0 → 10.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/extensible/index.d.ts
CHANGED
|
@@ -176,8 +176,6 @@ declare class ExtensibleFormPropComponent implements OnChanges, AfterViewInit {
|
|
|
176
176
|
first?: boolean;
|
|
177
177
|
isFirstGroup?: boolean;
|
|
178
178
|
private fieldRef;
|
|
179
|
-
private shouldFocus;
|
|
180
|
-
private isViewReady;
|
|
181
179
|
injectorForCustomComponent?: Injector;
|
|
182
180
|
asterisk: string;
|
|
183
181
|
containerClassName: string;
|
|
@@ -189,7 +187,6 @@ declare class ExtensibleFormPropComponent implements OnChanges, AfterViewInit {
|
|
|
189
187
|
passwordKey: eExtensibleComponents;
|
|
190
188
|
disabledFn: (data: PropData) => boolean;
|
|
191
189
|
get disabled(): boolean;
|
|
192
|
-
constructor();
|
|
193
190
|
setTypeaheadValue(selectedOption: ABP.Option<string>): void;
|
|
194
191
|
search: (text$: Observable<string>) => Observable<any[]>;
|
|
195
192
|
typeaheadFormatter: (option: ABP.Option<any>) => string;
|
|
@@ -197,7 +194,6 @@ declare class ExtensibleFormPropComponent implements OnChanges, AfterViewInit {
|
|
|
197
194
|
get isInvalid(): boolean;
|
|
198
195
|
private getTypeaheadControls;
|
|
199
196
|
private setAsterisk;
|
|
200
|
-
private focusElement;
|
|
201
197
|
ngAfterViewInit(): void;
|
|
202
198
|
getComponent(prop: FormProp): string;
|
|
203
199
|
getType(prop: FormProp): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ChangeDetectorRef, input, Optional, SkipSelf, ViewChild, ChangeDetectionStrategy, Component, InjectionToken, Injectable, forwardRef, Injector,
|
|
2
|
+
import { inject, ChangeDetectorRef, input, Optional, SkipSelf, ViewChild, ChangeDetectionStrategy, Component, InjectionToken, Injectable, forwardRef, Injector, Input, TemplateRef, ViewContainerRef, Directive, ViewChildren, LOCALE_ID, PLATFORM_ID, EventEmitter, signal, computed, Output, Pipe, NgModule } from '@angular/core';
|
|
3
3
|
import * as i2 from '@angular/forms';
|
|
4
4
|
import { ControlContainer, ReactiveFormsModule, Validators, NG_VALUE_ACCESSOR, FormGroupDirective, FormsModule, UntypedFormGroup, UntypedFormControl } from '@angular/forms';
|
|
5
5
|
import * as i1 from '@ng-bootstrap/ng-bootstrap';
|
|
@@ -486,10 +486,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
|
|
|
486
486
|
}] });
|
|
487
487
|
|
|
488
488
|
class ExtensibleFormPropComponent {
|
|
489
|
-
#groupDirective;
|
|
490
|
-
get disabled() {
|
|
491
|
-
return this.disabledFn(this.data);
|
|
492
|
-
}
|
|
493
489
|
constructor() {
|
|
494
490
|
this.service = inject(ExtensibleFormPropService);
|
|
495
491
|
this.cdRef = inject(ChangeDetectorRef);
|
|
@@ -497,8 +493,6 @@ class ExtensibleFormPropComponent {
|
|
|
497
493
|
this.#groupDirective = inject(FormGroupDirective);
|
|
498
494
|
this.injector = inject(Injector);
|
|
499
495
|
this.form = this.#groupDirective.form;
|
|
500
|
-
this.shouldFocus = signal(false);
|
|
501
|
-
this.isViewReady = signal(false);
|
|
502
496
|
this.asterisk = '';
|
|
503
497
|
this.containerClassName = 'mb-2';
|
|
504
498
|
this.showPassword = false;
|
|
@@ -511,12 +505,10 @@ class ExtensibleFormPropComponent {
|
|
|
511
505
|
: of([]);
|
|
512
506
|
this.typeaheadFormatter = (option) => option.key;
|
|
513
507
|
this.meridian$ = this.service.meridian$;
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
}
|
|
519
|
-
});
|
|
508
|
+
}
|
|
509
|
+
#groupDirective;
|
|
510
|
+
get disabled() {
|
|
511
|
+
return this.disabledFn(this.data);
|
|
520
512
|
}
|
|
521
513
|
setTypeaheadValue(selectedOption) {
|
|
522
514
|
this.typeaheadModel = selectedOption || { key: null, value: null };
|
|
@@ -542,19 +534,11 @@ class ExtensibleFormPropComponent {
|
|
|
542
534
|
setAsterisk() {
|
|
543
535
|
this.asterisk = this.service.calcAsterisks(this.validators);
|
|
544
536
|
}
|
|
545
|
-
focusElement() {
|
|
546
|
-
try {
|
|
547
|
-
this.fieldRef.nativeElement.focus();
|
|
548
|
-
this.shouldFocus.set(false);
|
|
549
|
-
}
|
|
550
|
-
catch (error) {
|
|
551
|
-
console.error('Error focusing field:', error);
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
537
|
ngAfterViewInit() {
|
|
555
|
-
this.
|
|
556
|
-
|
|
557
|
-
|
|
538
|
+
if (this.isFirstGroup && this.first && this.fieldRef) {
|
|
539
|
+
requestAnimationFrame(() => {
|
|
540
|
+
this.fieldRef.nativeElement.focus();
|
|
541
|
+
});
|
|
558
542
|
}
|
|
559
543
|
}
|
|
560
544
|
getComponent(prop) {
|
|
@@ -640,7 +624,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImpor
|
|
|
640
624
|
{ provide: NgbDateAdapter, useClass: DateAdapter },
|
|
641
625
|
{ provide: NgbTimeAdapter, useClass: TimeAdapter },
|
|
642
626
|
], template: "<ng-container *abpPermission=\"prop.permission; runChangeDetection: false\">\r\n @switch (getComponent(prop)) {\r\n @case ('template') {\r\n <ng-container *ngComponentOutlet=\"prop.template; injector: injectorForCustomComponent\" />\r\n }\r\n }\r\n\r\n <div [ngClass]=\"containerClassName\" class=\"mb-2\">\r\n @switch (getComponent(prop)) {\r\n @case ('input') {\r\n <ng-template [ngTemplateOutlet]=\"label\" />\r\n <input\r\n #field\r\n [id]=\"prop.id\"\r\n [formControlName]=\"prop.name\"\r\n [autocomplete]=\"prop.autocomplete\"\r\n [type]=\"getType(prop)\"\r\n [abpDisabled]=\"disabled\"\r\n [readonly]=\"readonly\"\r\n class=\"form-control\"\r\n />\r\n }\r\n @case ('hidden') {\r\n <input [formControlName]=\"prop.name\" type=\"hidden\" />\r\n }\r\n @case ('checkbox') {\r\n <div class=\"form-check\" validationTarget>\r\n <input\r\n #field\r\n [id]=\"prop.id\"\r\n [formControlName]=\"prop.name\"\r\n [abpDisabled]=\"disabled\"\r\n type=\"checkbox\"\r\n class=\"form-check-input\"\r\n />\r\n <ng-template\r\n [ngTemplateOutlet]=\"label\"\r\n [ngTemplateOutletContext]=\"{ $implicit: 'form-check-label' }\"\r\n />\r\n </div>\r\n }\r\n @case ('select') {\r\n <ng-template [ngTemplateOutlet]=\"label\" />\r\n <select\r\n #field\r\n [id]=\"prop.id\"\r\n [formControlName]=\"prop.name\"\r\n [abpDisabled]=\"disabled\"\r\n class=\"form-select form-control\"\r\n >\r\n @for (option of options$ | async; track option.value) {\r\n <option [ngValue]=\"option.value\">\r\n @if (prop.isExtra) {\r\n {{ '::' + option.key | abpLocalization }}\r\n } @else {\r\n {{ option.key }}\r\n }\r\n </option>\r\n }\r\n </select>\r\n }\r\n @case ('multiselect') {\r\n <ng-template [ngTemplateOutlet]=\"label\"></ng-template>\r\n <abp-extensible-form-multi-select\r\n [prop]=\"prop\"\r\n [options]=\"options$ | async\"\r\n [formControlName]=\"prop.name\"\r\n [abpDisabled]=\"disabled\"\r\n />\r\n }\r\n @case ('typeahead') {\r\n <ng-template [ngTemplateOutlet]=\"label\" />\r\n <div #typeahead class=\"position-relative\" validationStyle validationTarget>\r\n <input\r\n #field\r\n [id]=\"prop.id\"\r\n [autocomplete]=\"prop.autocomplete\"\r\n [abpDisabled]=\"disabled\"\r\n [ngbTypeahead]=\"search\"\r\n [editable]=\"false\"\r\n [inputFormatter]=\"typeaheadFormatter\"\r\n [resultFormatter]=\"typeaheadFormatter\"\r\n [ngModelOptions]=\"{ standalone: true }\"\r\n [(ngModel)]=\"typeaheadModel\"\r\n (selectItem)=\"setTypeaheadValue($event.item)\"\r\n (blur)=\"setTypeaheadValue(typeaheadModel)\"\r\n [class.is-invalid]=\"typeahead.classList.contains('is-invalid')\"\r\n class=\"form-control\"\r\n />\r\n <input [formControlName]=\"prop.name\" type=\"hidden\" />\r\n </div>\r\n }\r\n @case ('date') {\r\n <ng-template [ngTemplateOutlet]=\"label\" />\r\n <input\r\n [id]=\"prop.id\"\r\n [formControlName]=\"prop.name\"\r\n (click)=\"datepicker.open()\"\r\n (keyup.space)=\"datepicker.open()\"\r\n ngbDatepicker\r\n #datepicker=\"ngbDatepicker\"\r\n type=\"text\"\r\n class=\"form-control\"\r\n />\r\n }\r\n @case ('time') {\r\n <ng-template [ngTemplateOutlet]=\"label\" />\r\n <ngb-timepicker [formControlName]=\"prop.name\" />\r\n }\r\n @case ('dateTime') {\r\n <ng-template [ngTemplateOutlet]=\"label\" />\r\n <abp-extensible-date-time-picker [prop]=\"prop\" [meridian]=\"meridian$ | async\" />\r\n }\r\n @case ('textarea') {\r\n <ng-template [ngTemplateOutlet]=\"label\" />\r\n <textarea\r\n #field\r\n [id]=\"prop.id\"\r\n [formControlName]=\"prop.name\"\r\n [abpDisabled]=\"disabled\"\r\n [readonly]=\"readonly\"\r\n class=\"form-control\"\r\n ></textarea>\r\n }\r\n @case ('passwordinputgroup') {\r\n <ng-template [ngTemplateOutlet]=\"label\" />\r\n <div class=\"input-group form-group\" validationTarget>\r\n <input\r\n class=\"form-control\"\r\n [id]=\"prop.id\"\r\n [formControlName]=\"prop.name\"\r\n [abpShowPassword]=\"showPassword\"\r\n />\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"showPassword = !showPassword\">\r\n <i\r\n class=\"fa\"\r\n aria-hidden=\"true\"\r\n [ngClass]=\"{\r\n 'fa-eye-slash': !showPassword,\r\n 'fa-eye': showPassword,\r\n }\"\r\n ></i>\r\n </button>\r\n </div>\r\n }\r\n }\r\n\r\n @if (prop.formText) {\r\n <small class=\"text-muted d-block\">{{ prop.formText | abpLocalization }}</small>\r\n }\r\n </div>\r\n</ng-container>\r\n\r\n<ng-template #label let-classes>\r\n <label [htmlFor]=\"prop.id\" [ngClass]=\"classes || 'form-label d-inline-block'\">\r\n <span class=\"d-inline-flex align-items-center gap-1 text-nowrap\">\r\n @if (prop.displayTextResolver) {\r\n {{ prop.displayTextResolver(data) | abpLocalization }}\r\n } @else {\r\n @if (prop.isExtra) {\r\n {{ '::' + prop.displayName | abpLocalization }}\r\n } @else {\r\n {{ prop.displayName | abpLocalization }}\r\n }\r\n }\r\n {{ asterisk }}\r\n @if (prop.tooltip) {\r\n <i\r\n [ngbTooltip]=\"prop.tooltip.text | abpLocalization\"\r\n [placement]=\"prop.tooltip.placement || 'auto'\"\r\n container=\"body\"\r\n class=\"bi bi-info-circle\"\r\n ></i>\r\n }\r\n </span>\r\n </label>\r\n</ng-template>\r\n" }]
|
|
643
|
-
}],
|
|
627
|
+
}], propDecorators: { data: [{
|
|
644
628
|
type: Input
|
|
645
629
|
}], prop: [{
|
|
646
630
|
type: Input
|