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