I have a problem with that field. This is the html "<form class="row"…
- User
I have a problem with that field. This is the html "<form class="row" [formGroup]="fieldForm">
@if (fieldForm.get("min")) { Minimum Value Enter the minimum value of the range }
@if (fieldForm.get("max")) { Maximum Value Enter the maximum value of the range }
@if (fieldForm.get("values")) { Values Enter numeric values separated by commas }
@if (fieldForm.get("weights")) { Weights <input [readonly]="autoRenew()" placeholder="e.g., 0.3, 0.3, 0.4" matInput formControlName="weights" /> Enter decimal weights between 0 and 1, separated by commas. The weights should sum to 1. <button (click)="onToggleAutorenew()" matIconSuffix mat-icon-button> {{ autoRenew() ? "autorenew" : "pause" }} }
@if (fieldForm.get("start")) { Start Enter the starting value of the sequence }
@if (fieldForm.get("step")) { Step Enter the step size to increment or decrement the value }
type IntFieldGenerator = | { type: GeneratorType.Uniform; min: number; max: number } | { type: GeneratorType.Enum; values: number[]; weights: number[] } | { type: GeneratorType.NumericRange; start: number; step: number } | { type: GeneratorType.Values; values: number[] };
interface IntFieldForm { type: FormControl; min?: FormControl; max?: FormControl; values?: FormControl; weights?: FormControl; start?: FormControl; step?: FormControl; }
@Component({ selector: 'app-int-field', standalone: true, imports: [ MatFormFieldModule, MatSelectModule, ReactiveFormsModule, MatInputModule, ReactiveFormsModule, TitleCasePipe, RepeatMaskDirective, MatButtonModule, MatIconModule, ], templateUrl: './int-field.component.html', styleUrl: './int-field.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, }) export class IntFieldComponent implements OnInit { private readonly schemaFormFieldGeneratorSvc = inject( SchemaFormFieldGeneratorService, ); private readonly destroyRef = inject(DestroyRef);
public readonly autoRenew = signal(true);
public readonly generatorTypes = input.required(); public readonly changeField = output();
public readonly type = this.schemaFormFieldGeneratorSvc.getTypeField(); public readonly min = this.schemaFormFieldGeneratorSvc.getMinField([ Validators.min(-2147483648), compareToOtherFieldValidator( 'max', (min: number, max: number) => min < max, 'minGreaterThanMax', ), ]); public readonly max = this.schemaFormFieldGeneratorSvc.getMaxField([ Validators.max(2147483648), compareToOtherFieldValidator( 'min', (max: number, min: number) => min < max, 'MaxSmallerThanMin', ), ]); public readonly values = this.schemaFormFieldGeneratorSvc.getValuesField([ numbersCommaSeparatedValidator, ]); public readonly weights = this.schemaFormFieldGeneratorSvc.getWeightsField(); public readonly start = this.schemaFormFieldGeneratorSvc.getStartField(); public readonly step = this.schemaFormFieldGeneratorSvc.getStepField(); public readonly fieldForm = new FormGroup({ type: this.type, });
- Assistant