Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: show dynamic input toggle for arrays #4632

Merged
merged 2 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<div class="ap-select-none">
{{ property.displayName }}
</div>
<ng-container *ngTemplateOutlet="dynamicInputTemplate"></ng-container>
<ng-content></ng-content>

</div>

@if(!!property.properties)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
ChangeDetectorRef,
Component,
Input,
TemplateRef,
ViewChild,
} from '@angular/core';
import {
Expand Down Expand Up @@ -50,7 +49,6 @@ export class ArrayFormControlComponent
{
formArray: FormArray<FormControl<string> | UntypedFormGroup>;
@Input({ required: true }) property: ArrayProperty<boolean>;
@Input() dynamicInputTemplate: TemplateRef<unknown>;
@ViewChild('textControl') firstInput: InterpolatingTextFormControlComponent;
@Input({ required: true }) pieceMetaData: PieceMetadataModel;
@Input({ required: true }) flow: Pick<PopulatedFlow, 'id' | 'version'>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ import {
PiecePropertyMap,
PropertyType,
} from '@activepieces/pieces-framework';
import { jsonValidator } from '@activepieces/ui/common';
import {
getPropertyInitialValue,
jsonValidator,
} from '@activepieces/ui/common';
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { BehaviorSubject, Observable, distinctUntilChanged, tap } from 'rxjs';
import deepEqual from 'deep-equal';
Expand Down Expand Up @@ -129,8 +132,12 @@ export class PiecePropertiesFormComponent
this.form.controls[propertyName].addValidators(jsonValidator);
}
}

this.customizedInputsChanged.emit({ propertyName, value });
this.form.controls[propertyName].setValue('', { emitEvent: false });
this.form.controls[propertyName].setValue(
getPropertyInitialValue(property, undefined),
{ emitEvent: false }
);
this.form.controls[propertyName].updateValueAndValidity({
emitEvent: false,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,12 @@
</div>


<!-- 100vh - (height of tabs + height of sidebar title) - builder header height -->
<cdk-virtual-scroll-viewport *ngIf="typesList.length> 50; else nonVirtualList" maxBufferPx="400" itemSize="80"
class="ap-h-[calc(100vh-204px-76px)] ap-flex-grow thin-scrollbars ap-my-2">
<div class="ap-my-2 ap-mx-5" *cdkVirtualFor="let flowItemDetails of typesList">
<app-step-type-item [flowItemDetails]="flowItemDetails" (click)="typeSelected.emit({flowItemDetails})" (suggestionClicked)="typeSelected.emit({flowItemDetails,suggestion:$event})" >
</app-step-type-item>
</div>
</cdk-virtual-scroll-viewport>

<ng-template #nonVirtualList>


<div *ngIf="typesList.length>0" class="ap-h-[calc(100vh-204px-76px)] ap-overflow-auto ap-flex-grow thin-scrollbars ap-my-2">
<div *ngFor="let flowItemDetails of typesList" class="ap-my-2 ap-mx-5">
<app-step-type-item [flowItemDetails]="flowItemDetails" (click)="typeSelected.emit({flowItemDetails})" (suggestionClicked)="typeSelected.emit({flowItemDetails,suggestion:$event})" >
</app-step-type-item>
</div>
</div>
</ng-template>
</div>