Skip to content

Commit 8bdbbac

Browse files
authored
Merge pull request #219 from gdi-be/26828
Remove hints and update field layout
2 parents e3d54fb + bc2b89f commit 8bdbbac

72 files changed

Lines changed: 812 additions & 277 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bun.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/components/Form/CommentsPanel.svelte

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import { page } from '$app/state';
99
import { invalidateAll } from '$app/navigation';
1010
import { getContext, onMount } from 'svelte';
11-
import { popconfirm } from '$lib/context/PopConfirmContext.svelte';
11+
import { getPopconfirm } from '$lib/context/PopConfirmContext.svelte';
1212
import { FORMSTATE_CONTEXT, type FormState } from '$lib/context/FormContext.svelte';
1313
import { toast } from 'svelte-french-toast';
1414
import { getAccessToken } from '$lib/context/TokenContext.svelte';
@@ -28,6 +28,8 @@
2828
let inputRows = $derived(Math.min(value.split('\n').length, 4));
2929
let helpActive = $state(false);
3030
31+
const popconfirm = $derived(getPopconfirm());
32+
3133
onMount(() => {
3234
scrollToBottom();
3335
});
@@ -67,7 +69,7 @@
6769
async function onDelete(id: string, evt: MouseEvent) {
6870
const targetEl = evt.currentTarget as HTMLElement;
6971
evt.preventDefault();
70-
popconfirm(
72+
popconfirm.open(
7173
targetEl,
7274
async () => {
7375
const metadataId = metadata?.metadataId;

src/lib/components/Form/CopyButton.svelte

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import IconButton from '@smui/icon-button';
33
import { Icon } from '@smui/button';
4-
import { getValue } from '$lib/context/FormContext.svelte';
4+
import { getFormContext, getExtraParams } from '$lib/context/FormContext.svelte';
55
import type { FieldKey } from '$lib/models/form';
66
import type { FullFieldConfig } from './FieldsConfig';
77
import toast from 'svelte-french-toast';
@@ -16,6 +16,7 @@
1616
let { key, fieldConfig, value: valueFromProps }: CopyButtonProps = $props();
1717
1818
const t = $derived(page.data.t);
19+
const { formState, getValue } = getFormContext();
1920
const value = $derived(valueFromProps ?? getValue(key));
2021
let copied = $state(false);
2122
let copyFailed = $state(false);
@@ -26,7 +27,10 @@
2627
2728
if (fieldConfig?.getCopyValue) {
2829
try {
29-
text = await fieldConfig.getCopyValue(value);
30+
const extraParams = formState.metadata
31+
? getExtraParams(fieldConfig, formState.metadata)
32+
: undefined;
33+
text = await fieldConfig.getCopyValue(value, extraParams);
3034
} catch {
3135
toast.error(t('copybutton.copyError'));
3236
return;

src/lib/components/Form/Field/01_TitleField.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<script lang="ts">
22
import TextInput from '$lib/components/Form/Inputs/TextInput.svelte';
3-
import { getFieldConfig, getValue, persistValue } from '$lib/context/FormContext.svelte';
3+
import { getFieldConfig, getFormContext, persistValue } from '$lib/context/FormContext.svelte';
44
import FieldTools from '../FieldTools.svelte';
55
import { page } from '$app/state';
66
const t = $derived(page.data.t);
77
88
const KEY = 'isoMetadata.title';
99
10-
const valueFromData = $derived(getValue<string>(KEY));
10+
const formContext = $derived(getFormContext());
11+
const valueFromData = $derived(formContext.getValue<string>(KEY));
1112
let value = $state('');
1213
$effect(() => {
1314
value = valueFromData || '';

src/lib/components/Form/Field/02_DescriptionField.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<script lang="ts">
22
import type { ValidationResult } from '../FieldsConfig';
33
import FieldTools from '../FieldTools.svelte';
4-
import { getFieldConfig, getValue, persistValue } from '$lib/context/FormContext.svelte';
4+
import { getFieldConfig, getFormContext, persistValue } from '$lib/context/FormContext.svelte';
55
import TextAreaInput from '../Inputs/TextAreaInput.svelte';
66
import { page } from '$app/state';
77
const t = $derived(page.data.t);
88
99
const KEY = 'isoMetadata.description';
1010
11+
const { getValue } = getFormContext();
1112
const valueFromData = $derived(getValue<string>(KEY));
1213
let value = $state('');
1314
$effect(() => {

src/lib/components/Form/Field/04_PrivacyField.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { getFieldConfig, getValue, persistValue } from '$lib/context/FormContext.svelte';
2+
import { getFieldConfig, getFormContext, persistValue } from '$lib/context/FormContext.svelte';
33
import FieldTools from '../FieldTools.svelte';
44
import RadioInput from '../Inputs/RadioInput.svelte';
55
import type { ValidationResult } from '../FieldsConfig';
@@ -12,6 +12,7 @@
1212
const KEY = 'isoMetadata.privacy';
1313
const TERMS_OF_USE_KEY = 'isoMetadata.termsOfUseId';
1414
15+
const { getValue } = getFormContext();
1516
const valueFromData = $derived(getValue<string>(KEY));
1617
let value = $state('');
1718
$effect(() => {

src/lib/components/Form/Field/05_MetadataProfileField.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { getFieldConfig, getValue, persistValue } from '$lib/context/FormContext.svelte';
2+
import { getFieldConfig, getFormContext, persistValue } from '$lib/context/FormContext.svelte';
33
import FieldTools from '../FieldTools.svelte';
44
import SelectInput from '../Inputs/SelectInput.svelte';
55
import type { MetadataProfile } from '$lib/models/metadata';
@@ -27,6 +27,7 @@
2727
}
2828
]);
2929
30+
const { getValue } = getFormContext();
3031
const valueFromData = $derived(getValue<MetadataProfile>(KEY));
3132
let value = $state('');
3233
$effect(() => {

src/lib/components/Form/Field/06_HighValueDatasetField.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { getFieldConfig, getValue, persistValue } from '$lib/context/FormContext.svelte';
2+
import { getFieldConfig, getFormContext, persistValue } from '$lib/context/FormContext.svelte';
33
import FieldTools from '../FieldTools.svelte';
44
import Switch from '@smui/switch';
55
import type { Option } from '$lib/models/form';
@@ -14,6 +14,8 @@
1414
const CHECKED_KEY = 'isoMetadata.highValueDataset';
1515
const CATEGORY_KEY = 'isoMetadata.highValueDataCategory';
1616
17+
const { getValue } = getFormContext();
18+
1719
const checkedValueFromData = $derived(getValue<boolean>(CHECKED_KEY));
1820
let checkedValue = $state(false);
1921
$effect(() => {

src/lib/components/Form/Field/07_AnnexThemeField.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import {
33
FORMSTATE_CONTEXT,
44
getFieldConfig,
5-
getValue,
5+
getFormContext,
66
persistValue,
77
type FormState
88
} from '$lib/context/FormContext.svelte';
@@ -26,6 +26,7 @@
2626
const formState = getContext<FormState>(FORMSTATE_CONTEXT);
2727
const metadata = $derived(formState.metadata);
2828
29+
const { getValue } = getFormContext();
2930
let metadataProfile = $derived(getValue<MetadataProfile>(PROFILE_KEY, metadata));
3031
3132
const valueFromData = $derived(getValue<string[]>(KEY));

src/lib/components/Form/Field/09_CreatedField.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { getFieldConfig, getValue, persistValue } from '$lib/context/FormContext.svelte';
2+
import { getFieldConfig, getFormContext, persistValue } from '$lib/context/FormContext.svelte';
33
import FieldTools from '../FieldTools.svelte';
44
import DateInput from '../Inputs/DateInput.svelte';
55
import { page } from '$app/state';
@@ -8,6 +8,7 @@
88
const t = $derived(page.data.t);
99
const KEY = 'isoMetadata.created';
1010
11+
const { getValue } = getFormContext();
1112
const valueFromData = $derived(getValue<string>(KEY));
1213
let value = $state('');
1314
$effect(() => {

0 commit comments

Comments
 (0)