@luomus/laji-form-builder 1.0.28
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/CHANGELOG.md +3 -0
- package/LICENSE +21 -0
- package/README.md +114 -0
- package/dist/laji-form-builder.js +2 -0
- package/dist/laji-form-builder.js.LICENSE.txt +82 -0
- package/dist/main.js +2 -0
- package/dist/main.js.LICENSE.txt +86 -0
- package/dist/styles.css +4 -0
- package/lib/api-client.d.ts +20 -0
- package/lib/api-client.js +60 -0
- package/lib/api-client.js.map +1 -0
- package/lib/client/LajiFormInterface.d.ts +44 -0
- package/lib/client/LajiFormInterface.js +39 -0
- package/lib/client/LajiFormInterface.js.map +1 -0
- package/lib/client/app.d.ts +9 -0
- package/lib/client/app.js +39 -0
- package/lib/client/app.js.map +1 -0
- package/lib/client/components/Builder.d.ts +101 -0
- package/lib/client/components/Builder.js +357 -0
- package/lib/client/components/Builder.js.map +1 -0
- package/lib/client/components/Context.d.ts +18 -0
- package/lib/client/components/Context.js +25 -0
- package/lib/client/components/Context.js.map +1 -0
- package/lib/client/components/Editor/BasicEditor.d.ts +29 -0
- package/lib/client/components/Editor/BasicEditor.js +185 -0
- package/lib/client/components/Editor/BasicEditor.js.map +1 -0
- package/lib/client/components/Editor/DiffViewer.d.ts +17 -0
- package/lib/client/components/Editor/DiffViewer.js +134 -0
- package/lib/client/components/Editor/DiffViewer.js.map +1 -0
- package/lib/client/components/Editor/Editor.d.ts +111 -0
- package/lib/client/components/Editor/Editor.js +344 -0
- package/lib/client/components/Editor/Editor.js.map +1 -0
- package/lib/client/components/Editor/ElemPicker.d.ts +13 -0
- package/lib/client/components/Editor/ElemPicker.js +170 -0
- package/lib/client/components/Editor/ElemPicker.js.map +1 -0
- package/lib/client/components/Editor/FieldEditor.d.ts +41 -0
- package/lib/client/components/Editor/FieldEditor.js +125 -0
- package/lib/client/components/Editor/FieldEditor.js.map +1 -0
- package/lib/client/components/Editor/Fields.d.ts +27 -0
- package/lib/client/components/Editor/Fields.js +185 -0
- package/lib/client/components/Editor/Fields.js.map +1 -0
- package/lib/client/components/Editor/OptionsEditor.d.ts +20 -0
- package/lib/client/components/Editor/OptionsEditor.js +207 -0
- package/lib/client/components/Editor/OptionsEditor.js.map +1 -0
- package/lib/client/components/Editor/UiSchemaEditor.d.ts +22 -0
- package/lib/client/components/Editor/UiSchemaEditor.js +368 -0
- package/lib/client/components/Editor/UiSchemaEditor.js.map +1 -0
- package/lib/client/components/LajiForm.d.ts +4 -0
- package/lib/client/components/LajiForm.js +32 -0
- package/lib/client/components/LajiForm.js.map +1 -0
- package/lib/client/components/Wizard.d.ts +11 -0
- package/lib/client/components/Wizard.js +364 -0
- package/lib/client/components/Wizard.js.map +1 -0
- package/lib/client/components/components.d.ts +103 -0
- package/lib/client/components/components.js +321 -0
- package/lib/client/components/components.js.map +1 -0
- package/lib/client/services/change-handler-service.d.ts +57 -0
- package/lib/client/services/change-handler-service.js +150 -0
- package/lib/client/services/change-handler-service.js.map +1 -0
- package/lib/client/services/form-service.d.ts +21 -0
- package/lib/client/services/form-service.js +77 -0
- package/lib/client/services/form-service.js.map +1 -0
- package/lib/client/styles.css +227 -0
- package/lib/client/styles.d.ts +2 -0
- package/lib/client/styles.js +5 -0
- package/lib/client/styles.js.map +1 -0
- package/lib/client/themes/bs3.d.ts +3 -0
- package/lib/client/themes/bs3.js +49 -0
- package/lib/client/themes/bs3.js.map +1 -0
- package/lib/client/themes/theme.d.ts +28 -0
- package/lib/client/themes/theme.js +14 -0
- package/lib/client/themes/theme.js.map +1 -0
- package/lib/client/translations.json +272 -0
- package/lib/client/utils.d.ts +63 -0
- package/lib/client/utils.js +370 -0
- package/lib/client/utils.js.map +1 -0
- package/lib/model.d.ts +205 -0
- package/lib/model.js +43 -0
- package/lib/model.js.map +1 -0
- package/lib/services/form-expander-service.d.ts +15 -0
- package/lib/services/form-expander-service.js +77 -0
- package/lib/services/form-expander-service.js.map +1 -0
- package/lib/services/has-cache.d.ts +8 -0
- package/lib/services/has-cache.js +22 -0
- package/lib/services/has-cache.js.map +1 -0
- package/lib/services/metadata-service.d.ts +23 -0
- package/lib/services/metadata-service.js +138 -0
- package/lib/services/metadata-service.js.map +1 -0
- package/lib/utils.d.ts +79 -0
- package/lib/utils.js +117 -0
- package/lib/utils.js.map +1 -0
- package/package.json +114 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
## 1.0.0
|
|
2
|
+
### BREAKING CHANGES:
|
|
3
|
+
* `schema` format follows strictly now the JSON Schema 7 spec. As a result, the support for the `enum` & `enumNames` keywords were dropped. Enumerations are formatted as items of `oneOf` instead. To use the old format, use the `schema-with-enums` format` (which will be deprecated later on though)
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 Dan Abramov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# laji-form-builder
|
|
2
|
+
This repo is responsible for two things:
|
|
3
|
+
* the **server** aka form backend which runs at https://form.laji.fi
|
|
4
|
+
* the **client** which is a React component for editing forms. Available as an npm package [`laji-form-builder`](https://www.npmjs.com/package/laji-form-builder).
|
|
5
|
+
|
|
6
|
+
## Server API
|
|
7
|
+
|
|
8
|
+
* `/?{lang:fi | en | sv = fi}` UI for selecting/deleting a form
|
|
9
|
+
* `/:id?{lang:fi | en | sv = fi}` UI for editing a form
|
|
10
|
+
|
|
11
|
+
REST JSON API `/api`:
|
|
12
|
+
* `/api?{lang?: fi | en | sv}` list forms as JSON
|
|
13
|
+
* `/api/:id?{lang?: fi | en | sv, format: json | schema | schema-with-enums = json, expand: true | false = true}` list forms as JSON
|
|
14
|
+
* `/api` (`POST`) Create new form entry
|
|
15
|
+
* `/api/:id` (`PUT`) Update form entry
|
|
16
|
+
* `/api/:id` (`DELETE`) Delete form entry
|
|
17
|
+
* `/api/transform?{lang?: fi | en | sv}` (`POST`) Transform BODY from `json` format to `schema` format
|
|
18
|
+
* `/api/flush` flushes cache
|
|
19
|
+
|
|
20
|
+
## Client API
|
|
21
|
+
|
|
22
|
+
For documentation, see how the server uses the `Builder` component: https://github.com/luomus/laji-form-builder/blob/master/src/server/view/app.tsx
|
|
23
|
+
|
|
24
|
+
## Development
|
|
25
|
+
|
|
26
|
+
### Stack
|
|
27
|
+
|
|
28
|
+
* node@14
|
|
29
|
+
* TypeScript
|
|
30
|
+
* express
|
|
31
|
+
* React
|
|
32
|
+
* protractor (e2e tests)
|
|
33
|
+
* supertest (express tests)
|
|
34
|
+
|
|
35
|
+
Development is done against node `v14`. Might work on other versions or might not.
|
|
36
|
+
|
|
37
|
+
### Install dependencies
|
|
38
|
+
```
|
|
39
|
+
npm ci
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Configuration
|
|
43
|
+
|
|
44
|
+
Copy `config.json.example` to `config.json`, and fill the configuration file.
|
|
45
|
+
|
|
46
|
+
### Development
|
|
47
|
+
|
|
48
|
+
Start the development server (it's the same as the production server but with hot reload enabled so code changed are reflected upon file changes):
|
|
49
|
+
```
|
|
50
|
+
npm start
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Tests
|
|
54
|
+
|
|
55
|
+
Both server/client tests use jasmine. Client e2e testing is done with protractor on top of jasmine.
|
|
56
|
+
|
|
57
|
+
#### Server
|
|
58
|
+
Server is tested without having to run the server. Just run:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
npm run test:server
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
##### Env variables:
|
|
65
|
+
|
|
66
|
+
* `MOCK=true`: Field service test API requests are mocked by default.
|
|
67
|
+
|
|
68
|
+
#### Client
|
|
69
|
+
First start the development server. You might need to update the webdriver manager:
|
|
70
|
+
```
|
|
71
|
+
node_modules/.bin/webdriver-manager update
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Then run the e2e tests:
|
|
75
|
+
```
|
|
76
|
+
npm run test:client
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
##### Debugging
|
|
80
|
+
|
|
81
|
+
You can debug the tests by running `npm run test:client:debug`. Details in [protractor docs](https://www.protractortest.org/#/debugging).
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
##### Env variables:
|
|
85
|
+
|
|
86
|
+
* `HEADLESS=false`: Run the tests in an actual browser window instead of the headless browser. Supports only Chrome.
|
|
87
|
+
* `TEST_BROWSER=chrome`: `firefox` will run against firefox, `multi` against both.
|
|
88
|
+
* `THREADS=4`: How many browser instances the tests are run against.
|
|
89
|
+
|
|
90
|
+
### Build
|
|
91
|
+
|
|
92
|
+
#### Server
|
|
93
|
+
|
|
94
|
+
To build the server (compiles both `static` and `build`):
|
|
95
|
+
```
|
|
96
|
+
npm run build:server
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
In production, run the built server with:
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
npm run start:prod
|
|
103
|
+
````
|
|
104
|
+
|
|
105
|
+
#### npm package
|
|
106
|
+
|
|
107
|
+
To build the npm package (compiles `lib`):
|
|
108
|
+
```
|
|
109
|
+
npm run build:client
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Publishing to npm
|
|
113
|
+
|
|
114
|
+
Run `npm version {patch,minor,major}`. This will run the linting & front end tests (and halt if they fail), build the client and publish to npm. We follow [semantic versioning](https://docs.npmjs.com/about-semantic-versioning).
|