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
16 changes: 10 additions & 6 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

// TODO: import Jsonix as module
// TODO: reset currentItem after loading a new file
// TODO: edit struktur, not enthaelt.datenfeld or enthaelt.datenfeldgruppe and make anzahl available
// TODO: use stammdatenschema as root of tree to allow adding elements before first enthaelt
// TODO: optionally use own counter in number range 00

import example from "./bewohnerparken-datenfelder.json"
Expand All @@ -18,8 +16,14 @@
let formHandle;
let stammdatenschemaValue;

// let stammdatenschemaElement = example;
let stammdatenschemaElement;
let stammdatenschemaElement = example;
// let stammdatenschemaElement;

let maskInformation = {
profile: {
seitenbau: {}
}
};

$: if (stammdatenschemaElement) {
stammdatenschemaValue = stammdatenschemaElement.value;
Expand Down Expand Up @@ -112,8 +116,8 @@
<button on:click={loadTemplate} disabled='{!stammdatenschemaElement}'>Formulartemplate wählen...</button>

{#if stammdatenschemaValue}
<h1>{stammdatenschemaValue.stammdatenschema.name}</h1>
<Stammdatenschema structures="{stammdatenschemaValue.stammdatenschema.struktur}"/>
<!-- <h1>{stammdatenschemaValue.stammdatenschema.name}</h1>-->
<Stammdatenschema stammdatenschema="{stammdatenschemaValue.stammdatenschema}" {maskInformation}/>
{/if}
</div>
<style>
Expand Down
4 changes: 4 additions & 0 deletions src/Datenfeld.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<script>
import {createEventDispatcher} from 'svelte';
import Field from "./profiles/seitenbau/Field.svelte";

const dispatch = createEventDispatcher();

export let currentItem;
export let currentItemJson;
export let currentMaskInformation;
export let anzahl;

let bezeichnungEingabeInput; // TODO to focus when the item is new

Expand Down Expand Up @@ -103,6 +106,7 @@
<input class="w3-input" bind:value="{currentItem.schemaelementart.code}"/>
</label>
</div>
<Field {currentMaskInformation} feldart="{currentItem.feldart.code}" datentyp="{currentItem.datentyp.code}" anzahl="{anzahl}" on:maskInformationChanged/>
<p>
<label>Quelltext
<textarea class="w3-input" rows="30" cols="80" disabled>{currentItemJson}</textarea>
Expand Down
1 change: 1 addition & 0 deletions src/Datenfeldgruppe.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

export let currentItem = {};
export let currentItemJson = {};
export let currentMaskInformation;

let bezeichnungEingabeInput; // TODO to focus when the item is new

Expand Down
36 changes: 29 additions & 7 deletions src/Stammdatenschema.svelte
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
<script>
import Struktur from "./Struktur.svelte";
import StrukturEditor from "./StrukturEditor.svelte"
import StammdatenschemaRoot from "./StammdatenschemaRoot.svelte";
import StammdatenschemaEditor from "./StammdatenschemaEditor.svelte";

export let structures = [];
export let stammdatenschema;
// export let structures = [];
export let maskInformation;

let structures = [];
let currentItem;
let currentFimIdPath;
let currentMaskInformation = {};
let currentItemJson = "";
let indent = 18

$: if (stammdatenschema) {
structures = stammdatenschema.struktur;
}

function selectCurrentItem(event) {
currentFimIdPath = event.detail.fimIdPath;
if(!maskInformation.profile['seitenbau'][currentFimIdPath]) {
if (!maskInformation.profile['seitenbau'][currentFimIdPath]) {
maskInformation.profile['seitenbau'][currentFimIdPath] = {};
}
currentMaskInformation = maskInformation.profile['seitenbau'][currentFimIdPath];
const structure = event.detail.current;
console.log(structure);
console.log(`structure: ${JSON.stringify(structure)}`);
currentItem = structure;
const currentItemClone = Object.assign({}, structure); // clone structure to delete struktur from it for json display
delete currentItemClone.struktur;
Expand All @@ -28,11 +37,16 @@
structures = structures;
}

function updateStammdatenschema() {
stammdatenschema = stammdatenschema;
}

function updateMaskInformation() {
console.log("updateMaskInformations")
maskInformation = maskInformation;
}


</script>

<style>
Expand All @@ -41,15 +55,23 @@
<div class="stammdatenschema w3-cell-row">

<div class="structures w3-container w3-cell" style="width:45%">
{JSON.stringify(maskInformation)}
<!--{JSON.stringify(maskInformation)}-->
<StammdatenschemaRoot {stammdatenschema} on:currentItemSelected={selectCurrentItem}/>
{#each structures as structure, i}
<Struktur struktur={structure} parentStructures={structures} index="{i}" fimIdPath="{structure.enthaelt.datenfeld ? structure.enthaelt.datenfeld.identifikation.id : structure.enthaelt.datenfeldgruppe.identifikation.id}"
on:currentItemSelected={selectCurrentItem} on:structuresChanged={updateStructures}/>
<Struktur struktur={structure} parentStructures={structures} indent="{indent}" index="{i}"
fimIdPath="{structure.enthaelt.datenfeld ? structure.enthaelt.datenfeld.identifikation.id : structure.enthaelt.datenfeldgruppe.identifikation.id}"
on:currentItemSelected={selectCurrentItem} on:structuresChanged={updateStructures}/>
{/each}
</div>

<form class="editor w3-container w3-light-grey w3-cell" style="margin-left:46%">
<StrukturEditor {currentItem} {currentItemJson} {currentMaskInformation} on:structuresChanged="{updateStructures}" on:maskInformationChanged={updateMaskInformation}/>
{#if currentItem && currentItem.enthaelt}
<StrukturEditor {currentItem} {currentItemJson} {currentMaskInformation}
on:structuresChanged="{updateStructures}"
on:maskInformationChanged={updateMaskInformation}/>
{:else}
<StammdatenschemaEditor {currentItem} on:structuresChanged={updateStammdatenschema}/>
{/if}
</form>

</div>
20 changes: 20 additions & 0 deletions src/StammdatenschemaEditor.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<script>
import {createEventDispatcher} from 'svelte';

const dispatch = createEventDispatcher();

export let currentItem;

function bezeichnungEingabeChanged() {
dispatch("structuresChanged")
}
</script>

{#if currentItem}
<h4>Stammdatenschema {currentItem.identifikation.id} V{currentItem.identifikation.version}</h4>
<div class="w3-row">
<label>Bezeichnung Eingabe
<input class="w3-input" bind:value="{currentItem.bezeichnungEingabe}" on:change={bezeichnungEingabeChanged}/>
</label>
</div>
{/if}
162 changes: 162 additions & 0 deletions src/StammdatenschemaRoot.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
<script>
import {createEventDispatcher} from 'svelte';
import {v4 as uuidv4} from "uuid";

export let stammdatenschema;

let open = false;
const dispatch = createEventDispatcher();

function setCurrent(object) {
dispatch('currentItemSelected', {current: object, fimIdPath: null});
}

function addChildGroup() {
const newGroup = {
"TYPE_NAME": "xdf.Struktur",
"anzahl": "1:1",
"bezug": "",
"enthaelt": {
"TYPE_NAME": "xdf.Enthaelt",
"datenfeldgruppe": {
"TYPE_NAME": "xdf.Datenfeldgruppe",
"identifikation": {
"TYPE_NAME": "xdf.ElementIdentifikation",
"id": "G-" + uuidv4(),
"version": "1.0"
},
"name": "",
"bezeichnungEingabe": "Neue Datenfeldgruppe",
"bezeichnungAusgabe": "",
"beschreibung": "",
"definition": "",
"bezug": "",
"status": {
"TYPE_NAME": "xdf.CodeStatus",
"listURI": "urn:xoev-de:fim:codeliste:xdatenfelder.status",
"listVersionID": "1.0",
"code": "aktiv"
},
"fachlicherErsteller": "TODO",
"schemaelementart": {
"TYPE_NAME": "xdf.CodeSchemaelementart",
"listURI": "urn:xoev-de:fim:codeliste:xdatenfelder.schemaelementart",
"listVersionID": "1.0",
"code": "RNG"
},
"hilfetextEingabe": "",
"hilfetextAusgabe": "",
"struktur": []
}
}
};
stammdatenschema.struktur.splice(0, 0, newGroup)
dispatch('structuresChanged')
dispatch('currentItemSelected', {current: newGroup});
open = true;
}

function addChildField() {
const newField = {
"TYPE_NAME": "xdf.Struktur",
"anzahl": "1:1",
"bezug": "",
"enthaelt": {
"TYPE_NAME": "xdf.Enthaelt",
"datenfeld": {
"TYPE_NAME": "xdf.Datenfeld",
"identifikation": {
"TYPE_NAME": "xdf.ElementIdentifikation",
"id": "F-" + uuidv4(),
"version": "1.0"
},
"name": "",
"bezeichnungEingabe": "Neues Datenfeld",
"bezeichnungAusgabe": "",
"beschreibung": "",
"definition": "",
"bezug": "",
"status": {
"TYPE_NAME": "xdf.CodeStatus",
"listURI": "urn:xoev-de:fim:codeliste:xdatenfelder.status",
"listVersionID": "1.0",
"code": "aktiv"
},
"fachlicherErsteller": "TODO aktueller User",
"schemaelementart": {
"TYPE_NAME": "xdf.CodeSchemaelementart",
"listURI": "urn:xoev-de:fim:codeliste:xdatenfelder.schemaelementart",
"listVersionID": "1.0",
"code": "RNG"
},
"hilfetextEingabe": "",
"hilfetextAusgabe": "",
"feldart": {
"TYPE_NAME": "xdf.CodeFeldart",
"listURI": "urn:xoev-de:fim:codeliste:xdatenfelder.feldart",
"listVersionID": "1.0",
"code": "input"
},
"datentyp": {
"TYPE_NAME": "xdf.CodeDatentyp",
"listURI": "urn:xoev-de:fim:codeliste:xdatenfelder.datentyp",
"listVersionID": "1.0",
"code": "text"
},
"praezisierung": "",
"inhalt": "",
"codelisteReferenz": {
"TYPE_NAME": "xdf.CodelisteReferenz",
"identifikation": {
"TYPE_NAME": "xdf.ElementIdentifikation",
"id": "TODO C05000073"
},
"genericodeIdentification": {
"TYPE_NAME": "xdf.GenericodeIdentification",
"canonicalIdentification": "urn:de:fim:codeliste:zustimmung",
"version": "2021-01-11",
"canonicalVersionUri": "urn:de:fim:codeliste:zustimmung_2021-01-11"
}
}
}
}
};
stammdatenschema.struktur.splice(0, 0, newField)
dispatch('structuresChanged')
dispatch('currentItemSelected', {current:newField});
open = true;
}

$: arrowDown = open
</script>

<p>
<span>
<span class="arrow arrowDown" class:arrowDown>&#x25b6</span>
</span>
<strong class="clickable"
on:click={setCurrent(stammdatenschema)}>{stammdatenschema.bezeichnungEingabe}</strong>
<i class="bi-node-plus clickable w3-text-grey" title="Feld zu diesem Stammdatenschema hinzufügen"
on:click={addChildField}></i>
<i class="bi-node-plus-fill clickable w3-text-grey" title="Feldgruppe zu diesem Stammdatenschema hinzufügen"
on:click={addChildGroup}></i>
<!-- <i class="bi-x-circle clickable w3-text-red" title="Entfernen" on:click={deleteItem(index, struktur.enthaelt.datenfeldgruppe.bezeichnungEingabe)}></i>-->
</p>

<style>
.clickable {
cursor: pointer;
user-select: none;
}

/*.arrow {*/
/* cursor: pointer;*/
/* display: inline-block;*/
/* user-select: none;*/
/* transition: transform 200ms;*/
/*}*/

.arrowDown {
transform: rotate(90deg);
}
</style>
10 changes: 5 additions & 5 deletions src/Struktur.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
if (window.confirm(`Möchten Sie das Element '${bezeichnungEingabe}' wirklich löschen?`)) {
parentStructures.splice(index, 1)
dispatch('structuresChanged')
dispatch('currentItemSelected', {enthaelt: {}});
dispatch('currentItemSelected', {current:{enthaelt: {}}});
}
}

Expand Down Expand Up @@ -179,7 +179,7 @@
};
parentStructures.splice(index + 1, 0, newGroup)
dispatch('structuresChanged')
dispatch('currentItemSelected', newGroup);
dispatch('currentItemSelected', {current:newGroup, fimIdPath: fimIdPath});
}

function addField(index) {
Expand Down Expand Up @@ -250,7 +250,7 @@
};
console.log(`new field: ${JSON.stringify(newField)}`)
parentStructures.splice(index + 1, 0, newField)
dispatch('currentItemSelected', newField);
dispatch('currentItemSelected', {current:newField, fimIdPath: fimIdPath});
dispatch('structuresChanged')
}

Expand Down Expand Up @@ -296,7 +296,7 @@
};
parentStructures[index].enthaelt.datenfeldgruppe.struktur.splice(0, 0, newGroup)
dispatch('structuresChanged')
dispatch('currentItemSelected', newGroup);
dispatch('currentItemSelected', {current:newGroup, fimIdPath: fimIdPath});
open = true;
}

Expand Down Expand Up @@ -368,7 +368,7 @@
};
parentStructures[index].enthaelt.datenfeldgruppe.struktur.splice(0, 0, newField)
dispatch('structuresChanged')
dispatch('currentItemSelected', newField);
dispatch('currentItemSelected', {current:newField, fimIdPath: fimIdPath});
open = true;
}

Expand Down
Loading