@tft/crispr-forms 14.0.1-rc.2 → 14.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/esm2020/src/lib/crispr-forms.module.mjs +5 -2
- package/esm2020/src/lib/display-field.directive.mjs +53 -0
- package/esm2020/src/lib/field-component-map.const.mjs +18 -18
- package/esm2020/src/lib/field.directive.mjs +2 -2
- package/esm2020/src/lib/form-group-list/form-group-list.component.mjs +9 -3
- package/esm2020/ui/autocomplete-chiplist-field/autocomplete-chiplist-field.component.mjs +9 -6
- package/esm2020/ui/autocomplete-chiplist-field/public-api.mjs +2 -0
- package/esm2020/ui/autocomplete-chiplist-field/tft-crispr-forms-ui-autocomplete-chiplist-field.mjs +5 -0
- package/esm2020/ui/autocomplete-field/autocomplete-field.component.mjs +8 -5
- package/esm2020/ui/autocomplete-field/public-api.mjs +2 -0
- package/esm2020/ui/autocomplete-field/tft-crispr-forms-ui-autocomplete-field.mjs +5 -0
- package/esm2020/ui/button/button.component.mjs +5 -2
- package/esm2020/ui/button/public-api.mjs +2 -0
- package/esm2020/ui/button/tft-crispr-forms-ui-button.mjs +5 -0
- package/esm2020/ui/checkbox-field/checkbox-field.component.mjs +7 -7
- package/esm2020/ui/checkbox-field/public-api.mjs +2 -0
- package/esm2020/ui/checkbox-field/tft-crispr-forms-ui-checkbox-field.mjs +5 -0
- package/esm2020/ui/datepicker-field/datepicker-field.component.mjs +8 -5
- package/esm2020/ui/datepicker-field/public-api.mjs +2 -0
- package/esm2020/ui/datepicker-field/tft-crispr-forms-ui-datepicker-field.mjs +5 -0
- package/esm2020/ui/divider/public-api.mjs +2 -0
- package/esm2020/ui/divider/tft-crispr-forms-ui-divider.mjs +5 -0
- package/esm2020/ui/{file-upload/file-upload.component.mjs → file-upload-field/file-upload-field.component.mjs} +3 -3
- package/esm2020/ui/file-upload-field/public-api.mjs +2 -0
- package/esm2020/ui/file-upload-field/tft-crispr-forms-ui-file-upload-field.mjs +5 -0
- package/esm2020/ui/input-field/input-field.component.mjs +7 -4
- package/esm2020/ui/input-field/public-api.mjs +2 -0
- package/esm2020/ui/input-field/tft-crispr-forms-ui-input-field.mjs +5 -0
- package/esm2020/ui/option/public-api.mjs +2 -0
- package/esm2020/ui/option/tft-crispr-forms-ui-option.mjs +5 -0
- package/esm2020/ui/public-api.mjs +1 -15
- package/esm2020/ui/radio-field/public-api.mjs +2 -0
- package/esm2020/ui/radio-field/radio-field.component.mjs +7 -4
- package/esm2020/ui/radio-field/tft-crispr-forms-ui-radio-field.mjs +5 -0
- package/esm2020/ui/select-field/public-api.mjs +2 -0
- package/esm2020/ui/select-field/select-field.component.mjs +9 -10
- package/esm2020/ui/select-field/tft-crispr-forms-ui-select-field.mjs +5 -0
- package/esm2020/ui/slider-field/public-api.mjs +2 -0
- package/esm2020/ui/slider-field/slider-field.component.mjs +8 -5
- package/esm2020/ui/slider-field/tft-crispr-forms-ui-slider-field.mjs +5 -0
- package/esm2020/ui/textarea-field/public-api.mjs +2 -0
- package/esm2020/ui/textarea-field/textarea-field.component.mjs +6 -3
- package/esm2020/ui/textarea-field/tft-crispr-forms-ui-textarea-field.mjs +5 -0
- package/esm2020/ui/unit-conversion-field/public-api.mjs +2 -0
- package/esm2020/ui/unit-conversion-field/tft-crispr-forms-ui-unit-conversion-field.mjs +5 -0
- package/esm2020/ui/unit-conversion-field/unit-conversion-field.component.mjs +7 -4
- package/esm2020/utils/abstracts/crispr-display-field.abstract.mjs +14 -0
- package/esm2020/utils/abstracts/index.mjs +2 -1
- package/esm2020/utils/models/file-upload-field.config.mjs +1 -1
- package/esm2020/utils/models/form-group-list.config.mjs +1 -1
- package/fesm2015/tft-crispr-forms-ui-autocomplete-chiplist-field.mjs +138 -0
- package/fesm2015/tft-crispr-forms-ui-autocomplete-chiplist-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-autocomplete-field.mjs +101 -0
- package/fesm2015/tft-crispr-forms-ui-autocomplete-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-button.mjs +55 -0
- package/fesm2015/tft-crispr-forms-ui-button.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-checkbox-field.mjs +49 -0
- package/fesm2015/tft-crispr-forms-ui-checkbox-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-datepicker-field.mjs +71 -0
- package/fesm2015/tft-crispr-forms-ui-datepicker-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-divider.mjs +34 -0
- package/fesm2015/tft-crispr-forms-ui-divider.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-file-upload-field.mjs +117 -0
- package/fesm2015/tft-crispr-forms-ui-file-upload-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-input-field.mjs +48 -0
- package/fesm2015/tft-crispr-forms-ui-input-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-option.mjs +26 -0
- package/fesm2015/tft-crispr-forms-ui-option.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-radio-field.mjs +46 -0
- package/fesm2015/tft-crispr-forms-ui-radio-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-select-field.mjs +81 -0
- package/fesm2015/tft-crispr-forms-ui-select-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-slider-field.mjs +51 -0
- package/fesm2015/tft-crispr-forms-ui-slider-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-textarea-field.mjs +49 -0
- package/fesm2015/tft-crispr-forms-ui-textarea-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-unit-conversion-field.mjs +93 -0
- package/fesm2015/tft-crispr-forms-ui-unit-conversion-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui.mjs +2 -674
- package/fesm2015/tft-crispr-forms-ui.mjs.map +1 -1
- package/fesm2015/tft-crispr-forms-utils.mjs +11 -1
- package/fesm2015/tft-crispr-forms-utils.mjs.map +1 -1
- package/fesm2015/tft-crispr-forms.mjs +80 -21
- package/fesm2015/tft-crispr-forms.mjs.map +1 -1
- package/fesm2020/tft-crispr-forms-ui-autocomplete-chiplist-field.mjs +137 -0
- package/fesm2020/tft-crispr-forms-ui-autocomplete-chiplist-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-autocomplete-field.mjs +100 -0
- package/fesm2020/tft-crispr-forms-ui-autocomplete-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-button.mjs +55 -0
- package/fesm2020/tft-crispr-forms-ui-button.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-checkbox-field.mjs +49 -0
- package/fesm2020/tft-crispr-forms-ui-checkbox-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-datepicker-field.mjs +70 -0
- package/fesm2020/tft-crispr-forms-ui-datepicker-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-divider.mjs +34 -0
- package/fesm2020/tft-crispr-forms-ui-divider.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-file-upload-field.mjs +115 -0
- package/fesm2020/tft-crispr-forms-ui-file-upload-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-input-field.mjs +48 -0
- package/fesm2020/tft-crispr-forms-ui-input-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-option.mjs +26 -0
- package/fesm2020/tft-crispr-forms-ui-option.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-radio-field.mjs +46 -0
- package/fesm2020/tft-crispr-forms-ui-radio-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-select-field.mjs +80 -0
- package/fesm2020/tft-crispr-forms-ui-select-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-slider-field.mjs +51 -0
- package/fesm2020/tft-crispr-forms-ui-slider-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-textarea-field.mjs +49 -0
- package/fesm2020/tft-crispr-forms-ui-textarea-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-unit-conversion-field.mjs +91 -0
- package/fesm2020/tft-crispr-forms-ui-unit-conversion-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui.mjs +2 -666
- package/fesm2020/tft-crispr-forms-ui.mjs.map +1 -1
- package/fesm2020/tft-crispr-forms-utils.mjs +11 -1
- package/fesm2020/tft-crispr-forms-utils.mjs.map +1 -1
- package/fesm2020/tft-crispr-forms.mjs +78 -21
- package/fesm2020/tft-crispr-forms.mjs.map +1 -1
- package/package.json +114 -4
- package/src/lib/crispr-forms.module.d.ts +5 -4
- package/src/lib/display-field.directive.d.ts +23 -0
- package/src/lib/field-component-map.const.d.ts +31 -18
- package/src/lib/form-group-list/form-group-list.component.d.ts +2 -0
- package/tft-crispr-forms-14.0.2.tgz +0 -0
- package/ui/autocomplete-chiplist-field/index.d.ts +5 -1
- package/ui/autocomplete-chiplist-field/public-api.d.ts +1 -0
- package/ui/autocomplete-field/index.d.ts +5 -1
- package/ui/autocomplete-field/public-api.d.ts +1 -0
- package/ui/button/index.d.ts +5 -1
- package/ui/button/public-api.d.ts +1 -0
- package/ui/checkbox-field/index.d.ts +5 -1
- package/ui/checkbox-field/public-api.d.ts +1 -0
- package/ui/datepicker-field/index.d.ts +5 -1
- package/ui/datepicker-field/public-api.d.ts +1 -0
- package/ui/divider/index.d.ts +5 -1
- package/ui/divider/public-api.d.ts +1 -0
- package/ui/file-upload-field/index.d.ts +5 -0
- package/ui/file-upload-field/public-api.d.ts +1 -0
- package/ui/input-field/index.d.ts +5 -1
- package/ui/input-field/public-api.d.ts +1 -0
- package/ui/option/index.d.ts +5 -1
- package/ui/option/public-api.d.ts +1 -0
- package/ui/public-api.d.ts +0 -14
- package/ui/radio-field/index.d.ts +5 -1
- package/ui/radio-field/public-api.d.ts +1 -0
- package/ui/select-field/index.d.ts +5 -1
- package/ui/select-field/public-api.d.ts +1 -0
- package/ui/slider-field/index.d.ts +5 -1
- package/ui/slider-field/public-api.d.ts +1 -0
- package/ui/textarea-field/index.d.ts +5 -1
- package/ui/textarea-field/public-api.d.ts +1 -0
- package/ui/unit-conversion-field/index.d.ts +5 -1
- package/ui/unit-conversion-field/public-api.d.ts +1 -0
- package/utils/abstracts/crispr-display-field.abstract.d.ts +22 -0
- package/utils/abstracts/index.d.ts +1 -0
- package/utils/models/file-upload-field.config.d.ts +7 -1
- package/utils/models/form-group-list.config.d.ts +1 -0
- package/esm2020/ui/autocomplete-chiplist-field/index.mjs +0 -2
- package/esm2020/ui/autocomplete-field/index.mjs +0 -2
- package/esm2020/ui/button/index.mjs +0 -2
- package/esm2020/ui/checkbox-field/index.mjs +0 -2
- package/esm2020/ui/datepicker-field/index.mjs +0 -2
- package/esm2020/ui/divider/index.mjs +0 -2
- package/esm2020/ui/file-upload/index.mjs +0 -2
- package/esm2020/ui/input-field/index.mjs +0 -2
- package/esm2020/ui/option/index.mjs +0 -2
- package/esm2020/ui/radio-field/index.mjs +0 -2
- package/esm2020/ui/select-field/index.mjs +0 -2
- package/esm2020/ui/slider-field/index.mjs +0 -2
- package/esm2020/ui/textarea-field/index.mjs +0 -2
- package/esm2020/ui/unit-conversion-field/index.mjs +0 -2
- package/tft-crispr-forms-14.0.1-rc.2.tgz +0 -0
- package/ui/file-upload/index.d.ts +0 -1
- /package/ui/{file-upload/file-upload.component.d.ts → file-upload-field/file-upload-field.component.d.ts} +0 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, ChangeDetectionStrategy, ViewChild } from '@angular/core';
|
|
3
|
+
import * as i3 from '@angular/material/autocomplete';
|
|
4
|
+
import { MatAutocompleteTrigger, MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
5
|
+
import * as i1 from '@angular/common';
|
|
6
|
+
import { CommonModule } from '@angular/common';
|
|
7
|
+
import * as i2 from '@angular/forms';
|
|
8
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
9
|
+
import * as i6 from '@angular/material/input';
|
|
10
|
+
import { MatInputModule } from '@angular/material/input';
|
|
11
|
+
import * as i4 from '@angular/material/core';
|
|
12
|
+
import { MatOptionModule } from '@angular/material/core';
|
|
13
|
+
import { OptionComponent } from '@tft/crispr-forms/ui/option';
|
|
14
|
+
import * as i7 from '@tft/form-validation-handler';
|
|
15
|
+
import { FormValidationHandlerModule } from '@tft/form-validation-handler';
|
|
16
|
+
import { FieldContainerComponent } from '@tft/crispr-forms/ui/field-container';
|
|
17
|
+
import { DEFAULT_EMPTY_OPTIONS_MESSAGE, AbstractAutocompleteComponent } from '@tft/crispr-forms/utils';
|
|
18
|
+
import { InfoComponent } from '@tft/crispr-forms/ui/info';
|
|
19
|
+
import * as i5 from '@angular/material/form-field';
|
|
20
|
+
|
|
21
|
+
/* eslint-disable @nrwl/nx/enforce-module-boundaries */
|
|
22
|
+
const defaultConfig = {
|
|
23
|
+
autoActiveFirstOption: true,
|
|
24
|
+
typeDebounceTime: 500,
|
|
25
|
+
emptyOptionsMessage: DEFAULT_EMPTY_OPTIONS_MESSAGE
|
|
26
|
+
};
|
|
27
|
+
class AutocompleteFieldComponent extends AbstractAutocompleteComponent {
|
|
28
|
+
constructor() {
|
|
29
|
+
super(...arguments);
|
|
30
|
+
this.defaultConfig = defaultConfig;
|
|
31
|
+
}
|
|
32
|
+
ngOnInit() {
|
|
33
|
+
super.ngOnInit();
|
|
34
|
+
this.clearFieldSubscription = this.autocompleteInputControl.valueChanges.subscribe((text) => {
|
|
35
|
+
if (typeof text === 'string' && text?.trim() === '') {
|
|
36
|
+
this.control.setValue(null);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
ngOnDestroy() {
|
|
41
|
+
this.clearFieldSubscription.unsubscribe();
|
|
42
|
+
}
|
|
43
|
+
setControlValue(value) {
|
|
44
|
+
if (this.control && value) {
|
|
45
|
+
// sets the initial value on the control if one is passed
|
|
46
|
+
this.control.setValue(value.value || '');
|
|
47
|
+
this.autocompleteInputControl.setValue(value.label || '');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The material autocomplete defaults to displaying the options value instead of its label.
|
|
52
|
+
* We only have the value from the selected option to work with, so we have to pass the options
|
|
53
|
+
* through a function called in the template and return the function that the material displayWith
|
|
54
|
+
* input is expecting.
|
|
55
|
+
* @param options the array of options to search for option with corresponding value
|
|
56
|
+
*/
|
|
57
|
+
displayLabel(options) {
|
|
58
|
+
if (this.config.displayWith) {
|
|
59
|
+
return this.config.displayWith(options);
|
|
60
|
+
}
|
|
61
|
+
return (value) => {
|
|
62
|
+
const label = !!options && Array.isArray(options)
|
|
63
|
+
? options.find((option) => JSON.stringify(option.value) === JSON.stringify(value))?.label : value;
|
|
64
|
+
return label;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
handleSelect(event) {
|
|
68
|
+
this.control.setValue(event.option.value);
|
|
69
|
+
this.autoInputRef.nativeElement.blur();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
AutocompleteFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: AutocompleteFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
73
|
+
AutocompleteFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: AutocompleteFieldComponent, isStandalone: true, selector: "crispr-autocomplete-field", viewQueries: [{ propertyName: "autoInput", first: true, predicate: ["autoInput"], descendants: true, read: MatAutocompleteTrigger }, { propertyName: "autoInputRef", first: true, predicate: ["autoInput"], descendants: true }], usesInheritance: true, ngImport: i0, template: "\n<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\n <mat-form-field\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n\n <input class=\"hidden-error-directive-anchor\" [formControlName]=\"config.controlName\" type=\"text\"/>\n\n <input\n matInput\n [formControl]=\"autocompleteInputControl\"\n [placeholder]=\"config.placeholder\"\n [matAutocomplete]=\"auto\"\n role=\"textbox\"\n type=\"textbox\"\n autocapitalize=\"off\"\n autocorrect=\"off\"\n spellcheck=\"false\"\n #autoInput>\n\n <span *ngIf=\"config.fieldSuffix\" matSuffix>{{config.fieldSuffix}}</span>\n <crispr-info\n *ngIf=\"config.info\"\n matSuffix\n [info]=\"config.info \">\n </crispr-info>\n\n <mat-autocomplete\n #auto=\"matAutocomplete\"\n [autoActiveFirstOption]=\"config.autoActiveFirstOption\"\n (optionSelected)=\"handleSelect($event)\"\n [displayWith]=\"displayLabel(options$ | async)\">\n\n <ng-container *ngIf=\"options$ | async as options; else emptyOption\">\n <ng-container *ngIf=\"options.length > 0; else emptyOption\">\n <mat-option\n *ngFor=\"let option of options\"\n [value]=\"option.value\">\n <crispr-option [option]=\"option\"></crispr-option>\n </mat-option>\n </ng-container>\n\n </ng-container>\n <ng-template #emptyOption>\n <mat-option disabled=\"true\">\n {{config.emptyOptionsMessage}}\n </mat-option>\n </ng-template>\n\n </mat-autocomplete>\n\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n</crispr-field-container>\n", styles: [".hidden-error-directive-anchor{display:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "component", type: InfoComponent, selector: "crispr-info", inputs: ["info"] }, { kind: "component", type: OptionComponent, selector: "crispr-option", inputs: ["option"] }, { 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],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: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "ngmodule", type: MatAutocompleteModule }, { kind: "component", type: i3.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i3.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "component", type: i4.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i5.MatLabel, selector: "mat-label" }, { kind: "directive", type: i5.MatSuffix, selector: "[matSuffix]" }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatOptionModule }, { kind: "ngmodule", type: FormValidationHandlerModule }, { kind: "directive", type: i7.ControlErrorsDirective, selector: "[formControl], [formControlName]" }, { kind: "directive", type: i7.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
74
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: AutocompleteFieldComponent, decorators: [{
|
|
75
|
+
type: Component,
|
|
76
|
+
args: [{ selector: 'crispr-autocomplete-field', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
|
|
77
|
+
CommonModule,
|
|
78
|
+
InfoComponent,
|
|
79
|
+
OptionComponent,
|
|
80
|
+
ReactiveFormsModule,
|
|
81
|
+
FieldContainerComponent,
|
|
82
|
+
MatAutocompleteModule,
|
|
83
|
+
MatInputModule,
|
|
84
|
+
MatOptionModule,
|
|
85
|
+
FormValidationHandlerModule,
|
|
86
|
+
], template: "\n<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\n <mat-form-field\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n\n <input class=\"hidden-error-directive-anchor\" [formControlName]=\"config.controlName\" type=\"text\"/>\n\n <input\n matInput\n [formControl]=\"autocompleteInputControl\"\n [placeholder]=\"config.placeholder\"\n [matAutocomplete]=\"auto\"\n role=\"textbox\"\n type=\"textbox\"\n autocapitalize=\"off\"\n autocorrect=\"off\"\n spellcheck=\"false\"\n #autoInput>\n\n <span *ngIf=\"config.fieldSuffix\" matSuffix>{{config.fieldSuffix}}</span>\n <crispr-info\n *ngIf=\"config.info\"\n matSuffix\n [info]=\"config.info \">\n </crispr-info>\n\n <mat-autocomplete\n #auto=\"matAutocomplete\"\n [autoActiveFirstOption]=\"config.autoActiveFirstOption\"\n (optionSelected)=\"handleSelect($event)\"\n [displayWith]=\"displayLabel(options$ | async)\">\n\n <ng-container *ngIf=\"options$ | async as options; else emptyOption\">\n <ng-container *ngIf=\"options.length > 0; else emptyOption\">\n <mat-option\n *ngFor=\"let option of options\"\n [value]=\"option.value\">\n <crispr-option [option]=\"option\"></crispr-option>\n </mat-option>\n </ng-container>\n\n </ng-container>\n <ng-template #emptyOption>\n <mat-option disabled=\"true\">\n {{config.emptyOptionsMessage}}\n </mat-option>\n </ng-template>\n\n </mat-autocomplete>\n\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n</crispr-field-container>\n", styles: [".hidden-error-directive-anchor{display:none}\n"] }]
|
|
87
|
+
}], propDecorators: { autoInput: [{
|
|
88
|
+
type: ViewChild,
|
|
89
|
+
args: ['autoInput', { read: MatAutocompleteTrigger }]
|
|
90
|
+
}], autoInputRef: [{
|
|
91
|
+
type: ViewChild,
|
|
92
|
+
args: ['autoInput']
|
|
93
|
+
}] } });
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Generated bundle index. Do not edit.
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
export { AutocompleteFieldComponent };
|
|
100
|
+
//# sourceMappingURL=tft-crispr-forms-ui-autocomplete-field.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tft-crispr-forms-ui-autocomplete-field.mjs","sources":["../../../../libs/crispr-forms/ui/autocomplete-field/autocomplete-field.component.ts","../../../../libs/crispr-forms/ui/autocomplete-field/autocomplete-field.component.html","../../../../libs/crispr-forms/ui/autocomplete-field/tft-crispr-forms-ui-autocomplete-field.ts"],"sourcesContent":["/* eslint-disable @nrwl/nx/enforce-module-boundaries */\nimport { Component, OnInit, ViewChild, ChangeDetectionStrategy, ElementRef, OnDestroy } from '@angular/core';\nimport { MatAutocompleteTrigger, MatAutocompleteSelectedEvent, MatAutocompleteModule } from '@angular/material/autocomplete';\n\nimport { Subscription } from 'rxjs';\nimport { CommonModule } from '@angular/common';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatOptionModule } from '@angular/material/core';\nimport { OptionComponent } from '@tft/crispr-forms/ui/option';\nimport { FormValidationHandlerModule } from '@tft/form-validation-handler';\n\nimport { FieldContainerComponent } from '@tft/crispr-forms/ui/field-container';\nimport { SelectOption, AbstractAutocompleteComponent, AutocompleteFieldConfig, DEFAULT_EMPTY_OPTIONS_MESSAGE } from '@tft/crispr-forms/utils';\nimport { InfoComponent } from '@tft/crispr-forms/ui/info';\n\nconst defaultConfig: Partial<AutocompleteFieldConfig> = {\n autoActiveFirstOption: true,\n typeDebounceTime: 500,\n emptyOptionsMessage: DEFAULT_EMPTY_OPTIONS_MESSAGE\n};\n\n@Component({\n selector: 'crispr-autocomplete-field',\n templateUrl: './autocomplete-field.component.html',\n styleUrls: ['./autocomplete-field.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n CommonModule,\n InfoComponent,\n OptionComponent,\n ReactiveFormsModule,\n FieldContainerComponent,\n MatAutocompleteModule,\n MatInputModule,\n MatOptionModule,\n FormValidationHandlerModule,\n ],\n})\nexport class AutocompleteFieldComponent\n extends AbstractAutocompleteComponent<AutocompleteFieldConfig>\n implements OnInit, OnDestroy {\n\n defaultConfig = defaultConfig;\n @ViewChild('autoInput', { read: MatAutocompleteTrigger }) autoInput: MatAutocompleteTrigger;\n @ViewChild('autoInput') autoInputRef: ElementRef<HTMLInputElement>;\n\n clearFieldSubscription: Subscription;\n\n ngOnInit() {\n super.ngOnInit();\n this.clearFieldSubscription = this.autocompleteInputControl.valueChanges.subscribe((text: string) => {\n if (typeof text === 'string' && text?.trim() === '') {\n this.control.setValue(null);\n }\n })\n }\n\n ngOnDestroy() {\n this.clearFieldSubscription.unsubscribe();\n }\n\n setControlValue(value: SelectOption) {\n if(this.control && value) {\n // sets the initial value on the control if one is passed\n this.control.setValue(value.value || '');\n this.autocompleteInputControl.setValue(value.label || '');\n }\n }\n\n /**\n * The material autocomplete defaults to displaying the options value instead of its label.\n * We only have the value from the selected option to work with, so we have to pass the options\n * through a function called in the template and return the function that the material displayWith\n * input is expecting.\n * @param options the array of options to search for option with corresponding value\n */\n displayLabel(options: SelectOption[]) {\n if (this.config.displayWith) {\n return this.config.displayWith(options);\n }\n return (value: any) => {\n const label: string = !!options && Array.isArray(options)\n ? options.find((option) => JSON.stringify(option.value) === JSON.stringify(value))?.label: value;\n return label\n };\n }\n\n handleSelect(event: MatAutocompleteSelectedEvent) {\n this.control.setValue(event.option.value)\n this.autoInputRef.nativeElement.blur();\n }\n}\n","\n<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\n <mat-form-field\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n\n <input class=\"hidden-error-directive-anchor\" [formControlName]=\"config.controlName\" type=\"text\"/>\n\n <input\n matInput\n [formControl]=\"autocompleteInputControl\"\n [placeholder]=\"config.placeholder\"\n [matAutocomplete]=\"auto\"\n role=\"textbox\"\n type=\"textbox\"\n autocapitalize=\"off\"\n autocorrect=\"off\"\n spellcheck=\"false\"\n #autoInput>\n\n <span *ngIf=\"config.fieldSuffix\" matSuffix>{{config.fieldSuffix}}</span>\n <crispr-info\n *ngIf=\"config.info\"\n matSuffix\n [info]=\"config.info \">\n </crispr-info>\n\n <mat-autocomplete\n #auto=\"matAutocomplete\"\n [autoActiveFirstOption]=\"config.autoActiveFirstOption\"\n (optionSelected)=\"handleSelect($event)\"\n [displayWith]=\"displayLabel(options$ | async)\">\n\n <ng-container *ngIf=\"options$ | async as options; else emptyOption\">\n <ng-container *ngIf=\"options.length > 0; else emptyOption\">\n <mat-option\n *ngFor=\"let option of options\"\n [value]=\"option.value\">\n <crispr-option [option]=\"option\"></crispr-option>\n </mat-option>\n </ng-container>\n\n </ng-container>\n <ng-template #emptyOption>\n <mat-option disabled=\"true\">\n {{config.emptyOptionsMessage}}\n </mat-option>\n </ng-template>\n\n </mat-autocomplete>\n\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n</crispr-field-container>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAgBA,MAAM,aAAa,GAAqC;AACtD,IAAA,qBAAqB,EAAE,IAAI;AAC3B,IAAA,gBAAgB,EAAE,GAAG;AACrB,IAAA,mBAAmB,EAAE,6BAA6B;CACnD,CAAC;AAoBI,MAAO,0BACX,SAAQ,6BAAsD,CAAA;AAnBhE,IAAA,WAAA,GAAA;;QAsBE,IAAa,CAAA,aAAA,GAAG,aAAa,CAAC;AAiD/B,KAAA;IA3CC,QAAQ,GAAA;QACN,KAAK,CAAC,QAAQ,EAAE,CAAC;AACjB,QAAA,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,wBAAwB,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,IAAY,KAAI;YAClG,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;AACnD,gBAAA,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC7B,aAAA;AACH,SAAC,CAAC,CAAA;KACH;IAED,WAAW,GAAA;AACT,QAAA,IAAI,CAAC,sBAAsB,CAAC,WAAW,EAAE,CAAC;KAC3C;AAED,IAAA,eAAe,CAAC,KAAmB,EAAA;AACjC,QAAA,IAAG,IAAI,CAAC,OAAO,IAAI,KAAK,EAAE;;YAExB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;YACzC,IAAI,CAAC,wBAAwB,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;AAC3D,SAAA;KAC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
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
|
3
|
+
import * as i5 from '@angular/forms';
|
|
4
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
5
|
+
import { map, startWith } from 'rxjs/operators';
|
|
6
|
+
import * as i1 from '@angular/common';
|
|
7
|
+
import { CommonModule } from '@angular/common';
|
|
8
|
+
import * as i2 from '@angular/material/button';
|
|
9
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
10
|
+
import * as i3 from '@angular/material/icon';
|
|
11
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
12
|
+
import * as i4 from '@angular/material/tooltip';
|
|
13
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
14
|
+
import * as i6 from '@tft/form-validation-handler';
|
|
15
|
+
import { FormValidationHandlerModule } from '@tft/form-validation-handler';
|
|
16
|
+
import { CrisprFieldComponent } from '@tft/crispr-forms/utils';
|
|
17
|
+
|
|
18
|
+
class ButtonComponent extends CrisprFieldComponent {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.defaultConfig = { buttonType: 'raised', type: 'submit' };
|
|
22
|
+
}
|
|
23
|
+
get matButtonClass() {
|
|
24
|
+
return this.config.buttonType ? `mat-${this.config.buttonType}-button` : '';
|
|
25
|
+
}
|
|
26
|
+
ngOnInit() {
|
|
27
|
+
super.ngOnInit();
|
|
28
|
+
this.formValid$ = this.group.statusChanges.pipe(map(status => status === 'VALID'), startWith(this.group.valid));
|
|
29
|
+
}
|
|
30
|
+
handleClick(group, event) {
|
|
31
|
+
if (this.config.callback) {
|
|
32
|
+
this.config.callback(group, event);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
ButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: ButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
37
|
+
ButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: ButtonComponent, isStandalone: true, selector: "crispr-button", usesInheritance: true, ngImport: i0, template: "<button\n [formGroup]=\"group\"\n mat-button\n [ngClass]=\"matButtonClass\"\n [color]=\"config.color\"\n [disabled]=\"config.disabledOnInvalidForm && !(formValid$ | async)\"\n [type]=\"config.type\"\n (click)=\"handleClick(group, $event)\"\n [matTooltip]=\"config.info?.content\"\n [matTooltipPosition]=\"config.info?.tooltipPosition || 'below'\">\n {{ config.label }}\n <mat-icon *ngIf=\"config.icon\">\n {{ config.icon}}\n </mat-icon>\n</button>\n\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i5.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormValidationHandlerModule }, { kind: "directive", type: i6.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
38
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: ButtonComponent, decorators: [{
|
|
39
|
+
type: Component,
|
|
40
|
+
args: [{ selector: 'crispr-button', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
|
|
41
|
+
CommonModule,
|
|
42
|
+
MatButtonModule,
|
|
43
|
+
MatIconModule,
|
|
44
|
+
MatTooltipModule,
|
|
45
|
+
ReactiveFormsModule,
|
|
46
|
+
FormValidationHandlerModule
|
|
47
|
+
], template: "<button\n [formGroup]=\"group\"\n mat-button\n [ngClass]=\"matButtonClass\"\n [color]=\"config.color\"\n [disabled]=\"config.disabledOnInvalidForm && !(formValid$ | async)\"\n [type]=\"config.type\"\n (click)=\"handleClick(group, $event)\"\n [matTooltip]=\"config.info?.content\"\n [matTooltipPosition]=\"config.info?.tooltipPosition || 'below'\">\n {{ config.label }}\n <mat-icon *ngIf=\"config.icon\">\n {{ config.icon}}\n </mat-icon>\n</button>\n\n" }]
|
|
48
|
+
}] });
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Generated bundle index. Do not edit.
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
export { ButtonComponent };
|
|
55
|
+
//# sourceMappingURL=tft-crispr-forms-ui-button.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tft-crispr-forms-ui-button.mjs","sources":["../../../../libs/crispr-forms/ui/button/button.component.ts","../../../../libs/crispr-forms/ui/button/button.component.html","../../../../libs/crispr-forms/ui/button/tft-crispr-forms-ui-button.ts"],"sourcesContent":["\nimport { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';\nimport { ReactiveFormsModule, FormGroup } from '@angular/forms';\nimport { Observable } from 'rxjs';\nimport { map, startWith } from 'rxjs/operators';\nimport { CommonModule } from '@angular/common';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatTooltipModule } from '@angular/material/tooltip';\nimport { FormValidationHandlerModule } from '@tft/form-validation-handler';\n// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries\nimport { CrisprFieldComponent, ButtonConfig } from '@tft/crispr-forms/utils';\n\n@Component({\n selector: 'crispr-button',\n templateUrl: './button.component.html',\n styleUrls: ['./button.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n CommonModule,\n MatButtonModule,\n MatIconModule,\n MatTooltipModule,\n ReactiveFormsModule,\n FormValidationHandlerModule\n ],\n})\nexport class ButtonComponent extends CrisprFieldComponent<ButtonConfig> implements OnInit {\n\n group: FormGroup;\n defaultConfig: Partial<ButtonConfig> = {buttonType: 'raised', type: 'submit'};\n formValid$: Observable<boolean>\n\n get matButtonClass () {\n return this.config.buttonType ? `mat-${this.config.buttonType}-button` : '';\n }\n\n ngOnInit() {\n super.ngOnInit();\n this.formValid$ = this.group.statusChanges.pipe(\n map(status => status === 'VALID'),\n startWith(this.group.valid),\n );\n }\n\n handleClick(group: FormGroup, event: MouseEvent) {\n if (this.config.callback) {\n this.config.callback(group, event);\n }\n }\n}\n","<button\n [formGroup]=\"group\"\n mat-button\n [ngClass]=\"matButtonClass\"\n [color]=\"config.color\"\n [disabled]=\"config.disabledOnInvalidForm && !(formValid$ | async)\"\n [type]=\"config.type\"\n (click)=\"handleClick(group, $event)\"\n [matTooltip]=\"config.info?.content\"\n [matTooltipPosition]=\"config.info?.tooltipPosition || 'below'\">\n {{ config.label }}\n <mat-icon *ngIf=\"config.icon\">\n {{ config.icon}}\n </mat-icon>\n</button>\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA4BM,MAAO,eAAgB,SAAQ,oBAAkC,CAAA;AAfvE,IAAA,WAAA,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A,CAAA,8BAAA,EAAA,QAAA,EAAA,sCAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,mBAAA,EAAA,IAAA,EAAA,CAAA,CAAA;2FAGlB,eAAe,EAAA,UAAA,EAAA,CAAA;kBAf3B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,eAAe,mBAGR,uBAAuB,CAAC,MAAM,EAAA,UAAA,EACnC,IAAI,EACP,OAAA,EAAA;wBACP,YAAY;wBACZ,eAAe;wBACf,aAAa;wBACb,gBAAgB;wBAChB,mBAAmB;wBACnB,2BAA2B;AAC5B,qBAAA,EAAA,QAAA,EAAA,odAAA,EAAA,CAAA;;;AE1BH;;AAEG;;;;"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i2 from '@angular/material/checkbox';
|
|
6
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
7
|
+
import * as i3 from '@angular/forms';
|
|
8
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
9
|
+
import * as i4 from '@tft/form-validation-handler';
|
|
10
|
+
import { FormValidationHandlerModule } from '@tft/form-validation-handler';
|
|
11
|
+
import { FieldContainerComponent } from '@tft/crispr-forms/ui/field-container';
|
|
12
|
+
import { crisprControlMixin, CrisprFieldComponent } from '@tft/crispr-forms/utils';
|
|
13
|
+
import { InfoComponent } from '@tft/crispr-forms/ui/info';
|
|
14
|
+
|
|
15
|
+
/* eslint-disable @nrwl/nx/enforce-module-boundaries */
|
|
16
|
+
const defaultConfig = {
|
|
17
|
+
labelPosition: 'after',
|
|
18
|
+
inline: false
|
|
19
|
+
};
|
|
20
|
+
const CheckboxFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
21
|
+
class CheckboxFieldComponent extends CheckboxFieldMixin {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.defaultConfig = defaultConfig;
|
|
25
|
+
}
|
|
26
|
+
ngOnInit() {
|
|
27
|
+
super.ngOnInit();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
CheckboxFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CheckboxFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
31
|
+
CheckboxFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: CheckboxFieldComponent, isStandalone: true, selector: "crispr-checkbox-field", usesInheritance: true, ngImport: i0, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\"\n [inlineField]=\"config.inline\">\n <div\n [formGroup]=\"group\">\n <mat-checkbox\n [color]=\"config.color\"\n [labelPosition]=\"config.labelPosition\"\n [formControlName]=\"config.controlName\">\n {{config.label}}\n <crispr-info\n matSuffix *ngIf=\"config.info\"\n [info]=\"config.info\">\n </crispr-info>\n </mat-checkbox>\n </div>\n</crispr-field-container>\n", styles: ["mat-checkbox{height:42px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: InfoComponent, selector: "crispr-info", inputs: ["info"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i2.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "ngmodule", type: FormValidationHandlerModule }, { kind: "directive", type: i4.ControlErrorsDirective, selector: "[formControl], [formControlName]" }, { kind: "directive", type: i4.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
32
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CheckboxFieldComponent, decorators: [{
|
|
33
|
+
type: Component,
|
|
34
|
+
args: [{ selector: 'crispr-checkbox-field', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
|
|
35
|
+
CommonModule,
|
|
36
|
+
InfoComponent,
|
|
37
|
+
MatCheckboxModule,
|
|
38
|
+
ReactiveFormsModule,
|
|
39
|
+
FieldContainerComponent,
|
|
40
|
+
FormValidationHandlerModule
|
|
41
|
+
], template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\"\n [inlineField]=\"config.inline\">\n <div\n [formGroup]=\"group\">\n <mat-checkbox\n [color]=\"config.color\"\n [labelPosition]=\"config.labelPosition\"\n [formControlName]=\"config.controlName\">\n {{config.label}}\n <crispr-info\n matSuffix *ngIf=\"config.info\"\n [info]=\"config.info\">\n </crispr-info>\n </mat-checkbox>\n </div>\n</crispr-field-container>\n", styles: ["mat-checkbox{height:42px}\n"] }]
|
|
42
|
+
}] });
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Generated bundle index. Do not edit.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
export { CheckboxFieldComponent };
|
|
49
|
+
//# sourceMappingURL=tft-crispr-forms-ui-checkbox-field.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tft-crispr-forms-ui-checkbox-field.mjs","sources":["../../../../libs/crispr-forms/ui/checkbox-field/checkbox-field.component.ts","../../../../libs/crispr-forms/ui/checkbox-field/checkbox-field.component.html","../../../../libs/crispr-forms/ui/checkbox-field/tft-crispr-forms-ui-checkbox-field.ts"],"sourcesContent":["/* eslint-disable @nrwl/nx/enforce-module-boundaries */\nimport { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { FormValidationHandlerModule } from '@tft/form-validation-handler';\nimport { FieldContainerComponent } from '@tft/crispr-forms/ui/field-container';\nimport { crisprControlMixin, CrisprFieldComponent, CheckboxFieldConfig } from '@tft/crispr-forms/utils';\nimport { InfoComponent } from '@tft/crispr-forms/ui/info';\n\nconst defaultConfig: Partial<CheckboxFieldConfig> = {\n labelPosition: 'after',\n inline: false\n}\nconst CheckboxFieldMixin = crisprControlMixin<CheckboxFieldConfig>(CrisprFieldComponent);\n\n@Component({\n selector: 'crispr-checkbox-field',\n templateUrl: './checkbox-field.component.html',\n styleUrls: ['./checkbox-field.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n CommonModule,\n InfoComponent,\n MatCheckboxModule,\n ReactiveFormsModule,\n FieldContainerComponent,\n FormValidationHandlerModule\n ],\n})\nexport class CheckboxFieldComponent extends CheckboxFieldMixin implements OnInit {\n\n defaultConfig = defaultConfig;\n ngOnInit() {\n super.ngOnInit();\n }\n}\n\n","<crispr-field-container\n [config]=\"config\"\n [group]=\"group\"\n [inlineField]=\"config.inline\">\n <div\n [formGroup]=\"group\">\n <mat-checkbox\n [color]=\"config.color\"\n [labelPosition]=\"config.labelPosition\"\n [formControlName]=\"config.controlName\">\n {{config.label}}\n <crispr-info\n matSuffix *ngIf=\"config.info\"\n [info]=\"config.info\">\n </crispr-info>\n </mat-checkbox>\n </div>\n</crispr-field-container>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;AAUA,MAAM,aAAa,GAAiC;AAClD,IAAA,aAAa,EAAE,OAAO;AACtB,IAAA,MAAM,EAAE,KAAK;CACd,CAAA;AACD,MAAM,kBAAkB,GAAG,kBAAkB,CAAsB,oBAAoB,CAAC,CAAC;AAiBnF,MAAO,sBAAuB,SAAQ,kBAAkB,CAAA;AAf9D,IAAA,WAAA,GAAA;;QAiBE,IAAa,CAAA,aAAA,GAAG,aAAa,CAAC;AAI/B,KAAA;IAHC,QAAQ,GAAA;QACN,KAAK,CAAC,QAAQ,EAAE,CAAC;KAClB;;mHALU,sBAAsB,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAtB,sBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,sBAAsB,EC/BnC,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,uBAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAAA,yeAkBA,EDKI,MAAA,EAAA,CAAA,6BAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,YAAY,EACZ,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,IAAA,EAAA,QAAA,EAAA,QAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,UAAA,EAAA,UAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,aAAa,EACb,QAAA,EAAA,aAAA,EAAA,MAAA,EAAA,CAAA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,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,mBAAA,EAAA,IAAA,EAAA,CAAA,CAAA;2FAGlB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAflC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,uBAAuB,mBAGhB,uBAAuB,CAAC,MAAM,EAAA,UAAA,EACnC,IAAI,EACP,OAAA,EAAA;wBACP,YAAY;wBACZ,aAAa;wBACb,iBAAiB;wBACjB,mBAAmB;wBACnB,uBAAuB;wBACvB,2BAA2B;AAC5B,qBAAA,EAAA,QAAA,EAAA,yeAAA,EAAA,MAAA,EAAA,CAAA,6BAAA,CAAA,EAAA,CAAA;;;AE7BH;;AAEG;;;;"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
|
3
|
+
import * as i2 from '@angular/material/datepicker';
|
|
4
|
+
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
5
|
+
import { MatDateFnsModule } from '@angular/material-date-fns-adapter';
|
|
6
|
+
import { of } from 'rxjs';
|
|
7
|
+
import * as i6 from '@angular/cdk/portal';
|
|
8
|
+
import { ComponentPortal, PortalModule } from '@angular/cdk/portal';
|
|
9
|
+
import * as i3 from '@angular/material/form-field';
|
|
10
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
11
|
+
import * as i1 from '@angular/common';
|
|
12
|
+
import { CommonModule } from '@angular/common';
|
|
13
|
+
import * as i4 from '@angular/forms';
|
|
14
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
15
|
+
import * as i5 from '@angular/material/input';
|
|
16
|
+
import { MatInputModule } from '@angular/material/input';
|
|
17
|
+
import * as i7 from '@tft/form-validation-handler';
|
|
18
|
+
import { FormValidationHandlerModule } from '@tft/form-validation-handler';
|
|
19
|
+
import { FieldContainerComponent } from '@tft/crispr-forms/ui/field-container';
|
|
20
|
+
import { crisprControlMixin, CrisprFieldComponent } from '@tft/crispr-forms/utils';
|
|
21
|
+
|
|
22
|
+
/* eslint-disable @nrwl/nx/enforce-module-boundaries */
|
|
23
|
+
const defaultConfig = {
|
|
24
|
+
startView: 'month',
|
|
25
|
+
};
|
|
26
|
+
const DatepickerFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
27
|
+
class DatepickerFieldComponent extends DatepickerFieldMixin {
|
|
28
|
+
constructor() {
|
|
29
|
+
super(...arguments);
|
|
30
|
+
this.defaultConfig = defaultConfig;
|
|
31
|
+
}
|
|
32
|
+
ngOnInit() {
|
|
33
|
+
super.ngOnInit();
|
|
34
|
+
this.startAt$ = this.config.startAt instanceof Date
|
|
35
|
+
? of(this.config.startAt)
|
|
36
|
+
: this.config.startAt instanceof Function
|
|
37
|
+
? this.config.startAt(this.group)
|
|
38
|
+
: of(null);
|
|
39
|
+
this.dateClass = this.config?.cellClassFunction || null;
|
|
40
|
+
this.dateClass$ = this.config.dateClass ? this.config?.dateClass(this.group) : of(() => '');
|
|
41
|
+
}
|
|
42
|
+
ngAfterContentInit() {
|
|
43
|
+
if (this.config.datepickerActions) {
|
|
44
|
+
this.calendarFooterPortal = new ComponentPortal(this.config.datepickerActions);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
DatepickerFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DatepickerFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
49
|
+
DatepickerFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: DatepickerFieldComponent, isStandalone: true, selector: "crispr-datepicker-field", usesInheritance: true, ngImport: i0, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <mat-form-field\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n <input\n matInput\n [formControlName]=\"config.controlName\"\n [min]=\"config.min\"\n [max]=\"config.max\"\n [matDatepicker]=\"picker\"\n [matDatepickerFilter]=\"config.datepickerFilter\">\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker\n [touchUi]=\"config.touchUi\"\n [startView]=\"config.startView\"\n [startAt]=\"startAt$ | async\"\n [dateClass]=\"dateClass || (dateClass$ | async)\"\n #picker>\n <mat-datepicker-actions *ngIf=\"calendarFooterPortal\">\n <ng-template [cdkPortalOutlet]=\"calendarFooterPortal\"></ng-template>\n </mat-datepicker-actions>\n </mat-datepicker>\n\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n</crispr-field-container>\n\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i2.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i2.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i2.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: i2.MatDatepickerActions, selector: "mat-datepicker-actions, mat-date-range-picker-actions" }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i4.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: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatDateFnsModule }, { kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i6.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "ngmodule", type: FormValidationHandlerModule }, { kind: "directive", type: i7.ControlErrorsDirective, selector: "[formControl], [formControlName]" }, { kind: "directive", type: i7.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
50
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DatepickerFieldComponent, decorators: [{
|
|
51
|
+
type: Component,
|
|
52
|
+
args: [{ selector: 'crispr-datepicker-field', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
|
|
53
|
+
CommonModule,
|
|
54
|
+
FieldContainerComponent,
|
|
55
|
+
MatDatepickerModule,
|
|
56
|
+
MatFormFieldModule,
|
|
57
|
+
ReactiveFormsModule,
|
|
58
|
+
MatInputModule,
|
|
59
|
+
MatDateFnsModule,
|
|
60
|
+
PortalModule,
|
|
61
|
+
FormValidationHandlerModule,
|
|
62
|
+
], template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <mat-form-field\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n <input\n matInput\n [formControlName]=\"config.controlName\"\n [min]=\"config.min\"\n [max]=\"config.max\"\n [matDatepicker]=\"picker\"\n [matDatepickerFilter]=\"config.datepickerFilter\">\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker\n [touchUi]=\"config.touchUi\"\n [startView]=\"config.startView\"\n [startAt]=\"startAt$ | async\"\n [dateClass]=\"dateClass || (dateClass$ | async)\"\n #picker>\n <mat-datepicker-actions *ngIf=\"calendarFooterPortal\">\n <ng-template [cdkPortalOutlet]=\"calendarFooterPortal\"></ng-template>\n </mat-datepicker-actions>\n </mat-datepicker>\n\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n</crispr-field-container>\n\n" }]
|
|
63
|
+
}] });
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Generated bundle index. Do not edit.
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
export { DatepickerFieldComponent };
|
|
70
|
+
//# sourceMappingURL=tft-crispr-forms-ui-datepicker-field.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tft-crispr-forms-ui-datepicker-field.mjs","sources":["../../../../libs/crispr-forms/ui/datepicker-field/datepicker-field.component.ts","../../../../libs/crispr-forms/ui/datepicker-field/datepicker-field.component.html","../../../../libs/crispr-forms/ui/datepicker-field/tft-crispr-forms-ui-datepicker-field.ts"],"sourcesContent":["/* eslint-disable @nrwl/nx/enforce-module-boundaries */\nimport { Component, OnInit, ChangeDetectionStrategy, AfterContentInit } from '@angular/core';\nimport { MatCalendarCellClassFunction, MatDatepickerModule } from '@angular/material/datepicker';\nimport { MatDateFnsModule } from '@angular/material-date-fns-adapter';\nimport { Observable, of } from 'rxjs';\nimport { ComponentPortal, Portal, PortalModule } from '@angular/cdk/portal';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { CommonModule } from '@angular/common';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { MatInputModule } from '@angular/material/input';\nimport { FormValidationHandlerModule } from '@tft/form-validation-handler';\nimport { FieldContainerComponent } from '@tft/crispr-forms/ui/field-container';\nimport { crisprControlMixin, CrisprFieldComponent, DatepickerFieldConfig } from '@tft/crispr-forms/utils';\n\nconst defaultConfig: Partial<DatepickerFieldConfig> = {\n startView: 'month',\n}\nconst DatepickerFieldMixin = crisprControlMixin<DatepickerFieldConfig>(CrisprFieldComponent);\n\n@Component({\n selector: 'crispr-datepicker-field',\n templateUrl: './datepicker-field.component.html',\n styleUrls: ['./datepicker-field.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n CommonModule,\n FieldContainerComponent,\n MatDatepickerModule,\n MatFormFieldModule,\n ReactiveFormsModule,\n MatInputModule,\n MatDateFnsModule,\n PortalModule,\n FormValidationHandlerModule,\n ],\n})\nexport class DatepickerFieldComponent extends DatepickerFieldMixin implements OnInit, AfterContentInit {\n\n defaultConfig = defaultConfig;\n\n dateClass: MatCalendarCellClassFunction<Date>;\n dateClass$: Observable<MatCalendarCellClassFunction<Date>>;\n startAt$: Observable<Date>;\n\n /** A portal containing the footer component type for this calendar. */\n calendarFooterPortal: Portal<any>;\n\n ngOnInit() {\n super.ngOnInit();\n this.startAt$ = this.config.startAt instanceof Date\n ? of(this.config.startAt)\n : this.config.startAt instanceof Function\n ? this.config.startAt(this.group)\n : of(null);\n this.dateClass = this.config?.cellClassFunction || null\n this.dateClass$ = this.config.dateClass ? this.config?.dateClass(this.group) : of(() => '');\n }\n\n ngAfterContentInit() {\n if (this.config.datepickerActions) {\n this.calendarFooterPortal = new ComponentPortal(this.config.datepickerActions);\n }\n }\n\n // handleSelectedChange(event, picker: MatDatepicker<unknown>) {\n // console.log({event, picker})\n // if(this.config.selectedChange) {\n // this.config.selectedChange(event, picker);\n // }\n // }\n}\n","<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <mat-form-field\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n <input\n matInput\n [formControlName]=\"config.controlName\"\n [min]=\"config.min\"\n [max]=\"config.max\"\n [matDatepicker]=\"picker\"\n [matDatepickerFilter]=\"config.datepickerFilter\">\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker\n [touchUi]=\"config.touchUi\"\n [startView]=\"config.startView\"\n [startAt]=\"startAt$ | async\"\n [dateClass]=\"dateClass || (dateClass$ | async)\"\n #picker>\n <mat-datepicker-actions *ngIf=\"calendarFooterPortal\">\n <ng-template [cdkPortalOutlet]=\"calendarFooterPortal\"></ng-template>\n </mat-datepicker-actions>\n </mat-datepicker>\n\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n</crispr-field-container>\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAcA,MAAM,aAAa,GAAmC;AACpD,IAAA,SAAS,EAAE,OAAO;CACnB,CAAA;AACD,MAAM,oBAAoB,GAAG,kBA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AAA,EAAA,mBAAA,EAAA,IAAA,EAAA,CAAA,CAAA;2FAGlB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBAlBpC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,yBAAyB,mBAGlB,uBAAuB,CAAC,MAAM,EAAA,UAAA,EACnC,IAAI,EACP,OAAA,EAAA;wBACP,YAAY;wBACZ,uBAAuB;wBACvB,mBAAmB;wBACnB,kBAAkB;wBAClB,mBAAmB;wBACnB,cAAc;wBACd,gBAAgB;wBAChB,YAAY;wBACZ,2BAA2B;AAC5B,qBAAA,EAAA,QAAA,EAAA,mnCAAA,EAAA,CAAA;;;AEnCH;;AAEG;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component } from '@angular/core';
|
|
3
|
+
import * as i2 from '@angular/material/divider';
|
|
4
|
+
import { MatDividerModule } from '@angular/material/divider';
|
|
5
|
+
import * as i1 from '@angular/common';
|
|
6
|
+
import { CommonModule } from '@angular/common';
|
|
7
|
+
import { CrisprFieldComponent } from '@tft/crispr-forms/utils';
|
|
8
|
+
|
|
9
|
+
class DividerComponent extends CrisprFieldComponent {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
// TODO: pull in type after configs are better organized
|
|
13
|
+
this.defaultConfig = {};
|
|
14
|
+
}
|
|
15
|
+
ngOnInit() {
|
|
16
|
+
super.ngOnInit();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
DividerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DividerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
20
|
+
DividerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: DividerComponent, isStandalone: true, selector: "crispr-divider", usesInheritance: true, ngImport: i0, template: "<mat-divider [ngClass]=\"config.classes\"></mat-divider>", styles: [":host{display:block;padding:1em 0}::ng-deep .mat-divider.mat-divider-horizontal{position:relative}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i2.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }], preserveWhitespaces: true });
|
|
21
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DividerComponent, decorators: [{
|
|
22
|
+
type: Component,
|
|
23
|
+
args: [{ selector: 'crispr-divider', standalone: true, imports: [
|
|
24
|
+
CommonModule,
|
|
25
|
+
MatDividerModule
|
|
26
|
+
], template: "<mat-divider [ngClass]=\"config.classes\"></mat-divider>", styles: [":host{display:block;padding:1em 0}::ng-deep .mat-divider.mat-divider-horizontal{position:relative}\n"] }]
|
|
27
|
+
}] });
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Generated bundle index. Do not edit.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
export { DividerComponent };
|
|
34
|
+
//# sourceMappingURL=tft-crispr-forms-ui-divider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tft-crispr-forms-ui-divider.mjs","sources":["../../../../libs/crispr-forms/ui/divider/divider.component.ts","../../../../libs/crispr-forms/ui/divider/divider.component.html","../../../../libs/crispr-forms/ui/divider/tft-crispr-forms-ui-divider.ts"],"sourcesContent":["import { Component, OnInit } from '@angular/core';\nimport { MatDividerModule } from '@angular/material/divider';\nimport { CommonModule } from '@angular/common';\n// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries\nimport { CrisprFieldComponent, DividerConfig } from '@tft/crispr-forms/utils';\n\n@Component({\n selector: 'crispr-divider',\n templateUrl: './divider.component.html',\n styleUrls: ['./divider.component.scss'],\n standalone: true,\n imports: [\n CommonModule,\n MatDividerModule\n ],\n})\nexport class DividerComponent extends CrisprFieldComponent<DividerConfig> implements OnInit {\n // TODO: pull in type after configs are better organized\n defaultConfig = {};\n ngOnInit() {\n super.ngOnInit();\n }\n\n}\n","<mat-divider [ngClass]=\"config.classes\"></mat-divider>","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAgBM,MAAO,gBAAiB,SAAQ,oBAAmC,CAAA;AAVzE,IAAA,WAAA,GAAA;;;QAYE,IAAa,CAAA,aAAA,GAAG,EAAE,CAAC;AAKpB,KAAA;IAJC,QAAQ,GAAA;QACN,KAAK,CAAC,QAAQ,EAAE,CAAC;KAClB;;6GALU,gBAAgB,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAhB,gBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,gBAAgB,EChB7B,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,gBAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAAA,0DAAsD,EDYlD,MAAA,EAAA,CAAA,sGAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,YAAY,4HACZ,gBAAgB,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,UAAA,EAAA,QAAA,EAAA,aAAA,EAAA,MAAA,EAAA,CAAA,UAAA,EAAA,OAAA,CAAA,EAAA,CAAA,EAAA,mBAAA,EAAA,IAAA,EAAA,CAAA,CAAA;2FAGP,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAV5B,SAAS;+BACE,gBAAgB,EAAA,UAAA,EAGd,IAAI,EACP,OAAA,EAAA;wBACP,YAAY;wBACZ,gBAAgB;AACjB,qBAAA,EAAA,QAAA,EAAA,0DAAA,EAAA,MAAA,EAAA,CAAA,sGAAA,CAAA,EAAA,CAAA;;;AEdH;;AAEG;;;;"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as i2 from '@angular/common';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { Component, ChangeDetectionStrategy, Optional, Self, ViewChild } from '@angular/core';
|
|
5
|
+
import * as i1 from '@angular/forms';
|
|
6
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
7
|
+
import * as i4 from '@angular/material/button';
|
|
8
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
9
|
+
import * as i5 from '@angular/material/form-field';
|
|
10
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
11
|
+
import * as i3 from '@angular/material/icon';
|
|
12
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
13
|
+
import * as i6 from '@angular/material/input';
|
|
14
|
+
import { MatInputModule } from '@angular/material/input';
|
|
15
|
+
import { of } from 'rxjs';
|
|
16
|
+
import { FileDropzoneDirective } from '@tft/crispr-forms/ui/file-dropzone';
|
|
17
|
+
import * as i7 from '@tft/form-validation-handler';
|
|
18
|
+
import { FormValidationHandlerModule } from '@tft/form-validation-handler';
|
|
19
|
+
import { crisprControlMixin, CrisprFieldComponent } from '@tft/crispr-forms/utils';
|
|
20
|
+
import { FieldContainerComponent } from '@tft/crispr-forms/ui/field-container';
|
|
21
|
+
import { SelectedFileComponent } from '@tft/crispr-forms/ui/selected-file';
|
|
22
|
+
|
|
23
|
+
/* eslint-disable @nrwl/nx/enforce-module-boundaries */
|
|
24
|
+
const FileUploadFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
25
|
+
class FileUploadFieldComponent extends FileUploadFieldMixin {
|
|
26
|
+
// ngControl: NgControl = null;
|
|
27
|
+
constructor(ngControl) {
|
|
28
|
+
super();
|
|
29
|
+
this.ngControl = ngControl;
|
|
30
|
+
this.defaultConfig = {
|
|
31
|
+
allowMultipleFiles: false,
|
|
32
|
+
acceptedTypes: '*.*',
|
|
33
|
+
dropZoneText: 'DROP FILE HERE',
|
|
34
|
+
selectFilesButtonType: 'button',
|
|
35
|
+
selectButtonText: 'SELECT',
|
|
36
|
+
showClearFilesButton: true,
|
|
37
|
+
clearFilesButtonText: 'CLEAR',
|
|
38
|
+
uploadButtonText: 'UPLOAD',
|
|
39
|
+
uploadButtonType: 'button',
|
|
40
|
+
showUploadProgress: false,
|
|
41
|
+
disableOnUpload: true
|
|
42
|
+
};
|
|
43
|
+
this.isUploaded = false;
|
|
44
|
+
this.fileProgress = [];
|
|
45
|
+
if (this.ngControl != null) {
|
|
46
|
+
// Setting the value accessor directly (instead of using
|
|
47
|
+
// the providers) to avoid running into a circular import.
|
|
48
|
+
ngControl.valueAccessor = this;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
ngOnInit() {
|
|
52
|
+
super.ngOnInit();
|
|
53
|
+
this.disabled$ = this.config.disabledCallback
|
|
54
|
+
? this.config.disabledCallback(this.group)
|
|
55
|
+
: of(false);
|
|
56
|
+
}
|
|
57
|
+
filesChanged(files) {
|
|
58
|
+
if (files && files.length > 0) {
|
|
59
|
+
this.selectedFiles = files;
|
|
60
|
+
this.control.patchValue(files);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
uploadFiles() {
|
|
64
|
+
if (this.selectedFiles && this.config.uploadFiles) {
|
|
65
|
+
this.isUploaded = true;
|
|
66
|
+
this.config.uploadFiles(this.group, this.selectedFiles, this);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
resetFileInput() {
|
|
70
|
+
this.fileInputRef.nativeElement.value = '';
|
|
71
|
+
this.control.patchValue(null);
|
|
72
|
+
this.isUploaded = false;
|
|
73
|
+
}
|
|
74
|
+
writeValue(value) {
|
|
75
|
+
// clear file input
|
|
76
|
+
// this.host.nativeElement.value = '';
|
|
77
|
+
// this.file = null;
|
|
78
|
+
}
|
|
79
|
+
registerOnChange(fn) {
|
|
80
|
+
this.onChange = fn;
|
|
81
|
+
}
|
|
82
|
+
registerOnTouched(fn) {
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
FileUploadFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FileUploadFieldComponent, deps: [{ token: i1.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
86
|
+
FileUploadFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: FileUploadFieldComponent, isStandalone: true, selector: "crispr-file-upload-field", viewQueries: [{ propertyName: "fileInputRef", first: true, predicate: ["fileInput"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <mat-form-field floatLabel=\"always\"\n [color]=\"config.color\"\n appearance=\"outline\"\n [crisprFileDropzone]=\"!(disabled$ | async) && !(config.disableOnUpload && isUploaded)\"\n [formGroup]=\"group\"\n (fileDrop)=\"filesChanged($event)\">\n\n <input [formControlName]=\"config.controlName\" matInput type=\"text\"/>\n <input\n #fileInput\n type=\"file\"\n style=\"display: none\"\n [accept]=\"config.acceptedTypes\"\n [multiple]=\"config.allowMultipleFiles\"\n (change)=\"filesChanged($event.target.files)\"/>\n <mat-label>{{config.label}}</mat-label>\n\n <div *ngIf=\"!(selectedFiles?.length > 0); else selectedFileList\" class=\"drop-info\">\n <mat-icon class=\"drop-icon\" inline=\"true\">cloud_upload</mat-icon>\n <h2 class=\"mat-h2\">{{config.dropZoneText}}</h2>\n or\n <button\n mat-raised-button\n type=\"button\"\n color=\"primary\"\n [disabled]=\"(disabled$ | async) || config.disableOnUpload && isUploaded\"\n (click)=\"fileInput.click()\"\n [attr.aria-label]=\"config.controlName\">\n {{config.selectButtonText}}\n </button>\n </div>\n <ng-template #selectedFileList>\n <div class=\"selected-files-container\">\n <div class=\"selected-files-list\">\n <crispr-selected-file\n *ngFor=\"let file of selectedFiles; let i = index;\"\n [color]=\"config.color === 'primary' ? 'accent' : 'primary'\"\n [fileName]=\"file.name\"\n [showProgress]=\"config.showUploadProgress\"\n [progress]=\"fileProgress && (fileProgress[i] | async)\">\n </crispr-selected-file>\n </div>\n\n </div>\n </ng-template>\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n </mat-form-field>\n <div class=\"button-container\" *ngIf=\"selectedFiles?.length > 0\">\n\n <button\n mat-button\n (click)=\"resetFileInput()\"\n type=\"button\"\n [disabled]=\"(disabled$ | async) || (config.disableOnUpload && isUploaded)\"\n aria-label=\"Remove Selected File(s)\">\n {{config.clearFilesButtonText}}\n <mat-icon>delete</mat-icon>\n </button>\n\n <button\n *ngIf=\"!!config.uploadFiles\"\n mat-raised-button\n type=\"button\"\n color=\"accent\"\n class=\"file-input-button\"\n [disabled]=\"(disabled$ | async) || (config.disableOnUpload && isUploaded)\"\n (click)=\"uploadFiles()\"\n [attr.aria-label]=\"config.uploadButtonText\">\n {{ config.uploadButtonText }}\n </button>\n\n </div>\n</crispr-field-container>\n", styles: [":host ::ng-deep .mat-form-field .mat-form-field-infix{padding-top:0;display:flex;justify-content:center}:host .drop-info{display:flex;flex-direction:column;align-items:center}:host .drop-info .drop-icon{font-size:36px}:host .drop-info .mat-h2{margin:0}:host .button-container{display:flex;justify-content:flex-end;margin-top:-16px}:host .button-container button{margin-left:8px}:host .selected-files-container{width:100%}:host [matInput]{position:absolute;max-height:0;visibility:hidden}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i5.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i6.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: SelectedFileComponent, selector: "crispr-selected-file", inputs: ["fileName", "progress", "showProgress", "color"] }, { kind: "ngmodule", type: FormValidationHandlerModule }, { kind: "directive", type: i7.ControlErrorsDirective, selector: "[formControl], [formControlName]" }, { kind: "directive", type: i7.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }, { kind: "directive", type: FileDropzoneDirective, selector: "[crisprFileDropzone]", inputs: ["crisprFileDropzone"], outputs: ["fileDrop"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
87
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FileUploadFieldComponent, decorators: [{
|
|
88
|
+
type: Component,
|
|
89
|
+
args: [{ selector: 'crispr-file-upload-field', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
|
|
90
|
+
CommonModule,
|
|
91
|
+
FieldContainerComponent,
|
|
92
|
+
ReactiveFormsModule,
|
|
93
|
+
MatIconModule,
|
|
94
|
+
MatButtonModule,
|
|
95
|
+
MatFormFieldModule,
|
|
96
|
+
MatInputModule,
|
|
97
|
+
SelectedFileComponent,
|
|
98
|
+
FormValidationHandlerModule,
|
|
99
|
+
FileDropzoneDirective,
|
|
100
|
+
], template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <mat-form-field floatLabel=\"always\"\n [color]=\"config.color\"\n appearance=\"outline\"\n [crisprFileDropzone]=\"!(disabled$ | async) && !(config.disableOnUpload && isUploaded)\"\n [formGroup]=\"group\"\n (fileDrop)=\"filesChanged($event)\">\n\n <input [formControlName]=\"config.controlName\" matInput type=\"text\"/>\n <input\n #fileInput\n type=\"file\"\n style=\"display: none\"\n [accept]=\"config.acceptedTypes\"\n [multiple]=\"config.allowMultipleFiles\"\n (change)=\"filesChanged($event.target.files)\"/>\n <mat-label>{{config.label}}</mat-label>\n\n <div *ngIf=\"!(selectedFiles?.length > 0); else selectedFileList\" class=\"drop-info\">\n <mat-icon class=\"drop-icon\" inline=\"true\">cloud_upload</mat-icon>\n <h2 class=\"mat-h2\">{{config.dropZoneText}}</h2>\n or\n <button\n mat-raised-button\n type=\"button\"\n color=\"primary\"\n [disabled]=\"(disabled$ | async) || config.disableOnUpload && isUploaded\"\n (click)=\"fileInput.click()\"\n [attr.aria-label]=\"config.controlName\">\n {{config.selectButtonText}}\n </button>\n </div>\n <ng-template #selectedFileList>\n <div class=\"selected-files-container\">\n <div class=\"selected-files-list\">\n <crispr-selected-file\n *ngFor=\"let file of selectedFiles; let i = index;\"\n [color]=\"config.color === 'primary' ? 'accent' : 'primary'\"\n [fileName]=\"file.name\"\n [showProgress]=\"config.showUploadProgress\"\n [progress]=\"fileProgress && (fileProgress[i] | async)\">\n </crispr-selected-file>\n </div>\n\n </div>\n </ng-template>\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n </mat-form-field>\n <div class=\"button-container\" *ngIf=\"selectedFiles?.length > 0\">\n\n <button\n mat-button\n (click)=\"resetFileInput()\"\n type=\"button\"\n [disabled]=\"(disabled$ | async) || (config.disableOnUpload && isUploaded)\"\n aria-label=\"Remove Selected File(s)\">\n {{config.clearFilesButtonText}}\n <mat-icon>delete</mat-icon>\n </button>\n\n <button\n *ngIf=\"!!config.uploadFiles\"\n mat-raised-button\n type=\"button\"\n color=\"accent\"\n class=\"file-input-button\"\n [disabled]=\"(disabled$ | async) || (config.disableOnUpload && isUploaded)\"\n (click)=\"uploadFiles()\"\n [attr.aria-label]=\"config.uploadButtonText\">\n {{ config.uploadButtonText }}\n </button>\n\n </div>\n</crispr-field-container>\n", styles: [":host ::ng-deep .mat-form-field .mat-form-field-infix{padding-top:0;display:flex;justify-content:center}:host .drop-info{display:flex;flex-direction:column;align-items:center}:host .drop-info .drop-icon{font-size:36px}:host .drop-info .mat-h2{margin:0}:host .button-container{display:flex;justify-content:flex-end;margin-top:-16px}:host .button-container button{margin-left:8px}:host .selected-files-container{width:100%}:host [matInput]{position:absolute;max-height:0;visibility:hidden}\n"] }]
|
|
101
|
+
}], ctorParameters: function () { return [{ type: i1.NgControl, decorators: [{
|
|
102
|
+
type: Optional
|
|
103
|
+
}, {
|
|
104
|
+
type: Self
|
|
105
|
+
}] }]; }, propDecorators: { fileInputRef: [{
|
|
106
|
+
type: ViewChild,
|
|
107
|
+
args: ['fileInput']
|
|
108
|
+
}] } });
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Generated bundle index. Do not edit.
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
export { FileUploadFieldComponent };
|
|
115
|
+
//# sourceMappingURL=tft-crispr-forms-ui-file-upload-field.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tft-crispr-forms-ui-file-upload-field.mjs","sources":["../../../../libs/crispr-forms/ui/file-upload-field/file-upload-field.component.ts","../../../../libs/crispr-forms/ui/file-upload-field/file-upload-field.component.html","../../../../libs/crispr-forms/ui/file-upload-field/tft-crispr-forms-ui-file-upload-field.ts"],"sourcesContent":["/* eslint-disable @nrwl/nx/enforce-module-boundaries */\nimport { CommonModule } from '@angular/common';\nimport {\n Component,\n ElementRef,\n ViewChild,\n OnInit,\n ChangeDetectionStrategy,\n Optional,\n Self,\n} from '@angular/core';\nimport { ControlValueAccessor, NgControl, ReactiveFormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatInputModule } from '@angular/material/input';\nimport { Observable, of } from 'rxjs';\nimport { FileDropzoneDirective } from '@tft/crispr-forms/ui/file-dropzone';\nimport { FormValidationHandlerModule } from '@tft/form-validation-handler';\n\nimport { crisprControlMixin, CrisprFieldComponent, FileUploadFieldConfig } from '@tft/crispr-forms/utils';\nimport { FieldContainerComponent } from '@tft/crispr-forms/ui/field-container';\nimport { SelectedFileComponent } from '@tft/crispr-forms/ui/selected-file';\n\nconst FileUploadFieldMixin = crisprControlMixin<FileUploadFieldConfig>(CrisprFieldComponent);\n\n@Component({\n selector: 'crispr-file-upload-field',\n templateUrl: './file-upload-field.component.html',\n styleUrls: ['./file-upload-field.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n CommonModule,\n FieldContainerComponent,\n ReactiveFormsModule,\n MatIconModule,\n MatButtonModule,\n MatFormFieldModule,\n MatInputModule,\n SelectedFileComponent,\n FormValidationHandlerModule,\n FileDropzoneDirective,\n ],\n})\nexport class FileUploadFieldComponent extends FileUploadFieldMixin implements OnInit, ControlValueAccessor {\n\n onChange: () => void;\n\n defaultConfig: Partial<FileUploadFieldConfig> = {\n allowMultipleFiles: false,\n acceptedTypes: '*.*',\n dropZoneText: 'DROP FILE HERE',\n selectFilesButtonType: 'button',\n selectButtonText: 'SELECT',\n showClearFilesButton: true,\n clearFilesButtonText: 'CLEAR',\n uploadButtonText: 'UPLOAD',\n uploadButtonType: 'button',\n showUploadProgress: false,\n disableOnUpload: true\n }\n\n @ViewChild('fileInput') fileInputRef: ElementRef\n\n selectedFiles: FileList;\n\n isUploaded = false;\n\n fileProgress: Observable<number>[] = [];\n disabled$: Observable<boolean>;\n\n // ngControl: NgControl = null;\n constructor(\n @Optional() @Self() public ngControl: NgControl,\n ) {\n super();\n if (this.ngControl != null) {\n // Setting the value accessor directly (instead of using\n // the providers) to avoid running into a circular import.\n ngControl.valueAccessor = this;\n }\n }\n\n ngOnInit() {\n super.ngOnInit();\n this.disabled$ = this.config.disabledCallback\n ? this.config.disabledCallback(this.group)\n : of(false);\n }\n\n\n filesChanged(files: FileList): void {\n if (files && files.length > 0 ) {\n this.selectedFiles = files\n this.control.patchValue(files);\n }\n }\n\n uploadFiles() {\n if(this.selectedFiles && this.config.uploadFiles) {\n this.isUploaded = true;\n this.config.uploadFiles(this.group, this.selectedFiles, this);\n }\n }\n\n resetFileInput(): void {\n this.fileInputRef.nativeElement.value = ''\n this.control.patchValue(null);\n this.isUploaded = false;\n }\n\n writeValue( value: null ) {\n // clear file input\n // this.host.nativeElement.value = '';\n // this.file = null;\n }\n\n registerOnChange( fn: () => void ) {\n this.onChange = fn;\n }\n\n registerOnTouched( fn: () => void ) {\n }\n}\n","<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <mat-form-field floatLabel=\"always\"\n [color]=\"config.color\"\n appearance=\"outline\"\n [crisprFileDropzone]=\"!(disabled$ | async) && !(config.disableOnUpload && isUploaded)\"\n [formGroup]=\"group\"\n (fileDrop)=\"filesChanged($event)\">\n\n <input [formControlName]=\"config.controlName\" matInput type=\"text\"/>\n <input\n #fileInput\n type=\"file\"\n style=\"display: none\"\n [accept]=\"config.acceptedTypes\"\n [multiple]=\"config.allowMultipleFiles\"\n (change)=\"filesChanged($event.target.files)\"/>\n <mat-label>{{config.label}}</mat-label>\n\n <div *ngIf=\"!(selectedFiles?.length > 0); else selectedFileList\" class=\"drop-info\">\n <mat-icon class=\"drop-icon\" inline=\"true\">cloud_upload</mat-icon>\n <h2 class=\"mat-h2\">{{config.dropZoneText}}</h2>\n or\n <button\n mat-raised-button\n type=\"button\"\n color=\"primary\"\n [disabled]=\"(disabled$ | async) || config.disableOnUpload && isUploaded\"\n (click)=\"fileInput.click()\"\n [attr.aria-label]=\"config.controlName\">\n {{config.selectButtonText}}\n </button>\n </div>\n <ng-template #selectedFileList>\n <div class=\"selected-files-container\">\n <div class=\"selected-files-list\">\n <crispr-selected-file\n *ngFor=\"let file of selectedFiles; let i = index;\"\n [color]=\"config.color === 'primary' ? 'accent' : 'primary'\"\n [fileName]=\"file.name\"\n [showProgress]=\"config.showUploadProgress\"\n [progress]=\"fileProgress && (fileProgress[i] | async)\">\n </crispr-selected-file>\n </div>\n\n </div>\n </ng-template>\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n </mat-form-field>\n <div class=\"button-container\" *ngIf=\"selectedFiles?.length > 0\">\n\n <button\n mat-button\n (click)=\"resetFileInput()\"\n type=\"button\"\n [disabled]=\"(disabled$ | async) || (config.disableOnUpload && isUploaded)\"\n aria-label=\"Remove Selected File(s)\">\n {{config.clearFilesButtonText}}\n <mat-icon>delete</mat-icon>\n </button>\n\n <button\n *ngIf=\"!!config.uploadFiles\"\n mat-raised-button\n type=\"button\"\n color=\"accent\"\n class=\"file-input-button\"\n [disabled]=\"(disabled$ | async) || (config.disableOnUpload && isUploaded)\"\n (click)=\"uploadFiles()\"\n [attr.aria-label]=\"config.uploadButtonText\">\n {{ config.uploadButtonText }}\n </button>\n\n </div>\n</crispr-field-container>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AAwBA,MAAM,oBAAoB,GAAG,kBAAkB,CAAwB,oBAAoB,CAAC,CAAC;AAqBvF,MAAO,wBAAyB,SAAQ,oBAAoB,CAAA;;AA4BhE,IAAA,WAAA,CAC6B,SAAoB,EAAA;AAE/C,QAAA,KAAK,EAAE,CAAC;QAFmB,IAAS,CAAA,SAAA,GAAT,SAAS,CAAW;AAzBjD,QAAA,IAAA,CAAA,aAAa,GAAmC;AAC9C,YAAA,kBAAkB,EAAE,KAAK;AACzB,YAAA,aAAa,EAAE,KAAK;AACpB,YAAA,YAAY,EAAE,gBAAgB;AAC9B,YAAA,qBAAqB,EAAE,QAAQ;AAC/B,YAAA,gBAAgB,EAAE,QAAQ;AAC1B,YAAA,oBAAoB,EAAE,IAAI;AAC1B,YAAA,oBAAoB,EAAE,OAAO;AAC7B,YAAA,gBAAgB,EAAE,QAAQ;AAC1B,YAAA,gBAAgB,EAAE,QAAQ;AAC1B,YAAA,kBAAkB,EAAE,KAAK;AACzB,YAAA,eAAe,EAAE,IAAI;SACtB,CAAA;QAMD,IAAU,CAAA,UAAA,GAAG,KAAK,CAAC;QAEnB,IAAY,CAAA,YAAA,GAAyB,EAAE,CAAC;AAQtC,QAAA,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,E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