From 59c0abae3df7397f32b65360b6740ca71a91444b Mon Sep 17 00:00:00 2001 From: Faton Ramadani Date: Tue, 21 May 2024 21:58:48 +0200 Subject: [PATCH] feat(frontend): Added support for title and placeholder for ArgInputs (#3779) * feat(frontend): Added support for customLabel and placeholder * feat(frontend): correctly handle labels * feat(frontend): rename customLabel into title * feat(frontend): fix layout * feat(frontend): properly implement placeholder * feat(frontend): properly implement placeholder * feat(frontend): add missing undefined check * feat(frontend): remove code duplication --- frontend/src/lib/common.ts | 8 +++- frontend/src/lib/components/ArgInput.svelte | 38 +++++++++++---- .../lib/components/EditableSchemaForm.svelte | 2 + .../lib/components/InputTransformForm.svelte | 2 + .../lib/components/LightweightArgInput.svelte | 14 +++--- .../components/LightweightSchemaForm.svelte | 2 + .../lib/components/ModulePreviewForm.svelte | 2 + frontend/src/lib/components/SchemaForm.svelte | 2 + .../src/lib/components/SchemaModal.svelte | 35 +++++++++++++- .../lib/components/StringTypeNarrowing.svelte | 27 ++++------- .../settingsPanel/InputsSpecEditor.svelte | 4 +- frontend/src/lib/utils.ts | 46 +++++++++++++++++++ .../(root)/(logged)/scripts/add/+page.svelte | 6 ++- 13 files changed, 150 insertions(+), 38 deletions(-) diff --git a/frontend/src/lib/common.ts b/frontend/src/lib/common.ts index c1917635ea..0daa000b50 100644 --- a/frontend/src/lib/common.ts +++ b/frontend/src/lib/common.ts @@ -41,6 +41,8 @@ export interface SchemaProperty { order?: string[] nullable?: boolean dateFormat?: string + title?: string + placeholder?: string } export interface ModalSchemaProperty { @@ -65,6 +67,8 @@ export interface ModalSchemaProperty { password?: boolean nullable?: boolean dateFormat?: string + title?: string + placeholder?: string } export function modalToSchema(schema: ModalSchemaProperty): SchemaProperty { @@ -88,7 +92,9 @@ export function modalToSchema(schema: ModalSchemaProperty): SchemaProperty { showExpr: schema.showExpr, password: schema.password, nullable: schema.nullable, - dateFormat: schema.dateFormat + dateFormat: schema.dateFormat, + title: schema.title, + placeholder: schema.placeholder } } export type Schema = { diff --git a/frontend/src/lib/components/ArgInput.svelte b/frontend/src/lib/components/ArgInput.svelte index 7f013a2360..c6c1ee6b0b 100644 --- a/frontend/src/lib/components/ArgInput.svelte +++ b/frontend/src/lib/components/ArgInput.svelte @@ -1,6 +1,6 @@ @@ -192,6 +208,11 @@