-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: prepare audit select for baseline
- Loading branch information
1 parent
067f0dd
commit f73904f
Showing
5 changed files
with
155 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<script lang="ts"> | ||
// Props | ||
/** Exposes parent props to this component. */ | ||
export let parent: any; | ||
// Stores | ||
import type { ModelInfo } from '$lib/utils/types'; | ||
import type { ModalStore } from '@skeletonlabs/skeleton'; | ||
import { getModalStore } from '@skeletonlabs/skeleton'; | ||
const modalStore: ModalStore = getModalStore(); | ||
export let form: SuperValidated<AnyZodObject>; | ||
export let model: ModelInfo; | ||
export let invalidateAll = true; // set to false to keep form data using muliple forms on a page | ||
export let formAction = '?/update'; | ||
export let context = 'default'; | ||
export let object: Record<string, any> = {}; | ||
let closeModal = true; | ||
export let suggestions: { [key: string]: any } = {}; | ||
export let selectOptions: Record<string, any> = {}; | ||
export let foreignKeys: Record<string, any> = {}; | ||
// Base Classes | ||
const cBase = 'card p-4 w-modal shadow-xl space-y-4'; | ||
const cHeader = 'text-2xl font-bold'; | ||
export let debug = false; | ||
import ModelForm from '$lib/components/Forms/ModelForm.svelte'; | ||
import type { SuperValidated } from 'sveltekit-superforms'; | ||
import type { AnyZodObject } from 'zod'; | ||
</script> | ||
|
||
{#if $modalStore[0]} | ||
<div class="modal-example-form {cBase}"> | ||
<div class="flex items-center justify-between"> | ||
<header class={cHeader} data-testid="modal-title"> | ||
{$modalStore[0].title ?? '(title missing)'} | ||
</header> | ||
<div | ||
role="button" | ||
tabindex="0" | ||
class="flex items-center hover:text-primary-500 cursor-pointer" | ||
on:click={parent.onClose} | ||
on:keydown={parent.onClose} | ||
> | ||
<i class="fa-solid fa-xmark" /> | ||
</div> | ||
</div> | ||
<ModelForm | ||
{form} | ||
{object} | ||
{suggestions} | ||
{parent} | ||
action={formAction} | ||
{invalidateAll} | ||
{model} | ||
{closeModal} | ||
{context} | ||
caching={true} | ||
selectOptions={selectOptions} | ||
foreignKeys={foreignKeys} | ||
{debug} | ||
/> | ||
</div> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters