mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
make textarea rows configurable (#3042)
* make textarea rows configurable * add comments * better defaults
This commit is contained in:
@@ -283,6 +283,8 @@ export class Value<Type extends StaticValidatedAs, StaticValidatedAs = Type> {
|
||||
warning: null,
|
||||
minLength: null,
|
||||
maxLength: null,
|
||||
minRows: 3
|
||||
maxRows: 6
|
||||
immutable: false,
|
||||
}),
|
||||
* ```
|
||||
@@ -296,6 +298,10 @@ export class Value<Type extends StaticValidatedAs, StaticValidatedAs = Type> {
|
||||
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<Type extends StaticValidatedAs, StaticValidatedAs = Type> {
|
||||
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<Type extends StaticValidatedAs, StaticValidatedAs = Type> {
|
||||
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<Type extends StaticValidatedAs, StaticValidatedAs = Type> {
|
||||
warning: null,
|
||||
minLength: null,
|
||||
maxLength: null,
|
||||
minRows: 3,
|
||||
maxRows: 6,
|
||||
placeholder: null,
|
||||
type: "textarea" as const,
|
||||
disabled: false,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -22,8 +22,8 @@ import { HintPipe } from '../pipes/hint.pipe'
|
||||
<textarea
|
||||
placeholder="Placeholder"
|
||||
tuiTextarea
|
||||
[max]="6"
|
||||
[min]="3"
|
||||
[min]="spec.minRows"
|
||||
[max]="spec.maxRows"
|
||||
[attr.maxLength]="spec.maxLength"
|
||||
[disabled]="!!spec.disabled"
|
||||
[readOnly]="readOnly"
|
||||
|
||||
@@ -96,6 +96,8 @@ export default class GatewaysComponent {
|
||||
name: this.i18n.transform('File Contents'),
|
||||
default: null,
|
||||
required: true,
|
||||
minRows: 16,
|
||||
maxRows: 16,
|
||||
}),
|
||||
}),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user