From 1ea525feaa9468228ce0f5d99fcea67b0f382bde Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Fri, 31 Oct 2025 11:46:49 -0600 Subject: [PATCH] make textarea rows configurable (#3042) * make textarea rows configurable * add comments * better defaults --- sdk/base/lib/actions/input/builder/value.ts | 12 ++++++++++++ sdk/base/lib/actions/input/inputSpecTypes.ts | 2 ++ sdk/package/lib/test/inputSpecBuilder.test.ts | 4 ++++ sdk/package/scripts/oldSpecToBuilder.ts | 4 +++- .../components/form/controls/textarea.component.ts | 4 ++-- .../system/routes/gateways/gateways.component.ts | 2 ++ 6 files changed, 25 insertions(+), 3 deletions(-) diff --git a/sdk/base/lib/actions/input/builder/value.ts b/sdk/base/lib/actions/input/builder/value.ts index 7e13b6cce..78fcbeae6 100644 --- a/sdk/base/lib/actions/input/builder/value.ts +++ b/sdk/base/lib/actions/input/builder/value.ts @@ -283,6 +283,8 @@ export class Value { warning: null, minLength: null, maxLength: null, + minRows: 3 + maxRows: 6 immutable: false, }), * ``` @@ -296,6 +298,10 @@ export class Value { required: Required minLength?: number | null maxLength?: number | null + /** Defaults to 3 */ + minRows?: number + /** Maximum number of rows before scroll appears. Defaults to 6 */ + maxRows?: number placeholder?: string | null /** * @description Once set, the value can never be changed. @@ -310,6 +316,8 @@ export class Value { warning: null, minLength: null, maxLength: null, + minRows: 3, + maxRows: 6, placeholder: null, type: "textarea" as const, disabled: false, @@ -328,6 +336,8 @@ export class Value { required: Required minLength?: number | null maxLength?: number | null + minRows?: number + maxRows?: number placeholder?: string | null disabled?: false | string }>, @@ -341,6 +351,8 @@ export class Value { warning: null, minLength: null, maxLength: null, + minRows: 3, + maxRows: 6, placeholder: null, type: "textarea" as const, disabled: false, diff --git a/sdk/base/lib/actions/input/inputSpecTypes.ts b/sdk/base/lib/actions/input/inputSpecTypes.ts index 3e2dfabb1..0d0f7a398 100644 --- a/sdk/base/lib/actions/input/inputSpecTypes.ts +++ b/sdk/base/lib/actions/input/inputSpecTypes.ts @@ -61,6 +61,8 @@ export type ValueSpecTextarea = { placeholder: string | null minLength: number | null maxLength: number | null + minRows: number + maxRows: number required: boolean disabled: false | string immutable: boolean diff --git a/sdk/package/lib/test/inputSpecBuilder.test.ts b/sdk/package/lib/test/inputSpecBuilder.test.ts index fbad4b8f1..946e0b2e4 100644 --- a/sdk/package/lib/test/inputSpecBuilder.test.ts +++ b/sdk/package/lib/test/inputSpecBuilder.test.ts @@ -140,6 +140,8 @@ describe("values", () => { warning: null, minLength: null, maxLength: null, + minRows: 3, + maxRows: 6, placeholder: null, }).build({} as any) const validator = value.validator @@ -452,6 +454,8 @@ describe("values", () => { warning: null, minLength: null, maxLength: null, + minRows: 3, + maxRows: 6, placeholder: null, })).build({} as any) const validator = value.validator diff --git a/sdk/package/scripts/oldSpecToBuilder.ts b/sdk/package/scripts/oldSpecToBuilder.ts index 2acaf21f6..c8a275d57 100644 --- a/sdk/package/scripts/oldSpecToBuilder.ts +++ b/sdk/package/scripts/oldSpecToBuilder.ts @@ -81,8 +81,10 @@ const {InputSpec, List, Value, Variants} = sdk required: !(value.nullable || false), default: value.default, placeholder: value.placeholder || null, - maxLength: null, minLength: null, + maxLength: null, + minRows: 3, + maxRows: 6, }, null, 2, diff --git a/web/projects/ui/src/app/routes/portal/components/form/controls/textarea.component.ts b/web/projects/ui/src/app/routes/portal/components/form/controls/textarea.component.ts index b4fdbcde2..f10f66748 100644 --- a/web/projects/ui/src/app/routes/portal/components/form/controls/textarea.component.ts +++ b/web/projects/ui/src/app/routes/portal/components/form/controls/textarea.component.ts @@ -22,8 +22,8 @@ import { HintPipe } from '../pipes/hint.pipe'