Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Dynamic form component#23917

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
erdemcaygor wants to merge20 commits intodev
base:dev
Choose a base branch
Loading
fromfeat/#23891
Draft

Dynamic form component#23917

erdemcaygor wants to merge20 commits intodevfromfeat/#23891

Conversation

@erdemcaygor
Copy link
Contributor

@erdemcaygorerdemcaygor commentedOct 8, 2025
edited
Loading

Resolves#23891

Config Interfaces

exportinterfaceFormFieldConfig{key:string;value?:any;type:'text'|'email'|'number'|'select'|'checkbox'|'date'|'textarea';label:string;placeholder?:string;required?:boolean;disabled?:boolean;options?:{key:string;value:any}[];validators?:ValidatorConfig[];conditionalLogic?:ConditionalRule[];order?:number;gridSize?:number;component?:Type<ControlValueAccessor>;}exportinterfaceValidatorConfig{type:'required'|'email'|'minLength'|'maxLength'|'pattern'|'custom'|'min'|'max'|'requiredTrue';value?:any;message:string;}exportinterfaceConditionalRule{dependsOn:string;condition:'equals'|'notEquals'|'contains'|'greaterThan'|'lessThan';value:any;action:'show'|'hide'|'enable'|'disable';}

Example Usage

  formFields:FormFieldConfig[]=[{key:'firstName',type:'text',label:'First Name',placeholder:'Enter first name',value:'erdemc',required:true,validators:[{type:'required',message:'First name is required'},{type:'minLength',value:2,message:'Minimum 2 characters required'}],gridSize:6,order:1},{key:'lastName',type:'text',label:'Last Name',placeholder:'Enter last name',required:true,validators:[{type:'required',message:'Last name is required'}],gridSize:12,order:2},{key:'email',type:'email',label:'Email Address',placeholder:'Enter email',required:true,validators:[{type:'required',message:'Email is required'},{type:'email',message:'Please enter a valid email'}],order:3},{key:'userType',type:'select',label:'User Type',required:true,options:[{key:'admin',value:'Administrator'},{key:'user',value:'Regular User'},{key:'guest',value:'Guest User'}],validators:[{type:'required',message:'Please select user type'}],order:4},{key:'adminNotes',type:'textarea',label:'Admin Notes',placeholder:'Enter admin-specific notes',conditionalLogic:[{dependsOn:'userType',condition:'equals',value:'admin',action:'show'}],order:5}];
<abp-dynamic-form[fields]="formFields"></abp-dynamic-form>

@fahrigedik
Copy link
Member

Thanks for contributions. feature is very good but support for nested forms should be added.

fahrigedik reacted with rocket emojifahrigedik reacted with eyes emoji

Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull Request Overview

This PR introduces a new dynamic form component for the ABP Angular framework that allows developers to create forms dynamically using configuration objects. The component supports various field types, validation, conditional logic, and custom components.

  • Adds a comprehensive dynamic form system with support for text, email, select, checkbox, textarea, and date field types
  • Implements conditional field visibility and enablement based on other field values
  • Provides validation configuration with custom error messages and built-in Angular validators

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.

Show a summary per file
FileDescription
npm/ng-packs/tsconfig.base.jsonAdds TypeScript path mapping for the new dynamic-form package
npm/ng-packs/packages/components/dynamic-form/src/public-api.tsExports public API for the dynamic form components and models
npm/ng-packs/packages/components/dynamic-form/src/dynamic-form.service.tsService for creating form groups and handling validation logic
npm/ng-packs/packages/components/dynamic-form/src/dynamic-form.models.tsType definitions for form field configuration and validation
npm/ng-packs/packages/components/dynamic-form/src/dynamic-form.component.tsMain dynamic form component with conditional logic and form management
npm/ng-packs/packages/components/dynamic-form/src/dynamic-form.component.scssStyling for the dynamic form layout
npm/ng-packs/packages/components/dynamic-form/src/dynamic-form.component.htmlTemplate for rendering dynamic form fields and actions
npm/ng-packs/packages/components/dynamic-form/src/dynamic-form-field/index.tsBarrel export for form field components
npm/ng-packs/packages/components/dynamic-form/src/dynamic-form-field/dynamic-form-field.component.tsIndividual form field component with validation and error handling
npm/ng-packs/packages/components/dynamic-form/src/dynamic-form-field/dynamic-form-field.component.scssStyling for individual form fields
npm/ng-packs/packages/components/dynamic-form/src/dynamic-form-field/dynamic-form-field.component.htmlTemplate for rendering different field types
npm/ng-packs/packages/components/dynamic-form/src/dynamic-form-field/dynamic-form-field-host.component.tsHost component for dynamic custom field components
npm/ng-packs/packages/components/dynamic-form/ng-package.jsonPackage configuration for the dynamic form library
npm/ng-packs/apps/dev-app/src/server.tsRemoves conditional check for TLS rejection in development
npm/ng-packs/apps/dev-app/src/app/home/home.component.tsAdds example usage of the dynamic form component
npm/ng-packs/apps/dev-app/src/app/home/home.component.htmlUpdates template to include dynamic form demonstration

Tip: Customize your code reviews with copilot-instructions.md.Create the file orlearn how to get started.

constvalidator=this.field().validators.find(
v=>v.type.toLowerCase()===key.toLowerCase(),
);
console.log(this.field().validators,key);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Remove console.log statement used for debugging. This should not be present in production code.

Suggested change
console.log(this.field().validators, key);

Copilot uses AI. Check for mistakes.
}

submit(){
console.log(this.dynamicForm.valid,this.dynamicForm.value);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Remove console.log statement used for debugging. This should not be present in production code.

Suggested change
console.log(this.dynamicForm.valid,this.dynamicForm.value);

Copilot uses AI. Check for mistakes.
return`Maximum length is${this.control.errors[key].requiredLength}`;
return`${this.field().label} is invalid due to${key} validation.`;
});
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Theerrors getter method doesn't return anything when there are no errors. It should return an empty array to ensure consistent return type.

Suggested change
}
}
return[];

Copilot uses AI. Check for mistakes.
if(environment.production===false){
process.env["NODE_TLS_REJECT_UNAUTHORIZED"]="0";
}
process.env["NODE_TLS_REJECT_UNAUTHORIZED"]="0";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Setting NODE_TLS_REJECT_UNAUTHORIZED to '0' disables TLS certificate validation globally, which is a security risk. This should be conditional for development environments only or use a more targeted approach.

Suggested change
process.env["NODE_TLS_REJECT_UNAUTHORIZED"]="0";
if(!environment.production){
process.env["NODE_TLS_REJECT_UNAUTHORIZED"]="0";
}

Copilot uses AI. Check for mistakes.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

@fahrigedikfahrigedikAwaiting requested review from fahrigedik

@sumeyyeKurtulussumeyyeKurtulusAwaiting requested review from sumeyyeKurtulus

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Projects

None yet

Milestone

10.1-preview

Development

Successfully merging this pull request may close these issues.

Angular - Dynamic Form Component

3 participants

@erdemcaygor@fahrigedik

[8]ページ先頭

©2009-2025 Movatter.jp