@tft/crispr-forms 13.0.16 → 13.0.19
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/lib/field-component-map.const.mjs +2 -2
- package/esm2020/lib/field.directive.mjs +10 -6
- package/esm2020/lib/form-group-list/form-group-list.component.mjs +16 -3
- package/esm2020/lib/material/image-upload-field/image-upload-field.component.mjs +1 -6
- package/esm2020/lib/sub-group/sub-group.component.mjs +4 -4
- package/fesm2015/tft-crispr-forms.mjs +26 -14
- package/fesm2015/tft-crispr-forms.mjs.map +1 -1
- package/fesm2020/tft-crispr-forms.mjs +26 -14
- package/fesm2020/tft-crispr-forms.mjs.map +1 -1
- package/lib/field.directive.d.ts +4 -3
- package/lib/form-group-list/form-group-list.component.d.ts +7 -0
- package/lib/material/image-upload-field/image-upload-field.component.d.ts +0 -3
- package/package.json +1 -1
- package/tft-crispr-forms-13.0.19.tgz +0 -0
- package/tft-crispr-forms-13.0.16.tgz +0 -0
|
@@ -1160,10 +1160,6 @@ class ImageUploadFieldComponent extends ImageUploadFieldMixin {
|
|
|
1160
1160
|
minCompressionThresholdMb: .6,
|
|
1161
1161
|
useWebWorker: true,
|
|
1162
1162
|
};
|
|
1163
|
-
/**
|
|
1164
|
-
* The url mapped from initial input value, consumers can us mapInputValueToUrl in config to transform their input value into a src url for the image element
|
|
1165
|
-
*/
|
|
1166
|
-
// inputValueUrl: string | undefined;
|
|
1167
1163
|
this.inputImageFileSubject = new Subject();
|
|
1168
1164
|
this.inputImageFile$ = this.inputImageFileSubject.asObservable().pipe(shareReplay(1));
|
|
1169
1165
|
this.compressedFile$ = this.inputImageFile$.pipe(switchMap(async (file) => {
|
|
@@ -1225,7 +1221,6 @@ class ImageUploadFieldComponent extends ImageUploadFieldMixin {
|
|
|
1225
1221
|
}
|
|
1226
1222
|
ngOnInit() {
|
|
1227
1223
|
super.ngOnInit();
|
|
1228
|
-
// this.inputValueUrl = this.value && this.config.mapInputValueToUrl?.(this.value) || this.value;
|
|
1229
1224
|
this.imageSrcUrl$ = combineLatest([
|
|
1230
1225
|
this.compressedImageUrlString$.pipe(startWith(null)),
|
|
1231
1226
|
this.control.valueChanges.pipe(startWith(this.value), map((controlValue) => {
|
|
@@ -1565,19 +1560,21 @@ const FIELD_COMPONENTS = {
|
|
|
1565
1560
|
unitConversion: Promise.resolve().then(function () { return index$2; }).then(({ UnitConversionFieldComponent }) => UnitConversionFieldComponent)
|
|
1566
1561
|
};
|
|
1567
1562
|
function isControlComponent(component) {
|
|
1568
|
-
return isControlConfig(component.config) && 'value' in component; // || component.config.controlType === ControlType.BUTTON;
|
|
1563
|
+
return component && isControlConfig(component.config) && 'value' in component; // || component.config.controlType === ControlType.BUTTON;
|
|
1569
1564
|
}
|
|
1570
1565
|
function isControlOrButtonComponent(component) {
|
|
1571
1566
|
return isControlComponent(component) || component.config.controlType === ControlType.BUTTON;
|
|
1572
1567
|
}
|
|
1573
1568
|
|
|
1574
1569
|
class CrisprFieldDirective {
|
|
1575
|
-
constructor(container, renderer) {
|
|
1570
|
+
constructor(container, renderer, cdr) {
|
|
1576
1571
|
this.container = container;
|
|
1577
1572
|
this.renderer = renderer;
|
|
1573
|
+
this.cdr = cdr;
|
|
1578
1574
|
}
|
|
1579
1575
|
set value(value) {
|
|
1580
1576
|
this._value = value;
|
|
1577
|
+
// This is needed to keep the group list from resetting control values to the initial input value
|
|
1581
1578
|
this.updateComponentValue(value);
|
|
1582
1579
|
}
|
|
1583
1580
|
;
|
|
@@ -1611,19 +1608,21 @@ class CrisprFieldDirective {
|
|
|
1611
1608
|
});
|
|
1612
1609
|
}
|
|
1613
1610
|
updateComponentValue(value) {
|
|
1614
|
-
if (
|
|
1611
|
+
if (isControlComponent(this.component)) {
|
|
1615
1612
|
this.component.value = value;
|
|
1613
|
+
// SubGroups won't populate without this detectChanges
|
|
1614
|
+
this.cdr.detectChanges();
|
|
1616
1615
|
}
|
|
1617
1616
|
}
|
|
1618
1617
|
}
|
|
1619
|
-
CrisprFieldDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: CrisprFieldDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1618
|
+
CrisprFieldDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: CrisprFieldDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1620
1619
|
CrisprFieldDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.1", type: CrisprFieldDirective, selector: "[crisprField]", inputs: { config: "config", group: "group", value: "value" }, ngImport: i0 });
|
|
1621
1620
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: CrisprFieldDirective, decorators: [{
|
|
1622
1621
|
type: Directive,
|
|
1623
1622
|
args: [{
|
|
1624
1623
|
selector: '[crisprField]'
|
|
1625
1624
|
}]
|
|
1626
|
-
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.Renderer2 }]; }, propDecorators: { config: [{
|
|
1625
|
+
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { config: [{
|
|
1627
1626
|
type: Input
|
|
1628
1627
|
}], group: [{
|
|
1629
1628
|
type: Input
|
|
@@ -1722,6 +1721,11 @@ class FormGroupListComponent extends FormGroupListMixin {
|
|
|
1722
1721
|
super();
|
|
1723
1722
|
this.cdr = cdr;
|
|
1724
1723
|
this.defaultConfig = defaultConfig;
|
|
1724
|
+
/**
|
|
1725
|
+
* By setting this to true when adding/removing items from array,
|
|
1726
|
+
* we can block original values from overwriting form values
|
|
1727
|
+
* */
|
|
1728
|
+
this.blockValue = false;
|
|
1725
1729
|
}
|
|
1726
1730
|
ngOnInit() {
|
|
1727
1731
|
super.ngOnInit();
|
|
@@ -1746,6 +1750,14 @@ class FormGroupListComponent extends FormGroupListMixin {
|
|
|
1746
1750
|
});
|
|
1747
1751
|
}
|
|
1748
1752
|
}
|
|
1753
|
+
clickDelete(index) {
|
|
1754
|
+
this.blockValue = true;
|
|
1755
|
+
this.deleteGroup(index);
|
|
1756
|
+
}
|
|
1757
|
+
clickAdd() {
|
|
1758
|
+
this.blockValue = true;
|
|
1759
|
+
this.addGroup();
|
|
1760
|
+
}
|
|
1749
1761
|
addGroup(value = null) {
|
|
1750
1762
|
this.control.push(createControlForType(this.config.itemConfig, value));
|
|
1751
1763
|
// needed to ensure new array items render
|
|
@@ -1758,10 +1770,10 @@ class FormGroupListComponent extends FormGroupListMixin {
|
|
|
1758
1770
|
}
|
|
1759
1771
|
}
|
|
1760
1772
|
FormGroupListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: FormGroupListComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1761
|
-
FormGroupListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: FormGroupListComponent, selector: "crispr-form-group-list", usesInheritance: true, ngImport: i0, template: "\n<crispr-field-container\n [config]=\"config\"\n [group]=\"group\"\n [formGroup]=\"group\">\n\n <div [formArrayName]=\"config.controlName\">\n <!-- Don't add trackBy function, it confuses the state of the array -->\n <div *ngFor=\"let
|
|
1773
|
+
FormGroupListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: FormGroupListComponent, selector: "crispr-form-group-list", usesInheritance: true, ngImport: i0, template: "\n<crispr-field-container\n [config]=\"config\"\n [group]=\"group\"\n [formGroup]=\"group\">\n\n <div [formArrayName]=\"config.controlName\">\n <!-- Don't add trackBy function, it confuses the state of the array -->\n <div *ngFor=\"let con of control?.controls; let i = index;\">\n <!-- TODO: use content projection to allow custom item label component -->\n <div class=\"item-header\">\n <span class=\"mat-h2\"> {{ config.itemLabelBuilder ? config.itemLabelBuilder(i) : 'Item ' + (i + 1) }} </span>\n <button\n mat-icon-button\n type=\"button\"\n *ngIf=\"i + 1 > config.minListLength\">\n <mat-icon (click)=\"clickDelete(i)\">delete</mat-icon>\n </button>\n </div>\n <div\n [formGroup]=\"con\">\n <!-- TODO: if chiplists didn't need to have labels mixed in with their values we could use [value]=\"control.value\" below -->\n <ng-container\n *ngFor=\"let field of config.itemConfig.fields;\"\n crisprField\n [value]=\"blockValue ? null : value && value[i] | initialControlValue : field\"\n [config]=\"field\"\n [group]=\"con\">\n </ng-container>\n </div>\n </div>\n </div>\n <div class=\"group-footer\">\n <button\n type=\"button\"\n class=\"add\"\n mat-raised-button\n [color]=\"config.addButtonColor\"\n (click)=\"clickAdd()\">\n {{config.addItemLabel || config.addButtonLabel}}\n </button>\n </div>\n\n</crispr-field-container>\n", styles: [".item-header{display:flex;justify-content:space-between}.group-footer{display:flex;justify-content:flex-end}.group-footer button.add{margin-bottom:16px}\n"], components: [{ type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { type: i1.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"] }, { type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }, { type: i4$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: CrisprFieldDirective, selector: "[crisprField]", inputs: ["config", "group", "value"] }], pipes: { "initialControlValue": InitialControlValuePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
1762
1774
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: FormGroupListComponent, decorators: [{
|
|
1763
1775
|
type: Component,
|
|
1764
|
-
args: [{ selector: 'crispr-form-group-list', changeDetection: ChangeDetectionStrategy.OnPush, template: "\n<crispr-field-container\n [config]=\"config\"\n [group]=\"group\"\n [formGroup]=\"group\">\n\n <div [formArrayName]=\"config.controlName\">\n <!-- Don't add trackBy function, it confuses the state of the array -->\n <div *ngFor=\"let
|
|
1776
|
+
args: [{ selector: 'crispr-form-group-list', changeDetection: ChangeDetectionStrategy.OnPush, template: "\n<crispr-field-container\n [config]=\"config\"\n [group]=\"group\"\n [formGroup]=\"group\">\n\n <div [formArrayName]=\"config.controlName\">\n <!-- Don't add trackBy function, it confuses the state of the array -->\n <div *ngFor=\"let con of control?.controls; let i = index;\">\n <!-- TODO: use content projection to allow custom item label component -->\n <div class=\"item-header\">\n <span class=\"mat-h2\"> {{ config.itemLabelBuilder ? config.itemLabelBuilder(i) : 'Item ' + (i + 1) }} </span>\n <button\n mat-icon-button\n type=\"button\"\n *ngIf=\"i + 1 > config.minListLength\">\n <mat-icon (click)=\"clickDelete(i)\">delete</mat-icon>\n </button>\n </div>\n <div\n [formGroup]=\"con\">\n <!-- TODO: if chiplists didn't need to have labels mixed in with their values we could use [value]=\"control.value\" below -->\n <ng-container\n *ngFor=\"let field of config.itemConfig.fields;\"\n crisprField\n [value]=\"blockValue ? null : value && value[i] | initialControlValue : field\"\n [config]=\"field\"\n [group]=\"con\">\n </ng-container>\n </div>\n </div>\n </div>\n <div class=\"group-footer\">\n <button\n type=\"button\"\n class=\"add\"\n mat-raised-button\n [color]=\"config.addButtonColor\"\n (click)=\"clickAdd()\">\n {{config.addItemLabel || config.addButtonLabel}}\n </button>\n </div>\n\n</crispr-field-container>\n", styles: [".item-header{display:flex;justify-content:space-between}.group-footer{display:flex;justify-content:flex-end}.group-footer button.add{margin-bottom:16px}\n"] }]
|
|
1765
1777
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
|
|
1766
1778
|
|
|
1767
1779
|
class CrisprPipesModule {
|
|
@@ -1842,10 +1854,10 @@ class SubGroupComponent extends FormGroupMixin {
|
|
|
1842
1854
|
}
|
|
1843
1855
|
}
|
|
1844
1856
|
SubGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: SubGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1845
|
-
SubGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: SubGroupComponent, selector: "crispr-sub-group", usesInheritance: true, ngImport: i0, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <ng-container\n *ngFor=\"let fieldConfig of config.fields;\"\n crisprField\n [value]=\"value | initialControlValue : fieldConfig\"\n [config]=\"fieldConfig\"\n [group]=\"control\">\n </ng-container>\n</crispr-field-container>\n\n", styles: [""], components: [{ type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }], directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: CrisprFieldDirective, selector: "[crisprField]", inputs: ["config", "group", "value"] }], pipes: { "initialControlValue": InitialControlValuePipe },
|
|
1857
|
+
SubGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: SubGroupComponent, selector: "crispr-sub-group", usesInheritance: true, ngImport: i0, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <ng-container\n *ngFor=\"let fieldConfig of config.fields;\"\n crisprField\n [value]=\"value | initialControlValue : fieldConfig\"\n [config]=\"fieldConfig\"\n [group]=\"control\">\n </ng-container>\n</crispr-field-container>\n\n", styles: [""], components: [{ type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }], directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: CrisprFieldDirective, selector: "[crisprField]", inputs: ["config", "group", "value"] }], pipes: { "initialControlValue": InitialControlValuePipe }, preserveWhitespaces: true });
|
|
1846
1858
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: SubGroupComponent, decorators: [{
|
|
1847
1859
|
type: Component,
|
|
1848
|
-
args: [{ selector: 'crispr-sub-group',
|
|
1860
|
+
args: [{ selector: 'crispr-sub-group', template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <ng-container\n *ngFor=\"let fieldConfig of config.fields;\"\n crisprField\n [value]=\"value | initialControlValue : fieldConfig\"\n [config]=\"fieldConfig\"\n [group]=\"control\">\n </ng-container>\n</crispr-field-container>\n\n", styles: [""] }]
|
|
1849
1861
|
}] });
|
|
1850
1862
|
|
|
1851
1863
|
class SubGroupModule {
|