@3kles/kles-material-dynamicforms 21.4.1 → 21.5.0
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.
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { signal, InjectionToken, inject, Component, Injector, Input, Directive, Injectable, EventEmitter, Output, NgModule, computed, ViewContainerRef, HostBinding, Pipe, ChangeDetectorRef, ViewChildren, ViewChild, forwardRef, ChangeDetectionStrategy, ElementRef, Renderer2, HostListener, LOCALE_ID, DEFAULT_CURRENCY_CODE, CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
|
-
import { CommonModule } from '@angular/common';
|
|
4
|
+
import { CommonModule, AsyncPipe } from '@angular/common';
|
|
5
5
|
import * as i2 from '@angular/forms';
|
|
6
6
|
import { Validators, FormControl, ReactiveFormsModule, FormsModule, FormControlDirective, FormControlName, FormArray, FormGroup, UntypedFormBuilder, NG_VALUE_ACCESSOR, UntypedFormGroup, UntypedFormControl } from '@angular/forms';
|
|
7
|
-
import { concat, of, Subject, combineLatest, startWith, map as map$1, takeUntil, Observable, BehaviorSubject, ReplaySubject, defer } from 'rxjs';
|
|
7
|
+
import { concat, of, Subject, combineLatest, startWith, map as map$1, takeUntil, Observable, BehaviorSubject, ReplaySubject, defer, distinctUntilChanged as distinctUntilChanged$1, filter as filter$1, switchMap as switchMap$1 } from 'rxjs';
|
|
8
8
|
import { tap, take, catchError, map, takeUntil as takeUntil$1, distinctUntilChanged, filter, switchMap, startWith as startWith$1, debounceTime, shareReplay } from 'rxjs/operators';
|
|
9
9
|
import * as i2$1 from '@angular/material/form-field';
|
|
10
10
|
import { MatError, MatFormFieldModule, MatFormField, MatHint, MatLabel, MatSuffix } from '@angular/material/form-field';
|
|
@@ -29,6 +29,7 @@ import { MatInputModule, MatInput, MatLabel as MatLabel$1, MatFormField as MatFo
|
|
|
29
29
|
import * as i4$1 from '@angular/material/select';
|
|
30
30
|
import { MatSelectModule, MatSelectTrigger, MatSelect } from '@angular/material/select';
|
|
31
31
|
import { MatRadioModule, MatRadioButton, MatRadioGroup } from '@angular/material/radio';
|
|
32
|
+
import * as i2$3 from '@angular/material/chips';
|
|
32
33
|
import { MatChipsModule, MatChipOption, MatChipListbox } from '@angular/material/chips';
|
|
33
34
|
import * as i4$2 from '@angular/material/tooltip';
|
|
34
35
|
import { MatTooltipModule, MatTooltip } from '@angular/material/tooltip';
|
|
@@ -71,6 +72,7 @@ import { KlesMaterialDatepickerModule } from '@3kles/kles-material-datepicker';
|
|
|
71
72
|
import * as i1$2 from '@angular/cdk/clipboard';
|
|
72
73
|
import { ClipboardModule } from '@angular/cdk/clipboard';
|
|
73
74
|
import { MatDividerModule } from '@angular/material/divider';
|
|
75
|
+
import { ENTER, COMMA } from '@angular/cdk/keycodes';
|
|
74
76
|
|
|
75
77
|
class KlesAbstractFormControl {
|
|
76
78
|
constructor(field, ref) {
|
|
@@ -5880,6 +5882,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.19", ngImpo
|
|
|
5880
5882
|
}] });
|
|
5881
5883
|
|
|
5882
5884
|
class KlesFormTileComponent extends KlesFieldAbstract {
|
|
5885
|
+
constructor() {
|
|
5886
|
+
super(...arguments);
|
|
5887
|
+
this.control = this.group.controls[this.field.name];
|
|
5888
|
+
this.controlValue = toSignal(this.control.valueChanges, {
|
|
5889
|
+
initialValue: this.control.value,
|
|
5890
|
+
});
|
|
5891
|
+
this.formattedValue = computed(() => {
|
|
5892
|
+
const value = this.controlValue();
|
|
5893
|
+
if (value == null) {
|
|
5894
|
+
return '';
|
|
5895
|
+
}
|
|
5896
|
+
if (this.field.displayWith) {
|
|
5897
|
+
return this.field.displayWith(value) ?? '';
|
|
5898
|
+
}
|
|
5899
|
+
if (this.field.property && typeof value === 'object') {
|
|
5900
|
+
return String(value[this.field.property] ?? '');
|
|
5901
|
+
}
|
|
5902
|
+
return String(value);
|
|
5903
|
+
}, ...(ngDevMode ? [{ debugName: "formattedValue" }] : /* istanbul ignore next */ []));
|
|
5904
|
+
this.displayValue = computed(() => this.formattedValue() || this.label() || '', ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
|
|
5905
|
+
}
|
|
5883
5906
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: KlesFormTileComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
5884
5907
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.19", type: KlesFormTileComponent, isStandalone: true, selector: "app-kles-form-tile", usesInheritance: true, ngImport: i0, template: `
|
|
5885
5908
|
<div class="kles-tile" [ngClass]="ngClass()" [ngStyle]="ngStyle()" [matTooltip]="tooltip()">
|
|
@@ -5888,9 +5911,9 @@ class KlesFormTileComponent extends KlesFieldAbstract {
|
|
|
5888
5911
|
}
|
|
5889
5912
|
|
|
5890
5913
|
<div class="kles-tile__content">
|
|
5891
|
-
@if (
|
|
5914
|
+
@if (displayValue(); as value) {
|
|
5892
5915
|
<div class="kles-tile__label">
|
|
5893
|
-
{{
|
|
5916
|
+
{{ value }}
|
|
5894
5917
|
</div>
|
|
5895
5918
|
}
|
|
5896
5919
|
|
|
@@ -5912,9 +5935,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.19", ngImpo
|
|
|
5912
5935
|
}
|
|
5913
5936
|
|
|
5914
5937
|
<div class="kles-tile__content">
|
|
5915
|
-
@if (
|
|
5938
|
+
@if (displayValue(); as value) {
|
|
5916
5939
|
<div class="kles-tile__label">
|
|
5917
|
-
{{
|
|
5940
|
+
{{ value }}
|
|
5918
5941
|
</div>
|
|
5919
5942
|
}
|
|
5920
5943
|
|
|
@@ -6426,6 +6449,213 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.19", ngImpo
|
|
|
6426
6449
|
`, styles: [":host{display:flex;justify-content:inherit}.kles-status{display:inline-flex;align-items:center;gap:6px;box-sizing:border-box;color:var(--kles-status-color, var(--mat-sys-on-surface-variant));background:var(--kles-status-container, var(--mat-sys-surface-container-high))}.kles-status--chip{min-height:28px;padding:3px 10px;border-radius:999px;font:var(--mat-sys-label-medium)}.kles-status--badge{min-height:22px;padding:2px 7px;border-radius:4px;font:var(--mat-sys-label-small)}.kles-status--text{padding:0;border-radius:0;background:transparent}.kles-status__icon{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;flex:0 0 20px;line-height:20px;overflow:visible;vertical-align:middle}.kles-status__icon svg{width:100%;height:100%;overflow:visible}.kles-status__dot{width:8px;height:8px;flex:0 0 8px;border-radius:50%;background:currentColor}.kles-status__label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.kles-status--disabled{opacity:.56}.kles-status--neutral{--kles-status-color: var(--mat-sys-on-surface-variant);--kles-status-container: var(--mat-sys-surface-container-high)}.kles-status--info{--kles-status-color: var(--mat-sys-on-primary-container);--kles-status-container: var(--mat-sys-primary-container)}.kles-status--success{--kles-status-color: var(--kles-status-success-color, #1b5e20);--kles-status-container: var(--kles-status-success-container, #d7f5df)}.kles-status--warning{--kles-status-color: var(--kles-status-warning-color, #7a4f00);--kles-status-container: var(--kles-status-warning-container, #ffecb3)}.kles-status--error{--kles-status-color: var(--mat-sys-on-error-container);--kles-status-container: var(--mat-sys-error-container)}\n"] }]
|
|
6427
6450
|
}] });
|
|
6428
6451
|
|
|
6452
|
+
class KlesFormChipGridComponent extends KlesFieldAbstract {
|
|
6453
|
+
constructor() {
|
|
6454
|
+
super(...arguments);
|
|
6455
|
+
this.options = this.field.options;
|
|
6456
|
+
this.control = this.group.controls[this.field.name];
|
|
6457
|
+
this.intl = inject(KlesDynamicFormIntl);
|
|
6458
|
+
this.separatorKeysCodes = [ENTER, COMMA];
|
|
6459
|
+
this.isFocused = new Subject();
|
|
6460
|
+
this.searchControl = new FormControl('aaa');
|
|
6461
|
+
}
|
|
6462
|
+
ngOnInit() {
|
|
6463
|
+
if (this.field.lazy) {
|
|
6464
|
+
this.options$ = this.isFocused.pipe(distinctUntilChanged$1(), filter$1((isFocused) => isFocused), switchMap$1((isFocused) => {
|
|
6465
|
+
if (isFocused) {
|
|
6466
|
+
let obs$;
|
|
6467
|
+
if (this.field.options instanceof Observable) {
|
|
6468
|
+
obs$ = this.field.options;
|
|
6469
|
+
}
|
|
6470
|
+
else if (this.field.options instanceof Function) {
|
|
6471
|
+
obs$ = this.field.options();
|
|
6472
|
+
}
|
|
6473
|
+
else {
|
|
6474
|
+
obs$ = of(this.field.options ?? []);
|
|
6475
|
+
}
|
|
6476
|
+
return concat(of({ loading: true, options: [] }), obs$.pipe(map$1((options) => {
|
|
6477
|
+
return { loading: false, options };
|
|
6478
|
+
})));
|
|
6479
|
+
}
|
|
6480
|
+
else {
|
|
6481
|
+
return of({ loading: false, options: [] });
|
|
6482
|
+
}
|
|
6483
|
+
}));
|
|
6484
|
+
}
|
|
6485
|
+
else {
|
|
6486
|
+
if (this.field.options instanceof Observable) {
|
|
6487
|
+
this.options$ = concat(of({ loading: true, options: [] }), this.field.options.pipe(map$1((options) => {
|
|
6488
|
+
return { loading: false, options };
|
|
6489
|
+
})));
|
|
6490
|
+
}
|
|
6491
|
+
else if (this.field.options instanceof Function) {
|
|
6492
|
+
this.options$ = concat(of({ loading: true, options: [] }), this.field.options().pipe(map$1((options) => {
|
|
6493
|
+
return { loading: false, options };
|
|
6494
|
+
})));
|
|
6495
|
+
}
|
|
6496
|
+
else {
|
|
6497
|
+
this.options$ = of({ loading: false, options: this.field.options });
|
|
6498
|
+
}
|
|
6499
|
+
}
|
|
6500
|
+
this.filteredOption$ = concat(combineLatest([this.searchControl?.valueChanges.pipe(startWith('')) ?? of(''), this.options$]).pipe(map$1(([data, response]) => {
|
|
6501
|
+
if (response.loading) {
|
|
6502
|
+
return response;
|
|
6503
|
+
}
|
|
6504
|
+
else {
|
|
6505
|
+
return { loading: false, options: data && response.options ? this.filterData(data, response.options) : response.options };
|
|
6506
|
+
}
|
|
6507
|
+
})));
|
|
6508
|
+
super.ngOnInit();
|
|
6509
|
+
}
|
|
6510
|
+
ngOnDestroy() {
|
|
6511
|
+
super.ngOnDestroy();
|
|
6512
|
+
}
|
|
6513
|
+
onFocus() {
|
|
6514
|
+
if (this.field.lazy) {
|
|
6515
|
+
this.isFocused.next(true);
|
|
6516
|
+
}
|
|
6517
|
+
super.onFocus();
|
|
6518
|
+
}
|
|
6519
|
+
onTokenEnd(event) {
|
|
6520
|
+
this.addChip(event.value);
|
|
6521
|
+
event.chipInput.clear();
|
|
6522
|
+
}
|
|
6523
|
+
addChip(rawValue) {
|
|
6524
|
+
const value = (rawValue || '').trim();
|
|
6525
|
+
if (value) {
|
|
6526
|
+
this.control.setValue([...(this.control.value ?? []), value]);
|
|
6527
|
+
}
|
|
6528
|
+
}
|
|
6529
|
+
removeChip(value) {
|
|
6530
|
+
const values = this.control.value;
|
|
6531
|
+
const index = values.lastIndexOf(value);
|
|
6532
|
+
if (index > -1) {
|
|
6533
|
+
values.splice(index, 1);
|
|
6534
|
+
this.control.setValue(values);
|
|
6535
|
+
}
|
|
6536
|
+
}
|
|
6537
|
+
selected(event) {
|
|
6538
|
+
this.addChip(event.option.viewValue);
|
|
6539
|
+
event.option.deselect();
|
|
6540
|
+
this.searchControl.reset();
|
|
6541
|
+
}
|
|
6542
|
+
filterData(value, options) {
|
|
6543
|
+
let filterValue = undefined;
|
|
6544
|
+
const property = this.field.property;
|
|
6545
|
+
if (typeof value === 'string' && Object.prototype.toString.call(value) === '[object String]') {
|
|
6546
|
+
filterValue = value.toLowerCase();
|
|
6547
|
+
}
|
|
6548
|
+
else {
|
|
6549
|
+
if (property) {
|
|
6550
|
+
filterValue = value[property]?.toLowerCase();
|
|
6551
|
+
}
|
|
6552
|
+
}
|
|
6553
|
+
if (filterValue != undefined) {
|
|
6554
|
+
if (property) {
|
|
6555
|
+
return options.filter((option) => option[property].toLowerCase().indexOf(filterValue) === 0);
|
|
6556
|
+
}
|
|
6557
|
+
return options.filter((option) => option.toLowerCase().indexOf(filterValue) === 0);
|
|
6558
|
+
}
|
|
6559
|
+
else {
|
|
6560
|
+
return options;
|
|
6561
|
+
}
|
|
6562
|
+
}
|
|
6563
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: KlesFormChipGridComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
6564
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.19", type: KlesFormChipGridComponent, isStandalone: true, selector: "kles-form-chip-grid", usesInheritance: true, ngImport: i0, template: `
|
|
6565
|
+
<div [formGroup]="group">
|
|
6566
|
+
<mat-form-field [matTooltip]="tooltip()">
|
|
6567
|
+
<mat-label>{{ label() }}</mat-label>
|
|
6568
|
+
<mat-chip-grid #reactiveChipGrid [formControl]="group.controls[field.name]">
|
|
6569
|
+
@for (value of group.controls[field.name].value ?? []; track value) {
|
|
6570
|
+
<mat-chip-row (removed)="removeChip(value)">
|
|
6571
|
+
{{ value | klesTransform: field.pipeTransform }}
|
|
6572
|
+
<button matChipRemove>
|
|
6573
|
+
<mat-icon>cancel</mat-icon>
|
|
6574
|
+
</button>
|
|
6575
|
+
</mat-chip-row>
|
|
6576
|
+
}
|
|
6577
|
+
</mat-chip-grid>
|
|
6578
|
+
<input
|
|
6579
|
+
#search
|
|
6580
|
+
[formControl]="searchControl"
|
|
6581
|
+
[placeholder]="placeholder()"
|
|
6582
|
+
[matChipInputFor]="reactiveChipGrid"
|
|
6583
|
+
(matChipInputTokenEnd)="onTokenEnd($event)"
|
|
6584
|
+
[matAutocomplete]="auto"
|
|
6585
|
+
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
|
|
6586
|
+
(focus)="onFocus()"
|
|
6587
|
+
(blur)="onBlur()"
|
|
6588
|
+
/>
|
|
6589
|
+
|
|
6590
|
+
<mat-autocomplete #auto="matAutocomplete" (optionSelected)="selected($event); search.value = ''">
|
|
6591
|
+
@if (filteredOption$ | async; as filteredOption) {
|
|
6592
|
+
@if (filteredOption.loading) {
|
|
6593
|
+
<mat-option disabled>
|
|
6594
|
+
<div class="loadingSelect">
|
|
6595
|
+
{{ intl.loading }}...
|
|
6596
|
+
<mat-spinner class="spinner" diameter="20"></mat-spinner>
|
|
6597
|
+
</div>
|
|
6598
|
+
</mat-option>
|
|
6599
|
+
} @else {
|
|
6600
|
+
@for (item of filteredOption.options; track item) {
|
|
6601
|
+
<mat-option [value]="item" [disabled]="item?.disabled">{{ (field.property ? item[field.property] : item) | klesTransform: field.pipeTransform }}</mat-option>
|
|
6602
|
+
}
|
|
6603
|
+
}
|
|
6604
|
+
}
|
|
6605
|
+
</mat-autocomplete>
|
|
6606
|
+
</mat-form-field>
|
|
6607
|
+
</div>
|
|
6608
|
+
`, isInline: true, styles: [".suffix{display:flex;align-items:center}\n", ".field-bottom .mat-mdc-form-field-bottom-align:before{content:none!important}\n", ".loadingSelect{display:flex;flex-direction:row;justify-content:space-between;align-items:center}\n", "mat-form-field{width:100%}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i2$3.MatChipGrid, selector: "mat-chip-grid", inputs: ["disabled", "placeholder", "required", "value", "errorStateMatcher"], outputs: ["change", "valueChange"] }, { kind: "directive", type: i2$3.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled", "readonly", "matChipInputDisabledInteractive"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { kind: "directive", type: i2$3.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i2$3.MatChipRow, selector: "mat-chip-row, [mat-chip-row], mat-basic-chip-row, [mat-basic-chip-row]", inputs: ["editable"], outputs: ["edited"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "component", type: i5.MatAutocomplete, selector: "mat-autocomplete", inputs: ["aria-label", "aria-labelledby", "displayWith", "autoActiveFirstOption", "autoSelectActiveOption", "requireSelection", "panelWidth", "disableRipple", "class", "hideSingleSelectionIndicator"], outputs: ["optionSelected", "opened", "closed", "optionActivated"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i4$1.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: i5.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i7.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "pipe", type: KlesTransformPipe, name: "klesTransform" }, { kind: "pipe", type: AsyncPipe, name: "async" }] }); }
|
|
6609
|
+
}
|
|
6610
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: KlesFormChipGridComponent, decorators: [{
|
|
6611
|
+
type: Component,
|
|
6612
|
+
args: [{ selector: 'kles-form-chip-grid', template: `
|
|
6613
|
+
<div [formGroup]="group">
|
|
6614
|
+
<mat-form-field [matTooltip]="tooltip()">
|
|
6615
|
+
<mat-label>{{ label() }}</mat-label>
|
|
6616
|
+
<mat-chip-grid #reactiveChipGrid [formControl]="group.controls[field.name]">
|
|
6617
|
+
@for (value of group.controls[field.name].value ?? []; track value) {
|
|
6618
|
+
<mat-chip-row (removed)="removeChip(value)">
|
|
6619
|
+
{{ value | klesTransform: field.pipeTransform }}
|
|
6620
|
+
<button matChipRemove>
|
|
6621
|
+
<mat-icon>cancel</mat-icon>
|
|
6622
|
+
</button>
|
|
6623
|
+
</mat-chip-row>
|
|
6624
|
+
}
|
|
6625
|
+
</mat-chip-grid>
|
|
6626
|
+
<input
|
|
6627
|
+
#search
|
|
6628
|
+
[formControl]="searchControl"
|
|
6629
|
+
[placeholder]="placeholder()"
|
|
6630
|
+
[matChipInputFor]="reactiveChipGrid"
|
|
6631
|
+
(matChipInputTokenEnd)="onTokenEnd($event)"
|
|
6632
|
+
[matAutocomplete]="auto"
|
|
6633
|
+
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
|
|
6634
|
+
(focus)="onFocus()"
|
|
6635
|
+
(blur)="onBlur()"
|
|
6636
|
+
/>
|
|
6637
|
+
|
|
6638
|
+
<mat-autocomplete #auto="matAutocomplete" (optionSelected)="selected($event); search.value = ''">
|
|
6639
|
+
@if (filteredOption$ | async; as filteredOption) {
|
|
6640
|
+
@if (filteredOption.loading) {
|
|
6641
|
+
<mat-option disabled>
|
|
6642
|
+
<div class="loadingSelect">
|
|
6643
|
+
{{ intl.loading }}...
|
|
6644
|
+
<mat-spinner class="spinner" diameter="20"></mat-spinner>
|
|
6645
|
+
</div>
|
|
6646
|
+
</mat-option>
|
|
6647
|
+
} @else {
|
|
6648
|
+
@for (item of filteredOption.options; track item) {
|
|
6649
|
+
<mat-option [value]="item" [disabled]="item?.disabled">{{ (field.property ? item[field.property] : item) | klesTransform: field.pipeTransform }}</mat-option>
|
|
6650
|
+
}
|
|
6651
|
+
}
|
|
6652
|
+
}
|
|
6653
|
+
</mat-autocomplete>
|
|
6654
|
+
</mat-form-field>
|
|
6655
|
+
</div>
|
|
6656
|
+
`, standalone: true, imports: [MatIconModule, KlesTransformPipe, MatChipsModule, MatTooltip, ReactiveFormsModule, MatFormFieldModule, MatAutocompleteModule, AsyncPipe, MatProgressSpinnerModule], styles: [".suffix{display:flex;align-items:center}\n", ".field-bottom .mat-mdc-form-field-bottom-align:before{content:none!important}\n", ".loadingSelect{display:flex;flex-direction:row;justify-content:space-between;align-items:center}\n", "mat-form-field{width:100%}\n"] }]
|
|
6657
|
+
}] });
|
|
6658
|
+
|
|
6429
6659
|
const components = [
|
|
6430
6660
|
KlesDynamicFormComponent,
|
|
6431
6661
|
KlesFormLabelComponent,
|
|
@@ -6475,7 +6705,8 @@ const components = [
|
|
|
6475
6705
|
KlesFormTileComponent,
|
|
6476
6706
|
KlesFormActionMenuComponent,
|
|
6477
6707
|
KlesFormCurrencyComponent,
|
|
6478
|
-
KlesFormStatusComponent
|
|
6708
|
+
KlesFormStatusComponent,
|
|
6709
|
+
KlesFormChipGridComponent
|
|
6479
6710
|
];
|
|
6480
6711
|
const colorPicker = [ColorPickerComponent, ColorPickerDirective];
|
|
6481
6712
|
const directives = [KlesDynamicFieldDirective, KlesComponentDirective, MatErrorMessageDirective, MatErrorFormDirective];
|
|
@@ -6531,7 +6762,8 @@ class KlesMaterialDynamicformsModule {
|
|
|
6531
6762
|
KlesFormTileComponent,
|
|
6532
6763
|
KlesFormActionMenuComponent,
|
|
6533
6764
|
KlesFormCurrencyComponent,
|
|
6534
|
-
KlesFormStatusComponent,
|
|
6765
|
+
KlesFormStatusComponent,
|
|
6766
|
+
KlesFormChipGridComponent, KlesDynamicFieldDirective, KlesComponentDirective, MatErrorMessageDirective, MatErrorFormDirective, KlesTransformPipe, ArrayFormatPipe, ColorPickerComponent, ColorPickerDirective], exports: [KlesDynamicFormComponent,
|
|
6535
6767
|
KlesFormLabelComponent,
|
|
6536
6768
|
KlesFormInputComponent,
|
|
6537
6769
|
KlesFormInputClearableComponent,
|
|
@@ -6579,7 +6811,8 @@ class KlesMaterialDynamicformsModule {
|
|
|
6579
6811
|
KlesFormTileComponent,
|
|
6580
6812
|
KlesFormActionMenuComponent,
|
|
6581
6813
|
KlesFormCurrencyComponent,
|
|
6582
|
-
KlesFormStatusComponent,
|
|
6814
|
+
KlesFormStatusComponent,
|
|
6815
|
+
KlesFormChipGridComponent, KlesTransformPipe, ArrayFormatPipe, KlesDynamicFieldDirective, KlesComponentDirective, MatErrorMessageDirective, MatErrorFormDirective] }); }
|
|
6583
6816
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: KlesMaterialDynamicformsModule, providers: [{ provide: ErrorStateMatcher, useClass: KlesFormErrorStateMatcher }, pipes], imports: [CommonModule, ReactiveFormsModule, FormsModule, MaterialModule, NgxMatSelectSearchModule, KlesDynamicFormComponent,
|
|
6584
6817
|
KlesFormLabelComponent,
|
|
6585
6818
|
KlesFormInputComponent,
|
|
@@ -6627,7 +6860,8 @@ class KlesMaterialDynamicformsModule {
|
|
|
6627
6860
|
KlesFormTileComponent,
|
|
6628
6861
|
KlesFormActionMenuComponent,
|
|
6629
6862
|
KlesFormCurrencyComponent,
|
|
6630
|
-
KlesFormStatusComponent,
|
|
6863
|
+
KlesFormStatusComponent,
|
|
6864
|
+
KlesFormChipGridComponent, MatErrorMessageDirective, MatErrorFormDirective, ColorPickerComponent] }); }
|
|
6631
6865
|
}
|
|
6632
6866
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: KlesMaterialDynamicformsModule, decorators: [{
|
|
6633
6867
|
type: NgModule,
|
|
@@ -6644,13 +6878,14 @@ class KlesFormPasswordVisibilityComponent {
|
|
|
6644
6878
|
this.field = inject(FIELD);
|
|
6645
6879
|
this.group = inject(GROUP);
|
|
6646
6880
|
this.siblingFields = inject(SIBLING_FIELDS);
|
|
6647
|
-
this.
|
|
6881
|
+
this.ui = inject(GROUP_UI, { optional: true });
|
|
6882
|
+
this.hide = computed(() => {
|
|
6883
|
+
return this.ui?.get(this.field.name)?.value().inputType === 'password';
|
|
6884
|
+
}, ...(ngDevMode ? [{ debugName: "hide" }] : /* istanbul ignore next */ []));
|
|
6648
6885
|
}
|
|
6649
6886
|
toggleVisibility(event) {
|
|
6650
6887
|
event.stopPropagation();
|
|
6651
|
-
this.
|
|
6652
|
-
// this.field.inputType = this.hide ? 'password' : 'text';
|
|
6653
|
-
//TODO
|
|
6888
|
+
this.ui?.get(this.field.name)?.patchValue({ inputType: this.hide() ? 'text' : 'password' });
|
|
6654
6889
|
}
|
|
6655
6890
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: KlesFormPasswordVisibilityComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
6656
6891
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.19", type: KlesFormPasswordVisibilityComponent, isStandalone: true, selector: "kles-form-password-visibility", ngImport: i0, template: `
|
|
@@ -6704,5 +6939,5 @@ function autocompleteStringValidator(validOptions, optional) {
|
|
|
6704
6939
|
* Generated bundle index. Do not edit.
|
|
6705
6940
|
*/
|
|
6706
6941
|
|
|
6707
|
-
export { AbstractUiState, ArrayFormatPipe, ArrayUiState, ControlUiState, EnumType, FIELD, FIELD_CONTEXT, FIELD_NAME, FieldMapper, GROUP, GROUP_UI, GroupUiState, KlesAbstractFormControl, KlesAbstractFormUiControl, KlesButtonBase, KlesButtonCheckerComponent, KlesButtonComponent, KlesButtonFileComponent, KlesComponentDirective, KlesCurrencyValueAccessorDirective, KlesDynamicFieldDirective, KlesDynamicFormComponent, KlesDynamicFormIntl, KlesFabComponent, KlesFieldAbstract, KlesFileControlComponent, KlesFormActionMenuComponent, KlesFormArray, KlesFormArrayComponent, KlesFormBadgeComponent, KlesFormButtonCheckerComponent, KlesFormButtonComponent, KlesFormButtonFileComponent, KlesFormButtonToogleGroupComponent, KlesFormCheckboxComponent, KlesFormCheckboxIndeterminateComponent, KlesFormChipComponent, KlesFormClearComponent, KlesFormColorComponent, KlesFormControl, KlesFormCopyComponent, KlesFormCurrencyComponent, KlesFormDateComponent, KlesFormDateTimeComponent, KlesFormErrorStateMatcher, KlesFormFabComponent, KlesFormFileComponent, KlesFormGroup, KlesFormGroupComponent, KlesFormIconButtonComponent, KlesFormIconComponent, KlesFormInputClearableComponent, KlesFormInputComponent, KlesFormLabelComponent, KlesFormLineBreakComponent, KlesFormLinkComponent, KlesFormListFieldComponent, KlesFormMiniFabComponent, KlesFormPasswordVisibilityComponent, KlesFormRadioComponent, KlesFormRange, KlesFormRangeComponent, KlesFormSelectComponent, KlesFormSelectLazySearchComponent, KlesFormSelectSearchComponent, KlesFormSelectionListComponent, KlesFormSelectionListSearchComponent, KlesFormSlideToggleComponent, KlesFormStatusComponent, KlesFormTextComponent, KlesFormTextareaComponent, KlesFormTileComponent, KlesFormUiArray, KlesFormUiControl, KlesFormUiGroup, KlesIconButtonComponent, KlesIndeterminateCheckboxComponent, KlesMaterialDynamicformsModule, KlesMiniFabComponent, KlesSelectionModel, KlesTransformPipe, MatErrorFormDirective, MatErrorMessageDirective, SIBLING_FIELDS, autocompleteObjectValidator, autocompleteStringValidator, componentMapper, isDestroyable, klesFieldControlFactory, klesFieldUiFactory };
|
|
6942
|
+
export { AbstractUiState, ArrayFormatPipe, ArrayUiState, ControlUiState, EnumType, FIELD, FIELD_CONTEXT, FIELD_NAME, FieldMapper, GROUP, GROUP_UI, GroupUiState, KlesAbstractFormControl, KlesAbstractFormUiControl, KlesButtonBase, KlesButtonCheckerComponent, KlesButtonComponent, KlesButtonFileComponent, KlesComponentDirective, KlesCurrencyValueAccessorDirective, KlesDynamicFieldDirective, KlesDynamicFormComponent, KlesDynamicFormIntl, KlesFabComponent, KlesFieldAbstract, KlesFileControlComponent, KlesFormActionMenuComponent, KlesFormArray, KlesFormArrayComponent, KlesFormBadgeComponent, KlesFormButtonCheckerComponent, KlesFormButtonComponent, KlesFormButtonFileComponent, KlesFormButtonToogleGroupComponent, KlesFormCheckboxComponent, KlesFormCheckboxIndeterminateComponent, KlesFormChipComponent, KlesFormChipGridComponent, KlesFormClearComponent, KlesFormColorComponent, KlesFormControl, KlesFormCopyComponent, KlesFormCurrencyComponent, KlesFormDateComponent, KlesFormDateTimeComponent, KlesFormErrorStateMatcher, KlesFormFabComponent, KlesFormFileComponent, KlesFormGroup, KlesFormGroupComponent, KlesFormIconButtonComponent, KlesFormIconComponent, KlesFormInputClearableComponent, KlesFormInputComponent, KlesFormLabelComponent, KlesFormLineBreakComponent, KlesFormLinkComponent, KlesFormListFieldComponent, KlesFormMiniFabComponent, KlesFormPasswordVisibilityComponent, KlesFormRadioComponent, KlesFormRange, KlesFormRangeComponent, KlesFormSelectComponent, KlesFormSelectLazySearchComponent, KlesFormSelectSearchComponent, KlesFormSelectionListComponent, KlesFormSelectionListSearchComponent, KlesFormSlideToggleComponent, KlesFormStatusComponent, KlesFormTextComponent, KlesFormTextareaComponent, KlesFormTileComponent, KlesFormUiArray, KlesFormUiControl, KlesFormUiGroup, KlesIconButtonComponent, KlesIndeterminateCheckboxComponent, KlesMaterialDynamicformsModule, KlesMiniFabComponent, KlesSelectionModel, KlesTransformPipe, MatErrorFormDirective, MatErrorMessageDirective, SIBLING_FIELDS, autocompleteObjectValidator, autocompleteStringValidator, componentMapper, isDestroyable, klesFieldControlFactory, klesFieldUiFactory };
|
|
6708
6943
|
//# sourceMappingURL=3kles-kles-material-dynamicforms.mjs.map
|