Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/ambient.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ declare global {

interface AttributeRequest {
t: string
v: string
v?: string
}

interface AttributeType {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/AttributeForm/AttributeCon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
>{$_(`addAttribute${signing ? 'Sign' : ''}`)}</option
>
{#each possibleChoices as { ident }}
<option required value={ident} label={$_(`attributeTypes.${ident}`)} />
<option value={ident} label={$_(`attributeTypes.${ident}`)} />
{/each}
</select>
{/if}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/AttributeForm/AttributeForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@

const res: { [key: string]: AttributeCon } = {}
for (const { id, con } of $policy) {
res[id] = [{ t: EMAIL, v: id.toLowerCase() }]
res[id] = signing ? [{ t: EMAIL }] : [{ t: EMAIL, v: id.toLowerCase() }]
for (let { t, v } of con) {
if (t === 'pbdf.gemeente.personalData.dateofbirth') v = v.replace(/\.|\//g, '-')
res[id].push({ t, v })
res[id].push(signing ? { t } : { t, v })
}
}

Expand Down
18 changes: 17 additions & 1 deletion src/lib/components/AttributeForm/AttributeValue.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import { tick, onMount } from 'svelte'
import { getContext } from 'svelte'

import './../../app.css'

Expand All @@ -25,10 +26,22 @@
? typ.placeholder.length * 0.8 + 1
: 10

const { policy, signing } = getContext('store')

onMount(() => element.focus())
</script>

{#if typ?.options}
{#if signing}
<input
bind:this={element}
on:blur={onblur}
bind:value
readonly
size=1
class="signing"
{...inputProps}
/>
{:else if typ?.options}
<select bind:this={element} on:blur={onblur} bind:value required>
{#each typ.options as option}
<option>{option}</option>
Expand Down Expand Up @@ -64,4 +77,7 @@
height: 100%;
padding: 0px 2px;
}
input.signing {
cursor: default !important;
}
</style>
2 changes: 1 addition & 1 deletion src/lib/components/TopBar/TopBar.story.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}

const initialPolicySign = {
'alice@example.com': [{ t: 'pbdf.sidn-pbdf.email.email', v: 'alice@example.com' }]
'alice@example.com': [{ t: 'pbdf.sidn-pbdf.email.email'}]
}

const onSubmit = async (policy: Policy) => {
Expand Down