nwl-components 1.3.19 → 1.4.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 +26 -0
- package/dist/nwl-components.es.js +3787 -6319
- package/dist/nwl-components.umd.js +6 -32
- package/dist/style.css +1 -1
- package/package.json +8 -5
package/README.md
CHANGED
|
@@ -41,6 +41,32 @@ The parent components are said to be container components (or sometimes _smart_
|
|
|
41
41
|
This concept makes it possible to separate view and business logic. In the project, pure components are prefixed with _Pure_.
|
|
42
42
|
|
|
43
43
|
|
|
44
|
+
## Configuration
|
|
45
|
+
|
|
46
|
+
The apps give the components their settings through a `config` object, provided to the
|
|
47
|
+
whole Vue app (`app.provide('config', config)`); see `.storybook/preview.js` for the
|
|
48
|
+
usual keys (`baseURL`, `usernameField`, `fetchLabelSets`, ...). Optional settings, all
|
|
49
|
+
off by default:
|
|
50
|
+
|
|
51
|
+
| Key | Default | Effect |
|
|
52
|
+
|---|---|---|
|
|
53
|
+
| `showEmbedButton` | `true` | Set to `false` to hide the "Embed Project" button (and its dialog) in the project settings, for apps that have no `/project/:p/embed` page. |
|
|
54
|
+
| `beforeSaveProject(project)` | none | Called when "Save Changes" is clicked in the project settings, before the project is sent to the server, with the project as edited. Return (or resolve to) `false` to cancel the save; any other value saves as before. If it throws or rejects, the project is not saved and the page shows "Changes not saved". |
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
app.provide('config', {
|
|
58
|
+
baseURL: '',
|
|
59
|
+
// ...
|
|
60
|
+
showEmbedButton: false,
|
|
61
|
+
beforeSaveProject: async (project) => {
|
|
62
|
+
// e.g. check the project, ask the user to confirm
|
|
63
|
+
return confirm(`Save ${project.shortname}?`);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Since 1.4.0.
|
|
69
|
+
|
|
44
70
|
## Storybook
|
|
45
71
|
|
|
46
72
|
The components are documented through storybook, where you can see their props and see example use cases (for now we just have 'default' ones). Storybook stories are defined in files with the `.stories.js` extension. It's a quite handy tool to develop a component in isolation of other components.
|