@lblod/ember-rdfa-editor-lblod-plugins 32.2.0 → 32.3.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +28 -817
  3. package/addon/components/location-plugin/nodeview.gts +9 -1
  4. package/addon/components/mandatee-table-plugin/node.gts +6 -1
  5. package/addon/components/snippet-plugin/nodes/placeholder.gts +9 -1
  6. package/addon/components/snippet-plugin/nodes/snippet.gts +5 -1
  7. package/addon/components/structure-plugin/_private/structure.gts +5 -0
  8. package/addon/components/template-comments-plugin/template-comment.hbs +1 -1
  9. package/addon/components/template-comments-plugin/template-comment.ts +4 -0
  10. package/addon/components/variable-plugin/address/nodeview.hbs +1 -1
  11. package/addon/components/variable-plugin/address/nodeview.ts +4 -0
  12. package/addon/components/variable-plugin/date/nodeview.hbs +1 -1
  13. package/addon/components/variable-plugin/date/nodeview.ts +5 -0
  14. package/addon/components/variable-plugin/number/nodeview.hbs +5 -1
  15. package/addon/components/variable-plugin/number/nodeview.ts +4 -0
  16. package/addon/components/variable-plugin/person/nodeview.hbs +1 -1
  17. package/addon/components/variable-plugin/person/nodeview.ts +4 -0
  18. package/addon/components/variable-plugin/variable/nodeview.hbs +1 -1
  19. package/addon/components/variable-plugin/variable/nodeview.ts +4 -0
  20. package/addon/plugins/document-title-plugin/nodes/document-title.ts +1 -0
  21. package/addon/plugins/location-plugin/node-contents/address.ts +15 -2
  22. package/addon/plugins/location-plugin/node-contents/area.ts +13 -2
  23. package/addon/plugins/location-plugin/node-contents/place.ts +13 -2
  24. package/addon/plugins/location-plugin/node.ts +14 -4
  25. package/addon/plugins/mandatee-table-plugin/node.ts +5 -2
  26. package/addon/plugins/roadsign-regulation-plugin/nodes.ts +10 -2
  27. package/addon/plugins/snippet-plugin/nodes/snippet-placeholder.ts +3 -1
  28. package/addon/plugins/snippet-plugin/nodes/snippet.ts +3 -0
  29. package/addon/plugins/structure-plugin/node.ts +3 -0
  30. package/addon/plugins/template-comments-plugin/node.ts +1 -0
  31. package/addon/plugins/variable-plugin/variables/address.ts +3 -1
  32. package/addon/plugins/variable-plugin/variables/autofilled.ts +4 -2
  33. package/addon/plugins/variable-plugin/variables/codelist.ts +4 -2
  34. package/addon/plugins/variable-plugin/variables/date.ts +3 -1
  35. package/addon/plugins/variable-plugin/variables/location.ts +4 -2
  36. package/addon/plugins/variable-plugin/variables/number.ts +3 -1
  37. package/addon/plugins/variable-plugin/variables/person.ts +3 -1
  38. package/addon/plugins/variable-plugin/variables/text.ts +4 -2
  39. package/app/styles/snippet-plugin.scss +3 -12
  40. package/app/styles/variable-plugin.scss +46 -44
  41. package/declarations/addon/components/location-plugin/nodeview.d.ts +1 -0
  42. package/declarations/addon/components/mandatee-table-plugin/node.d.ts +1 -0
  43. package/declarations/addon/components/snippet-plugin/nodes/placeholder.d.ts +1 -0
  44. package/declarations/addon/components/snippet-plugin/nodes/snippet.d.ts +1 -0
  45. package/declarations/addon/components/structure-plugin/_private/structure.d.ts +1 -0
  46. package/declarations/addon/components/template-comments-plugin/template-comment.d.ts +1 -0
  47. package/declarations/addon/components/variable-plugin/address/nodeview.d.ts +1 -0
  48. package/declarations/addon/components/variable-plugin/date/nodeview.d.ts +1 -0
  49. package/declarations/addon/components/variable-plugin/number/nodeview.d.ts +1 -0
  50. package/declarations/addon/components/variable-plugin/person/nodeview.d.ts +1 -0
  51. package/declarations/addon/components/variable-plugin/variable/nodeview.d.ts +1 -0
  52. package/declarations/addon/plugins/location-plugin/node-contents/address.d.ts +6 -1
  53. package/declarations/addon/plugins/location-plugin/node-contents/area.d.ts +6 -1
  54. package/declarations/addon/plugins/location-plugin/node-contents/index.d.ts +9 -3
  55. package/declarations/addon/plugins/location-plugin/node-contents/place.d.ts +6 -1
  56. package/declarations/addon/plugins/location-plugin/node.d.ts +2 -0
  57. package/docs/plugins/article-structure.md +145 -0
  58. package/docs/plugins/besluit-topic.md +20 -0
  59. package/docs/plugins/besluit-type.md +20 -0
  60. package/docs/plugins/citation.md +102 -0
  61. package/docs/plugins/confidentiality.md +30 -0
  62. package/docs/plugins/decision.md +22 -0
  63. package/docs/plugins/document-title.md +20 -0
  64. package/docs/plugins/generic-rdfa-variable.md +4 -0
  65. package/docs/plugins/import-snippet.md +30 -0
  66. package/docs/plugins/lmb.md +9 -0
  67. package/docs/plugins/location.md +23 -0
  68. package/docs/plugins/lpdc.md +4 -0
  69. package/docs/plugins/mandatee-table.md +23 -0
  70. package/docs/plugins/roadsign-regulation.md +40 -0
  71. package/docs/plugins/snippet.md +28 -0
  72. package/docs/plugins/standard-template.md +29 -0
  73. package/docs/plugins/structure.md +27 -0
  74. package/docs/plugins/table-of-contents.md +65 -0
  75. package/docs/plugins/template-comments.md +49 -0
  76. package/docs/plugins/variable.md +283 -0
  77. package/docs/plugins/worship.md +4 -0
  78. package/package.json +1 -1
