web_lib

Common web application libraries
git clone https://radroots.dev/git/web_lib.git
Log | Files | Refs | LICENSE

commit 3a93a94aa0da0fd6723b256a6e880552d59f73e4
parent 6864f306705b9be7b25218d0d5e82ab69f4a5090
Author: triesap <137732411+triesap@users.noreply.github.com>
Date:   Tue, 17 Sep 2024 07:16:10 +0000

apps-lib: update input form and layout view components

Diffstat:
Mapps-lib/src/lib/components/input_form.svelte | 11+++++++----
Mapps-lib/src/lib/components/layout_view.svelte | 10++++++----
Mapps-lib/src/lib/types/components.ts | 1+
3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/apps-lib/src/lib/components/input_form.svelte b/apps-lib/src/lib/components/input_form.svelte @@ -18,10 +18,13 @@ onMount(async () => { try { - if (basis.sync && basis.id) { - const kv_val = await kv.get(basis.id); - if (kv_val) el.value = kv_val; - await kv.set(basis.id, kv_val || ""); + if (basis.id) { + if (basis.init) await kv.set(basis.id, ``); + else if (basis.sync) { + const kv_val = await kv.get(basis.id); + if (kv_val) el.value = kv_val; + await kv.set(basis.id, kv_val || ``); + } } } catch (e) {} }); diff --git a/apps-lib/src/lib/components/layout_view.svelte b/apps-lib/src/lib/components/layout_view.svelte @@ -12,11 +12,13 @@ import { onDestroy, onMount } from "svelte"; const styles: Record<AppLayoutKey, string> = { - base: "pt-2", + base: "", lg: "pt-16", }; - export let basis: (IClOpt & { fade?: boolean }) | undefined = undefined; + export let basis: + | (IClOpt & { fade?: boolean; hide_padding?: boolean }) + | undefined = undefined; $: basis = basis; let el: HTMLElement | null; @@ -39,7 +41,7 @@ $: classes_nav = $app_nav_visible ? `pt-h_nav_${$app_layout}` - : `${styles[$app_layout]}`; + : styles[$app_layout]; $: classes_tabs = $app_tabs_visible ? `pb-h_tabs_${$app_layout}` : ``; $: classes_fade = basis?.fade ? `fade-in` : ``; @@ -54,7 +56,7 @@ <div bind:this={el} - class={`${fmt_cl(basis?.classes)} absolute top-0 left-0 flex flex-col h-[100vh] w-full overflow-y-scroll scroll-hide ${classes_nav} ${classes_tabs} ${classes_fade}`} + class={`${fmt_cl(basis?.classes)} absolute top-0 left-0 flex flex-col h-[100vh] w-full overflow-y-scroll scroll-hide ${!basis?.hide_padding ? classes_nav : ``} ${classes_tabs} ${classes_fade}`} > <slot /> </div> diff --git a/apps-lib/src/lib/types/components.ts b/apps-lib/src/lib/types/components.ts @@ -31,6 +31,7 @@ export type IInputFormBasis = IClOpt & ILyOptTs & ICbGOpt<{ val: string; pass: b hidden?: boolean; validate?: RegExp; sync?: boolean; + init?: boolean; field?: IFormField; notify_inline?: { glyph: GlyphKey | IGlyph;