Coder Social home page Coder Social logo

flxbe / xdatenfelder-ts Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 4.11 MB

A collection of TypeScript modules to work with the german eGov standard xDatenfelder

Home Page: https://flxbe.github.io/xdatenfelder-ts/

License: European Union Public License 1.2

TypeScript 98.98% JavaScript 1.02%
react typescript xoev xdatenfelder

xdatenfelder-ts's Introduction

xdatenfelder-ts

A collection of TypeScript modules to work with the german eGov standard XDatenfelder.

Modules

  • xdatenfelder-xml: Parser for XDatenfelder v2.0 and v3.0.0.
  • xdatenfelder-viewer: A web application to load and inspect xDatenfelder files locally (Hosted via Github Pages).
  • xdatenfelder-cg: Code generation tool that emits TypeScript for a given xDatenfelder file.
  • xdatenfelder-react: Experimental react bindings for the code generated via xdatenfelder-cg.
  • xdatenfelder: The code generated by xdatenfelder-cg from the files in harmonisierte Baukastenelemente Version 2.1

Getting Started (xdatenfelder)

Validate User Input

import { Familienstand } from "xdatenfelder";

const input = "x";

// throws for invalid input
const familienstand = Familienstand.fromString(input);

// or alternatively:
Familienstand.isValid(input);

List All Available Variants

import { Familienstand } from "./src";

for (const entry of Object.entries(Familienstand.Variants)) {
  const [value, label] = entry;
  console.log(value, label);
}

Output:

EA Ehe aufgehoben
GS geschieden
LA aufgehobene Lebenspartnerschaft
LD ledig
LE durch Todeserklärung aufgelöste Lebenspartnerschaft
LP in eingetragener Lebenspartnerschaft
LV durch Tod aufgelöste Lebenspartnerschaft
NB nicht bekannt
VH verheiratet
VW verwitwet

Example: React Select

See ./modules/xdatenfelder-react for the source code of the Select component.

import * as React from "react";

import { Augenfarbe, Familienstand } from "xdatenfelder";
import { Select } from "xdatenfelder-react";

export function Example() {
  const [familienstand, setFamilienstand] = React.useState<Familienstand>(
    new Familienstand("LD")
  );

  const [augenfarbe, setAugenfarbe] = React.useState<Augenfarbe>(
    new Augenfarbe("22")
  );

  return (
    <div>
      <Select
        Type={Familienstand}
        value={familienstand}
        onChange={setFamilienstand}
      />
      <br />
      <Select Type={Augenfarbe} value={augenfarbe} onChange={setAugenfarbe} />
    </div>
  );
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.