From 272fabe2e2a71edd2cf861386b1b2bd0b8cf4d6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81d=C3=A1m=20Kov=C3=A1cs?= <43071496+adam-kov@users.noreply.github.com> Date: Tue, 25 Apr 2023 12:28:27 +0200 Subject: [PATCH] fix(frontend): Minor app editor updates (#1458) * fix(frontend): Update clearable inputs * update icon picker popup * update --- .../components/apps/editor/AppEditor.svelte | 2 +- .../componentsPanel/ComponentList.svelte | 19 +-- .../editor/componentsPanel/CssSettings.svelte | 130 ++++++++---------- .../editor/contextPanel/ContextPanel.svelte | 18 +-- .../inputEditor/ColorInput.svelte | 2 +- .../inputEditor/IconSelectInput.svelte | 28 ++-- .../clearableInput/ClearableInput.svelte | 16 ++- 7 files changed, 87 insertions(+), 128 deletions(-) diff --git a/frontend/src/lib/components/apps/editor/AppEditor.svelte b/frontend/src/lib/components/apps/editor/AppEditor.svelte index ec290fe453..c0de7c84b5 100644 --- a/frontend/src/lib/components/apps/editor/AppEditor.svelte +++ b/frontend/src/lib/components/apps/editor/AppEditor.svelte @@ -311,7 +311,7 @@ - + diff --git a/frontend/src/lib/components/apps/editor/componentsPanel/ComponentList.svelte b/frontend/src/lib/components/apps/editor/componentsPanel/ComponentList.svelte index 6d3f482d51..6320bc8f72 100644 --- a/frontend/src/lib/components/apps/editor/componentsPanel/ComponentList.svelte +++ b/frontend/src/lib/components/apps/editor/componentsPanel/ComponentList.svelte @@ -11,9 +11,9 @@ } from '../component' import ListItem from './ListItem.svelte' import { appComponentFromType, insertNewGridItem } from '../appUtils' - import { X } from 'lucide-svelte' import { push } from '$lib/history' import { flip } from 'svelte/animate' + import { ClearableInput } from '../../../common' const { app, selectedComponent, focusedGrid } = getContext('AppViewerContext') @@ -47,22 +47,7 @@
-
- - - {#if search !== ''} - - {/if} -
+
diff --git a/frontend/src/lib/components/apps/editor/componentsPanel/CssSettings.svelte b/frontend/src/lib/components/apps/editor/componentsPanel/CssSettings.svelte index 1d387014c0..d92082d2da 100644 --- a/frontend/src/lib/components/apps/editor/componentsPanel/CssSettings.svelte +++ b/frontend/src/lib/components/apps/editor/componentsPanel/CssSettings.svelte @@ -1,13 +1,14 @@ -
Global Styling
- switchTab(e.detail === 'json')} class="relative"> + + switchTab(e.detail === 'json')} class="h-full">
@@ -81,80 +83,64 @@ JSON
-
- -
-
- - {#if search} - - {/if} -
+
+ +
+
- {#each search != '' ? entries.filter((x) => x.name - .toLowerCase() - .includes(search.toLowerCase())) : entries as { type, name, icon, ids } (name)} - {#if ids.length > 0} - { - if ($app.css != undefined) { - if (e.detail && $app.css[type] == undefined) { - $app.css[type] = Object.fromEntries(ids.map(({ id }) => [id, {}])) +
+ {#each search != '' ? entries.filter((x) => x.name + .toLowerCase() + .includes(search.toLowerCase())) : entries as { type, name, icon, ids } (name)} + {#if ids.length > 0} + { + if ($app.css != undefined) { + if (e.detail && $app.css[type] == undefined) { + $app.css[type] = Object.fromEntries(ids.map(({ id }) => [id, {}])) + } } - } - }} - > -
- - - {name} - -
-
- {#each ids as { id, forceStyle, forceClass }} -
- {#if $app?.css?.[type]} - - {/if} -
- {/each} -
-
- {/if} - {/each} + }} + > +
+ + + {name} + +
+
+ {#each ids as { id, forceStyle, forceClass }} +
+ {#if $app?.css?.[type]} + + {/if} +
+ {/each} +
+ + {/if} + {/each} +
- + {#if !emptyString(jsonError)} - +
{jsonError} - - {:else} -
+
{/if} -
- +
+
diff --git a/frontend/src/lib/components/apps/editor/contextPanel/ContextPanel.svelte b/frontend/src/lib/components/apps/editor/contextPanel/ContextPanel.svelte index 608078c9a0..a44abe411b 100644 --- a/frontend/src/lib/components/apps/editor/contextPanel/ContextPanel.svelte +++ b/frontend/src/lib/components/apps/editor/contextPanel/ContextPanel.svelte @@ -1,6 +1,5 @@ -
- + (componentInput.value = detail)} on:focus={getData} class="!pr-6" /> @@ -64,28 +64,24 @@
- {:else if componentInput.value} - {/if}
{#if anchor} {#if !loading} -
+
{#if filteredItems} { diff --git a/frontend/src/lib/components/common/clearableInput/ClearableInput.svelte b/frontend/src/lib/components/common/clearableInput/ClearableInput.svelte index 9deb674bd2..882a026583 100644 --- a/frontend/src/lib/components/common/clearableInput/ClearableInput.svelte +++ b/frontend/src/lib/components/common/clearableInput/ClearableInput.svelte @@ -10,6 +10,7 @@ export let wrapperClass = '' export let buttonClass = '' const dispatch = createEventDispatcher() + let isHovered = false $: isNumeric = ['number', 'range'].includes(type) $: dispatch('change', value) @@ -23,7 +24,11 @@ } -
+
(isHovered = true)} + on:mouseleave={() => (isHovered = false)} +> {#if type === 'textarea'}