More good things
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|
||||||
<main class="container mx-auto flex flex-col max-w-screen-md p-6">
|
<main class="container mx-auto flex flex-col max-w-screen-md p-6">
|
||||||
|
<input type="hidden" name="__RequestVerificationToken" value="fakeaft" />
|
||||||
<div
|
<div
|
||||||
id="4j2b7wf1fmjdd1g2twvxhpng4h"
|
id="4j2b7wf1fmjdd1g2twvxhpng4h"
|
||||||
class="OapApplicationForm"
|
class="OapApplicationForm"
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Client, setContextClient, queryStore } from "@urql/svelte";
|
import { Client, setContextClient, queryStore } from "@urql/svelte";
|
||||||
import OapApplicationFormStep from "./components/OapApplicationFormStep.svelte";
|
|
||||||
import { graphql } from "./gql";
|
import { graphql } from "./gql";
|
||||||
|
import OapApplicationFormStep from "./components/OapApplicationFormStep.svelte";
|
||||||
|
import step from "./lib/stores/step";
|
||||||
|
|
||||||
|
export let antiForgeryToken: string | null;
|
||||||
export let contentItemId: string;
|
export let contentItemId: string;
|
||||||
export let client: Client;
|
export let client: Client;
|
||||||
|
|
||||||
@@ -30,6 +32,10 @@
|
|||||||
contentItemId,
|
contentItemId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function handleSubmit(event: SubmitEvent) {
|
||||||
|
step.update(x => x + 1);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if $content.fetching}
|
{#if $content.fetching}
|
||||||
@@ -48,13 +54,14 @@
|
|||||||
{oapApplicationForm.displayText}
|
{oapApplicationForm.displayText}
|
||||||
</h1>
|
</h1>
|
||||||
{/if}
|
{/if}
|
||||||
{#if oapApplicationForm?.list}
|
{#each oapApplicationForm?.list?.contentItems ?? [] as contentItem, index}
|
||||||
{#each oapApplicationForm.list.contentItems ?? [] as contentItem}
|
{#if contentItem?.__typename === "OapApplicationFormStep" && $step === index}
|
||||||
{#if contentItem?.__typename === "OapApplicationFormStep"}
|
<OapApplicationFormStep
|
||||||
<OapApplicationFormStep fragment={contentItem} />
|
onSubmit={handleSubmit}
|
||||||
|
{antiForgeryToken}
|
||||||
|
fragment={contentItem} />
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<script context="module" lang="ts">
|
<script context="module" lang="ts">
|
||||||
|
import type { EventHandler } from "svelte/elements";
|
||||||
import { graphql } from "../gql";
|
import { graphql } from "../gql";
|
||||||
|
|
||||||
export const FormFragment = graphql(/* GraphQL */ `
|
export const FormFragment = graphql(/* GraphQL */ `
|
||||||
@@ -32,7 +33,8 @@
|
|||||||
import SelectPart from "./SelectPart.svelte";
|
import SelectPart from "./SelectPart.svelte";
|
||||||
import TextAreaPart from "./TextAreaPart.svelte";
|
import TextAreaPart from "./TextAreaPart.svelte";
|
||||||
|
|
||||||
export let antiForgeryToken: string;
|
export let onSubmit: EventHandler<SubmitEvent, HTMLFormElement> | undefined | null;
|
||||||
|
export let antiForgeryToken: string | null;
|
||||||
export let fragment: FragmentType<typeof FormFragment>;
|
export let fragment: FragmentType<typeof FormFragment>;
|
||||||
|
|
||||||
const content = useFragment(FormFragment, fragment);
|
const content = useFragment(FormFragment, fragment);
|
||||||
@@ -42,9 +44,9 @@
|
|||||||
id={content.formElement?.id}
|
id={content.formElement?.id}
|
||||||
action={content.form?.action}
|
action={content.form?.action}
|
||||||
method={content.form?.method}
|
method={content.form?.method}
|
||||||
|
on:submit|preventDefault={onSubmit}
|
||||||
>
|
>
|
||||||
{antiForgeryToken}
|
<input type="hidden" name="__RequestVerificationToken" value={antiForgeryToken}/>
|
||||||
|
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-2">
|
||||||
{#if content.flow}
|
{#if content.flow}
|
||||||
{#each content.flow.widgets ?? [] as widget}
|
{#each content.flow.widgets ?? [] as widget}
|
||||||
|
|||||||
@@ -22,7 +22,10 @@
|
|||||||
|
|
||||||
import RichText from "./RichText.svelte";
|
import RichText from "./RichText.svelte";
|
||||||
import Form from "./Form.svelte";
|
import Form from "./Form.svelte";
|
||||||
|
import type { EventHandler } from "svelte/elements";
|
||||||
|
|
||||||
|
export let onSubmit: EventHandler<SubmitEvent, HTMLFormElement> | undefined | null;
|
||||||
|
export let antiForgeryToken: string | null;
|
||||||
export let fragment: FragmentType<typeof OapApplicationFormStepFragment>;
|
export let fragment: FragmentType<typeof OapApplicationFormStepFragment>;
|
||||||
|
|
||||||
const content = useFragment(OapApplicationFormStepFragment, fragment);
|
const content = useFragment(OapApplicationFormStepFragment, fragment);
|
||||||
@@ -37,9 +40,9 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if content.flow}
|
{#if content.flow}
|
||||||
{#each content.flow.widgets as widget}
|
{#each content.flow.widgets ?? [] as widget}
|
||||||
{#if widget?.__typename === "Form"}
|
{#if widget?.__typename === "Form"}
|
||||||
<Form antiForgeryToken="" fragment={widget} />
|
<Form {onSubmit} {antiForgeryToken} fragment={widget} />
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
4
src/OAP/Oap.Theme.Svelte/src/lib/stores/step.ts
Normal file
4
src/OAP/Oap.Theme.Svelte/src/lib/stores/step.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
import { writable } from 'svelte/store';
|
||||||
|
const step = writable(0);
|
||||||
|
|
||||||
|
export default step;
|
||||||
@@ -7,6 +7,7 @@ const client = new Client({
|
|||||||
exchanges: [cacheExchange, fetchExchange],
|
exchanges: [cacheExchange, fetchExchange],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var antiForgeryToken = document.getElementsByName("__RequestVerificationToken");
|
||||||
var oapApplicationForms = document.getElementsByClassName("OapApplicationForm");
|
var oapApplicationForms = document.getElementsByClassName("OapApplicationForm");
|
||||||
|
|
||||||
let oapApplicationForm: OapApplicationForm;
|
let oapApplicationForm: OapApplicationForm;
|
||||||
@@ -15,6 +16,7 @@ if (oapApplicationForms.length === 1) {
|
|||||||
oapApplicationForm = new OapApplicationForm({
|
oapApplicationForm = new OapApplicationForm({
|
||||||
target: oapApplicationForms[0],
|
target: oapApplicationForms[0],
|
||||||
props: {
|
props: {
|
||||||
|
antiForgeryToken: antiForgeryToken[0]?.getAttribute("value") ?? null,
|
||||||
contentItemId: oapApplicationForms[0].id,
|
contentItemId: oapApplicationForms[0].id,
|
||||||
client,
|
client,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<h1 class="mb-6 border-b-2 border-solid border-black pb-1 text-center text-2xl font-bold">
|
@Html.AntiForgeryToken()
|
||||||
@Model.Header.TitlePart.Title
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
<div id="@Model.ContentItem.ContentItemId" class="@Model.ContentItem.ContentType"></div>
|
<div id="@Model.ContentItem.ContentItemId"
|
||||||
|
class="@Model.ContentItem.ContentType"></div>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"index.html": {
|
"index.html": {
|
||||||
"file": "index-DmYf-7v-.js",
|
"file": "index-CFylyzUG.js",
|
||||||
"name": "index",
|
"name": "index",
|
||||||
"src": "index.html",
|
"src": "index.html",
|
||||||
"isEntry": true,
|
"isEntry": true,
|
||||||
"css": [
|
"css": [
|
||||||
"index-ClWnXPkW.css"
|
"index-CRTzDW6u.css"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
5510
src/OAP/Oap.Theme/wwwroot/index-CFylyzUG.js
Normal file
5510
src/OAP/Oap.Theme/wwwroot/index-CFylyzUG.js
Normal file
File diff suppressed because one or more lines are too long
@@ -578,6 +578,9 @@ span.field-validation-error {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
border-width: 0;
|
border-width: 0;
|
||||||
}
|
}
|
||||||
|
.absolute {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
.mx-auto {
|
.mx-auto {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
@@ -760,6 +763,9 @@ span.field-validation-error {
|
|||||||
--tw-ring-opacity: 1;
|
--tw-ring-opacity: 1;
|
||||||
--tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity));
|
--tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity));
|
||||||
}
|
}
|
||||||
|
.filter {
|
||||||
|
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
|
||||||
|
}
|
||||||
.placeholder\:text-gray-400::-moz-placeholder {
|
.placeholder\:text-gray-400::-moz-placeholder {
|
||||||
--tw-text-opacity: 1;
|
--tw-text-opacity: 1;
|
||||||
color: rgb(156 163 175 / var(--tw-text-opacity));
|
color: rgb(156 163 175 / var(--tw-text-opacity));
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,16 +1,21 @@
|
|||||||
<!doctype html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Overseas Auto Protection - Svelte</title>
|
<title>Overseas Auto Protection - Svelte</title>
|
||||||
<script type="module" crossorigin src="/index-DmYf-7v-.js"></script>
|
<script type="module" crossorigin src="/index-CFylyzUG.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/index-ClWnXPkW.css">
|
<link rel="stylesheet" crossorigin href="/index-CRTzDW6u.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|
||||||
<div id="OapApplicationForm-1" class="OapApplicationForm"></div>
|
<main class="container mx-auto flex flex-col max-w-screen-md p-6">
|
||||||
|
<div
|
||||||
|
id="4j2b7wf1fmjdd1g2twvxhpng4h"
|
||||||
|
class="OapApplicationForm"
|
||||||
|
></div>
|
||||||
|
</main>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user