0.8.1 • Published 11 days ago

@hydrofoil/shaperone-wc v0.8.1

Weekly downloads
276
License
MIT
Repository
github
Last release
11 days ago

shaperone-form

A custom element which renders a form element using graph description in SHACL format. The underlying value is a graph represented using the RDF/JS data model specification

Usage

This example shows the element used with the default lit renderer

import '@hypermedia-app/shaperone-form/shaperone-form.js'
import Environment from '@zazuko/env/Environment.js'
import { configure } from '@hydrofoil/shaperone-wc/configure.js'
import { html } from '@hypermedia-app/shaperone-form'
import alcaeus from 'alcaeus/Factory.js'
import parent from '@zazuko/env/web.js'

const env = new Environment([alcaeus()], { parent })
configure(env)

const shapes = await env.hydra.loadResource('http://example.com/api/shape')
const resource = rdf.clownface().blankNode()

const formTemplate = html`<shaperone-form .shapes=${shapes} .resource=${resource}></shaperone-form>`

The above snippet assumes that shapes get loaded from a remote resource and the form value is initialized with a blank node without any properties.

Such setup will render a very basic and unstyled form using native browser input elements and no specific layout. Check the main documentation page for instructions on customizing the form's rendering.

Mixins: connect

Properties

PropertyAttributeModifiersTypeDefaultDescription
componentscomponentsreadonlyComponentsStateGets the state of the editor components
editorseditorsreadonlyEditorsStateGets the state of the DASH editors model
envreadonlyEnvironment<any>Gets the RDF/JS environment
isValidreadonlybooleanGets a value indicating if there are any sh:Violation violation results
noEditorSwitchesno-editor-switchesbooleanfalseDisables the ability to change object editors. Only the one with highest score will be rendered
rendererRenderer<UncompiledTemplateResult<ResultType>>"DefaultRenderer"Gets or sets the renderer implementation
rendererOptionsrendererOptionsreadonlyRendererStateGets the state of the renderer
resourceGraphPointer<BlankNode \| NamedNode<string>, DatasetCore<Quad, Quad>> \| undefinedGets or sets the resource graph as graph pointer
shapesDatasetCore<Quad, Quad> \| AnyPointer<AnyContext, DatasetCore<Quad, Quad>> \| undefinedGets or sets the shapes graph
statestateFormStateGets the internal state of the form element
validationReportreadonlyGraphPointer<Term, DatasetCore<Quad, Quad>> \| undefinedGets a graph pointer to the latest SHACL Validation Report
validationResultsreadonlyValidationResultState[]Get all validation results found in the {@see validationReport} graph
valuereadonlyRdfResource<DatasetCore<Quad, Quad>> \| nullGets the resource as a rdfine object

Methods

MethodTypeDescription
mapEvents((): DispatchMap) \| undefined
validate(): voidTriggers validation of the current resource against the shapes graph

Events

EventType
changedCustomEvent<any>
0.8.1

11 days ago

0.8.0

1 month ago

0.7.13

1 year ago

0.7.11

1 year ago

0.7.10

1 year ago

0.7.9

1 year ago

0.7.12

1 year ago

0.7.8

2 years ago

0.7.7

2 years ago

0.7.4

2 years ago

0.7.3

2 years ago

0.7.6

2 years ago

0.6.10

2 years ago

0.6.11

2 years ago

0.7.2

2 years ago

0.7.1

2 years ago

0.7.0

2 years ago

0.6.9

2 years ago

0.6.8

2 years ago

0.6.7

2 years ago

0.6.6

2 years ago

0.6.3

3 years ago

0.6.5

2 years ago

0.6.4

2 years ago

0.6.2

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.2

3 years ago

0.5.1

3 years ago

0.5.0

3 years ago

0.4.6

3 years ago

0.4.5

3 years ago

0.4.4

3 years ago

0.4.3

3 years ago

0.4.2

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.5

3 years ago

0.3.4

3 years ago

0.3.2

3 years ago

0.3.3

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.6

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2-next.0

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago