0.0.34 • Published 7 months ago

qsonforms v0.0.34

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

QSONForms

Usage

Install

  npm install qsonforms

Usage

Define Data

  const schema = {
    type: "object",
    properties: {
      first_name: {
        type: "string"
      },
      last_name: {
        type: "string"
      }
    }
  }

  const formData = useSignal({ first_name: "Aliyss", last_name: "Snow" })

  const uiSchema = createUiSchema(...);

Create Form

  const [userForm, { QSONForm }] = useQSONForm(schema, {
    loader: formData,
    uiSchema: uiSchema
  });

  return <QSONForm />

Caveats

Typesafety

Typesafety is not really given. Theoretically it could quickly implemented with json-schema-to-ts, however when currently using it I get "type instantiation to deep" or something like that. I assume after cleaning out unnecessary stuff this could work.

Of course the whole validation is to be based on json-schema with Ajv, so that would generally result to the same output anyways if one is not statically creating forms, in which case it may make more sense to use Modular Forms anyways.

Validation

Validation works by passing a validation function to useQSONForm. It must return an ajv ErrorObject or an empty array.

0.0.25

7 months ago

0.0.30

7 months ago

0.0.31

7 months ago

0.0.32

7 months ago

0.0.33

7 months ago

0.0.34

7 months ago

0.0.26

7 months ago

0.0.27

7 months ago

0.0.29

7 months ago

0.0.24

7 months ago

0.0.23

8 months ago

0.0.22

8 months ago

0.0.21

8 months ago

0.0.20

8 months ago

0.0.19

8 months ago

0.0.18

8 months ago

0.0.17

8 months ago

0.0.16

8 months ago

0.0.15

8 months ago

0.0.14

8 months ago

0.0.13

8 months ago

0.0.12

8 months ago

0.0.11

8 months ago

0.0.10

8 months ago

0.0.9

8 months ago

0.0.8

8 months ago

0.0.7

8 months ago

0.0.6

8 months ago

0.0.5

8 months ago

0.0.4

8 months ago

0.0.3

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago