diff --git a/frontend/projects/ui/src/app/components/form/form-array/form-array.component.html b/frontend/projects/ui/src/app/components/form/form-array/form-array.component.html
index 59ae693c2..e4921d742 100644
--- a/frontend/projects/ui/src/app/components/form/form-array/form-array.component.html
+++ b/frontend/projects/ui/src/app/components/form/form-array/form-array.component.html
@@ -4,7 +4,15 @@
*ngIf="spec.description"
[content]="spec.description"
>
-
+
diff --git a/frontend/projects/ui/src/app/components/form/form-array/form-array.component.ts b/frontend/projects/ui/src/app/components/form/form-array/form-array.component.ts
index dd6c3bb0e..a07c8cf7b 100644
--- a/frontend/projects/ui/src/app/components/form/form-array/form-array.component.ts
+++ b/frontend/projects/ui/src/app/components/form/form-array/form-array.component.ts
@@ -35,6 +35,13 @@ export class FormArrayComponent {
private readonly dialogs = inject(TuiDialogService)
private readonly destroy$ = inject(TuiDestroyService)
+ get canAdd(): boolean {
+ return (
+ !this.spec.maxLength ||
+ this.spec.maxLength >= this.array.control.controls.length
+ )
+ }
+
add() {
if (!this.warned && this.spec.warning) {
this.dialogs
diff --git a/frontend/projects/ui/src/app/components/form/form-control/form-control.component.html b/frontend/projects/ui/src/app/components/form/form-control/form-control.component.html
index 624b438d0..62dcbaf87 100644
--- a/frontend/projects/ui/src/app/components/form/form-control/form-control.component.html
+++ b/frontend/projects/ui/src/app/components/form/form-control/form-control.component.html
@@ -1,7 +1,7 @@
-
+
diff --git a/frontend/projects/ui/src/app/components/form/form-control/form-control.component.ts b/frontend/projects/ui/src/app/components/form/form-control/form-control.component.ts
index 43e4f3dff..127c3d33c 100644
--- a/frontend/projects/ui/src/app/components/form/form-control/form-control.component.ts
+++ b/frontend/projects/ui/src/app/components/form/form-control/form-control.component.ts
@@ -6,7 +6,10 @@ import {
TemplateRef,
ViewChild,
} from '@angular/core'
-import { AbstractTuiNullableControl } from '@taiga-ui/cdk'
+import {
+ AbstractTuiNullableControl,
+ TuiContextWithImplicit,
+} from '@taiga-ui/cdk'
import {
TuiAlertService,
TuiDialogContext,
@@ -17,6 +20,11 @@ import { filter, takeUntil } from 'rxjs'
import { ValueSpec, ValueSpecText } from 'start-sdk/lib/config/configTypes'
import { ERRORS } from '../form-group/form-group.component'
+interface ValidatorsPatternError {
+ actualValue: string
+ requiredPattern: string | RegExp
+}
+
@Component({
selector: 'form-control',
templateUrl: './form-control.component.html',
@@ -28,7 +36,10 @@ import { ERRORS } from '../form-group/form-group.component'
deps: [FormControlComponent],
useFactory: (control: FormControlComponent) => ({
required: 'Required',
- patterns: () => control.spec.patterns.map(p => p.regex), // @TODO Alex
+ pattern: ({ requiredPattern }: ValidatorsPatternError) =>
+ control.spec.patterns.find(
+ ({ regex }) => String(regex) === String(requiredPattern),
+ )?.description || 'Invalid pattern',
}),
},
],
diff --git a/frontend/projects/ui/src/app/components/form/form-multiselect/form-multiselect.component.html b/frontend/projects/ui/src/app/components/form/form-multiselect/form-multiselect.component.html
index 409a9ba1c..b97ed3632 100644
--- a/frontend/projects/ui/src/app/components/form/form-multiselect/form-multiselect.component.html
+++ b/frontend/projects/ui/src/app/components/form/form-multiselect/form-multiselect.component.html
@@ -1,9 +1,15 @@
{{ spec.name }}
-
+
diff --git a/frontend/projects/ui/src/app/components/form/form-multiselect/form-multiselect.component.ts b/frontend/projects/ui/src/app/components/form/form-multiselect/form-multiselect.component.ts
index 4a79834c4..4d7ddc909 100644
--- a/frontend/projects/ui/src/app/components/form/form-multiselect/form-multiselect.component.ts
+++ b/frontend/projects/ui/src/app/components/form/form-multiselect/form-multiselect.component.ts
@@ -13,6 +13,11 @@ export class FormMultiselectComponent extends Control<
> {
readonly items = Object.values(this.spec.values)
+ readonly disabledItemHandler = (item: string): boolean =>
+ !!this.spec.maxLength &&
+ this.selected.length >= this.spec.maxLength &&
+ !this.selected.includes(item)
+
get selected(): string[] {
return this.memoize(this.value)
}
diff --git a/frontend/projects/ui/src/app/components/form/form-number/form-number.component.html b/frontend/projects/ui/src/app/components/form/form-number/form-number.component.html
index ef90fc62e..472c29c4b 100644
--- a/frontend/projects/ui/src/app/components/form/form-number/form-number.component.html
+++ b/frontend/projects/ui/src/app/components/form/form-number/form-number.component.html
@@ -1,12 +1,11 @@
-
+
diff --git a/frontend/projects/ui/src/app/components/form/form-number/form-number.component.ts b/frontend/projects/ui/src/app/components/form/form-number/form-number.component.ts
index 29d53e018..ee131bcd2 100644
--- a/frontend/projects/ui/src/app/components/form/form-number/form-number.component.ts
+++ b/frontend/projects/ui/src/app/components/form/form-number/form-number.component.ts
@@ -8,14 +8,4 @@ import { Control } from '../control'
})
export class FormNumberComponent extends Control {
protected readonly Infinity = Infinity
-
- get min(): number {
- if (typeof this.spec.min !== 'number') return -Infinity
- return this.spec.min
- }
-
- get max(): number {
- if (typeof this.spec.max !== 'number') return Infinity
- return this.spec.max
- }
}
diff --git a/frontend/projects/ui/src/app/components/form/form-text/form-text.component.html b/frontend/projects/ui/src/app/components/form/form-text/form-text.component.html
index 9dbcd02f1..80d39e72b 100644
--- a/frontend/projects/ui/src/app/components/form/form-text/form-text.component.html
+++ b/frontend/projects/ui/src/app/components/form/form-text/form-text.component.html
@@ -10,8 +10,8 @@
tuiTextfield
[class.masked]="spec.masked && masked"
[placeholder]="spec.placeholder || ''"
- [minLength]="spec.minLength"
- [maxLength]="spec.maxLength"
+ [attr.minLength]="spec.minLength"
+ [attr.maxLength]="spec.maxLength"
[attr.inputmode]="spec.inputmode"
/>
diff --git a/frontend/projects/ui/src/app/components/form/form-textarea/form-textarea.component.html b/frontend/projects/ui/src/app/components/form/form-textarea/form-textarea.component.html
index ddaca759e..577c9a076 100644
--- a/frontend/projects/ui/src/app/components/form/form-textarea/form-textarea.component.html
+++ b/frontend/projects/ui/src/app/components/form/form-textarea/form-textarea.component.html
@@ -2,6 +2,7 @@
[tuiHintContent]="spec.description"
[expandable]="true"
[rows]="6"
+ [maxLength]="spec.maxLength"
[(ngModel)]="value"
(focusedChange)="onFocus($event)"
>