@@ -0,0 +1,283 @@
1
+ # variable-plugin
2
+
3
+ Editor plugin which provides node-specs and components which allow you to insert and edit different types of variables in a document. The plugin provides the following variable types:
4
+
5
+ - text variable
6
+ - number variable
7
+ - date variable
8
+ - codelist
9
+ - location
10
+ - address
11
+ - person
12
+ - autofilled variable
13
+
14
+ Additional variable types can be added in the consuming application or addon.
15
+
16
+ For each of these variable types, a node-spec and node-view are defined. You can import them like this:
17
+
18
+ ```js
19
+ import {
20
+ address,
21
+ addressView,
22
+ autofilled_variable,
23
+ autofilledVariableView,
24
+ codelist,
25
+ codelistView,
26
+ date,
27
+ dateView,
28
+ location,
29
+ locationView,
30
+ number,
31
+ numberView,
32
+ personVariableView,
33
+ person_variable,
34
+ text_variable,
35
+ textVariableView,
36
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/variables';
37
+ ```
38
+
39
+ For each of the variable-types you want to include in your editor instance, you should add the corresponding node-spec to your schema and the node-view to the `nodeViews` editor argument.
40
+
41
+ Both the `date` node-spec and `dateView` nodeview are functions which expect a `DateOptions` object, more information on how to define such a `DateOptions` object can be found in the section on the [date-edit component](#the-date-variable)
42
+
43
+ ## Inserting variables into a document
44
+
45
+ This addon includes an insert-component for each of these variable types:
46
+
47
+ - `variable-plugin/text/insert`
48
+ - `variable-plugin/number/insert`
49
+ - `variable-plugin/date/insert`
50
+ - `variable-plugin/location/insert`
51
+ - `variable-plugin/codelist/insert`
52
+ - `variable-plugin/address/insert-variable`
53
+ - `variable-plugin/person/insert`
54
+ - `variable-plugin/autofilled/insert`
55
+
56
+ Each of these components presents a custom UI which allows a user to insert a variable of the corresponding type in a document.
57
+
58
+ These insert-components can be used on their own, but can also be used in combination with the `variable-plugin/insert-variable-card` component. The responsibility of this component is two-fold:
59
+
60
+ - It allows a user to select a variable type.
61
+ - The correct insert component corresponding to the user-selected variable type is shown.
62
+
63
+ The `variable-plugin/insert-variable-card` can be easily configured: it expects two arguments:
64
+
65
+ - `controller`: An instance of the `SayController` class
66
+ - `variableTypes`: A list of `VariableConfig` objects. With each `VariableConfig` containing:
67
+ - the `label` which should be displayed in the variable-select dropdown
68
+ - the `component`: class of the component which should be displayed upon selecting the variable type.
69
+ - _optionally_ an `options` argument object which should be passed to the insert-variable component.
70
+
71
+ * The `VariableConfig` type is defined as follows:
72
+
73
+ ```js
74
+ type VariableConfig = {
75
+ label: string;
76
+ component: ComponentLike;
77
+ options?: unknown;
78
+ };
79
+ ```
80
+
81
+ ### An example
82
+
83
+ To allows users to insert variables into a document, add the following to the editor sidebar in your template:
84
+
85
+ ```hbs
86
+ <VariablePlugin::InsertVariableCard
87
+ @controller={{this.controller}}
88
+ @variableTypes={{this.variableTypes}}
89
+ />
90
+ ```
91
+
92
+ `this.controller` is an instance of `SayController` and `this.variableTypes` is the list of `VariableConfig` objects which should be defined in your controller/component class:
93
+
94
+ ```js
95
+ import TextVariableInsertComponent from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/text/insert';
96
+ import NumberInsertComponent from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/number/insert';
97
+ import DateInsertVariableComponent from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/date/insert-variable';
98
+ import LocationInsertComponent from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/location/insert';
99
+ import CodelistInsertComponent from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/codelist/insert';
100
+ import VariablePluginAddressInsertVariableComponent from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/address/insert-variable';
101
+ ...
102
+ get variableTypes() {
103
+ return [
104
+ {
105
+ label: 'text',
106
+ component: TextVariableInsertComponent,
107
+ },
108
+ {
109
+ label: 'number',
110
+ component: NumberInsertComponent,
111
+ },
112
+ {
113
+ label: 'date',
114
+ component: DateInsertVariableComponent
115
+ },
116
+ {
117
+ label: 'location',
118
+ component: LocationInsertComponent,
119
+ options: {
120
+ endpoint: 'https://dev.roadsigns.lblod.info/sparql',
121
+ },
122
+ },
123
+ {
124
+ label: 'codelist',
125
+ component: CodelistInsertComponent,
126
+ options: {
127
+ endpoint: 'https://dev.roadsigns.lblod.info/sparql',
128
+ },
129
+ },
130
+ {
131
+ label: 'address',
132
+ component: VariablePluginAddressInsertVariableComponent,
133
+ },
134
+ ];
135
+ }
136
+ ```
137
+
138
+ As you can see, both the `location` and `codelist` insert-components require an endpoint to be provided. They will use it to fetch the codelists/locations.
139
+ Aside from the endpoint, the `codelist` insert-component may optionally expect a publisher argument which it will use to limit the codelist fetch to a specific publisher.
140
+
141
+ ## Editing variables in a document
142
+
143
+ Each of the variables provided by this addon have a different editing experiences and use different components:
144
+
145
+ ### The text variable
146
+
147
+ Editing a text variable requires no extra components aside from its node-spec and node-view. A user can just type into the text variable directly.
148
+
149
+ ### The number variable
150
+
151
+ Editing a number variable can be done in its nodeview directly. When a user clicks on a number variable in a document, it opens a popup allow you to fill in a number.
152
+
153
+ ### The date variable
154
+
155
+ This addon provides a seperate edit component which allows users to fill in date variables in a document.
156
+ This component can be added to the sidebar of an editor instance in a template as follows:
157
+
158
+ ```hbs
159
+ <RdfaDatePlugin::Card
160
+ @controller={{this.controller}}
161
+ @options={{this.dateOptions}}
162
+ />
163
+ ```
164
+
165
+ Where `this.dateOptions` is a `DateOptions` object used to configure the edit component. It can be defined as e.g.:
166
+
167
+ ```js
168
+ get dateOptions(){
169
+ return {
170
+ formats: [
171
+ {
172
+ label: 'Short Date',
173
+ key: 'short',
174
+ dateFormat: 'dd/MM/yy',
175
+ dateTimeFormat: 'dd/MM/yy HH:mm',
176
+ },
177
+ {
178
+ label: 'Long Date',
179
+ key: 'long',
180
+ dateFormat: 'EEEE dd MMMM yyyy',
181
+ dateTimeFormat: 'PPPPp',
182
+ },
183
+ ],
184
+ allowCustomFormat: true,
185
+ }
186
+ }
187
+ ```
188
+
189
+ - `formats`: specify default formats to show for selection in the date card.
190
+ - `label` (optional): The label shown to the user on the card. If not provided, the format is used instead e.g.: `dd/MM/yyyy`
191
+ - `key`: A **unique** identifier used for identification in the internal code.
192
+ - `dateFormat`: The date format used when this is selected.
193
+ - `dateTimeFormat`: The datetime format to use when this is selected. Used when the user selects "Include time".
194
+ - `allowCustomFormat`: true by default, determines if the option to insert a fully custom format is available for newly created date nodes.
195
+
196
+ The syntax of formats can be found at [date-fns](https://date-fns.org/v2.29.3/docs/format).
197
+
198
+ ### The location variable
199
+
200
+ This addon provides a seperate edit component which allows users to fill in location variables in a document.
201
+ This component can be added to the sidebar of an editor instance in a template as follows:
202
+
203
+ ```hbs
204
+ <VariablePlugin::Location::Edit
205
+ @controller={{this.controller}}
206
+ @options={{this.locationEditOptions}}
207
+ />
208
+ ```
209
+
210
+ Where `this.locationEditOptions` is a `LocationEditOptions` object used to configure the edit component. It can be defined as e.g.:
211
+
212
+ ```js
213
+ get locationEditOptions() {
214
+ return {
215
+ endpoint: 'https://dev.roadsigns.lblod.info/sparql', //the fallback endpoint the edit component should use to fetch location values if the location variable has no `source` attribute
216
+ zonalLocationCodelistUri:
217
+ 'http://lblod.data.gift/concept-schemes/62331E6900730AE7B99DF7EF', //the uri the edit component should search for if the location variable is included in a zonal traffic measure
218
+ nonZonalLocationCodelistUri:
219
+ 'http://lblod.data.gift/concept-schemes/62331FDD00730AE7B99DF7F2', // the uri the edit component should search for if the location variable is included in a non-zonal traffic measure
220
+ };
221
+ }
222
+ ```
223
+
224
+ ### The codelist variable
225
+
226
+ This addon provides a seperate edit component which allows users to fill in codelist variables in a document.
227
+ This component can be added to the sidebar of an editor instance in a template as follows:
228
+
229
+ ```hbs
230
+ <VariablePlugin::Codelist::Edit
231
+ @controller={{this.controller}}
232
+ @options={{this.codelistEditOptions}}
233
+ />
234
+ ```
235
+
236
+ Where `this.codelistEditOptions` is a `CodelistEditOptions` object used to configure the edit component. It can be defined as e.g.:
237
+
238
+ ```js
239
+ get codelistEditOptions() {
240
+ return {
241
+ endpoint: 'https://dev.roadsigns.lblod.info/sparql', //the fallback endpoint the edit component should use to fetch codelist values if the codelist variable has no `source` attribute
242
+ };
243
+ }
244
+ ```
245
+
246
+ ### The address variable
247
+
248
+ This addon provides a seperate edit component which allows users to search for an address and update the select address variable. Additionally, they can also choose whether to include the housenumber of an address.
249
+ You can add this edit-component to a template as follows:
250
+
251
+ ```hbs
252
+ <VariablePlugin::Address::Edit
253
+ @controller={{this.controller}}
254
+ @defaultMuncipality='Antwerpen'
255
+ />
256
+ ```
257
+
258
+ The edit card can be configured with two arguments:
259
+
260
+ - An instance of a `SayController` (required)
261
+ - A `defaultMuncipality` which should be used as the default value of the `muncipality` field in the edit-card (optional)
262
+
263
+ You can also add an insert component meant for use outside of `insert-variable-card` by using the `variable-plugin/address/insert` component. This has no label-input and will show a default label.
264
+
265
+ ```hbs
266
+ <VariablePlugin::Address::Insert @controller={{this.controller}} />
267
+ ```
268
+
269
+ ## Styling
270
+
271
+ Nodes from this plugin can be styled by using the following classes:
272
+
273
+ | Node | Css class |
274
+ |---|---|
275
+ | All nodes, when empty | say-variable |
276
+ | date | say-date-variable|
277
+ | person | say-person-variable |
278
+ | codelist | say-codelist-variable |
279
+ | autofilled | say-autofilled-variable |
280
+ | address | say-address-variable |
281
+ | text_variable | say-text-variable |
282
+ | number | say-number-variable |
283
+ | location | say-location-variable |
@@ -0,0 +1,4 @@
1
+ # Worship plugin
2
+
3
+ This documentation is a work in progress.
4
+ It's possible that better information can be found in [the embeddable editor documentation](https://github.com/lblod/frontend-embeddable-notule-editor/tree/master/docs/plugins).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lblod/ember-rdfa-editor-lblod-plugins",
3
- "version": "32.2.0",
3
+ "version": "32.3.0",
4
4
  "description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
5
5
  "keywords": [
6
6
  "ember-addon",