From 4dee0fab35e83ec5310e1c6ff97501f80f2b059e Mon Sep 17 00:00:00 2001 From: Faton Ramadani Date: Fri, 23 Dec 2022 15:11:13 +0100 Subject: [PATCH] feat(frontend): Fix initial component dimensions + Select select + add spinner when buttons are clicked (#1044) --- .../apps/components/buttons/AppButton.svelte | 28 ++++++++++++++++++- .../apps/components/form/AppForm.svelte | 27 +++++++++++++++++- .../components/selectInputs/AppSelect.svelte | 19 +++++++++++-- .../components/apps/editor/GridEditor.svelte | 3 ++ .../componentsPanel/ComponentList.svelte | 18 ++++++++---- 5 files changed, 84 insertions(+), 11 deletions(-) diff --git a/frontend/src/lib/components/apps/components/buttons/AppButton.svelte b/frontend/src/lib/components/apps/components/buttons/AppButton.svelte index aadee5e28c..5de48965e0 100644 --- a/frontend/src/lib/components/apps/components/buttons/AppButton.svelte +++ b/frontend/src/lib/components/apps/components/buttons/AppButton.svelte @@ -1,7 +1,9 @@ @@ -40,6 +61,7 @@ diff --git a/frontend/src/lib/components/apps/components/form/AppForm.svelte b/frontend/src/lib/components/apps/components/form/AppForm.svelte index 5ba3a8ac7c..b10c458416 100644 --- a/frontend/src/lib/components/apps/components/form/AppForm.svelte +++ b/frontend/src/lib/components/apps/components/form/AppForm.svelte @@ -1,7 +1,9 @@ @@ -50,6 +71,10 @@ }} {size} {color} + endIcon={{ + icon: loading ? faRefresh : faArrowRight, + classes: loading ? 'animate-spin w-4' : 'w-4' + }} > {labelValue} diff --git a/frontend/src/lib/components/apps/components/selectInputs/AppSelect.svelte b/frontend/src/lib/components/apps/components/selectInputs/AppSelect.svelte index 4628010cec..f9d2394582 100644 --- a/frontend/src/lib/components/apps/components/selectInputs/AppSelect.svelte +++ b/frontend/src/lib/components/apps/components/selectInputs/AppSelect.svelte @@ -1,5 +1,5 @@ @@ -32,5 +35,15 @@ - { + if (!$connectingInput.opened) { + $selectedComponent = id + } + }} + /> diff --git a/frontend/src/lib/components/apps/editor/GridEditor.svelte b/frontend/src/lib/components/apps/editor/GridEditor.svelte index 91563c15af..c8a7e9e0d5 100644 --- a/frontend/src/lib/components/apps/editor/GridEditor.svelte +++ b/frontend/src/lib/components/apps/editor/GridEditor.svelte @@ -128,4 +128,7 @@ /* Back shadow */ background: rgb(147 197 253) !important; } + :global(.svlt-grid-active) { + opacity: 1 !important; + } diff --git a/frontend/src/lib/components/apps/editor/componentsPanel/ComponentList.svelte b/frontend/src/lib/components/apps/editor/componentsPanel/ComponentList.svelte index cd0ba26088..89256f5c62 100644 --- a/frontend/src/lib/components/apps/editor/componentsPanel/ComponentList.svelte +++ b/frontend/src/lib/components/apps/editor/componentsPanel/ComponentList.svelte @@ -18,12 +18,18 @@ function getMinDimensionsByComponent(componentType: AppComponent['type'], column: number): Size { // Dimensions key formula: :-: const dimensions: Record<`${number}:${number}-${number}:${number}`, AppComponent['type'][]> = { - '1:2-3:2': ['buttoncomponent', 'textcomponent', 'checkboxcomponent'], - '1:2-2:2': ['textinputcomponent', 'numberinputcomponent', 'selectcomponent'], - '2:2-6:4': ['displaycomponent'], - '2:3-6:4': ['formcomponent'], - '2:4-6:4': ['barchartcomponent', 'piechartcomponent'], - '3:4-12:4': ['tablecomponent'] + '1:2-2:2': [ + 'buttoncomponent', + 'textcomponent', + 'checkboxcomponent', + 'textinputcomponent', + 'numberinputcomponent', + 'selectcomponent', + 'passwordinputcomponent', + 'dateinputcomponent' + ], + '2:6-4:6': ['barchartcomponent', 'piechartcomponent', 'formcomponent', 'displaycomponent'], + '3:6-6:8': ['tablecomponent'] } // Finds the key that is associated with the component type and extracts the dimensions from it const [dimension] = Object.entries(dimensions).find(([_, value]) =>