refactor
This commit is contained in:
parent
38e4b92ae8
commit
6bedafbdb1
|
@ -2,6 +2,7 @@
|
||||||
import ExplanationModal from './ExplanationModal/index.svelte'
|
import ExplanationModal from './ExplanationModal/index.svelte'
|
||||||
import { warnings, errors } from "../../fieldValidator";
|
import { warnings, errors } from "../../fieldValidator";
|
||||||
import { Column, Support, NotRequired, StringNumber } from "./lines"
|
import { Column, Support, NotRequired, StringNumber } from "./lines"
|
||||||
|
import subjects from './subjects';
|
||||||
|
|
||||||
export let support = {}
|
export let support = {}
|
||||||
|
|
||||||
|
@ -16,7 +17,7 @@
|
||||||
|
|
||||||
let root = null;
|
let root = null;
|
||||||
|
|
||||||
let explanationModalSubject = null
|
let explanationModalSubject = subjects.none
|
||||||
|
|
||||||
const setExplanationSubject = (option) => {
|
const setExplanationSubject = (option) => {
|
||||||
explanationModalSubject = option;
|
explanationModalSubject = option;
|
||||||
|
|
|
@ -1,27 +1,28 @@
|
||||||
<script>
|
<script>
|
||||||
import { ContextTooltip } from "@budibase/bbui"
|
import { ContextTooltip } from "@budibase/bbui"
|
||||||
import { Column, Support, NotRequired, StringsAsNumbers } from './subjects'
|
import { Column, Support, NotRequired, StringsAsNumbers } from './subjects'
|
||||||
|
import subjects from '../subjects'
|
||||||
|
|
||||||
export let anchor
|
export let anchor
|
||||||
export let schema
|
export let schema
|
||||||
export let subject = null
|
export let subject = subjects.none
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<ContextTooltip
|
<ContextTooltip
|
||||||
noAnimation
|
noAnimation
|
||||||
visible={subject !== null}
|
visible={subject !== subjects.none}
|
||||||
{anchor}
|
{anchor}
|
||||||
offset={20}
|
offset={20}
|
||||||
>
|
>
|
||||||
<div class="explanationModalContent">
|
<div class="explanationModalContent">
|
||||||
{#if subject === "column"}
|
{#if subject === subjects.column}
|
||||||
<Column {schema} />
|
<Column {schema} />
|
||||||
{:else if subject === "support"}
|
{:else if subject === subjects.support}
|
||||||
<Support />
|
<Support />
|
||||||
{:else if subject === "stringsAndNumbers"}
|
{:else if subject === subjects.stringsAsNumbers}
|
||||||
<StringsAsNumbers />
|
<StringsAsNumbers />
|
||||||
{:else if subject === "required"}
|
{:else if subject === subjects.notRequired}
|
||||||
<NotRequired />
|
<NotRequired />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { Line, InfoWord, DocumentationLink, Space, Text, Period } from "../typography"
|
import { Line, InfoWord, DocumentationLink, Space, Text, Period } from "../typography"
|
||||||
|
import subjects from '../subjects'
|
||||||
|
|
||||||
export let columnName
|
export let columnName
|
||||||
export let columnIcon
|
export let columnIcon
|
||||||
|
@ -36,8 +37,8 @@
|
||||||
|
|
||||||
<Line>
|
<Line>
|
||||||
<InfoWord
|
<InfoWord
|
||||||
on:mouseenter={() => setExplanationSubject("column")}
|
on:mouseenter={() => setExplanationSubject(subjects.column)}
|
||||||
on:mouseleave={() => setExplanationSubject(null)}
|
on:mouseleave={() => setExplanationSubject(subjects.none)}
|
||||||
href={tableHref}
|
href={tableHref}
|
||||||
text={columnName}
|
text={columnName}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { Line, InfoWord, DocumentationLink, Space, Text, Period, Comma } from "../typography"
|
import { Line, InfoWord, DocumentationLink, Space, Text, Period, Comma } from "../typography"
|
||||||
|
import subjects from '../subjects'
|
||||||
|
|
||||||
export let setExplanationSubject
|
export let setExplanationSubject
|
||||||
</script>
|
</script>
|
||||||
|
@ -9,8 +10,8 @@
|
||||||
<Text>No</Text>
|
<Text>No</Text>
|
||||||
<Space />
|
<Space />
|
||||||
<InfoWord
|
<InfoWord
|
||||||
on:mouseenter={() => setExplanationSubject("required")}
|
on:mouseenter={() => setExplanationSubject(subjects.notRequired)}
|
||||||
on:mouseleave={() => setExplanationSubject(null)}
|
on:mouseleave={() => setExplanationSubject(subjects.none)}
|
||||||
text="required"
|
text="required"
|
||||||
/>
|
/>
|
||||||
<Space />
|
<Space />
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { Line, InfoWord, DocumentationLink, Space, Text, Period } from "../typography"
|
import { Line, InfoWord, DocumentationLink, Space, Text, Period } from "../typography"
|
||||||
|
import subjects from '../subjects'
|
||||||
|
|
||||||
export let setExplanationSubject
|
export let setExplanationSubject
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -7,8 +9,8 @@
|
||||||
<Text>Any</Text>
|
<Text>Any</Text>
|
||||||
<Space />
|
<Space />
|
||||||
<InfoWord
|
<InfoWord
|
||||||
on:mouseenter={() => setExplanationSubject("stringsAndNumbers")}
|
on:mouseenter={() => setExplanationSubject(subjects.stringsAsNumbers)}
|
||||||
on:mouseleave={() => setExplanationSubject(null)}
|
on:mouseleave={() => setExplanationSubject(subjects.none)}
|
||||||
text="non-number values"
|
text="non-number values"
|
||||||
/>
|
/>
|
||||||
<Space />
|
<Space />
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { Line, InfoWord, DocumentationLink, Space, Text, Period } from "../typography"
|
import { Line, InfoWord, DocumentationLink, Space, Text, Period } from "../typography"
|
||||||
|
import subjects from '../subjects'
|
||||||
|
|
||||||
export let setExplanationSubject
|
export let setExplanationSubject
|
||||||
export let support
|
export let support
|
||||||
|
@ -7,8 +8,8 @@
|
||||||
|
|
||||||
<Line>
|
<Line>
|
||||||
<InfoWord
|
<InfoWord
|
||||||
on:mouseenter={() => setExplanationSubject("support")}
|
on:mouseenter={() => setExplanationSubject(subjects.support)}
|
||||||
on:mouseleave={() => setExplanationSubject(null)}
|
on:mouseleave={() => setExplanationSubject(subjects.none)}
|
||||||
icon={support.icon}
|
icon={support.icon}
|
||||||
color={support.iconColor}
|
color={support.iconColor}
|
||||||
text={support.text}
|
text={support.text}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
const subjects = {
|
||||||
|
column: Symbol("explanation-modal-column"),
|
||||||
|
support: Symbol("explanation-modal-support"),
|
||||||
|
stringsAsNumbers: Symbol("explanation-modal-strings-as-numbers"),
|
||||||
|
notRequired: Symbol("explanation-modal-not-required"),
|
||||||
|
none: Symbol("explanation-modal-none")
|
||||||
|
}
|
||||||
|
|
||||||
|
export default subjects;
|
Loading…
Reference in New Issue