@teipublisher/pb-components 2.26.1-next.3 → 3.0.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/.github/workflows/main.yml +3 -3
- package/.github/workflows/node.js.yml +3 -3
- package/.github/workflows/release.js.yml +4 -4
- package/.releaserc.json +2 -2
- package/CHANGELOG.md +262 -11
- package/Dockerfile +78 -70
- package/css/components.css +5 -5
- package/css/leaflet/images/layers.png +0 -0
- package/dist/demo/components.css +46 -1
- package/dist/demo/pb-browse-docs2.html +1 -1
- package/dist/demo/pb-dialog.html +3 -5
- package/dist/demo/pb-drawer2.html +1 -1
- package/dist/demo/pb-facsimile.html +2 -2
- package/dist/demo/pb-grid.html +19 -6
- package/dist/demo/pb-leaflet-map.html +1 -1
- package/dist/demo/pb-login.html +0 -2
- package/dist/demo/pb-message.html +1 -2
- package/dist/demo/pb-progress.html +2 -2
- package/dist/demo/pb-repeat.html +1 -3
- package/dist/demo/pb-search.html +7 -4
- package/dist/demo/pb-search3.html +1 -1
- package/dist/demo/pb-search4.html +2 -2
- package/dist/demo/pb-view3.html +1 -1
- package/dist/{iron-form-3b8dcaa7.js → iron-form-dfb3e3b1.js} +95 -95
- package/dist/paper-checkbox-645e1077.js +200 -0
- package/dist/{paper-icon-button-b1d31571.js → paper-icon-button-984162bd.js} +1 -1
- package/dist/{paper-checkbox-515a5284.js → paper-inky-focus-behavior-fa16796b.js} +58 -247
- package/dist/{paper-listbox-a3b7175c.js → paper-listbox-5f5d1cec.js} +152 -162
- package/dist/pb-code-editor.js +25 -20
- package/dist/pb-component-docs.js +68 -64
- package/dist/pb-components-bundle.js +1983 -2293
- package/dist/pb-edit-app.js +167 -107
- package/dist/pb-elements.json +176 -120
- package/dist/{pb-i18n-0611135a.js → pb-i18n-4cc00bfe.js} +1 -1
- package/dist/pb-leaflet-map.js +23 -23
- package/dist/pb-mei.js +56 -41
- package/dist/{pb-mixin-b1caa22e.js → pb-mixin-886ece32.js} +1 -1
- package/dist/pb-odd-editor.js +1023 -782
- package/dist/pb-tify.js +2 -2
- package/dist/vaadin-element-mixin-beb74ffd.js +545 -0
- package/gh-pages.js +5 -3
- package/i18n/common/en.json +6 -0
- package/i18n/common/pl.json +2 -2
- package/lib/openseadragon.min.js +6 -6
- package/package.json +3 -3
- package/pb-elements.json +176 -120
- package/src/assets/components.css +5 -5
- package/src/authority/airtable.js +20 -21
- package/src/authority/anton.js +129 -129
- package/src/authority/custom.js +23 -21
- package/src/authority/geonames.js +38 -32
- package/src/authority/gnd.js +50 -42
- package/src/authority/kbga.js +137 -134
- package/src/authority/metagrid.js +44 -46
- package/src/authority/reconciliation.js +66 -67
- package/src/authority/registry.js +4 -4
- package/src/docs/pb-component-docs.js +2 -2
- package/src/docs/pb-component-view.js +5 -5
- package/src/docs/pb-components-list.js +2 -2
- package/src/docs/pb-demo-snippet.js +2 -2
- package/src/dts-client.js +299 -297
- package/src/dts-select-endpoint.js +90 -82
- package/src/parse-date-service.js +184 -135
- package/src/pb-ajax.js +158 -171
- package/src/pb-authority-lookup.js +191 -156
- package/src/pb-autocomplete.js +292 -280
- package/src/pb-blacklab-highlight.js +264 -259
- package/src/pb-blacklab-results.js +236 -221
- package/src/pb-browse-docs.js +540 -475
- package/src/pb-browse.js +68 -65
- package/src/pb-clipboard.js +79 -76
- package/src/pb-code-editor.js +110 -102
- package/src/pb-code-highlight.js +209 -204
- package/src/pb-codepen.js +79 -72
- package/src/pb-collapse.js +211 -151
- package/src/pb-combo-box.js +190 -190
- package/src/pb-components-bundle.js +1 -1
- package/src/pb-components.js +1 -0
- package/src/pb-custom-form.js +173 -153
- package/src/pb-dialog.js +98 -62
- package/src/pb-document.js +89 -90
- package/src/pb-download.js +212 -196
- package/src/pb-drawer.js +145 -148
- package/src/pb-edit-app.js +301 -229
- package/src/pb-edit-xml.js +100 -97
- package/src/pb-events.js +114 -107
- package/src/pb-facs-link.js +104 -102
- package/src/pb-facsimile.js +474 -410
- package/src/pb-formula.js +151 -153
- package/src/pb-geolocation.js +129 -131
- package/src/pb-grid-action.js +53 -56
- package/src/pb-grid.js +231 -228
- package/src/pb-highlight.js +140 -140
- package/src/pb-hotkeys.js +40 -42
- package/src/pb-i18n.js +101 -104
- package/src/pb-image-strip.js +84 -78
- package/src/pb-lang.js +142 -57
- package/src/pb-leaflet-map.js +488 -485
- package/src/pb-link.js +126 -124
- package/src/pb-load.js +431 -429
- package/src/pb-login.js +299 -244
- package/src/pb-manage-odds.js +352 -336
- package/src/pb-map-icon.js +89 -89
- package/src/pb-map-layer.js +85 -85
- package/src/pb-markdown.js +90 -99
- package/src/pb-media-query.js +74 -72
- package/src/pb-mei.js +306 -295
- package/src/pb-message.js +139 -97
- package/src/pb-mixin.js +269 -264
- package/src/pb-navigation.js +80 -95
- package/src/pb-observable.js +38 -38
- package/src/pb-odd-editor.js +1054 -958
- package/src/pb-odd-elementspec-editor.js +349 -298
- package/src/pb-odd-model-editor.js +1075 -909
- package/src/pb-odd-parameter-editor.js +200 -178
- package/src/pb-odd-rendition-editor.js +136 -124
- package/src/pb-page.js +431 -422
- package/src/pb-paginate.js +228 -179
- package/src/pb-panel.js +198 -182
- package/src/pb-popover-themes.js +15 -8
- package/src/pb-popover.js +296 -287
- package/src/pb-print-preview.js +127 -127
- package/src/pb-progress.js +51 -51
- package/src/pb-repeat.js +105 -104
- package/src/pb-restricted.js +84 -77
- package/src/pb-search.js +256 -228
- package/src/pb-select-feature.js +127 -120
- package/src/pb-select-odd.js +132 -124
- package/src/pb-select-template.js +89 -78
- package/src/pb-select.js +251 -227
- package/src/pb-split-list.js +179 -174
- package/src/pb-svg.js +80 -79
- package/src/pb-table-column.js +54 -54
- package/src/pb-table-grid.js +221 -203
- package/src/pb-tabs.js +61 -63
- package/src/pb-tify.js +154 -154
- package/src/pb-timeline.js +382 -249
- package/src/pb-toggle-feature.js +195 -187
- package/src/pb-upload.js +184 -174
- package/src/pb-version.js +30 -30
- package/src/pb-view-annotate.js +135 -98
- package/src/pb-view.js +1282 -1270
- package/src/pb-zoom.js +127 -45
- package/src/polymer-hack.js +1 -1
- package/src/search-result-service.js +256 -223
- package/src/seed-element.js +13 -20
- package/src/settings.js +4 -4
- package/src/theming.js +98 -91
- package/src/urls.js +289 -289
- package/src/utils.js +53 -51
- package/css/pb-styles.css +0 -51
- package/dist/vaadin-element-mixin-fe4a4883.js +0 -527
- package/src/assets/pb-styles.css +0 -51
- package/src/pb-light-dom.js +0 -41
|
@@ -13,16 +13,15 @@ import '@polymer/paper-dropdown-menu/paper-dropdown-menu.js';
|
|
|
13
13
|
import '@polymer/paper-listbox/paper-listbox.js';
|
|
14
14
|
import '@polymer/paper-item/paper-item.js';
|
|
15
15
|
import '@polymer/paper-styles/color.js';
|
|
16
|
-
|
|
17
|
-
import
|
|
16
|
+
|
|
17
|
+
import '@jinntec/jinn-codemirror/dist/src/jinn-codemirror';
|
|
18
18
|
|
|
19
19
|
import { cmpVersion } from './utils.js';
|
|
20
20
|
import './pb-odd-rendition-editor.js';
|
|
21
21
|
import './pb-odd-parameter-editor.js';
|
|
22
22
|
import './pb-message.js';
|
|
23
23
|
|
|
24
|
-
import { get as i18n, translate } from
|
|
25
|
-
|
|
24
|
+
import { get as i18n, translate } from './pb-i18n.js';
|
|
26
25
|
|
|
27
26
|
/**
|
|
28
27
|
* represents an odd model element for editing
|
|
@@ -32,436 +31,464 @@ import { get as i18n, translate } from "./pb-i18n.js";
|
|
|
32
31
|
* @polymer
|
|
33
32
|
*/
|
|
34
33
|
export class PbOddModelEditor extends LitElement {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
34
|
+
static get styles() {
|
|
35
|
+
return css`
|
|
36
|
+
:host {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
}
|
|
40
|
+
h1,
|
|
41
|
+
h2,
|
|
42
|
+
h3,
|
|
43
|
+
h4,
|
|
44
|
+
h5,
|
|
45
|
+
h6 {
|
|
46
|
+
font-family: 'Oswald', Verdana, 'Helvetica', sans-serif;
|
|
47
|
+
font-weight: 400 !important;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
form {
|
|
51
|
+
margin-bottom: 8px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
paper-input,
|
|
55
|
+
paper-autocomplete {
|
|
56
|
+
margin-bottom: 16px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.models {
|
|
60
|
+
margin-left: 20px;
|
|
61
|
+
margin-top: 10px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.btn,
|
|
65
|
+
.btn-group {
|
|
66
|
+
margin-top: 0;
|
|
67
|
+
margin-bottom: 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
header {
|
|
71
|
+
// background-color: #d1dae0;
|
|
72
|
+
background: var(--paper-grey-300);
|
|
73
|
+
margin: 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
header div {
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: row;
|
|
79
|
+
justify-content: space-between;
|
|
80
|
+
align-items: center;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
header h4 {
|
|
84
|
+
padding: 4px 8px;
|
|
85
|
+
margin: 0;
|
|
86
|
+
display: grid;
|
|
87
|
+
grid-template-columns: 40px 40% auto;
|
|
88
|
+
}
|
|
89
|
+
h4 .btn-group {
|
|
90
|
+
text-align: right;
|
|
91
|
+
display: none;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
#toggle,
|
|
95
|
+
.modelType {
|
|
96
|
+
align-self: center;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
header div.info {
|
|
100
|
+
padding: 0 16px 4px;
|
|
101
|
+
margin: 0;
|
|
102
|
+
font-size: 85%;
|
|
103
|
+
display: block;
|
|
104
|
+
margin: 0 0 0 32px;
|
|
105
|
+
}
|
|
106
|
+
header div.info * {
|
|
107
|
+
display: block;
|
|
108
|
+
line-height: 1.2;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
header .outputDisplay {
|
|
112
|
+
text-transform: uppercase;
|
|
113
|
+
}
|
|
114
|
+
header .description {
|
|
115
|
+
font-style: italic;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
header .predicate {
|
|
119
|
+
color: #ff5722;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.predicate label,
|
|
123
|
+
.template label {
|
|
124
|
+
display: block;
|
|
125
|
+
font-size: 12px;
|
|
126
|
+
font-weight: 300;
|
|
127
|
+
color: rgb(115, 115, 115);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.model-collapse {
|
|
131
|
+
color: #000000;
|
|
132
|
+
cursor: pointer;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.model-collapse:hover {
|
|
136
|
+
text-decoration: none;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.behaviour {
|
|
140
|
+
color: #ff5722;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.behaviour:before {
|
|
144
|
+
content: ' [';
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.behaviour:after {
|
|
148
|
+
content: ']';
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.behaviourWrapper {
|
|
152
|
+
display: grid;
|
|
153
|
+
grid-template-columns: 140px 40px 140px auto;
|
|
154
|
+
}
|
|
155
|
+
.behaviourWrapper > * {
|
|
156
|
+
display: inline;
|
|
157
|
+
align-self: stretch;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.group {
|
|
161
|
+
margin: 0;
|
|
162
|
+
font-size: 16px;
|
|
163
|
+
font-weight: bold;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.group .title {
|
|
167
|
+
/*text-decoration: underline;*/
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.renditions,
|
|
171
|
+
.parameters {
|
|
172
|
+
padding-left: 16px;
|
|
173
|
+
border-left: 3px solid #e0e0e0;
|
|
174
|
+
margin-bottom: 20px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.renditions .group {
|
|
178
|
+
display: flex;
|
|
179
|
+
flex-direction: row;
|
|
180
|
+
justify-content: space-between;
|
|
181
|
+
align-items: center;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.predicate .form-control {
|
|
185
|
+
width: 100%;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.source {
|
|
189
|
+
text-decoration: none;
|
|
190
|
+
margin-bottom: 8px;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.selectOutput {
|
|
194
|
+
margin-right: 10px;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
:host([currentselection]) > form > header {
|
|
198
|
+
@apply --shadow-elevation-4dp;
|
|
199
|
+
border-left: 3px solid var(--paper-blue-500);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
paper-menu-button paper-icon-button {
|
|
203
|
+
margin-left: -10px;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/* need to play it save for FF */
|
|
207
|
+
:host([currentselection]) > form > header > h4 > .btn-group {
|
|
208
|
+
display: inline-block;
|
|
209
|
+
}
|
|
210
|
+
details {
|
|
211
|
+
display: block;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
details summary {
|
|
215
|
+
display: none;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.renditions {
|
|
219
|
+
margin-top: 10px;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.details {
|
|
223
|
+
padding: 0px 50px 20px 20px;
|
|
224
|
+
background: var(--paper-grey-200);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
details:not([open]) {
|
|
228
|
+
padding: 0;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.editor label {
|
|
232
|
+
margin-bottom: 5px;
|
|
233
|
+
font-size: 12px;
|
|
234
|
+
font-weight: 400;
|
|
235
|
+
color: var(--paper-grey-500);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.horizontal {
|
|
239
|
+
display: flex;
|
|
240
|
+
flex-wrap: wrap;
|
|
241
|
+
justify-content: space-between;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
#mode {
|
|
245
|
+
min-width: 18em;
|
|
246
|
+
}
|
|
247
|
+
`;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
static get properties() {
|
|
251
|
+
return {
|
|
252
|
+
/**
|
|
253
|
+
* maps to ODD ´model` behaviour attribute
|
|
254
|
+
*/
|
|
255
|
+
behaviour: {
|
|
256
|
+
type: String,
|
|
257
|
+
},
|
|
258
|
+
/**
|
|
259
|
+
* maps to ODD `model` predicate
|
|
260
|
+
*/
|
|
261
|
+
predicate: {
|
|
262
|
+
type: String,
|
|
263
|
+
reflect: true,
|
|
264
|
+
converter: (value, type) => {
|
|
265
|
+
if (value.toLowerCase() === 'null') {
|
|
266
|
+
return '';
|
|
267
|
+
}
|
|
268
|
+
return value;
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
type: {
|
|
272
|
+
type: String,
|
|
273
|
+
reflect: true,
|
|
274
|
+
},
|
|
275
|
+
template: {
|
|
276
|
+
type: String,
|
|
277
|
+
reflect: true,
|
|
278
|
+
converter: (value, type) => {
|
|
279
|
+
if (value.toLowerCase() === 'null') {
|
|
280
|
+
return '';
|
|
281
|
+
}
|
|
282
|
+
return value;
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
output: {
|
|
286
|
+
type: String,
|
|
287
|
+
reflect: true,
|
|
288
|
+
converter: (value, type) => {
|
|
289
|
+
if (value.toLowerCase() === 'null') {
|
|
290
|
+
return '';
|
|
291
|
+
}
|
|
292
|
+
return value;
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
css: {
|
|
296
|
+
type: String,
|
|
297
|
+
converter: (value, type) => {
|
|
298
|
+
if (value.toLowerCase() === 'null') {
|
|
299
|
+
return '';
|
|
300
|
+
}
|
|
301
|
+
return value;
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
mode: {
|
|
305
|
+
type: String,
|
|
306
|
+
},
|
|
307
|
+
model: {
|
|
308
|
+
type: Object,
|
|
309
|
+
},
|
|
310
|
+
models: {
|
|
311
|
+
type: Array,
|
|
312
|
+
},
|
|
313
|
+
parameters: {
|
|
314
|
+
type: Array,
|
|
315
|
+
},
|
|
316
|
+
renditions: {
|
|
317
|
+
type: Array,
|
|
318
|
+
},
|
|
319
|
+
desc: {
|
|
320
|
+
type: String,
|
|
321
|
+
converter: (value, type) => {
|
|
322
|
+
if (value.toLowerCase() === 'null') {
|
|
323
|
+
return '';
|
|
324
|
+
}
|
|
325
|
+
return value;
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
sourcerend: {
|
|
329
|
+
type: String,
|
|
330
|
+
},
|
|
331
|
+
show: {
|
|
332
|
+
type: Boolean,
|
|
333
|
+
reflect: true,
|
|
334
|
+
},
|
|
335
|
+
outputs: {
|
|
336
|
+
type: Array,
|
|
337
|
+
},
|
|
338
|
+
behaviours: {
|
|
339
|
+
type: Array,
|
|
340
|
+
},
|
|
341
|
+
icon: {
|
|
342
|
+
type: String,
|
|
343
|
+
},
|
|
344
|
+
open: {
|
|
345
|
+
type: String,
|
|
346
|
+
},
|
|
347
|
+
hasCustomBehaviour: {
|
|
348
|
+
type: Boolean,
|
|
349
|
+
},
|
|
350
|
+
endpoint: {
|
|
351
|
+
type: String,
|
|
352
|
+
},
|
|
353
|
+
apiVersion: {
|
|
354
|
+
type: String,
|
|
355
|
+
},
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
constructor() {
|
|
360
|
+
super();
|
|
361
|
+
this.behaviour = 'inline';
|
|
362
|
+
this.predicate = '';
|
|
363
|
+
this.type = '';
|
|
364
|
+
this.template = '';
|
|
365
|
+
this.output = '';
|
|
366
|
+
this.css = '';
|
|
367
|
+
this.mode = '';
|
|
368
|
+
this.model = {};
|
|
369
|
+
this.model.models = [];
|
|
370
|
+
this.parameters = [];
|
|
371
|
+
this.renditions = [];
|
|
372
|
+
this.desc = '';
|
|
373
|
+
this.sourcerend = '';
|
|
374
|
+
this.show = false;
|
|
375
|
+
|
|
376
|
+
this.outputs = ['', 'web', 'print', 'epub', 'fo', 'latex', 'plain'];
|
|
377
|
+
|
|
378
|
+
this.parentModel = [];
|
|
379
|
+
this.behaviours = [
|
|
380
|
+
'alternate',
|
|
381
|
+
'anchor',
|
|
382
|
+
'block',
|
|
383
|
+
'body',
|
|
384
|
+
'break',
|
|
385
|
+
'cell',
|
|
386
|
+
'cit',
|
|
387
|
+
'document',
|
|
388
|
+
'figure',
|
|
389
|
+
'graphic',
|
|
390
|
+
'heading',
|
|
391
|
+
'inline',
|
|
392
|
+
'link',
|
|
393
|
+
'list',
|
|
394
|
+
'listItem',
|
|
395
|
+
'metadata',
|
|
396
|
+
'note',
|
|
397
|
+
'omit',
|
|
398
|
+
'paragraph',
|
|
399
|
+
'pass-through',
|
|
400
|
+
'row',
|
|
401
|
+
'section',
|
|
402
|
+
'table',
|
|
403
|
+
'text',
|
|
404
|
+
'title',
|
|
405
|
+
'webcomponent',
|
|
406
|
+
];
|
|
407
|
+
|
|
408
|
+
this.icon = 'expand-more';
|
|
409
|
+
this.hasCustomBehaviour = false;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
render() {
|
|
413
|
+
let tmplSyntax;
|
|
414
|
+
switch (this.output) {
|
|
415
|
+
case 'web':
|
|
416
|
+
case 'epub':
|
|
417
|
+
tmplSyntax = 'html';
|
|
418
|
+
break;
|
|
419
|
+
case 'latex':
|
|
420
|
+
tmplSyntax = 'tex';
|
|
421
|
+
break;
|
|
422
|
+
case 'plain':
|
|
423
|
+
tmplSyntax = 'default';
|
|
424
|
+
break;
|
|
425
|
+
case 'fo':
|
|
426
|
+
case 'print':
|
|
427
|
+
tmplSyntax = 'xml';
|
|
428
|
+
break;
|
|
429
|
+
default:
|
|
430
|
+
tmplSyntax = 'html';
|
|
431
|
+
break;
|
|
403
432
|
}
|
|
404
|
-
|
|
405
|
-
render() {
|
|
406
|
-
let tmplSyntax;
|
|
407
|
-
switch (this.output) {
|
|
408
|
-
case 'web':
|
|
409
|
-
case 'epub':
|
|
410
|
-
tmplSyntax = 'html';
|
|
411
|
-
break;
|
|
412
|
-
case 'latex':
|
|
413
|
-
tmplSyntax = 'tex';
|
|
414
|
-
break;
|
|
415
|
-
case 'plain':
|
|
416
|
-
tmplSyntax = 'default';
|
|
417
|
-
break;
|
|
418
|
-
case 'fo':
|
|
419
|
-
case 'print':
|
|
420
|
-
tmplSyntax = 'xml';
|
|
421
|
-
break;
|
|
422
|
-
default:
|
|
423
|
-
tmplSyntax = 'html';
|
|
424
|
-
break;
|
|
425
|
-
}
|
|
426
|
-
return html`
|
|
433
|
+
return html`
|
|
427
434
|
<form>
|
|
428
|
-
<header>
|
|
435
|
+
<header>
|
|
429
436
|
<h4>
|
|
430
437
|
<paper-icon-button id="toggle"
|
|
431
438
|
icon="${this.icon}" @click="${this.toggle}"
|
|
432
439
|
class="model-collapse"></paper-icon-button>
|
|
433
|
-
|
|
434
|
-
<span class="modelType">${
|
|
440
|
+
|
|
441
|
+
<span class="modelType">${
|
|
442
|
+
this.type
|
|
443
|
+
}<span class="behaviour" ?hidden="${this._isGroupOrSequence()}">${
|
|
444
|
+
this.behaviour
|
|
445
|
+
}</span></span>
|
|
435
446
|
|
|
436
447
|
<span class="btn-group">
|
|
437
448
|
<paper-icon-button @click="${this._moveDown}" icon="arrow-downward"
|
|
438
449
|
title="move down"></paper-icon-button>
|
|
439
450
|
<paper-icon-button @click="${this._moveUp}" icon="arrow-upward"
|
|
440
451
|
title="move up"></paper-icon-button>
|
|
441
|
-
<paper-icon-button @click="${
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
452
|
+
<paper-icon-button @click="${
|
|
453
|
+
this._requestRemoval
|
|
454
|
+
}" icon="delete" title="remove"></paper-icon-button>
|
|
455
|
+
<paper-icon-button @click="${
|
|
456
|
+
this._copy
|
|
457
|
+
}" icon="content-copy" title="copy"></paper-icon-button>
|
|
458
|
+
<paper-icon-button @click="${
|
|
459
|
+
this._paste
|
|
460
|
+
}" icon="content-paste"></paper-icon-button>
|
|
461
|
+
|
|
462
|
+
${
|
|
463
|
+
this._isGroupOrSequence()
|
|
464
|
+
? html`
|
|
465
|
+
<paper-menu-button horizontal-align="right">
|
|
466
|
+
<paper-icon-button
|
|
467
|
+
icon="add"
|
|
468
|
+
slot="dropdown-trigger"
|
|
469
|
+
></paper-icon-button>
|
|
470
|
+
<paper-listbox
|
|
471
|
+
id="modelType"
|
|
472
|
+
slot="dropdown-content"
|
|
473
|
+
@iron-select="${this._addNested}"
|
|
474
|
+
attr-for-selected="value"
|
|
475
|
+
>
|
|
476
|
+
${this.type === 'modelSequence'
|
|
477
|
+
? html` <paper-item value="model">model</paper-item> `
|
|
478
|
+
: ''}
|
|
479
|
+
${this.type === 'modelGrp'
|
|
480
|
+
? html`
|
|
481
|
+
<paper-item value="modelSequence"
|
|
482
|
+
>modelSequence</paper-item
|
|
483
|
+
>
|
|
484
|
+
<paper-item value="model">model</paper-item>
|
|
485
|
+
`
|
|
486
|
+
: ''}
|
|
487
|
+
</paper-listbox>
|
|
488
|
+
</paper-menu-button>
|
|
489
|
+
`
|
|
490
|
+
: ''
|
|
491
|
+
}
|
|
465
492
|
</span>
|
|
466
493
|
</h4>
|
|
467
494
|
<div class="info">
|
|
@@ -470,16 +497,16 @@ export class PbOddModelEditor extends LitElement {
|
|
|
470
497
|
<div class="predicate">${this.predicate}</div>
|
|
471
498
|
</p>
|
|
472
499
|
</header>
|
|
473
|
-
<
|
|
500
|
+
<details ?open="${this.show}" class="details">
|
|
501
|
+
<summary style="display: none;"></summary>
|
|
474
502
|
<div class="horizontal">
|
|
475
503
|
<paper-dropdown-menu class="selectOutput" label="Output">
|
|
476
504
|
<paper-listbox id="output" slot="dropdown-content" attr-for-selected="value"
|
|
477
505
|
selected="${this.output}" @iron-select="${this._selectOutput}">
|
|
478
506
|
|
|
479
|
-
${this.outputs.map(
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
`)}
|
|
507
|
+
${this.outputs.map(
|
|
508
|
+
item => html` <paper-item value="${item}">${item}</paper-item> `,
|
|
509
|
+
)}
|
|
483
510
|
|
|
484
511
|
</paper-listbox>
|
|
485
512
|
</paper-dropdown-menu>
|
|
@@ -488,530 +515,669 @@ export class PbOddModelEditor extends LitElement {
|
|
|
488
515
|
label="Mode"
|
|
489
516
|
@change="${this._inputMode}"></paper-input>
|
|
490
517
|
</div>
|
|
491
|
-
<paper-input id="desc" .value="${this.desc}" placeholder="${translate(
|
|
518
|
+
<paper-input id="desc" .value="${this.desc}" placeholder="${translate(
|
|
519
|
+
'odd.editor.model.description-placeholder',
|
|
520
|
+
)}"
|
|
492
521
|
label="Description" @change="${this._inputDesc}"></paper-input>
|
|
493
522
|
|
|
494
523
|
<div class="editor">
|
|
495
524
|
<label>Predicate</label>
|
|
496
525
|
<jinn-codemirror id="predicate"
|
|
497
|
-
code="${this.predicate}"
|
|
526
|
+
code="${this.predicate}"
|
|
498
527
|
mode="xquery"
|
|
499
|
-
linter="${this.endpoint}/${
|
|
528
|
+
linter="${this.endpoint}/${
|
|
529
|
+
cmpVersion(this.apiVersion, '1.0.0') < 0 ? 'modules/editor.xql' : 'api/lint'
|
|
530
|
+
}"
|
|
500
531
|
placeholder="${translate('odd.editor.model.predicate-placeholder')}"
|
|
501
532
|
@update="${this._updatePredicate}"></jinn-codemirror>
|
|
502
533
|
</div>
|
|
503
|
-
|
|
504
|
-
${this._isModel()
|
|
505
|
-
? html`
|
|
506
|
-
<div>
|
|
507
|
-
<div class="behaviourWrapper">
|
|
508
|
-
<paper-dropdown-menu label="behaviour" id="behaviourMenu" ?disabled="${this.hasCustomBehaviour}">
|
|
509
|
-
<paper-listbox id="behaviour" slot="dropdown-content" attr-for-selected="value"
|
|
510
|
-
selected="${this.behaviour}" @iron-select="${this._selectBehaviour}">
|
|
511
|
-
${this.behaviours.map((item) =>
|
|
512
|
-
html`
|
|
513
|
-
<paper-item value="${item}">${item}</paper-item>
|
|
514
|
-
`)}
|
|
515
|
-
</paper-listbox>
|
|
516
|
-
</paper-dropdown-menu>
|
|
517
|
-
<span style="align-self:center;justify-self: center;"> ${translate('odd.editor.model.link-with-or')} </span>
|
|
518
|
-
<paper-input id="custombehaviour" label="" @input="${this._handleCustomBehaviour}" placeHolder="${translate('odd.editor.model.custom-behaviour-placeholder')}"></paper-input>
|
|
519
|
-
<span></span>
|
|
520
|
-
</div>
|
|
521
534
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
535
|
+
${
|
|
536
|
+
this._isModel()
|
|
537
|
+
? html`
|
|
538
|
+
<div>
|
|
539
|
+
<div class="behaviourWrapper">
|
|
540
|
+
<paper-dropdown-menu
|
|
541
|
+
label="behaviour"
|
|
542
|
+
id="behaviourMenu"
|
|
543
|
+
?disabled="${this.hasCustomBehaviour}"
|
|
544
|
+
>
|
|
545
|
+
<paper-listbox
|
|
546
|
+
id="behaviour"
|
|
547
|
+
slot="dropdown-content"
|
|
548
|
+
attr-for-selected="value"
|
|
549
|
+
selected="${this.behaviour}"
|
|
550
|
+
@iron-select="${this._selectBehaviour}"
|
|
551
|
+
>
|
|
552
|
+
${this.behaviours.map(
|
|
553
|
+
item => html` <paper-item value="${item}">${item}</paper-item> `,
|
|
554
|
+
)}
|
|
555
|
+
</paper-listbox>
|
|
556
|
+
</paper-dropdown-menu>
|
|
557
|
+
<span style="align-self:center;justify-self: center;">
|
|
558
|
+
${translate('odd.editor.model.link-with-or')}
|
|
559
|
+
</span>
|
|
560
|
+
<paper-input
|
|
561
|
+
id="custombehaviour"
|
|
562
|
+
label=""
|
|
563
|
+
@input="${this._handleCustomBehaviour}"
|
|
564
|
+
placeHolder="${translate(
|
|
565
|
+
'odd.editor.model.custom-behaviour-placeholder',
|
|
566
|
+
)}"
|
|
567
|
+
></paper-input>
|
|
568
|
+
<span></span>
|
|
569
|
+
</div>
|
|
570
|
+
|
|
571
|
+
<paper-input
|
|
572
|
+
id="css"
|
|
573
|
+
.value="${this.css}"
|
|
574
|
+
placeholder="${translate('odd.editor.model.css-class-placeholder')}"
|
|
575
|
+
label="CSS Class"
|
|
576
|
+
@change="${this._inputCss}"
|
|
577
|
+
></paper-input>
|
|
578
|
+
|
|
579
|
+
<div class="editor">
|
|
580
|
+
<label>Template</label>
|
|
581
|
+
<jinn-codemirror
|
|
582
|
+
id="template"
|
|
583
|
+
code="${this.template}"
|
|
584
|
+
mode="${tmplSyntax}"
|
|
585
|
+
placeholder="${translate('odd.editor.model.template-placeholder')}"
|
|
586
|
+
@update="${this._updateTemplate}"
|
|
587
|
+
>
|
|
588
|
+
<div slot="toolbar">
|
|
589
|
+
<paper-button
|
|
590
|
+
data-mode="xml"
|
|
591
|
+
data-command="selectElement"
|
|
592
|
+
data-key="mod-e mod-s"
|
|
593
|
+
title="Select element around current cursor position"
|
|
594
|
+
><|></paper-button
|
|
595
|
+
>
|
|
596
|
+
<paper-button
|
|
597
|
+
data-mode="xml"
|
|
598
|
+
data-command="encloseWith"
|
|
599
|
+
data-key="mod-e mod-e"
|
|
600
|
+
title="Enclose selection in new element"
|
|
601
|
+
><...></paper-button
|
|
602
|
+
>
|
|
603
|
+
<paper-button
|
|
604
|
+
data-mode="xml"
|
|
605
|
+
data-command="removeEnclosing"
|
|
606
|
+
title="Remove enclosing tags"
|
|
607
|
+
data-key="mod-e mod-r"
|
|
608
|
+
class="sep"
|
|
609
|
+
><X></paper-button
|
|
610
|
+
>
|
|
611
|
+
<paper-button
|
|
612
|
+
data-mode="html"
|
|
613
|
+
data-command="selectElement"
|
|
614
|
+
data-key="mod-e mod-s"
|
|
615
|
+
title="Select element around current cursor position"
|
|
616
|
+
><|></paper-button
|
|
617
|
+
>
|
|
618
|
+
<paper-button
|
|
619
|
+
data-mode="html"
|
|
620
|
+
data-command="encloseWith"
|
|
621
|
+
data-key="mod-e mod-e"
|
|
622
|
+
title="Enclose selection in new element"
|
|
623
|
+
><...></paper-button
|
|
624
|
+
>
|
|
625
|
+
<paper-button
|
|
626
|
+
data-mode="html"
|
|
627
|
+
data-command="removeEnclosing"
|
|
628
|
+
title="Remove enclosing tags"
|
|
629
|
+
data-key="mod-e mod-r"
|
|
630
|
+
class="sep"
|
|
631
|
+
><X></paper-button
|
|
632
|
+
>
|
|
633
|
+
<paper-button
|
|
634
|
+
data-key="mod-e mod-p"
|
|
635
|
+
data-command="snippet"
|
|
636
|
+
data-params="[[\${_}]]"
|
|
637
|
+
title="Insert template variable"
|
|
638
|
+
>[[...]]</paper-button
|
|
639
|
+
>
|
|
640
|
+
</div>
|
|
641
|
+
</jinn-codemirror>
|
|
642
|
+
</div>
|
|
553
643
|
</div>
|
|
554
|
-
|
|
644
|
+
|
|
555
645
|
<div class="parameters">
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
646
|
+
<div class="group">
|
|
647
|
+
<span class="title">Parameters</span>
|
|
648
|
+
<paper-icon-button
|
|
649
|
+
icon="add"
|
|
650
|
+
@click="${this._addParameter}"
|
|
651
|
+
></paper-icon-button>
|
|
652
|
+
</div>
|
|
653
|
+
${repeat(
|
|
654
|
+
this.parameters,
|
|
655
|
+
parameter => parameter.name,
|
|
656
|
+
(parameter, index) =>
|
|
657
|
+
html`
|
|
658
|
+
<pb-odd-parameter-editor
|
|
659
|
+
behaviour="${this.behaviour}"
|
|
660
|
+
name="${parameter.name}"
|
|
661
|
+
value="${parameter.value}"
|
|
662
|
+
?set="${parameter.set}"
|
|
663
|
+
endpoint="${this.endpoint}"
|
|
664
|
+
apiVersion="${this.apiVersion}"
|
|
665
|
+
@parameter-remove="${e => this._removeParam(e, index)}"
|
|
666
|
+
@parameter-changed="${e => this._updateParam(e, index)}"
|
|
667
|
+
></pb-odd-parameter-editor>
|
|
668
|
+
`,
|
|
669
|
+
)}
|
|
574
670
|
</div>
|
|
575
671
|
|
|
576
672
|
<div class="renditions">
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
</div>
|
|
673
|
+
<div class="group">
|
|
674
|
+
<div>
|
|
675
|
+
<span class="title">Renditions</span>
|
|
676
|
+
<paper-icon-button
|
|
677
|
+
icon="add"
|
|
678
|
+
@click="${this._addRendition}"
|
|
679
|
+
></paper-icon-button>
|
|
585
680
|
</div>
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
681
|
+
<div class="source">
|
|
682
|
+
<paper-checkbox ?checked="${this.sourcerend}" id="sourcerend"
|
|
683
|
+
>Use source rendition</paper-checkbox
|
|
684
|
+
>
|
|
685
|
+
</div>
|
|
686
|
+
</div>
|
|
687
|
+
|
|
688
|
+
${repeat(
|
|
689
|
+
this.renditions,
|
|
690
|
+
rendition => rendition.name,
|
|
691
|
+
(rendition, index) =>
|
|
692
|
+
html`
|
|
693
|
+
<pb-odd-rendition-editor
|
|
694
|
+
scope="${rendition.scope}"
|
|
695
|
+
css="${rendition.css}"
|
|
696
|
+
@remove-rendition="${e => this._removeRendition(e, index)}"
|
|
697
|
+
@rendition-changed="${e => this._updateRendition(e, index)}"
|
|
698
|
+
></pb-odd-rendition-editor>
|
|
699
|
+
`,
|
|
700
|
+
)}
|
|
596
701
|
</div>
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
</
|
|
601
|
-
|
|
702
|
+
`
|
|
703
|
+
: ''
|
|
704
|
+
}
|
|
705
|
+
</details>
|
|
706
|
+
|
|
602
707
|
<div class="models">
|
|
603
|
-
${repeat(
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
708
|
+
${repeat(
|
|
709
|
+
this.model.models,
|
|
710
|
+
(model, index) => html`
|
|
711
|
+
<pb-odd-model-editor
|
|
712
|
+
behaviour="${model.behaviour || 'inline'}"
|
|
713
|
+
predicate="${model.predicate}"
|
|
714
|
+
type="${model.type}"
|
|
715
|
+
output="${model.output}"
|
|
716
|
+
css="${model.css}"
|
|
717
|
+
mode="${model.mode}"
|
|
718
|
+
.model="${model}"
|
|
719
|
+
.parameters="${model.parameters}"
|
|
720
|
+
desc="${model.desc}"
|
|
721
|
+
sourcerend="${model.sourcerend}"
|
|
722
|
+
.renditions="${model.renditions}"
|
|
723
|
+
.template="${model.template}"
|
|
724
|
+
.show="${model.show}"
|
|
725
|
+
endpoint="${this.endpoint}"
|
|
726
|
+
apiVersion="${this.apiVersion}"
|
|
727
|
+
@model-remove="${this._removeModel}"
|
|
728
|
+
@model-move-down="${this._moveModelDown}"
|
|
729
|
+
@model-move-up="${this._moveModelUp}"
|
|
730
|
+
@model-changed="${this.handleModelChanged}"
|
|
731
|
+
@click="${e => this.setCurrentSelection(e, index)}"
|
|
732
|
+
hasParent
|
|
626
733
|
></pb-odd-model-editor>
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
734
|
+
`,
|
|
735
|
+
)}
|
|
736
|
+
|
|
737
|
+
</div>
|
|
738
|
+
</form>
|
|
631
739
|
<pb-message id="dialog"></pb-message>
|
|
632
740
|
`;
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
firstUpdated() {
|
|
636
|
-
super.firstUpdated();
|
|
637
|
-
|
|
638
|
-
this.hasCustomBehaviour = this.behaviours.indexOf(this.behaviour) < 0;
|
|
639
|
-
if (this.hasCustomBehaviour) {
|
|
640
|
-
this.shadowRoot.getElementById('custombehaviour').value = this.behaviour;
|
|
641
|
-
}
|
|
642
|
-
}
|
|
741
|
+
}
|
|
643
742
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
this.refreshEditors();
|
|
647
|
-
}
|
|
648
|
-
}
|
|
743
|
+
firstUpdated() {
|
|
744
|
+
super.firstUpdated();
|
|
649
745
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
if (this._isGroupOrSequence()) { return console.log("asfdfa"); }
|
|
655
|
-
|
|
656
|
-
// this.shadowRoot.getElementById('template').refresh();
|
|
657
|
-
|
|
658
|
-
const models = this.shadowRoot.querySelectorAll('pb-odd-model-editor');
|
|
659
|
-
for (let i = 0; i < models.length; i++) {
|
|
660
|
-
models[i].refreshEditors();
|
|
661
|
-
}
|
|
662
|
-
const renditions = this.shadowRoot.querySelectorAll('pb-odd-rendition-editor');
|
|
663
|
-
for (let i = 0; i < renditions.length; i++) {
|
|
664
|
-
renditions[i].refreshEditor();
|
|
665
|
-
}
|
|
666
|
-
const parameters = this.shadowRoot.querySelectorAll('pb-odd-parameter-editor');
|
|
667
|
-
for (let i = 0; i < parameters.length; i++) {
|
|
668
|
-
parameters[i].refreshEditor();
|
|
669
|
-
}
|
|
746
|
+
this.hasCustomBehaviour = this.behaviours.indexOf(this.behaviour) < 0;
|
|
747
|
+
if (this.hasCustomBehaviour) {
|
|
748
|
+
this.shadowRoot.getElementById('custombehaviour').value = this.behaviour;
|
|
670
749
|
}
|
|
750
|
+
}
|
|
671
751
|
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
this.show = !this.show;
|
|
677
|
-
this.toggleButtonIcon();
|
|
678
|
-
|
|
679
|
-
const oldModel = this.model;
|
|
680
|
-
const newModel = Object.assign({}, oldModel, { show: this.show });
|
|
681
|
-
this.model = newModel;
|
|
682
|
-
this.refreshEditors();
|
|
683
|
-
this.dispatchEvent(new CustomEvent('model-changed', { composed: true, bubbles: true, detail: { oldModel, newModel } }));
|
|
752
|
+
updated(_changedProperties) {
|
|
753
|
+
if (_changedProperties.has('show') && this.show) {
|
|
754
|
+
this.refreshEditors();
|
|
684
755
|
}
|
|
756
|
+
}
|
|
685
757
|
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
}
|
|
690
|
-
else {
|
|
691
|
-
this.icon = 'expand-more';
|
|
692
|
-
}
|
|
693
|
-
}
|
|
758
|
+
refreshEditors() {
|
|
759
|
+
console.log('refreshEditors');
|
|
760
|
+
// this.shadowRoot.getElementById('predicate').refresh();
|
|
694
761
|
|
|
695
|
-
|
|
696
|
-
|
|
762
|
+
if (this._isGroupOrSequence()) {
|
|
763
|
+
return console.log('asfdfa');
|
|
697
764
|
}
|
|
698
765
|
|
|
699
|
-
|
|
700
|
-
return this.type !== 'model';
|
|
701
|
-
}
|
|
766
|
+
// this.shadowRoot.getElementById('template').refresh();
|
|
702
767
|
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
return 'latex';
|
|
707
|
-
case 'web':
|
|
708
|
-
default:
|
|
709
|
-
return 'xml';
|
|
710
|
-
}
|
|
768
|
+
const models = this.shadowRoot.querySelectorAll('pb-odd-model-editor');
|
|
769
|
+
for (let i = 0; i < models.length; i++) {
|
|
770
|
+
models[i].refreshEditors();
|
|
711
771
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
e.preventDefault();
|
|
716
|
-
e.stopPropagation();
|
|
717
|
-
if (this.currentSelection != undefined) {
|
|
718
|
-
this.currentSelection.removeAttribute('currentselection');
|
|
719
|
-
}
|
|
720
|
-
const newSelection = e.detail.target;
|
|
721
|
-
newSelection.setAttribute('currentselection', 'true');
|
|
722
|
-
this.currentSelection = newSelection;
|
|
772
|
+
const renditions = this.shadowRoot.querySelectorAll('pb-odd-rendition-editor');
|
|
773
|
+
for (let i = 0; i < renditions.length; i++) {
|
|
774
|
+
renditions[i].refreshEditor();
|
|
723
775
|
}
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
this.dispatchEvent(new CustomEvent('model-remove'));
|
|
776
|
+
const parameters = this.shadowRoot.querySelectorAll('pb-odd-parameter-editor');
|
|
777
|
+
for (let i = 0; i < parameters.length; i++) {
|
|
778
|
+
parameters[i].refreshEditor();
|
|
728
779
|
}
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
toggle(e) {
|
|
783
|
+
// e.stopPropagation()
|
|
784
|
+
// e.preventDefault()
|
|
785
|
+
|
|
786
|
+
this.show = !this.show;
|
|
787
|
+
this.toggleButtonIcon();
|
|
788
|
+
|
|
789
|
+
const oldModel = this.model;
|
|
790
|
+
const newModel = { ...oldModel, show: this.show };
|
|
791
|
+
this.model = newModel;
|
|
792
|
+
this.refreshEditors();
|
|
793
|
+
this.dispatchEvent(
|
|
794
|
+
new CustomEvent('model-changed', {
|
|
795
|
+
composed: true,
|
|
796
|
+
bubbles: true,
|
|
797
|
+
detail: { oldModel, newModel },
|
|
798
|
+
}),
|
|
799
|
+
);
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
toggleButtonIcon() {
|
|
803
|
+
if (this.show) {
|
|
804
|
+
this.icon = 'expand-less';
|
|
805
|
+
} else {
|
|
806
|
+
this.icon = 'expand-more';
|
|
741
807
|
}
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
_isModel() {
|
|
811
|
+
return this.type === 'model';
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
_isGroupOrSequence() {
|
|
815
|
+
return this.type !== 'model';
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
static _templateMode(output) {
|
|
819
|
+
switch (output) {
|
|
820
|
+
case 'latex':
|
|
821
|
+
return 'latex';
|
|
822
|
+
case 'web':
|
|
823
|
+
default:
|
|
824
|
+
return 'xml';
|
|
753
825
|
}
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
output: '',
|
|
763
|
-
sourcerend: false,
|
|
764
|
-
models: [],
|
|
765
|
-
mode: '',
|
|
766
|
-
parameters: [],
|
|
767
|
-
renditions: [],
|
|
768
|
-
template: '',
|
|
769
|
-
show: true
|
|
770
|
-
};
|
|
771
|
-
|
|
772
|
-
const oldModel = this.model;
|
|
773
|
-
const models = Array.from(this.model.models);
|
|
774
|
-
models.unshift(newNestedModel);
|
|
775
|
-
this.model = Object.assign({}, oldModel, { models });
|
|
776
|
-
|
|
777
|
-
// important to reset the listbox - otherwise next attempt to use it will fail if value has not changed
|
|
778
|
-
// use querySelector here instead of 'this.$' as listbox is in it's own <template>
|
|
779
|
-
const modelTypeSelector = this.shadowRoot.querySelector('#modelType')
|
|
780
|
-
modelTypeSelector.select("");
|
|
781
|
-
|
|
782
|
-
this.dispatchEvent(new CustomEvent('model-changed', { composed: true, bubbles: true, detail: { oldModel, newModel: this.model } }));
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
_changeSelection(e) {
|
|
829
|
+
if (e.detail.target == this) return;
|
|
830
|
+
e.preventDefault();
|
|
831
|
+
e.stopPropagation();
|
|
832
|
+
if (this.currentSelection != undefined) {
|
|
833
|
+
this.currentSelection.removeAttribute('currentselection');
|
|
783
834
|
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
835
|
+
const newSelection = e.detail.target;
|
|
836
|
+
newSelection.setAttribute('currentselection', 'true');
|
|
837
|
+
this.currentSelection = newSelection;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
_requestRemoval(e) {
|
|
841
|
+
e.preventDefault();
|
|
842
|
+
this.dispatchEvent(new CustomEvent('model-remove'));
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
/**
|
|
846
|
+
* move model down in list
|
|
847
|
+
*
|
|
848
|
+
* @param e
|
|
849
|
+
* @event model-move-down dispatched to request the model to move down
|
|
850
|
+
*/
|
|
851
|
+
_moveDown(e) {
|
|
852
|
+
e.preventDefault();
|
|
853
|
+
e.stopPropagation();
|
|
854
|
+
// this.dispatchEvent(new CustomEvent('model-move-down'));
|
|
855
|
+
this.dispatchEvent(
|
|
856
|
+
new CustomEvent('model-move-down', {
|
|
857
|
+
composed: true,
|
|
858
|
+
bubbles: true,
|
|
859
|
+
detail: { model: this },
|
|
860
|
+
}),
|
|
861
|
+
);
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* move model up in list
|
|
866
|
+
*
|
|
867
|
+
* @param e
|
|
868
|
+
* @event model-move-up dispatched to request the model to move up
|
|
869
|
+
*/
|
|
870
|
+
_moveUp(e) {
|
|
871
|
+
e.preventDefault();
|
|
872
|
+
e.stopPropagation();
|
|
873
|
+
this.dispatchEvent(new CustomEvent('model-move-up'));
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
_addNested(e) {
|
|
877
|
+
const newNestedModel = {
|
|
878
|
+
behaviour: 'inline',
|
|
879
|
+
css: '',
|
|
880
|
+
desc: '',
|
|
881
|
+
predicate: '',
|
|
882
|
+
type: e instanceof Event ? e.detail.item.getAttribute('value') : e,
|
|
883
|
+
output: '',
|
|
884
|
+
sourcerend: false,
|
|
885
|
+
models: [],
|
|
886
|
+
mode: '',
|
|
887
|
+
parameters: [],
|
|
888
|
+
renditions: [],
|
|
889
|
+
template: '',
|
|
890
|
+
show: true,
|
|
891
|
+
};
|
|
892
|
+
|
|
893
|
+
const oldModel = this.model;
|
|
894
|
+
const models = Array.from(this.model.models);
|
|
895
|
+
models.unshift(newNestedModel);
|
|
896
|
+
this.model = { ...oldModel, models };
|
|
897
|
+
|
|
898
|
+
// important to reset the listbox - otherwise next attempt to use it will fail if value has not changed
|
|
899
|
+
// use querySelector here instead of 'this.$' as listbox is in it's own <template>
|
|
900
|
+
const modelTypeSelector = this.shadowRoot.querySelector('#modelType');
|
|
901
|
+
modelTypeSelector.select('');
|
|
902
|
+
|
|
903
|
+
this.dispatchEvent(
|
|
904
|
+
new CustomEvent('model-changed', {
|
|
905
|
+
composed: true,
|
|
906
|
+
bubbles: true,
|
|
907
|
+
detail: { oldModel, newModel: this.model },
|
|
908
|
+
}),
|
|
909
|
+
);
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
addModel(newModel) {
|
|
913
|
+
if (newModel.type !== 'model') {
|
|
914
|
+
console.error('only models can be added to modelSequence or modelGrp');
|
|
915
|
+
return;
|
|
792
916
|
}
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
917
|
+
this.model.models.unshift(newModel);
|
|
918
|
+
this.requestUpdate();
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
_removeModel(ev) {
|
|
922
|
+
console.log('_removeModel ', ev);
|
|
923
|
+
ev.stopPropagation();
|
|
924
|
+
const { model } = ev.target;
|
|
925
|
+
const index = this.model.models.indexOf(model);
|
|
926
|
+
|
|
927
|
+
this.shadowRoot
|
|
928
|
+
.getElementById('dialog')
|
|
929
|
+
.confirm(
|
|
930
|
+
i18n('odd.editor.model.delete-model-label'),
|
|
931
|
+
i18n('odd.editor.model.delete-model-message'),
|
|
932
|
+
)
|
|
933
|
+
.then(
|
|
934
|
+
() => {
|
|
935
|
+
const oldModel = this.model;
|
|
936
|
+
const models = Array.from(this.model.models);
|
|
937
|
+
models.splice(index, 1);
|
|
938
|
+
this.model = { ...oldModel, models };
|
|
939
|
+
this.models = models;
|
|
940
|
+
this.dispatchEvent(
|
|
941
|
+
new CustomEvent('model-changed', {
|
|
942
|
+
composed: true,
|
|
943
|
+
bubbles: true,
|
|
944
|
+
detail: { oldModel, newModel: this.model },
|
|
945
|
+
}),
|
|
946
|
+
);
|
|
947
|
+
},
|
|
948
|
+
() => null,
|
|
949
|
+
);
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
_moveModelDown(ev) {
|
|
953
|
+
console.log('MODEL._moveModelDown ', ev);
|
|
954
|
+
ev.stopPropagation();
|
|
955
|
+
const { model } = ev.target;
|
|
956
|
+
const index = this.model.models.indexOf(model);
|
|
957
|
+
if (index === this.model.models.length) {
|
|
958
|
+
return;
|
|
810
959
|
}
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
960
|
+
const oldModel = this.model;
|
|
961
|
+
const models = Array.from(this.model.models);
|
|
962
|
+
models.splice(index, 1);
|
|
963
|
+
models.splice(index + 1, 0, model);
|
|
964
|
+
this.model = { ...oldModel, models };
|
|
965
|
+
|
|
966
|
+
const targetModel = this.shadowRoot.querySelectorAll('pb-odd-model-editor')[index + 1];
|
|
967
|
+
this._setCurrentSelection(index + 1, targetModel);
|
|
968
|
+
|
|
969
|
+
this.dispatchEvent(
|
|
970
|
+
new CustomEvent('model-changed', {
|
|
971
|
+
composed: true,
|
|
972
|
+
bubbles: true,
|
|
973
|
+
detail: { oldModel, newModel: this.model },
|
|
974
|
+
}),
|
|
975
|
+
);
|
|
976
|
+
this.requestUpdate();
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
_moveModelUp(ev) {
|
|
980
|
+
ev.stopPropagation();
|
|
981
|
+
const { model } = ev.target;
|
|
982
|
+
const index = this.model.models.indexOf(model);
|
|
983
|
+
if (index === 0) {
|
|
984
|
+
return;
|
|
831
985
|
}
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
986
|
+
const oldModel = this.model;
|
|
987
|
+
const models = Array.from(this.model.models);
|
|
988
|
+
// remove element from models
|
|
989
|
+
models.splice(index, 1);
|
|
990
|
+
// add element to new index
|
|
991
|
+
models.splice(index - 1, 0, model);
|
|
992
|
+
this.model = { ...oldModel, models };
|
|
993
|
+
|
|
994
|
+
const targetModel = this.shadowRoot.querySelectorAll('pb-odd-model-editor')[index - 1];
|
|
995
|
+
this._setCurrentSelection(index - 1, targetModel);
|
|
996
|
+
|
|
997
|
+
this.dispatchEvent(
|
|
998
|
+
new CustomEvent('model-changed', {
|
|
999
|
+
composed: true,
|
|
1000
|
+
bubbles: true,
|
|
1001
|
+
detail: { oldModel, newModel: this.model },
|
|
1002
|
+
}),
|
|
1003
|
+
);
|
|
1004
|
+
// this.requestUpdate();
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
handleModelChanged(ev) {
|
|
1008
|
+
console.log('handleModelChanged ', ev, this);
|
|
1009
|
+
ev.stopPropagation();
|
|
1010
|
+
const oldModel = this.model;
|
|
1011
|
+
const index = this.model.models.indexOf(ev.detail.oldModel);
|
|
1012
|
+
const models = Array.from(this.model.models);
|
|
1013
|
+
models.splice(index, 1, ev.detail.newModel);
|
|
1014
|
+
this.model = { ...oldModel, models };
|
|
1015
|
+
this.dispatchEvent(
|
|
1016
|
+
new CustomEvent('model-changed', {
|
|
1017
|
+
composed: true,
|
|
1018
|
+
bubbles: true,
|
|
1019
|
+
detail: { oldModel, newModel: this.model },
|
|
1020
|
+
}),
|
|
1021
|
+
);
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
// todo: setCurrentSelection functions are redundant in model and elementspec components - do better
|
|
1025
|
+
setCurrentSelection(e, index) {
|
|
1026
|
+
e.preventDefault();
|
|
1027
|
+
e.stopPropagation();
|
|
1028
|
+
|
|
1029
|
+
// prevent event if model is already the current one
|
|
1030
|
+
this._setCurrentSelection(index, e.target);
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
_setCurrentSelection(index, target) {
|
|
1034
|
+
// console.log('_setCurrentSelection ', target);
|
|
1035
|
+
const targetModel = this.shadowRoot.querySelectorAll('pb-odd-model-editor')[index];
|
|
1036
|
+
|
|
1037
|
+
if (!targetModel) {
|
|
1038
|
+
return;
|
|
853
1039
|
}
|
|
854
1040
|
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
1041
|
+
if (targetModel.hasAttribute('currentselection')) return;
|
|
1042
|
+
|
|
1043
|
+
this.dispatchEvent(
|
|
1044
|
+
new CustomEvent('current-changed', { composed: true, bubbles: true, detail: { target } }),
|
|
1045
|
+
);
|
|
1046
|
+
this.requestUpdate();
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
_inputDesc(e) {
|
|
1050
|
+
this.desc = e.composedPath()[0].value;
|
|
1051
|
+
this._fireModelChanged('desc', this.desc);
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
_selectOutput(e) {
|
|
1055
|
+
this.output = e.composedPath()[0].selected;
|
|
1056
|
+
this._fireModelChanged('output', this.output);
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
_updatePredicate() {
|
|
1060
|
+
this.predicate = this.shadowRoot.getElementById('predicate').value;
|
|
1061
|
+
console.log('_updatePredicate ', this.predicate);
|
|
1062
|
+
this._fireModelChanged('predicate', this.predicate);
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
_selectBehaviour(ev) {
|
|
1066
|
+
this.behaviour = ev.composedPath()[0].selected;
|
|
1067
|
+
this._fireModelChanged('behaviour', this.behaviour);
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
_inputCss(ev) {
|
|
1071
|
+
this.css = ev.composedPath()[0].value;
|
|
1072
|
+
this._fireModelChanged('css', this.css);
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
_inputMode(ev) {
|
|
1076
|
+
this.mode = ev.composedPath()[0].value;
|
|
1077
|
+
this._fireModelChanged('mode', this.mode);
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
_updateTemplate(ev) {
|
|
1081
|
+
this.template = this.shadowRoot.getElementById('template').content;
|
|
1082
|
+
this._fireModelChanged('template', this.template);
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
/**
|
|
1086
|
+
* add a model parameter
|
|
1087
|
+
*
|
|
1088
|
+
* @param e
|
|
1089
|
+
*/
|
|
1090
|
+
_addParameter(e) {
|
|
1091
|
+
this.parameters.push({ name: '', value: '' });
|
|
1092
|
+
this._fireModelChanged('parameters', this.parameters);
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
_updateParam(e, index) {
|
|
1096
|
+
this.parameters[index].name = e.detail.name;
|
|
1097
|
+
this.parameters[index].value = e.detail.value;
|
|
1098
|
+
this.parameters[index].set = e.detail.set;
|
|
1099
|
+
this._fireModelChanged('parameters', this.parameters);
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
/**
|
|
1103
|
+
* remove a parameter
|
|
1104
|
+
* @param e
|
|
1105
|
+
* @param index
|
|
1106
|
+
* @private
|
|
1107
|
+
*/
|
|
1108
|
+
_removeParam(e, index) {
|
|
1109
|
+
this.parameters.splice(index, 1);
|
|
1110
|
+
this._fireModelChanged('parameters', this.parameters);
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
/**
|
|
1114
|
+
* add a rendition
|
|
1115
|
+
*
|
|
1116
|
+
* @param ev
|
|
1117
|
+
*/
|
|
1118
|
+
_addRendition(ev) {
|
|
1119
|
+
this.renditions.push({
|
|
1120
|
+
scope: '',
|
|
1121
|
+
css: '',
|
|
1122
|
+
});
|
|
1123
|
+
this._fireModelChanged('renditions', this.renditions);
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
_updateRendition(e, index) {
|
|
1127
|
+
this.renditions[index].css = e.detail.css;
|
|
1128
|
+
this.renditions[index].scope = e.detail.scope;
|
|
1129
|
+
this._fireModelChanged('renditions', this.renditions);
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
_removeRendition(e, index) {
|
|
1133
|
+
this.renditions.splice(index, 1);
|
|
1134
|
+
this._fireModelChanged('renditions', this.renditions);
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
_fireModelChanged(prop, value) {
|
|
1138
|
+
const oldModel = this.model;
|
|
1139
|
+
this.model = { ...this.model, [prop]: value };
|
|
1140
|
+
console.log('model changed for %s: %o - %o', prop, value, this.model);
|
|
1141
|
+
this.dispatchEvent(
|
|
1142
|
+
new CustomEvent('model-changed', {
|
|
1143
|
+
composed: true,
|
|
1144
|
+
bubbles: true,
|
|
1145
|
+
detail: { oldModel, newModel: this.model },
|
|
1146
|
+
}),
|
|
1147
|
+
);
|
|
1148
|
+
this.requestUpdate();
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
_copy(ev) {
|
|
1152
|
+
ev.preventDefault();
|
|
1153
|
+
ev.stopPropagation();
|
|
1154
|
+
console.log('odd-model.copy ', ev);
|
|
1155
|
+
console.log('odd-model.copy data', this.model);
|
|
1156
|
+
|
|
1157
|
+
this.dispatchEvent(
|
|
1158
|
+
new CustomEvent('odd-copy', { composed: true, bubbles: true, detail: { model: this.model } }),
|
|
1159
|
+
);
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
_paste(ev) {
|
|
1163
|
+
console.log('model _paste ', ev);
|
|
1164
|
+
this.dispatchEvent(
|
|
1165
|
+
new CustomEvent('odd-paste', { composed: true, bubbles: true, detail: { target: this } }),
|
|
1166
|
+
);
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
_handleCustomBehaviour(e) {
|
|
1170
|
+
this.behaviour = e.composedPath()[0].value;
|
|
1171
|
+
this._fireModelChanged('behaviour', this.behaviour);
|
|
1172
|
+
|
|
1173
|
+
// en-/disable behaviour menu
|
|
1174
|
+
if (this.behaviour === '') {
|
|
1175
|
+
this.behaviour = 'inline';
|
|
1176
|
+
this.hasCustomBehaviour = false;
|
|
1177
|
+
} else {
|
|
1178
|
+
this.hasCustomBehaviour = true;
|
|
864
1179
|
}
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
//todo: setCurrentSelection functions are redundant in model and elementspec components - do better
|
|
868
|
-
setCurrentSelection(e, index) {
|
|
869
|
-
e.preventDefault();
|
|
870
|
-
e.stopPropagation();
|
|
871
|
-
|
|
872
|
-
//prevent event if model is already the current one
|
|
873
|
-
this._setCurrentSelection(index, e.target);
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
_setCurrentSelection(index, target) {
|
|
877
|
-
// console.log('_setCurrentSelection ', target);
|
|
878
|
-
const targetModel = this.shadowRoot.querySelectorAll('pb-odd-model-editor')[index];
|
|
879
|
-
|
|
880
|
-
if (!targetModel) { return; }
|
|
881
|
-
|
|
882
|
-
if (targetModel.hasAttribute('currentselection')) return;
|
|
883
|
-
|
|
884
|
-
this.dispatchEvent(new CustomEvent('current-changed', { composed: true, bubbles: true, detail: { target: target } }));
|
|
885
|
-
this.requestUpdate();
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
_inputDesc(e) {
|
|
889
|
-
this.desc = e.composedPath()[0].value;
|
|
890
|
-
this._fireModelChanged('desc', this.desc);
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
_selectOutput(e) {
|
|
894
|
-
this.output = e.composedPath()[0].selected;
|
|
895
|
-
this._fireModelChanged('output', this.output);
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
_updatePredicate() {
|
|
899
|
-
this.predicate = this.shadowRoot.getElementById('predicate').value;
|
|
900
|
-
console.log('_updatePredicate ', this.predicate);
|
|
901
|
-
this._fireModelChanged('predicate', this.predicate);
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
_selectBehaviour(ev) {
|
|
905
|
-
this.behaviour = ev.composedPath()[0].selected;
|
|
906
|
-
this._fireModelChanged('behaviour', this.behaviour);
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
_inputCss(ev) {
|
|
910
|
-
this.css = ev.composedPath()[0].value;
|
|
911
|
-
this._fireModelChanged('css', this.css);
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
_inputMode(ev) {
|
|
915
|
-
this.mode = ev.composedPath()[0].value;
|
|
916
|
-
this._fireModelChanged('mode', this.mode);
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
_updateTemplate(ev) {
|
|
920
|
-
this.template = this.shadowRoot.getElementById('template').content;
|
|
921
|
-
this._fireModelChanged('template', this.template);
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
/**
|
|
925
|
-
* add a model parameter
|
|
926
|
-
*
|
|
927
|
-
* @param e
|
|
928
|
-
*/
|
|
929
|
-
_addParameter(e) {
|
|
930
|
-
this.parameters.push({ name: "", value: "" });
|
|
931
|
-
this._fireModelChanged('parameters', this.parameters);
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
_updateParam(e, index) {
|
|
935
|
-
this.parameters[index].name = e.detail.name;
|
|
936
|
-
this.parameters[index].value = e.detail.value;
|
|
937
|
-
this.parameters[index].set = e.detail.set;
|
|
938
|
-
this._fireModelChanged('parameters', this.parameters);
|
|
939
|
-
}
|
|
940
|
-
|
|
941
|
-
/**
|
|
942
|
-
* remove a parameter
|
|
943
|
-
* @param e
|
|
944
|
-
* @param index
|
|
945
|
-
* @private
|
|
946
|
-
*/
|
|
947
|
-
_removeParam(e, index) {
|
|
948
|
-
this.parameters.splice(index, 1);
|
|
949
|
-
this._fireModelChanged('parameters', this.parameters);
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
/**
|
|
953
|
-
* add a rendition
|
|
954
|
-
*
|
|
955
|
-
* @param ev
|
|
956
|
-
*/
|
|
957
|
-
_addRendition(ev) {
|
|
958
|
-
this.renditions.push({
|
|
959
|
-
scope: '',
|
|
960
|
-
css: ''
|
|
961
|
-
});
|
|
962
|
-
this._fireModelChanged('renditions', this.renditions);
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
_updateRendition(e, index) {
|
|
966
|
-
this.renditions[index].css = e.detail.css;
|
|
967
|
-
this.renditions[index].scope = e.detail.scope;
|
|
968
|
-
this._fireModelChanged('renditions', this.renditions);
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
_removeRendition(e, index) {
|
|
972
|
-
this.renditions.splice(index, 1);
|
|
973
|
-
this._fireModelChanged('renditions', this.renditions);
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
_fireModelChanged(prop, value) {
|
|
977
|
-
const oldModel = this.model;
|
|
978
|
-
this.model = Object.assign({}, this.model, { [prop]: value });
|
|
979
|
-
console.log('model changed for %s: %o - %o', prop, value, this.model);
|
|
980
|
-
this.dispatchEvent(new CustomEvent('model-changed', { composed: true, bubbles: true, detail: { oldModel, newModel: this.model } }));
|
|
981
|
-
this.requestUpdate();
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
_copy(ev) {
|
|
985
|
-
ev.preventDefault();
|
|
986
|
-
ev.stopPropagation();
|
|
987
|
-
console.log('odd-model.copy ', ev);
|
|
988
|
-
console.log('odd-model.copy data', this.model);
|
|
989
|
-
|
|
990
|
-
this.dispatchEvent(new CustomEvent('odd-copy', { composed: true, bubbles: true, detail: { model: this.model } }));
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
_paste(ev) {
|
|
994
|
-
console.log('model _paste ', ev);
|
|
995
|
-
this.dispatchEvent(new CustomEvent('odd-paste', { composed: true, bubbles: true, detail: { target: this } }));
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
_handleCustomBehaviour(e) {
|
|
1000
|
-
this.behaviour = e.composedPath()[0].value;
|
|
1001
|
-
this._fireModelChanged('behaviour', this.behaviour);
|
|
1002
|
-
|
|
1003
|
-
// en-/disable behaviour menu
|
|
1004
|
-
if (this.behaviour === '') {
|
|
1005
|
-
this.behaviour = 'inline';
|
|
1006
|
-
this.hasCustomBehaviour = false;
|
|
1007
|
-
} else {
|
|
1008
|
-
this.hasCustomBehaviour = true;
|
|
1009
|
-
}
|
|
1010
|
-
this.requestUpdate();
|
|
1011
|
-
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1180
|
+
this.requestUpdate();
|
|
1181
|
+
}
|
|
1016
1182
|
}
|
|
1017
1183
|
customElements.define('pb-odd-model-editor', PbOddModelEditor);
|