@entryscape/rdforms 10.15.0 → 10.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,68 +10,72 @@ RDForms is designed to be adaptable to different UI libraries. Currently, integr
10
10
 
11
11
  Deeper documentation for RDForms can be found at [rdforms.org](https://rdforms.org).
12
12
 
13
- # Templates
13
+ ## Templates
14
14
 
15
15
  The templates that drives RDForms are expressed as JSON structures. Templates can be divided into profile-level and field-level templates. A typical scenario is that a template author combines a set of field-level templates into a bigger profile-level template to meet a specific need. Such a profile-level template could correspond to well known application profiles (for example a dataset according the W3C Recommendation DCAT2) or correspond to a specific class in an ontology defined for a specific purpose in a project. Field-level templates are often reused across profiles but may require tweaking in various ways, for instance changing a label, restricting cardinality, refining a constraint etc. For this purpose there is an extension mechanism that allows tweaks to be made without forcing the template author to fork the template by making a full copy.
16
16
 
17
17
  Read more about the templates in the [reference guide at the documentation site](https://rdforms.org/#!templateReference.md).
18
18
 
19
- # How to use RDForms
19
+ ## How to use RDForms
20
20
 
21
21
  In addition to the RDForms library you need to load the RDF library rdfjson and then initialize an Editor, Presenter or Validator on a DOM node. Below is a high-level example, for more detailed information on how to prepare the parameters look at the examples.
22
22
 
23
- <script type="text/javascript" src="https://unpkg.com/@entryscape/rdfjson@2.3.0/dist/rdfjson.js"></script>
24
- <script type="text/javascript" src="https://unpkg.com/@entryscape/rdforms@10.0.0/dist/rdforms.react.js"></script>
25
- <script type="module">
26
- // Make sure to provide the parameters graph, resource and template
27
- new Editor({ graph, resource, template }, 'node_id');
28
- <script>
23
+ ```html
24
+ <script type="text/javascript" src="https://unpkg.com/@entryscape/rdfjson@2.3.0/dist/rdfjson.js"></script>
25
+ <script type="text/javascript" src="https://unpkg.com/@entryscape/rdforms@10.0.0/dist/rdforms.react.js"></script>
26
+ <script type="module">
27
+ // Make sure to provide the parameters graph, resource and template
28
+ new Editor({ graph, resource, template }, 'node_id');
29
+ <script>
30
+ ```
29
31
 
30
32
  The exact versions above (2.3.0 and 10.0.0) may vary, please check for yourself the latest versions in package.json. Naturally you can also use the built version in the dist folder, see the next section.
31
33
 
32
- # Installing and building
34
+ ## Installing and building
33
35
 
34
36
  Before you can install dependencies and build RDForms you need to make sure you have [nodejs](http://nodejs.org/), [npm](https://www.npmjs.org/) and [pnpm](https://pnpm.io/) installed in your system. To install dependencies for RDForms:
35
37
 
36
- pnpm install
38
+ ```console
39
+ pnpm install
40
+ ```
37
41
 
38
42
  To build RDForms:
39
43
 
40
- pnpm build:all
44
+ ```console
45
+ pnpm build:all
46
+ ```
41
47
 
42
- # Samples
48
+ ## Samples
43
49
 
44
50
  A good way to see the capabilities of RDForms is to take a look at the samples (generated from the examples, see section below). To generate the samples just run:
45
51
 
46
- pnpm build:samples
52
+ ```console
53
+ pnpm build:samples
54
+ ```
47
55
 
48
56
  This will build the samples in the `samples` directory. You'd need a web server to serve the samples. We provide a simple one for your convenience:
49
57
 
50
- pnpm serve:samples
58
+ ```console
59
+ pnpm serve:samples
60
+ ```
51
61
 
52
62
  Your browser should open automatically, otherwise access the samples at [http://localhost:8080/](http://localhost:8080/).
53
63
 
54
- # Development
64
+ ## Development
55
65
 
56
66
  You can develop the different UI libraries as well as the part of the generic code base by running the examples in the webpack-dev-server:
57
67
 
58
- ```$js
68
+ ```js
59
69
  pnpm dev:react
60
70
  ```
61
71
 
62
72
  or
63
73
 
64
- ```$js
65
- pnpm dev:bmd
66
- ```
67
-
68
- or
69
-
70
- ```$js
74
+ ```js
71
75
  pnpm dev:bootstrap
72
76
  ```
73
77
 
74
- # Examples
78
+ ## Examples
75
79
 
76
80
  The examples serve two purposes:
77
81
 
@@ -80,48 +84,48 @@ The examples serve two purposes:
80
84
 
81
85
  The examples are outlined below:
82
86
 
83
- ## [example1](http://localhost:8080/samples/react/example1) - Editor for one field
87
+ ### [example1](http://localhost:8080/react/example1) - Editor for one field
84
88
 
85
89
  1. Loads the library and its CSS.
86
90
  2. Creates a minimal RDF graph manually.
87
91
  3. Creates a minimal RDForms template manually.
88
92
  4. Creates the editor UI from the RDF graph, a given resource, a template and an HTML node.
89
93
 
90
- Check [example1/init.js](http://localhost:8080/samples/react/example1/init.js) for more.
94
+ Check [example1/init.js](http://localhost:8080/react/example1/init.js) for more.
91
95
 
92
- ## [example2](http://localhost:8080/samples/react/example2) - Editor for large template loaded from file
96
+ ### [example2](http://localhost:8080/react/example2) - Editor for large template loaded from file
93
97
 
94
98
  Different from example1 in the sense that it loads the graph and template from separate files.
95
- Check [example2/init.js](http://localhost:8080/samples/react/example2/init.js) for more.
99
+ Check [example2/init.js](http://localhost:8080/react/example2/init.js) for more.
96
100
 
97
- ## [example3](http://localhost:8080/samples/react/example3) - Presenter
101
+ ### [example3](http://localhost:8080/react/example3) - Presenter
98
102
 
99
103
  Same template and data as in example2, but now the presenter is used instead.
100
- Check [example3/init.js](http://localhost:8080/samples/react/example3/init.js) for more.
104
+ Check [example3/init.js](http://localhost:8080/react/example3/init.js) for more.
101
105
 
102
- ## [example4](http://localhost:8080/samples/react/example4) - Validation presenter
106
+ ### [example4](http://localhost:8080/react/example4) - Validation presenter
103
107
 
104
108
  This examples shows how RDForms can be used as a form validator rather than just an editor or presenter.
105
109
  Take a look at the validation report inside the form presenter.
106
110
 
107
- Check [example4/init.js](http://localhost:8080/samples/react/example4/init.js) for more.
111
+ Check [example4/init.js](http://localhost:8080/react/example4/init.js) for more.
108
112
 
109
- ## [example5](http://localhost:8080/samples/react/example5) - Building on default templates
113
+ ### [example5](http://localhost:8080/react/example5) - Building on default templates
110
114
 
111
115
  This examples utilizes pre-made templates to render forms. It can serve as a very good start for extending them and creating your
112
116
  own custom forms.
113
117
 
114
- Check [example5/init.js](http://localhost:8080/samples/react/example5/init.js) for more.
118
+ Check [example5/init.js](http://localhost:8080/react/example5/init.js) for more.
115
119
 
116
- ## [example6](http://localhost:8080/samples/react/example6) - RDF output from editor (Template is for Dataset according to DCAT-AP)
120
+ ### [example6](http://localhost:8080/react/example6) - RDF output from editor (Template is for Dataset according to DCAT-AP)
117
121
 
118
122
  This example provides a ready output to check your form RDF output live.
119
123
 
120
- Check [example6/init.js](http://localhost:8080/samples/react/example6/init.js) for more.
124
+ Check [example6/init.js](http://localhost:8080/react/example6/init.js) for more.
121
125
 
122
- ## [example7](http://localhost:8080/samples/react/example7) - RDForm editor with a registered chooser
126
+ ### [example7](http://localhost:8080/react/example7) - RDForm editor with a registered chooser
123
127
 
124
128
  This is a more advanced example providing some guidance on how to create your own choosers and register them to show on
125
129
  select fields in your forms. You can even have your data be fetched across the network.
126
130
 
127
- Check [example7/init.js](http://localhost:8080/samples/rect/example7/init.js) for more.
131
+ Check [example7/init.js](http://localhost:8080/rect/example7/init.js) for more.